-
Notifications
You must be signed in to change notification settings - Fork 27
Avoid accepting mail to xyz@localhost from remote systems #101
Conversation
…to another user anyway.
Thanks for pointing this out. We had this because a user wanted to use the same |
Two users, actually. I just never mentioned it and only changed I got two questions about this PR:
Also thanks for pointing this out! This (and the backscatter issue recently) just confirms how beneficial it is to have multiple people look at a mail server's config. |
@phdoerfler Postfix has multiple transports, depending of where the domain is configured, postfix puts it into that transport's queue. As nixos-mailserver is only using virtual mailboxes, in my opinion it should not accept emails from the outside targeted at anything but the configured domains.
|
@phdoerfler So to actually answer your questions:
Since you already have these aliases configured, they should work. What does not happen anymore is that mail is delivered locally to /var/spool/mail/$user.
Yes, as long as example.com is listed among your receiving domains. |
@tokudan Very interesting! Thanks for this detailed explanation. I am a bit puzzled about this part:
I have observed that the mailserver does differentiate between mails outside and mails that come from the same systen (such as cron jobs) or authorized sources (such as an imap client) respectively. Especially rspamd is very verbose about it and denots in the logs that it's skipping spam checks for a particular email because it is a locally delivered one / authorized one. |
Here's a test script I use to verify that my mailserver works as expected:
|
I actually just noticed that for some reason an alias [email protected] -> realaccount works. but @example.com -> realaccount does not. |
In the current configuration though, mail that's received locally does not go through spam filtering, as the input does not come from smtpd. |
Does it not? My logs indicate otherwise (see #65):
|
I saw something unexpected in my logs when I ran some tests, but didn't investigate further, as I didn't have time. Quite possible that I misread something in the logs, but double-checking is better than breaking something. |
Let me know when you consider this done, so I can take a look at it again. |
Will do. I haven't forgotten it, this PR. The last couple of days' planning got thrown around a lot... |
Sorry for the delay in working on this. The below points should address the points raised so far. I believe this can be merged.
Two mails sent by the local root account and their logs:
|
Sounds great. I vote for merging asap. @phdoerfler are your concerns addressed? |
@r-raymond Yes, I suppose this will do. |
Thanks again! |
This prevents accepting emails addressed to xyz@localhost and thus avoids detecting valid account names from remote systems.
This does not affect email that is sent e.g. through the sendmail command, but the target addresses (or the two localhost and $myhostname domain) should be aliased to other users, or they will bounce and the bounce deleted, as it's not deliverable.