mirror of
https://github.com/chatmail/relay.git
synced 2026-05-11 16:34:39 +00:00
dns: warn if mail_domain is an IP, instead of checking DNS
This commit is contained in:
@@ -144,6 +144,9 @@ def dns_cmd_options(parser):
|
||||
|
||||
def dns_cmd(args, out):
|
||||
"""Check DNS entries and optionally generate dns zone file."""
|
||||
if is_valid_ipv4(args.config.mail_domain):
|
||||
print(f"[WARNING] {args.config.mail_domain} is not a domain, skipping DNS checks.")
|
||||
return 0
|
||||
ssh_host = args.ssh_host if args.ssh_host else args.config.mail_domain
|
||||
sshexec = get_sshexec(ssh_host, verbose=args.verbose)
|
||||
tls_cert_mode = args.config.tls_cert_mode
|
||||
|
||||
@@ -39,6 +39,14 @@ class TestCmdline:
|
||||
out, err = capsys.readouterr()
|
||||
assert "deleting config file" in out.lower()
|
||||
|
||||
def test_dns_skip_on_ip(self, capsys, tmp_path, monkeypatch):
|
||||
monkeypatch.delenv("CHATMAIL_INI", raising=False)
|
||||
inipath = tmp_path / "chatmail.ini"
|
||||
assert main(["init", "--config", str(inipath), "1.3.3.7"]) == 0
|
||||
assert main(["dns", "--config", str(inipath)]) == 0
|
||||
out, err = capsys.readouterr()
|
||||
assert out == "[WARNING] 1.3.3.7 is not a domain, skipping DNS checks.\n"
|
||||
|
||||
|
||||
def test_www_folder(example_config, tmp_path):
|
||||
reporoot = importlib.resources.files(__package__).joinpath("../../../../").resolve()
|
||||
|
||||
Reference in New Issue
Block a user