Courier Mail Server

UPDATE June 2020. Courier on a Fedora 32 machine.

Personal memo on how I did  install a working mail server Courier on my personal desktop machine, a Fedora 26 32 one.

Thanks so much to Sam Varshavchik without whose step by step help I couldn’t have made.
    1. My goals:
      1. to retrieve mail from my remote server (managed by a professional provider). I do that by fetchmail, and it transfers mails to courier;
      2. to manage mails by courier as my local mail server, in particular to be able to check them by the bundled webmail SqWebMail;
      3. to download mails by my local mail client (Evolution) from the local mail server. To do that, courier needs to listen to a pop3 port;

      Let’s see how I did

    2. I downloaded (June 2020) the following four tarball source codes:
      courier-1.0.13.tar.bz2
      courier-authlib-0.70.0.tar.bz2
      courier-sox-0.12.tar.bz2
      courier-unicode-2.1.tar.bz2
      
    3. rpmbuild -ta each of them:
      dnf install rpm-build 
      rpmbuild -ta courier-1.0.13.tar.bz2 rpmbuild -ta courier-authlib-0.70.0.tar.bz2 rpmbuild -ta courier-sox-0.12.tar.bz2 rpmbuild -ta courier-unicode-2.1.tar.bz2

      Note: I had missing dependencies; I could install every missing package (packages required by courier-authlib-0.70.0.tar.bz2):

      dnf install  courier-unicode-devel expect gdbm-devel libtool mysql-devel openldap-devel pam-devel postgresql-devel perl-generators sqlite-devel libtool-ltdl-devel
    4. hence, root and myself’s RPMS folders contain:
      /root/rpmbuild/RPMS/x86_64/courier-authlib-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-debuginfo-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-devel-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-ldap-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-mysql-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-pgsql-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-pipe-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-sqlite-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-authlib-userdb-0.68.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-sox-0.12-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-sox-debuginfo-0.12-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-sox-devel-0.12-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-sox-server-0.12-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-sox-utils-0.12-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-unicode-2.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-unicode-debuginfo-2.0-1.fc26.x86_64.rpm
      /root/rpmbuild/RPMS/x86_64/courier-unicode-devel-2.0-1.fc26.x86_64.rpm
      
      /home/myself/rpmbuild/RPMS/x86_64/courier-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-debuginfo-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-fax-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-imapd-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-ldap-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-maildrop-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-maildrop-wrapper-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-mlm-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-mlm-web-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-mysql-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-pgsql-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-pop3d-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-webadmin-0.78.2-1.fc26.x86_64.rpm
      /home/myself/rpmbuild/RPMS/x86_64/courier-webmail-0.78.2-1.fc26.x86_64.rpm
      

      and I could rpm -ivh all the rpm’s:

      rpm -ivh courier-authlib-0.68.0-1.fc26.x86_64.rpm courier-authlib-debuginfo-0.68.0-1.fc26.x86_64.rpm courier-authlib-devel-0.68.0-1.fc26.x86_64.rpm courier-authlib-ldap-0.68.0-1.fc26.x86_64.rpm courier-authlib-mysql-0.68.0-1.fc26.x86_64.rpm courier-authlib-pgsql-0.68.0-1.fc26.x86_64.rpm courier-authlib-pipe-0.68.0-1.fc26.x86_64.rpm courier-authlib-sqlite-0.68.0-1.fc26.x86_64.rpm courier-authlib-userdb-0.68.0-1.fc26.x86_64.rpm 
      
      rpm -ivh courier-sox-0.12-1.fc26.x86_64.rpm courier-sox-debuginfo-0.12-1.fc26.x86_64.rpm courier-sox-devel-0.12-1.fc26.x86_64.rpm courier-sox-server-0.12-1.fc26.x86_64.rpm courier-sox-utils-0.12-1.fc26.x86_64.rpm
      
      rpm -ivh courier-0.78.2-1.fc26.x86_64.rpm courier-debuginfo-0.78.2-1.fc26.x86_64.rpm courier-fax-0.78.2-1.fc26.x86_64.rpm courier-ldap-0.78.2-1.fc26.x86_64.rpm courier-maildrop-0.78.2-1.fc26.x86_64.rpm courier-maildrop-wrapper-0.78.2-1.fc26.x86_64.rpm courier-mlm-0.78.2-1.fc26.x86_64.rpm courier-mlm-web-0.78.2-1.fc26.x86_64.rpm courier-mysql-0.78.2-1.fc26.x86_64.rpm courier-mysql-0.78.2-1.fc26.x86_64.rpm courier-pgsql-0.78.2-1.fc26.x86_64.rpm courier-pop3d-0.78.2-1.fc26.x86_64.rpm courier-webadmin-0.78.2-1.fc26.x86_64.rpm courier-webmail-0.78.2-1.fc26.x86_64.rpm 
      

      Note: for courier-unicode, a older version seems to be sitting on Fedora 26, so first I needed to:

       rpm -e courier-unicode-devel-1.4-4.fc26.x86_64

      then

      rpm -Uvh courier-unicode-debuginfo-2.0-1.fc26.x86_64.rpm
      rpm -Uvh courier-unicode-devel-2.0-1.fc26.x86_64.rpm
      rpm -Uvh courier-unicode-2.0-1.fc26.x86_64.rp
    5. Now I had to define my mail users. I followed instruction at A simple userdb setup:  it is asked to create a system user, say vmail; I did that.
      I created file:

      # cp /dev/null /etc/authlib/userdb
      # chmod 700 /etc/authlib/userdb

      (note, for some reason, on my machine it did not work with file at /usr/local/etc/authlib/userdb)
      I retrieved info about vmail by (check vmail line):

      pw2userdb

      and wrote them within /etc/authlib/userdb:

      vmail uid=1001|gid=1001|home=/home/vmail|shell=/bin/bash|systempw=$ long long long pw
      1001= vmail
      

      for each of my users, I created MailDir:

      # su vmail
      $ cd ~vmail
      $ mkdir myuser_mydomain_glt
      $ maildirmake myuser_mydomain_glt/Maildir
      $ exit
      #

      and wrote the relevant line of info within /etc/authlib/userdb (note I use gid, uid as vmail’s ones)

      myuser@mydomain_glt  gid=1001|home=/home/vmail/myuser_mydomain_glt|uid=1001

      to include the password I launched

      userdbpw | userdb "myuser@mydomain_glt" set  systempw

      inserted the password at the prompt and got the file overwritten as

      myuser@mydomain_glt systempw= short pw|gid=1001|home=/home/vmail/myuser_mydomain_glt|uid=1001
    6. I still needed to define the hosted domain. I looked for file /etc/courier/hosteddomains/hosteddomains, wrote therein the line mydomain.glt, and launched
      /usr/lib/courier/sbin/makehosteddomains
    7. there was still a last step: to select Courier’s sendmail as the preferred mta (since Fedora seems to be shipped with postfix and original sendmail too)
      alternatives --set mta /usr/lib/courier/bin/sendmail

      I may check with (long output is not pasted)

      alternatives --display mta
    8. Now I may launch the program I wish to use:
      /usr/lib/courier/sbin/courier start  <<<< mail server
      /usr/lib/courier/sbin/pop3d start    <<<< to listen to my email client
      /usr/lib/courier/libexec/courier/sqwebmaild  <<<< to get into the webmail

      Also, I may check:

      authtest myuser@mydomain_glt
      Authentication succeeded.
      
      Authenticated: myuser@mydomain.glt (uid 1001, gid 1001)
      Home Directory: /home/vmail/myuser_mydomain_glt
      Maildir: (none)
      Quota: (none)
      Encrypted Password: short pw
      Cleartext Password: (none)
      Options: (none)

      If I try to ship a mail by

      echo "Subject: hello world" | sendmail myuser@mydomanin.gtl

      I may check that it pops up within the MailDir


      and I see it from within the webmail, at url http://localhost/cgi-bin/webmail?index=1

      Note: if you get a error msg, try >> setenforce Permissive.

       

    9. To download mail from the remote server, I use fetchmail. It needs a config file .fetchmailrc (to be saved within the main vmail folder) whose content is:
      set daemon 600
      poll pop3.mydomain.gtl protocol pop3 port 110 username "myuser@mydomain.gtl" password "remote server pw" mda "/usr/lib/courier/bin/sendmail -i -f %F -- %T" is "myuser@mydomain.gtl" here;
      [similar for any other mail accounts]
      set syslog set logfile "/home/vmail/logs/fetchmail.log"
    10. last but not least, I wish to launch all I need at booting. This seems has to be done by creating files .desktop under the /root/.config/autostart/ folder
      whose content is, say for courier.desktop
      and similarly for the other ones.
