setting up a mail server in Debian 8

The place to post if you need help or advice

Moderators: ChriThor, LXF moderators

setting up a mail server in Debian 8

Postby fede » Thu Jul 13, 2017 10:23 pm

I am in the process of retiring my old loud and clunky server for a new, sleek and silent SSD-based one, both running Debian 8 (xfce in the old one, gnome in the new one). I use it as a mail, file and DNS server, but I now realize that I had some blind luck when I set up my old one, and am missing it this time. The main reason is that I have only a foggy idea of how mail services work, and I am all too often short on time to get up to speed via documentation and web pages.

1.Following a great advice I got here long ago, I have the server run dnsmasq, and it seems to work OK, but when launhching it at boot I get the message

"dnsmasq: failed to create listening socket for port 53: Address already in use"

The item launched before dnsmasq is fetchmail. Should I do something?

2. I don't know how, but, without me doing doing anything specific that I can recall, including not installing explicitly anything, my old server has a working setup for mail, with inted launching ipop3d and imapd as needed, and SMTP handling fetchmail collection. The new one has (after installing it explicitly - I am positive I didn't do it before) inetd running (same command line arguments per ps as the old server: /usr/sbin/inetd -i), and also exim4 running (on its own volition) with the same arguments as well (/usr/sbin/exim4 -bd -q30m), but fetchmail does not find SMTP to take care of the mail, and pop and imap are not available (I didn't find imapd or ipop3d packages for download either, but they are listed in /usr/sbin in the old server, but not in the new one). I am obviously missing something big time, and would greatly appreciate some directions. Thank you.
fede
LXF regular
 
Posts: 106
Joined: Thu Sep 01, 2005 3:23 am

Re: setting up a mail server in Debian 8- Update

Postby fede » Sat Jul 22, 2017 2:38 am

I figured out how to set up Exim to work as SMTP service to fetchmail, so my mail is now in /$username. Now I need a POP3 and IMAP server, and in my old server I had ipop3d and imapd installed by default and doing the job. However, my new Debian 88.8 does not have them anywhere, and I can't find a place to download them from (the UW and its mirrors' links are broken, and they don't appear in the repositories, nor does uw-mailutil seem to include them any more). I could go brute force and copy them from server's /usr/sbin folder (and also adjust manually the inetd.conf and /etc/services files, where there is no mention of pop or imap), but I wonder if that would work or actually mess up things. Any suggestion would be most welcome, thank you.
fede
LXF regular
 
Posts: 106
Joined: Thu Sep 01, 2005 3:23 am

Re: setting up a mail server in Debian 8

Postby nelz » Sun Jul 23, 2017 6:32 pm

I use Dovecot to serve both POP3 and IMAP4, including the S variants. The support and documentation is good, although the default configuration should work for you. The only major change I made was to alter the location of saved mails from ~/Mail (I think) to /var/spool/mail/$USER.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 9038
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Re: setting up a mail server in Debian 8

Postby fede » Tue Jul 25, 2017 1:25 am

Thanks, but it doesn't look like the default is working. I installed dovecot, but any attempt by my mail client to access POP3 or IMAP results in a connection refused, whether using SSL or TSL. i can't figure out from the documentation what it is I should do to make it work. I hope somebody has a suggestion. Thank you!
fede
LXF regular
 
Posts: 106
Joined: Thu Sep 01, 2005 3:23 am

Re: setting up a mail server in Debian 8

Postby nelz » Tue Jul 25, 2017 6:13 am

What does the dovecot log say?

See https://wiki2.dovecot.org/QuickConfiguration for a quick startup guide.

If you want to use SSL/TLS, you need to set up a certificate.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 9038
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Re: setting up a mail server in Debian 8

Postby fede » Tue Jul 25, 2017 8:17 pm

Thank you, but I am still at a loss. I set up ssl=no, at least as a start to see if it worked, but I still get a "connection refused" message when my mail client tries to connect. The log files don't seem too helpful, since they all have the following reports:

Jul 25 11:56:56 yeats dovecot: doveadm: This is Dovecot's info log (1501009016)
Jul 25 11:56:56 yeats dovecot: doveadm: Warning: This is Dovecot's warning log (1501009016)
Jul 25 11:56:56 yeats dovecot: doveadm: Error: This is Dovecot's error log (1501009016)
Jul 25 11:56:56 yeats dovecot: doveadm: Fatal: This is Dovecot's fatal log (1501009016)
These are from /var/log/mail.info, with the same statements in the other log files (mail.err only lists the last two).

I am going through the dovecot documentation, but I can't find anything applicable. And to think that my old uw-mailutil stuff worked on its own, without me doing anything. I was wondering about copying ipop3d and imapd to /usr/sbin, and adding the relevant entries to inetd.conf and /etc/services, but it seems too chewing gum and duct tape to be sensible,
fede
LXF regular
 
Posts: 106
Joined: Thu Sep 01, 2005 3:23 am

Re: setting up a mail server in Debian 8/Extra issue

Postby fede » Tue Jul 25, 2017 9:36 pm

Waiting for some solution ot the dovecot issue, I decided to transfer the /var/mail/$user file to the /var/mail directory in the old server, so my mail clients could collect the (sizable) mail accumulated these last few days. However, that doesn't seem to work: even if the name of the file and its permissions are the same as always, the mail client reports

14:15:59] POP3> STLS
[14:15:59] POP3< +OK STLS completed
[14:15:59] POP3> USER fede
[14:15:59] POP3< +OK User name accepted, password please
[14:15:59] POP3> PASS ********
[14:15:59] POP3< +OK Mailbox open, 0 messages
[14:15:59] POP3> STAT
[14:15:59] POP3< +OK 0 0
[14:15:59] POP3> QUIT
[14:15:59] POP3< +OK Sayonara

like there was no mail file at all. The directory listing is

fede@yeats:~$ ls -l /var/mail
total 11222784
-rw-rw---- 1 fede mail 11480896942 Jul 25 11:03 fede

Why would it say there are no messages?

Thanks for any help. This is really frustrating, especially since the old sever setup worked so simply.
fede
LXF regular
 
Posts: 106
Joined: Thu Sep 01, 2005 3:23 am

Re: setting up a mail server in Debian 8

Postby nelz » Tue Jul 25, 2017 10:58 pm

So you're using mailfile format (a horrible idea IMO) while Dovecot may be trying to use maildir - this is set by mail_location. You can get more information from the logs by setting log_path, auth_verbose and mail_debug in your config - don't forget to restart the service after making changes. I'd check what listen is set to too, "listen = *" should accept connections from anywhere.

"doveconf -n" is a useful command, it shows only your configuration options that differ from the default.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 9038
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Re: setting up a mail server in Debian 8 (solved)

Postby fede » Sun Jul 30, 2017 6:07 am

For the record, I finally managed to get Exim+Dovecot working with SSL enabled. It took some digging and interpreting the Dovecot instructions (and many of their file locations and settings do not quite match with what I have in Debian 8.8, even if I got to the Dovecot instructions from Debian), but they seem to work now. There seems to be a problem with Kmail (the client on my least used laptop) connecting to the server as it is not really clear how to set it to accept the self-signed certificate (or any certificate, at least in the POP3 setup), but, if necessary, it will be something for another thread.

Thanks to all who helped - you were extremely helpful!
fede
LXF regular
 
Posts: 106
Joined: Thu Sep 01, 2005 3:23 am


Return to Help!

Who is online

Users browsing this forum: No registered users and 5 guests