Pour ma part, j'ai choisi d'utiliser plutôt ces services, en les faisant eux aussi démarrer par les daemontools.
La démarche sera sensiblement la même que pour courier-imap et courier-imap-ssl.
Pour courrier-pop3d, le fichier est /etc/courier/pop3d :
PIDFILE=/var/run/pop3d.pid
MAXDAEMONS=40
MAXPERIP=4
POP3AUTH="LOGIN CRAM-MD5 CRAM-SHA1"
POP3AUTH_ORIG="PLAIN LOGIN CRAM-MD5 CRAM-SHA1 CRAM-SHA256"
POP3AUTH_TLS="LOGIN PLAIN"
POP3AUTH_TLS_ORIG="LOGIN PLAIN"
POP3_PROXY=0
PORT=110
ADDRESS=0
TCPDOPTS="-nodnslookup -noidentlookup"
LOGGEROPTS="-name=pop3d"
POP3DSTART=YES
MAILDIRPATH=Maildir
Pour courier-pop3d-ssl :
SSLPORT=995 SSLADDRESS=0 SSLPIDFILE=/var/run/pop3d-ssl.pid SSLLOGGEROPTS="-name=pop3d-ssl" POP3DSSLSTART=YES POP3_STARTTLS=YES POP3_TLS_REQUIRED=0 COURIERTLS=/usr/lib/courier-imap/bin/couriertls TLS_PROTOCOL=SSL3 TLS_STARTTLS_PROTOCOL=TLS1 TLS_CERTFILE=/usr/lib/courier-imap/share/imapd.pem TLS_VERIFYPEER=NONE MAILDIRPATH=Maildir
Nous pouvons utiliser le certificat généré pour le serveur imap.
mkdir -p -m 755 /var/qmail/supervise/courier-pop3/log mkdir -p -m 755 /var/qmail/supervise/courier-pop3-ssl/log
Copier le script suivant dans /var/qmail/supervise/courier-pop3/run :
#!/bin/sh # # service-pop3-run # John Simpson <jms1@jms1.net> 2005-11-24 # ############################################################################### # # Copyright (C) 2005 John Simpson. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # or visit http://www.gnu.org/licenses/gpl.txt # ############################################################################### # # Modified by Christian Caleca <prof@grenouille.com> 2006-04-24 # # Use only with courier-imap-4.x or later # exec 2>&1 set -a # causes all shell variables to be exported # may be an issue if /bin/sh is not bash sysconf_dir=/etc/courier exec_prefix=/usr/lib/courier-imap bindir=${exec_prefix}/bin libexecdir=/usr/lib/courier-imap/libexec . ${sysconf_dir}/pop3d-ssl . ${sysconf_dir}/pop3d USERID=`id -u vpopmail` GROUPID=`id -g vpopmail` # any overrides can be done here #ADDRESS= #PORT= export TLS_PROTOCOL=$TLS_STARTTLS_PROTOCOL exec tcpserver -v -c $MAXDAEMONS -R -u"$USERID" -g"$GROUPID" $ADDRESS $PORT \ ${exec_prefix}/sbin/pop3login \ ${exec_prefix}/bin/pop3d Maildir
puis :
chmod 755 /var/qmail/supervise/courier-pop3/run
Copier le script suivant dans /var/qmail/supervise/courier-pop3-ssl/run :
#!/bin/sh # # service-pop3ssl-run # John Simpson <jms1@jms1.net> 2005-11-24 # ############################################################################### # # Copyright (C) 2005 John Simpson. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # or visit http://www.gnu.org/licenses/gpl.txt # ############################################################################### # # Modified by Christian Caleca <prof@grenouille.com> 2006-04-24 # # Use only with courier-imap-4.x or later # exec 2>&1 set -a # causes all shell variables to be exported # may be an issue if /bin/sh is not bash sysconf_dir=/etc/courier exec_prefix=/usr/lib/courier-imap bindir=${exec_prefix}/bin libexecdir=/usr/lib/courier-imap/libexec . ${sysconf_dir}/pop3d-ssl . ${sysconf_dir}/pop3d USERID=`id -u vpopmail` GROUPID=`id -g vpopmail` # overrides can be done here #SSLADDRESS= #SSLPORT= #POP3DSSLSTART= #POP3_STARTTLS= #POP3_TLS_REQUIRED= exec tcpserver -v -c $MAXDAEMONS -R -u"$USERID" -g"$GROUPID" $SSLADDRESS $SSLPORT \ $COURIERTLS -server -tcpd \ ${exec_prefix}/sbin/pop3login \ ${exec_prefix}/bin/pop3d Maildir
Gestion des logs habituelle :
cp /usr/local/src/tar/service-any-log-run /var/qmail/supervise/courier-pop3/log/run cp /usr/local/src/tar/service-any-log-run /var/qmail/supervise/courier-pop3-ssl/log/run chmod 755 /var/qmail/supervise/courier-pop3/log/run chmod 755 /var/qmail/supervise/courier-pop3-ssl/log/run
Lancement des services :
ln -s /var/qmail/supervise/courier-pop3 /service/ ln -s /var/qmail/supervise/courier-pop3-ssl /service/
quelques vérifications :
ps aux | grep supervise root 2133 0.0 0.0 1428 300 ? S 12:13 0:00 supervise qmail-send root 2134 0.0 0.0 1428 296 ? S 12:13 0:00 supervise log root 2135 0.0 0.0 1428 296 ? S 12:13 0:00 supervise qmail-smtpd root 2136 0.0 0.0 1432 300 ? S 12:13 0:00 supervise log root 2137 0.0 0.0 1432 300 ? S 12:13 0:00 supervise courier-authlib root 2138 0.0 0.0 1432 304 ? S 12:13 0:00 supervise log root 2139 0.0 0.0 1428 296 ? S 12:13 0:00 supervise courier-imap root 2140 0.0 0.0 1428 300 ? S 12:13 0:00 supervise log root 2141 0.0 0.0 1432 304 ? S 12:13 0:00 supervise courier-imap-ssl root 2142 0.0 0.0 1428 300 ? S 12:13 0:00 supervise log root 2286 0.0 0.0 1428 296 ? S 14:37 0:00 supervise courier-pop3 root 2288 0.0 0.0 1432 304 ? S 14:37 0:00 supervise log root 2470 0.0 0.0 1428 300 ? S 15:04 0:00 supervise courier-pop3-ssl root 2472 0.0 0.0 1428 300 ? S 15:04 0:00 supervise log
ps aux | grep readproc root 2127 0.0 0.0 1424 256 ? S 12:13 0:00 readproctitle service errors: ...................... ..................................................................................................................... ..................................................................................................................... ..................................................................................................................... ...........................
Du côté des daemontools, tout semble aller pour le mieux.
netstat -a | grep :pop tcp 0 0 *:pop3s *:* LISTEN tcp 0 0 *:pop3 *:* LISTEN
Nous avons le choix du mode de lecture des mails. Une bonne pratique serait sans doute de n'autoriser que StartTLS ou SSL et d'empêcher le imap et le pop en clair, ce qui obligerait à faire un peu de formation aux utilisateurs, mais serait plus sécurisé.