"You can't lie to the compiler." - Andrew Stevenson
Note this install is specific to POP3. If you are using IMAP it is likely to be different.
Some of the configuration for dovecot is held on /etc/dovecot/dovecot.conf which heeds to be edited with a text editer such as nano.
sudo nano /etc/dovecot/dovecot.conf
the lines below will require editing to your installation
include_try /usr/share/dovecot/protocols.d/*.protocol
listen = internal IP of server, : :
example
listen = 192.168.0.110, : :
Edit the configuration file /etc/dovecot/conf.d/10-auth.conf
with a text editor such as nano
sudo nano /etc/dovecot/conf.d/10-auth.conf
Make sure the lines below are enabled:
disable_plaintext_auth = no
auth_username_format = %n
auth_mechanisms = plain login
!include auth-system.conf.ext
Edit the configuration file /etc/dovecot/conf.d/10-mail.conf
with a text editor such as nano
sudo nano /etc/dovecot/conf.d/10-mail.conf
Make sure the lines below are enabled:
mail_location = mbox:~/mail:INBOX=/var/mail/%u
namespace inbox {
inbox = yes
}
mail_privileged_group = mail
protocol !indexer-worker {
}
Edit the configuration file /etc/dovecot/conf.d/10-master.conf
with a text editor such as nano
sudo nano /etc/dovecot/conf.d/10-master.conf
Make sure the lines below are enabled:
service pop3-login {
inet_listener pop3 {
port = 110
}
inet_listener pop3s {
port = 995
ssl = yes
}
}
service submission-login {
inet_listener submission {
port = 587
}
}
service lmtp {
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
}
service pop3 {
}
service submission {
}
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0660
user = postfix
group = postfix
}
service auth-worker {
}
service dict {
unix_listener dict {
}
}
Edit the configuration file /etc/dovecot/conf.d/10-ssl.conf
with a text editor such as nano
sudo nano /etc/dovecot/conf.d/10-ssl.conf
Make sure the lines below are enabled:
Note the example.com in blue needs replacing with your domain name
ssl = yes
#set the line below to the location of the certificate
# for example
ssl_cert = </etc/letsencrypt/live/example.com/fullchain.pem
#set the line below to the location of the certificate key
# for example
ssl_key = </etc/letsencrypt/live/ example.com/privkey.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = </usr/share/dovecot/dh.pem
Once the changes are made and saved then start Dovecot with the following commands:
sudo systemctl stop dovecot
sudo systemctl enable dovecot.service
sudo systemctl start dovecot.service
The command below will then indicate any issues.
sudo systemctl status dovecot.service
The first time I tried this I had all sorts of issues and had to go back and change the configuration files.
Hopefully you should avoid this apart from where you need to put in your own domain information.
After a few attempts I was able to connect to the mail server with Telnet localhost on port 110 successfully (command telnet localhost 110).
See Overview of Telnet.
If you still have issues then look at all the logs
Note you need to have at least set up the email user that you are trying to connect with.
try
journalctl -r -u dovecot
to list all the journal entries with dovecot most recent first. This should help. It will also show the thousands of failed entries where people have tried to hack your email server.
I have added the contents of /etc/postfix/master.cf and you should be able to use it in its entirety with Select all, copy and paste.
Code: Select all
#
# Postfix master process configuration file. For details on the format of the file, see the master(5) manual page (command: "man 5 master" or on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - y - - smtpd
#smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
#submissiion inet n - y - - smtpd
587 inet n - y - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=may
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_tls_auth_only=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smpts inet n - y - - smtpd
465 inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - y - - qmqpd
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
rewrite unix - - y - - trivial-rewrite
bounce unix - - y - 0 bounce
defer unix - - y - 0 bounce
trace unix - - y - 0 bounce
verify unix - - y - 1 verify
flush unix n - y 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - y - - smtp
relay unix - - y - - smtp
-o syslog_name=postfix/$service_name
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - y - - showq
error unix - - y - - error
retry unix - - y - - error
discard unix - - y - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - y - - lmtp
anvil unix - - y - 1 anvil
scache unix - - y - 1 scache
postlog unix-dgram n - n - 1 postlogd
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
After making changes you will need to restart postfix to get the updates recognised. There are several options, perhaps the simplest:
sudo postfix reload
or
sudo service postfix restart
or
sudo systemctl restart postfix
To see the status of postfix you can use:
systemctl status postfix
To verify that the configuration file is reasonably correct and list all configurations actually applied, then use:
sudo postfix check
You should now be able to connect to the mail server with Telnet localhost on port 25 successfully for SMTP (command telnet localhost 25).
See Overview of Telnet.
Note you need to have at least set up the email user that you are trying to connect with.
If you still have issues then look at all the logs.
Try
journalctl -r -u postfix
to list all the journal entries with postfix most recent first.
This should help.
For further testing you need to set up an email client for an email user on the server and then try sending emails both internally and externally.
Also the reverse sending emails from an external email address to an internal email address.