This is an old revision of the document!
Table of Contents
Making Slackware Mail Server
This article shows how to make an Slackware machine your personal Mail Server. This howto is for Slackware 64 13.37, but with few changes you can adapt it to the newest member of Slackware familly Slackware 14.
Before we begin I must say that you need a normal installation of Slackware, without any special packages. The packages we will need to make the Mail Server we will manually download and install from Slackbuilds.org. I preffer the Cyrus SASL authentication method and Cyrus IMAP for remote login, insted of other alternatives like qpopper or dovecot.
Let's get started then , we will need to install Cyrus-SASL, Postfix, Cyurs-IMAP and then configure them all to use Certificates for encrypting the mail packages that traverse the Internet.
Installing Cyrus-SASL
# cd /tmp # mkdir cyrus-sal # cd cyrus-sasl # wget ftp://ftp.slackware.com/pub/slackware/slackware64-13.37/source/n/cyrus-sasl/cyrus-sasl-2.1.23.tar.xz # wget ftp://ftp.slackware.com/pub/slackware/slackware64-13.37/source/n/cyrus-sasl/cyrus-sasl.SlackBuild # wget ftp://ftp.slackware.com/pub/slackware/slackware64-13.37/source/n/cyrus-sasl/doinst.sh.gz # wget ftp://ftp.slackware.com/pub/slackware/slackware64-13.37/source/n/cyrus-sasl/rc.saslauthd.gz # wget ftp://ftp.slackware.com/pub/slackware/slackware64-13.37/source/n/cyrus-sasl/slack-desc
# joe cyrus-sasl.SlackBuild
and add the following lines after “–disable static”
--enable-plain \ --disable-digest \
# sh cyrus-sasl.SlackBuild # installpkg /tmp/cyrus-sasl-2.1.23-x86_64-1.txz
Installing Postfix
# cd /tmp # mkdir postfix # cd postfix # wget http://postfix.cs.utah.edu/source/official/postfix-2.8.3.tar.gz # wget http://slackbuilds.org/slackbuilds/13.37/network/postfix/README # wget http://slackbuilds.org/slackbuilds/13.37/network/postfix/doinst.sh # wget http://slackbuilds.org/slackbuilds/13.37/network/postfix/postfix.SlackBuild # wget http://slackbuilds.org/slackbuilds/13.37/network/postfix/postfix.info # wget http://slackbuilds.org/slackbuilds/13.37/network/postfix/rc.postfix # wget http://slackbuilds.org/slackbuilds/13.37/network/postfix/slack-desc
# joe postfix.Slackbuild
Edit the following line and replace “dovecot” with “cyrus” like this
SASL=${SASL:-cyrus}
In order to begin Postfix installation you will need to create postfix user and group (also keep in mind that we need to add user postfix and user cyrus to the same group, mail group that is).
# groupadd -g 200 postfix # useradd -u 200 -d /dev/null -s /bin/false -g postfix postfix -G mail # groupadd -g 201 postdrop # sh postfix.SlackBuild # installpkg /tmp/postfix-2.8.3-x86_64-1_SBo.tgz
Before we continue with installation of Imap server we need to assure that Postfix is working and we can authenticate with sasl. Let's make some basic Postfix configuration and some basic SASL configuration. I will be explaining plain auth because later on we will use it togheter with sasl to authenticate.
First of all we need to make our aliases and tell postfix to use aliases maps from /etc/postfix/aliases, so :
# joe /etc/postfix/main.cf
Edit these lines and make them look like this :
alias_maps = hash:/etc/postfix/aliases alias_database = hash:/etc/postfix/aliases
Now let's add a user to the Slackware machine, a user who will also can read and send mail.
# adduser Login name for new user []:xxxxxx User ID ('UID') [ defaults to next available ]: press ENTER Initial group [ users ]: 200 Home directory [ /home/xxxxxx ]: press ENTER Shell [ /bin/bash ]: /bin/false Do you wish to change the sheel? (Y/n): n Expiry date (YYYY-MM-DD) []: press ENTER Press ENTER and imput full name and other account relates stuff. Also specify an password for your newly created user.
Now edit /etc/postfix/aliases and modifiy it to your needs :
root: your_user office: your_user, your_next_user
Now update your aliases database issuing the command :
# postalias hash:/etc/postfix/aliases
It is now time to make our important configurations for Postfix in order for it to run.
# joe /etc/postfix/main.cf myhostname = mx.yourdomain.tld mydomain = yourdomain.tld myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks = 127.0.0.0/8
Let's now configure Postfix to authenticate users using SASL
# mkdir /etc/sasl2 # cd /etc/sasl2 # touch smtpd.conf # joe smtpd.conf
pwcheck_method: saslauthd mech_list: PLAIN LOGIN
Now let's configure Postfix to have users authenticate using SASL. Edit /etc/postfix/main.cf and add the folowing code to the end of the file :
smtpd_sasl_auth_enable = yes broken_sasl_auth_clients = yes smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Let's start the daemons and test our configurations until now:
# saslauthd -a shadow # postfix start
Then from another machine telnet into your mail server on port 25 and issue the following commands :
# telnet mx.mailserver.com 25 ehlo user.mailserver.tld 250-mx.mailserver.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN AUTH PLAIN Y4R0QYxpcuHsFBRbbGjnPHIwYjB0MWrpMTk7La== 235 2.7.0 Authentication successful MAIL FROM: <user@mailserver.com> 250 2.1.0 Ok RCPT TO: <user@yahoo.com> 250 2.1.5 Ok DATA 354 End data with <CR><LF>.<CR><LF> HI. This mail is a test . . 250 2.0.0 Ok: queued as 4C0EE221E93 QUIT
printf 'user\0user\0password' | mmencode
on your mail server, where user is your username and password is your password
Sources