r-raymond / nixos-mailserver

A complete and Simple Nixos Mailserver
GNU General Public License v3.0
181 stars 27 forks source link

postfix fails to deliver mail due to wrong policy_service setting #87

Closed phdoerfler closed 6 years ago

phdoerfler commented 6 years ago

postfix logs "host/service mailstore.example.com/12340 not found: Name or service not known" when delivering mail:

Feb 22 23:17:39 turtle postfix/smtpd[4194]: Anonymous TLS connection established from mx.example.com[123.123.123.123]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Feb 22 23:17:39 turtle postfix/smtpd[4194]: fatal: host/service mailstore.example.com/12340 not found: Name or service not known
Feb 22 23:17:40 turtle postfix/master[4175]: warning: process /nix/store/xz06496qy0yfacj83qv1h750zwjbg965-postfix-3.2.5/libexec/postfix/smtpd pid 4194 exit status 1
Feb 22 23:17:40 turtle postfix/master[4175]: warning: /nix/store/xz06496qy0yfacj83qv1h750zwjbg965-postfix-3.2.5/libexec/postfix/smtpd: bad command startup -- throttling

In addition to the log message postfix is unable to deliver mail.

See https://github.com/r-raymond/nixos-mailserver/issues/86#issuecomment-367845286 for details.

The offending line instructs postfix to ask the policy server at mailstore.example.com at the given port. Or it would if there was any such server at that address. This would normally allow postfix to query dovecot if the mail may be delivered (due to the quota).

This line should at least read localhost or the fqdn instead of the example URL. I'm no expert with postfix and dovecot but I would suspect one can get this information not just via a network call but perhaps via unix sockets from dovecot.

r-raymond commented 6 years ago

Wow, sorry about that. I have now idea how that ended up in the release. Let met try to fix this right now.

dotlambda commented 6 years ago

We should definitely try to create a test case that catches that error.

r-raymond commented 6 years ago

I think the tests got lucky there, since the domain is actually example.com

dotlambda commented 6 years ago

Is there a way in Nix to create a random string that could be used as domain name?

r-raymond commented 6 years ago

I don't know, if you find a way feel free to open a PR