I have setup a simple mail server with Exim and Dovecot. Since obviously I don't want to have an open relay server, I want to restrict the access from outside. I figured the following configuration:
- Dovecot listens at ports 587 and 993, performs the authentication/authorization with my LDAP server, which works fine.
- Exim does not perform any user authentication by itself, only receives external mail and distributes it to users' maildirs. So far so good.
- Here is my problem - if I want to send an email, my MUA talks to Dovecot submission module -> it authenticates and authorizes the user -> and relays the email to Exim. In Dovecot I have configured:
submission_relay_host = 127.0.0.1
submission_relay_port = 25
and added in Exim the relevant ACL that allows a relay only from localhost, since Dovecot is running on the same machine. Despite the fact I am not using any public IP address in the configuration, still Exim resolves the connection as being made from the public IP of my server, and allows relaying only if I add it to the Exim ACL.
Two questions:
- How much of a security issue is if I allow this one public IP to Exim ACL? I can imagine IP-spoofing attack, but the attacker would have to spoof the IP of my server, which I believe would make the communication between two same IPs impossible... Right? Therefore the preferred option:
- How can I force Dovecot talk to Exim using a loopback and not public IP? Is it Dovecot figuring out that it should use public IP to talk to Exim, or Exim resolves localhost's IP address to the public one? In /etc/hosts I have only an entry for 127.0.0.1 (localhost) and don't even have the public IP listed with the FQDN...