albertito / chasquid

SMTP (email) server with a focus on simplicity, security, and ease of operation [mirror]
https://blitiri.com.ar/p/chasquid/
Other
868 stars 56 forks source link

Using an empty listening address in the config results in chasquid listening on a random port #45

Closed albertito closed 8 months ago

albertito commented 9 months ago

If chasquid.conf contain an entry like submission_address: "", then chasquid will use a random port for listening for submissions.

While that is a misconfiguration, it is an easy mistake to make (by users who don't want to listen on any ports), and the result of chasquid listening on a random port can be unexpectedly dangerous.

I will add some code to make chasquid reject empty addresses, to prevent this misconfiguration from happening.

Thanks to xavierg who reported this via IRC!

albertito commented 9 months ago

For future reference, we discussed this a bit on IRC.

An alternative to rejection would be to make it such an empty listening address means "do not listen for this mode". However, if there are repeated listening entries, it can also end up being surprising behaviour (although easier to spot).

Another option would be to have a separate toggle for "not listen on this mode", but that adds a fair amount of complexity to the config.

In the end I think a direct rejection of the config in this case is the safest option: the admin can quickly identify and adjust the configuration accordingly, and it's not going to cause any runtime surprises.

We can always change this later, if we want to end up allowing them, since it'd be backwards-compatible.

albertito commented 9 months ago

Another possible future change could be to special-case the listening address none (or similar), so there is no ambiguity or risk of accidental misconfiguration, and still allow a clear explicit way to say "I don't want chasquid listening for this mode".

But again, that is more complex than just commenting out the entry (or disabling it in systemd).

albertito commented 9 months ago

Commit dbff2f04553ca9bda575ca395d623176a678ffa6 contains the proposed fix for this; it's in the next branch.

I'm inclined to leave it there a little while, just in case something unexpected comes up.

albertito commented 8 months ago

chasquid v1.13 includes the fix.

Thanks a lot!