Configure Dovecot to only let localhost connect via imap

dovecotimaplocalhost

How do I configure the Dovecot message delivery agent to only allow imap connections from localhost?

Best Answer

The listen = addr:port config is deprecated in newer versions of dovecot. The new way of doing things is with service { inet_listener imap { address = ... } }.

On my system it's in /etc/dovecot/conf.d/10-master.conf:

service imap-login {
  inet_listener imap {
    address = 127.0.0.1
  }
}