UPDATE 31/12/2018. As I updated my machine to Fedora (27/28/) 29, I lost Courier. To have it back, I followed the following steps.
  1. I downloaded the following five tarball sources:
    courier-1.0.5.tar.bz2
    courier-imap-5.0.5.tar.bz2
    courier-unicode-2.1.tar.bz2   
    courier-authlib-0.69.0.tar.bz2
    courier-sox-0.12.tar.bz2  (I am not sure I needed this one)
    
  2. them I build and rpm as it follows
    rpmbuild -ta courier-unicode-2.1.tar.bz2  >>> to rpm unicode, you need to remove installed unicode and unicode-devel packeges
    rpm -e courier-unicode-devel
    rpm -e courier-unicode                     
    rpm -ivh courier-unicode-2.1-1.fc29.x86_64.rpm  courier-unicode-debuginfo-2.1-1.fc29.x86_64.rpm  courier-unicode-debugsource-2.1-1.fc29.x86_64.rpm courier-unicode-devel-2.1-1.fc29.x86_64.rpm
    rpmbuild -ta courier-authlib-0.69.0.tar.bz2 >>> authlib asks for unicode
    rpm -ivh courier-authlib-0.69.0-1.fc29.x86_64.rpm courier-authlib-mysql-0.69.0-1.fc29.x86_64.rpm courier-authlib-sqlite-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-mysql-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-userdb-0.69.0-1.fc29.x86_64.rpm courier-authlib-debugsource-0.69.0-1.fc29.x86_64.rpm courier-authlib-pgsql-0.69.0-1.fc29.x86_64.rpm courier-authlib-userdb-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-devel-0.69.0-1.fc29.x86_64.rpm courier-authlib-pgsql-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-devel-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-pipe-0.69.0-1.fc29.x86_64.rpm courier-authlib-ldap-0.69.0-1.fc29.x86_64.rpm courier-authlib-pipe-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-ldap-debuginfo-0.69.0-1.fc29.x86_64.rpm courier-authlib-sqlite-0.69.0-1.fc29.x86_64.rpm
    rpmbuild -ta courier-imap-5.0.5.tar.bz2
    rpmbuild -ta --define 'notice_option --with-notice=unicode' courier-1.0.5.tar.bz2
    rpm -e courier-mysql-0.78.2-1.fc26.x86_64
    rpm -e courier-pgsql-0.78.2-1.fc26.x86_64
    rpm -ivh courier-1.0.5-1.fc29.x86_64.rpm courier-mlm-web-1.0.5-1.fc29.x86_64.rpm  courier-mlm-web-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-mysql-1.0.5-1.fc29.x86_64.rpm   courier-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-pgsql-1.0.5-1.fc29.x86_64.rpm  courier-debugsource-1.0.5-1.fc29.x86_64.rpm  courier-pop3d-1.0.5-1.fc29.x86_64.rpm    courier-fax-1.0.5-1.fc29.x86_64.rpm  courier-pop3d-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-imapd-1.0.5-1.fc29.x86_64.rpm  courier-imapd-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-ldap-1.0.5-1.fc29.x86_64.rpm   courier-ldap-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-maildrop-1.0.5-1.fc29.x86_64.rpm  courier-webadmin-1.0.5-1.fc29.x86_64.rpm  courier-maildrop-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-webadmin-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-maildrop-wrapper-1.0.5-1.fc29.x86_64.rpm  courier-webmail-1.0.5-1.fc29.x86_64.rpm  courier-mlm-1.0.5-1.fc29.x86_64.rpm  courier-webmail-debuginfo-1.0.5-1.fc29.x86_64.rpm courier-mlm-debuginfo-1.0.5-1.fc29.x86_64.rpm
    
  3. luckly, maildirs and users were not erased during the process. I may start services as before, albeit it seems I need to launch courier-authdaemon too:
    /usr/lib/courier/sbin/courier start  
    /usr/lib/courier/sbin/pop3d start
    /usr/sbin/authdaemond start
    /usr/lib/courier/libexec/courier/sqwebmaild

 

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.