Enjoy Slackware 15.0!
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
howtos:network_services:postfix_with_cyrus [2013/07/21 11:41 (UTC)] badirca created |
howtos:network_services:postfix_with_cyrus [2019/02/16 16:44 (UTC)] pedro.herrero [Sources] |
||
---|---|---|---|
Line 11: | Line 11: | ||
# cd /tmp | # cd /tmp | ||
- | # mkdir cyrus-sal | + | # mkdir cyrus-sasl |
# cd cyrus-sasl | # cd cyrus-sasl | ||
# wget ftp:// | # wget ftp:// | ||
Line 57: | Line 57: | ||
# installpkg / | # installpkg / | ||
- | 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. | + | 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 | + | First of all we need to make our aliases and tell Postfix |
# joe / | # joe / | ||
Line 72: | Line 72: | ||
# adduser | # adduser | ||
| | ||
- | Login name for new user []:xxxxxx | + | Login name for new user []: slackware_user |
User ID (' | User ID (' | ||
Initial group [ users ]: 200 | Initial group [ users ]: 200 | ||
Line 79: | Line 79: | ||
Do you wish to change the sheel? (Y/n): n | Do you wish to change the sheel? (Y/n): n | ||
Expiry date (YYYY-MM-DD) []: press ENTER | 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. | + | Press ENTER and imput full name and other account relates stuff. Also specify an password for your newly created user. |
+ | |||
+ | Now edit / | ||
+ | root : | ||
+ | office: | ||
+ | | ||
+ | Now update your aliases database issuing the command : | ||
+ | |||
+ | # postalias hash:/ | ||
+ | It is now time to make our important configurations for Postfix in order for it to run. | ||
+ | # joe / | ||
+ | myhostname = mx.yourdomain.tld | ||
+ | mydomain = yourdomain.tld | ||
+ | myorigin = $mydomain | ||
+ | inet_interfaces = all | ||
+ | mydestination = $myhostname, | ||
+ | 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: | ||
+ | mech_list: PLAIN LOGIN | ||
+ | Now let's configure Postfix to have users authenticate using SASL. Edit / | ||
+ | smtpd_sasl_auth_enable = yes | ||
+ | broken_sasl_auth_clients = yes | ||
+ | smtpd_recipient_restrictions = permit_mynetworks, | ||
+ | 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: < | ||
+ | 250 2.1.0 Ok | ||
+ | RCPT TO: < | ||
+ | 250 2.1.5 Ok | ||
+ | DATA | ||
+ | 354 End data with < | ||
+ | HI. This mail is a test . | ||
+ | . | ||
+ | 250 2.0.0 Ok: queued as 4C0EE221E93 | ||
+ | QUIT | ||
+ | < | ||
+ | <note important> | ||
+ | ====== Installing Mail Delivery and Cyrus IMAP ====== | ||
+ | |||
+ | # cd /tmp | ||
+ | # mkdir cyrus-imap | ||
+ | # cd cyrus-imap | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # mkdir patches | ||
+ | # cd patches/ | ||
+ | # wget http:// | ||
+ | # wget http:// | ||
+ | # cd / | ||
+ | # groupadd -g 238 cyrus | ||
+ | # useradd -d /var/imap -s /bin/sh -u 238 -g 238 cyrus -G mail | ||
+ | # sh cyrus-imapd.SlackBuild | ||
+ | # installpkg / | ||
+ | # mkdir -m 750 -p /var/imap / | ||
+ | # chown cyrus:mail /var/imap / | ||
+ | # su - cyrus | ||
+ | # / | ||
+ | # su - root | ||
+ | Edit / | ||
+ | sasl_mech_list: | ||
+ | allowplaintext: | ||
+ | Edit / | ||
+ | mailbox_transport = lmtp: | ||
+ | The last step to do is to add users to your imap server. For that you need to issue these commands : | ||
+ | # passwd cyrus | ||
+ | and add a password for cyrus user | ||
+ | # cyradm --user cyrus --server localhost --auth plain | ||
+ | localhost> | ||
+ | localhost> | ||
+ | localhost> | ||
+ | < | ||
+ | At this point we have an functional Mail Server but with users authenticating in plain text . So the next step is innevitabile. | ||
+ | |||
+ | ====== SSL / TLS Postfix and Cyrus ====== | ||
+ | |||
+ | Let's start by creating our certificates and configuring POSTFIX to use STARTTLS. | ||
+ | # cd /etc/ssl | ||
+ | # misc/CA.pl -newca ( complete all entries) | ||
+ | # openssl req -new -nodes -keyout mailkey.pem -out mailreq.pem -days 36500 | ||
+ | # openssl ca -out mail_signed_cert.pem -infiles mailreq.pem | ||
+ | # cp / | ||
+ | # cp / | ||
+ | # chown root / | ||
+ | # chmod 400 / | ||
+ | # cp / | ||
+ | Now add the followings to / | ||
+ | smtpd_use_tls = yes | ||
+ | smtpd_tls_key_file = / | ||
+ | smtpd_tls_cert_file = / | ||
+ | smtpd_tls_CAfile = / | ||
+ | <note important> | ||
+ | | ||
+ | -o smtpd_tls_wrappermode=yes | ||
+ | -o smtpd_sasl_auth_enable=yes | ||
+ | </ | ||
+ | Now let's configure IMAP to use STARTTLS | ||
+ | # openssl req -new -nodes -out req.pem -keyout key.pem | ||
+ | # openssl rsa -in key.pem -out new.key.pem | ||
+ | # openssl x509 -in req.pem -out ca-cert -req -signkey new.key.pem -days 36500 | ||
+ | # cp new.key.pem / | ||
+ | # rm new.key.pem | ||
+ | # cat ca-cert >> / | ||
+ | # chown cyrus:mail / | ||
+ | # chmod 600 / | ||
+ | # echo tls_ca_file: | ||
+ | # echo tls_cert_file: | ||
+ | # echo tls_key_file: | ||
+ | | ||
+ | ====== Adding daemons to rc.local ====== | ||
+ | | ||
+ | Now the last step is to add all daemons to rc.local so they can start when machine boots. So open / | ||
+ | # Starting saslauthd daemon | ||
+ | if [ ! -r / | ||
+ | echo " | ||
+ | / | ||
+ | fi | ||
+ | # Starting IMAP daemon | ||
+ | if [ -x / | ||
+ | echo " | ||
+ | / | ||
+ | fi | ||
+ | # Starting POSTFIX daemon | ||
+ | / | ||
+ | |||
Line 88: | Line 241: | ||
====== Sources ====== | ====== Sources ====== | ||
- | <!-- If you are copying information from another source, then specify that source --> | + | Postfix The Definitive Guide, Kyle D. Dent, O' |
- | <!-- * Original source: | + | |
- | <!-- Authors are allowed to give credit to themselves! --> | + | Official Postfix Documentation, |
- | <!-- * Originally written by [[wiki: | + | {{tag>howtos author_badirca}} |
- | <!-- * Contributions by [[wiki: | + | |
- | <!-- Please do not modify anything below, except adding new tags.--> | ||
- | <!-- You must remove the tag-word " | ||
- | {{tag> |