Announcement

Collapse
No announcement yet.

RasPi Mail Server - Dovecot & Postfix Configuration

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [CONFIGURATION] RasPi Mail Server - Dovecot & Postfix Configuration

    Once again I'm in need of help.

    I have a mail server running on a Raspberry Pi (Raspbian). I can use Squirrelmail (webmail) to check, send and receive emails - everything is A-OK on that end.

    My problem is with setting up IMAP synchronisation in Thunderbird. When I add the account to Thunderbird, it finds these settings (these are what I expected):

    Click image for larger version

Name:	imap-troubleshooting.jpg
Views:	1
Size:	40.2 KB
ID:	648017

    These settings work for incoming mail, but don't let me send messages. When I try, I get the following error:

    Click image for larger version

Name:	imap-troubleshooting-2.jpg
Views:	1
Size:	21.3 KB
ID:	648018

    I also get errors using K9 mail on Android.

    To be clear, I want to use TLS when sending mail, and thought I had configured both postfix and dovecot so that it would work.

    I'm not quite sure whether the error is in the Postfix configuration or on the Dovecot side of things, but am very confused.

    If you've done this before, please help!

    Many thanks,

    Feathers
    samhobbs.co.uk

    #2
    Let me see both /etc/postfix/main.cf and /etc/postfix/master.cf from your mail server.

    Please upload each file to http://paste.kde.org, protect each file with a password, and set the duration to one month. Send me the passwords in a private message. I'm asking you to take these precautions because these files can, depending on how you create them, contain information you wouldn't want to broadcast.

    BTW, I tried telneting to ports 993 and 587 on samhobbs.co.uk. The connection was refused. Normally you'll want these to be accessible so that you can send and receive mail when your laptop and your phone aren't on your LAN.
    Last edited by SteveRiley; Sep 20, 2013, 12:11 AM.

    Comment


      #3
      Thanks Steve,

      Unfortunately I just removed (purged) postfix, dovecot and squirrelmail and reinstalled, because I wanted a fresh start.

      I previously had a problem where I couldn't receive mail from WAN because I hadn't set up an MX record pointing to the server, and before I realised it was the MX record I changed all sorts! I wasn't sure which bits were me and which bits were default settings.

      Starting from scratch will be good practice

      Will see how I get on setting it up by following the Ubuntu wiki again, and if I still have problems then I'll definitely upload the files for you.

      BTW, those ports are definitely being forwarded to the Pi, but nothing is listening at the moment because I've removed postfix etc.

      Will let you know how I get on, and thanks again!
      samhobbs.co.uk

      Comment


        #4
        Alrighty then.

        BTW, the Ubuntu server team has done a pretty good job of packaging up all this stuff. mail-stack-delivery and amavisd-new-postfix cover about 80% of what you need. Also, RoundCube is a much better webmail interface than SquirrelMail.

        Comment


          #5
          Just had a thought...

          There's this stage in the Postfix configuration on the wiki:

          We have to change a few things to make [SASL for SMTP-AUTH] work properly. Because Postfix runs chrooted in /var/spool/postfix we have change a couple paths to live in the false root. (ie. /var/run/saslauthd becomes /var/spool/postfix/var/run/saslauthd):

          Note: by changing the saslauthd path other applications that use saslauthd may be affected.
          That could have been it...will continue setting it up but if I have problems again I might remove Postfix from chroot and change /etc/default/saslauthd back
          samhobbs.co.uk

          Comment


            #6
            Oh, and Roundcube sounds interesting!

            What makes you prefer it to Squirrelmail?
            samhobbs.co.uk

            Comment


              #7
              Right, made some progress.

              I haven't set up squirrelmail this time, just postfix and dovecot.

              As before, I can receive mail but not send it. I have configured Postfix to use Dovecot SASL using this guide.

              This time, I get a different error from Thunderbird. It connects, and then says:
              An error occurred while sending mail. The mail server responded: 4.3.0 <sam@samhobbs.co.uk>: Temporary lookup failure. Please check the message recipient sam.hobbs@outlook.com and try again.
              Could this be because I'm not authenticating properly? Have tried to check this with telnet and it seems OK on port 25, couldn't check it on port 587 though because it doesn't have AUTH PLAIN (should it? Or is it not supposed to appear because it's for secure connections only?)
              Code:
              feathers-mcgraw@62-West-Wallaby-Street:~$ telnet samhobbs.co.uk 25
              Trying 195.166.151.235...
              Connected to samhobbs.co.uk.
              Escape character is '^]'.
              220 samhobbs.co.uk ESMTP Postfix (Debian/GNU)
              EHLO samhobbs.co.uk
              250-samhobbs.co.uk
              250-PIPELINING
              250-SIZE 10240000
              250-VRFY
              250-ETRN
              250-STARTTLS
              250-AUTH PLAIN
              250-AUTH=PLAIN
              250-ENHANCEDSTATUSCODES
              250-8BITMIME
              250 DSN
              AUTH PLAIN ****************************************==
              235 2.7.0 Authentication successful
              quit
              221 2.0.0 Bye
              Connection closed by foreign host.
              feathers-mcgraw@62-West-Wallaby-Street:~$ telnet samhobbs.co.uk 587
              Trying 195.166.151.235...
              Connected to samhobbs.co.uk.
              Escape character is '^]'.
              220 samhobbs.co.uk ESMTP Postfix (Debian/GNU)
              EHLO samhobbs.co.uk
              250-samhobbs.co.uk
              250-PIPELINING
              250-SIZE 10240000
              250-VRFY
              250-ETRN
              250-STARTTLS
              250-ENHANCEDSTATUSCODES
              250-8BITMIME
              250 DSN
              quit                                                                                          
              221 2.0.0 Bye                                                                                 
              Connection closed by foreign host.
              Feathers
              samhobbs.co.uk

              Comment


                #8
                I just now noticed you're running Raspbian, which is Debian, not Ubuntu. You will not have the two packages I referenced earlier. You really shouldn't be following Ubuntu guidance, then, because the Postfix and Dovecot packages in Debian are not configured the same way as in Ubuntu. Especially some of those really old Ubuntu pages, like the PostfixDovecotSASL page you linked to -- it was last edited in 2009!

                Setting up a mail server in Debian takes more work, and there is even less up-to-date guidance on the Internet. I would highly recommend that you do what I've done: use the free iRedMail script. It does everything for you, and it just works. Which is certainly a nice benefit.

                Comment


                  #9
                  Yep, was kind of relying on the fact that because Ubuntu is based on Debian the config would be similar. As it turns out, it is similar, but the few differences are killer. Relentless googling has revealed other people having problems when following the Ubuntu wiki...but no solution.


                  I've had frequent problems with config settings that were valid in older versions being unsupported in this one and throwing errors.


                  The most noticeable change from when some of the wikis were written, is that dovecot used to have most of its settings stored together in one file (/etc/dovecot/dovecot.conf), and now it's split up into lots of files in /etc/dovecot/conf.d/*.conf

                  Will try the script, thanks!

                  Feathers
                  samhobbs.co.uk

                  Comment


                    #10
                    Originally posted by SteveRiley View Post
                    Setting up a mail server in Debian takes more work, and there is even less up-to-date guidance on the Internet. I would highly recommend that you do what I've done: use the free iRedMail script. It does everything for you, and it just works. Which is certainly a nice benefit.
                    Well, I looked into that script and it looks ideal, but doesn't work on the Pi because of the chip type

                    Code:
                    admin@samhobbs ~/iRedMail-0.8.5 $ sudo /home/admin/iRedMail-0.8.5/iRedMail.sh
                    Your architecture is not supported yet: armv6l.
                    Both i386 and x86_64 are supported by iRedMail.
                    Sigh. Was going to try and use iRedMail to set it up, inspect the config files and reverse engineer a manual solution so that I could write a HowTo.

                    If I can crack this and write a decent HowTo I think a lot of people will be grateful - the Pi is ideal for an always-on email server and I'm sure this is something that many people have tried to do.

                    Feathers
                    samhobbs.co.uk

                    Comment


                      #11
                      Just for the record, in case anyone else is looking to set up a mail server on their RasPi, I gave up on postfix/dovecot/squirrelmail and installed citadel instead.

                      Very impressed so far, the configuration is so much easier. It includes a POP/IMAP server and a web interface.

                      The tutorial I used is here:
                      http://www.ducky-pond.com/posts/2012...itadel-on-rpi/

                      Feathers
                      samhobbs.co.uk

                      Comment


                        #12
                        That thing is still around? It sure is...interesting. You're right that it's an easy set-up, they've done a good job with that. In fact, my first attempt at a mail server was Citadel. But the "rooms" interface is just too klunky for me, and it has zero support for CalDAV and CardDAV, which are immensely useful when you have multiple devices accessing your mail and calendar server. GroupDAV is dead.

                        But hey, it's cool you got something running! You'll like having your own email set-up. Liberating one's self from the likes of any $FREE-EMAIL-FOR-NSA service is increasingly wise.

                        Comment


                          #13
                          Yeah, I'm going to have to do some customising in WebCit - took me too long to work out where the Sent and Outbox folders were, it's very counter-intuitive.

                          I had to look up what CalDAV and CardDAV are, so I doubt I'll miss them immediately, but they do look useful. I doubt this will be my last mail server, so I'll pencil those in as a requirement for the next one!

                          Yep, although I don't think the boys and girls in Cheltenham would find my email very interesting, I disagree strongly with automatic surveillance. Still, it doesn't help much if the people you are sending to are using an outlook or gmail account, or if they grab it while it's in the pipe.

                          Frustratingly, asking most people to use GPG encryption is unlikely to see them turn and run the other way.

                          BTW, thanks for your offer to troubleshoot for me, I really appreciate it.

                          Feathers
                          samhobbs.co.uk

                          Comment


                            #14
                            Steve,

                            Is there an easy way to tell where each of these CAs are based? Or did you google each one?
                            samhobbs.co.uk

                            Comment


                              #15
                              Never mind, that was a dumb question. Selecting a cert and clicking display brings up country info.


                              && I also managed to post it in the wrong thread.
                              Last edited by Feathers McGraw; Sep 28, 2013, 05:00 PM. Reason: wrong thread
                              samhobbs.co.uk

                              Comment

                              Working...
                              X