Conversation
…ivery for IP-only relays work
hpk42
left a comment
There was a problem hiding this comment.
nice :)
documentation is missing ("### experimental support for 'dns-free' IP-based relays" or so somehwere) with a note that this support is WIP and might change without prior notice.
|
|
||
|
|
||
| def test_init(tmp_path, maildomain): | ||
| def test_init(tmp_path, maildomain_sanitized): |
There was a problem hiding this comment.
In the tests i would make maildomain fixture return the "[]"-stripped ip-address so you don't need to change tests much. "config.mail_domain" would still have the "[]" spelling where needed. sshdomain/imap/smtp fixtures can use maildomain directly then.
j-g00da
left a comment
There was a problem hiding this comment.
Nice :D I would also add support for IPv6 domain-literals as this doesn't require that much more changes.
Suggested PR title/commit message:
feat: No-DNS relay deployment
Current title makes it a bit confusing, as relays with IPv4 maildomain can still operate over IPv6 (and we most likely want to also support IPv6 maildomains).
| def is_valid_ipv4(address: str) -> bool: | ||
| """Check if a mail_domain is an IPv4 address.""" | ||
| try: | ||
| ipaddress.IPv4Address(address) | ||
| return True | ||
| except ValueError: | ||
| return False |
There was a problem hiding this comment.
I would introduce something like format_maildomain that would check if it is either a domain, IPv4 or IPv6 and then either don't change it in case of a domain, or format it as a domain-literal. It would be nice to accept IPv6, as the only change needed would be adding IPv6: prefix inside the square brackets.
j4n
left a comment
There was a problem hiding this comment.
looks good to me apart from the aspects raised by the others.
| out.red("Deploy completed but letsencrypt not configured") | ||
| out.red("Run 'cmdeploy run' again") | ||
| else: | ||
| out.green("Deploy completed, call `cmdeploy dns` next.") |
There was a problem hiding this comment.
This should be skipped if it's an IP-only relay or cmdeploy dns amended to fail gracefully:
(venv) ~/delta/relay2 [ipv4-only] % cmdeploy dns
ssh: Could not resolve hostname [46.224.103.73]: Name or service not known
Traceback (most recent call last):
...
File "/home/ja/delta/relay2/venv/lib/python3.10/site-packages/execnet/gateway_bootstrap.py", line 55, in bootstrap_exec
raise HostNotFound(io.remoteaddress) from None
execnet.gateway_bootstrap.HostNotFound: root@[46.224.103.73]
| def sshdomain(maildomain): | ||
| return os.environ.get("CHATMAIL_SSH", maildomain) | ||
| def maildomain_sanitized(maildomain): | ||
| return maildomain.strip("[").strip("]") |
There was a problem hiding this comment.
this is good, should be used everywhere.
|
I'm continuing this effort in #919 :) |
This PR enables to run
cmdeploy init 13.12.131.2and then continue withcmdeploy runas expected.It federates successfully with https://172.238.97.168/, and nine.testrun.org, I tested both manually.
It can be tested with https://github.com/chatmail/hetzner-relay --ipv4only, I didn't adjust CI yet as things are in motion anyway right now.