Sendmail HP
De DocUnix.
Sommaire |
Sendmail en mode démon "sécurisé" avec Masquarade
Article repris de Bazar
Le but de la manip est d’avoir un démon Sendmail en permanence qui effectue des réessais d’envoi lorsque la passerelle est down. Pour une sécurité accrue le démon n’écoute qu’en local pour ne pas être relai d’autres machines.
Mise à jour de Sendmail
Il faut utiliser la version 8.13.3 qui est disponible ici. C’est un fichier dépot donc une fois sur la machine :
root@server306:/tmp#swinstall -s /tmp/Sendmail-Upgrade_B.11.23.1.004_HP-UX_B.11.23_IA+PA.depot
Attention de bien spécifier le chemin complet.
Fichiers de conf
sendmail.cf
On créé un fichier sendmail_new.mc en prenant de modifier l’entrée define(`SMART_HOST’,`server’)dnl avec le bon serveur mail :
divert(-1) # # Copyright (c) 1998, 1999, 2001 Sendmail, Inc. and its suppliers. # All rights reserved. # Copyright (c) 1983 Eric P. Allman. All rights reserved. # Copyright (c) 1988, 1993 # The Regents of the University of California. All rights reserved. # # By using this file, you agree to the terms and conditions set # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # # # # This is a generic configuration file for HP-UX 10.x. # It has support for local and SMTP mail only. If you want to # customize it, copy it to a name appropriate for your environment # and do the modifications there. # # divert(0)dnl divert(-1) # Ported changes from sendmail-8.11.1 - Manoj Nov 16, 2004. # Fix for JAGaa30867. # Enabled local site hiding and masquerading in default sendmail.cf file. # Adding feature(always_add_domain) and define __MASQUERADE_ENVELOPE_ # Fix for JAGaa30300 - Added support for openmail divert(0)dnl VERSIONID(`$Id: generic-hpux10.mc,v 8.13 2001/05/29 17:29:52 ca Exp $') OSTYPE(hpux11)dnl DOMAIN(generic)dnl define(`_MASQUERADE_ENVELOPE_')dnl define(`MASQUERADE_NAME')dnl define(`confTRY_NULL_MX_LIST',`T')dnl define(`DATABASE_MAP_TYPE',`dbm')dnl define(`_CLASS_U_')dnl define(`_NO_MSA_')dnl define(`SMART_HOST',`server')dnl define(`_ACCEPT_UNRESOLVABLE_DOMAINS_')dnl DAEMON_OPTIONS(`Port=587, Name=MSA, Addr=127.0.0.1, M=E')dnl TRUST_AUTH_MECH(`GSSAPI DIGEST-MD5')dnl FEATURE(always_add_domain)dnl FEATURE(`genericstable')dnl MAILER(smtp)dnl MAILER(local)dnl
Ensuite on compile le fichier pour obtenir le .cf quivabien :
m4 ../m4/cf.m4 sendmail_new.mc > sendmail_new.cf
submit.cf
divert(-1) # # Copyright (c) 2001-2003 Sendmail, Inc. and its suppliers. # All rights reserved. # # By using this file, you agree to the terms and conditions set # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # # # # This is the prototype file for a set-group-ID sm-msp sendmail that # acts as a initial mail submission program. # divert(0)dnl VERSIONID(`$Id: submit.mc,v 8.13 2003/09/10 22:12:48 ca Exp $') define(`confCF_VERSION', `Submit')dnl define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet define(`confTIME_ZONE', `USE_TZ')dnl define(`confDONT_INIT_GROUPS', `True')dnl define(`_MASQUERADE_ENVELOPE_')dnl define(`DATABASE_MAP_TYPE',`dbm')dnl dnl dnl If you use IPv6 only, change [127.0.0.1] to [IPv6:::1] FEATURE(`genericstable')dnl FEATURE(`msp', `[127.0.0.1]',`MSA')dnl
Ensuite on compile le fichier pour obtenir le .cf quivabien :
m4 ../m4/cf.m4 submit_new.mc > submit_new.mc
Copie des fichiers + droits
On copie les fichiers dans le répertoire /etc/mail (on backup les anciens fichiers au passage ). Ensuite il faut lancer le script gen_cf.utils qui rajoute les users et groupes nécessaires :
. /usr/contrib/sendmail/usr/newconfig/etc/mail/cf/cf/gen_cf.utils
Puis on appelle la fonction sourcée :
Create_User
On met à jour les droits des fichiers :
cd /etc/mail chgrp smmsp *
Rechargement des fichiers
On recharge les fichiers genericstable et aliases :
makemap hash genericstable < genericstable makemap hash aliases < aliases
Config du boot
Vérifier le fichier /etc/rc.config.d/mailservs :
######################################### # Mail configuration. See sendmail(1m) # ######################################### # # @(#)B.11.11_LR # # BSD's popular message handling system # # SENDMAIL_SERVER: Set to 1 if this is a mail server and should # run the sendmail deamon. # SENDMAIL_SERVER_NAME: If this is not a mail server, but a client being # served by another system, then set this variable # to the name of the mail server system name so that # site hiding can be performed. # export SENDMAIL_SERVER=0 export SENDMAIL_SERVER_NAME= export SENDMAIL_SENDONLY=1
Tests
On effectue un A/R du sendmail :
/sbin/init.d/sendmail stop /sbin/init.d/sendmail start
On vérifie que le démon écoute bien sur le 587 :
netstat -an|grep 587
On effectue un envoi de mail :
echo "test" |mailx -s "test" prenom.nom@grossesociete.com
Vérifier dans les logs que tout se passe bien (elles sont verbeuses) :
/var/adm/syslog/mail.log

