Server Postfix (pour envoyer des mails)
root@izenibm:/var/www# apt-get install postfix
Type de serveur de messagerie : Site Internet
Nom de courrier : bdemolon@izen-services.com
Courrier à destination : bdemolon
Oui
Oui
Ok
0
+
Ipv4
Pour reconfigurer :
root@izenibm:/var/www# dpkg-reconfigure postfix
root@izenibm:~# apt-get install procmail
root@izenibm:~# apt-get install sasl2-bin
root@izenibm:~# apt-get install courier-authdaemon
root@izenibm:~# apt-get install courier-imap
répondre: Non
root@izenibm:~# apt-get install courier-imap-ssl
root@izenibm:~# apt-get install courier-pop
root@izenibm:~# apt-get install courier-pop-ssl
root@izenibm:~# adduser postfix sasl
Ajout de l’utilisateur postfix au groupe sasl
Terminé.
root@izenibm:~# dpkg-reconfigure postfix
site internet
bdemolon@izen-services.com_
ibm.izen-services.com_
ibm.izen-services.com, izenibm, localhost.localdomain, localhost__
forcer la synchronisation… : oui
réseau interne : 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128_
faut t’il utiliser procmail pour la distribution locale : oui
0
+
Ipv4
Exécuter :
postconf -e ’smtpd_sasl_local_domain =’
postconf -e ’smtpd_sasl_auth_enable = yes’
postconf -e ’smtpd_sasl_security_options = noanonymous’
postconf -e ‘broken_sasl_auth_clients = yes’
postconf -e ’smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination’
postconf -e ‘inet_interfaces = all’
echo ‘pwcheck_method: saslauthd’ >> /etc/postfix/sasl/smtpd.conf
echo ‘mech_list: plain login’ >> /etc/postfix/sasl/smtpd.conf
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
postconf -e ’smtpd_tls_auth_only = no’
postconf -e ’smtp_use_tls = yes’
postconf -e ’smtpd_use_tls = yes’
postconf -e ’smtp_tls_note_starttls_offer = yes’
postconf -e ’smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key’
postconf -e ’smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt’
postconf -e ’smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem’
postconf -e ’smtpd_tls_loglevel = 1′
postconf -e ’smtpd_tls_received_header = yes’
postconf -e ’smtpd_tls_session_cache_timeout = 3600s’
postconf -e ‘tls_random_source = dev:/dev/urandom’
postconf -e ‘myhostname = server1.example.com’
Le fichier /etc/postfix/main.cf doit ressembler à ceci :
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA’s job.
append_dot_mydomain = no
# Uncomment the next line to generate « delayed mail » warnings
#delay_warning_time = 4h
myhostname = server1.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = server1.example.com, localhost.example.com, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
modifier les lignes :
myhostname = ibm.izen-services.com
mydestination = ibm.izen-services.com, izenibm, localhost.localdomain, localhost
root@izenibm:/etc/postfix/ssl# /etc/init.d/postfix restart
* Stopping Postfix Mail Transport Agent postfix [ OK ]
* Starting Postfix Mail Transport Agent postfix [ OK ]
mkdir -p /var/spool/postfix/var/run/saslauthd
rm -fr /var/run/saslauthd
Maintenant éditez /etc/default/saslauthd pour y activer saslauthd
START=yes
OPTIONS= »-m /var/spool/postfix/var/run/saslauthd »
root@izenibm:/etc/postfix/ssl# /etc/init.d/saslauthd start
* Starting SASL Authentication Daemon saslauthd [ OK ]
Test:
root@izenibm:/etc/postfix/ssl# telnet localhost 25
Trying ::1…
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 ibm.izen-services.com ESMTP Postfix (Ubuntu)
> EHLO somename.tld
250-ibm.izen-services.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
C’est bon!
Pour installer maildrop à la place de procmail:
root@izenibm:/etc/postfix/ssl# apt-get install maildrop
root@izenibm:/etc/postfix/ssl# vi /etc/postfix/main.cf
remplacer comme suit :
#mailbox_command = procmail -a « $EXTENSION »
mailbox_command = maildrop
et ajouter également pour créer un dossier pour chacun des users :
maildirmake.courier = ~/Maildir
root@izenibm:~# vi /etc/maildroprc
DEFAULT= »$HOME/Maildir »
Etat de la queue :
/usr/bin/mailq
Pour supprimer un élément :
postsuper -d queue_id
Pour vider la file d’attente :
postsuper -d ALL
test envoi mail de l’extérieur :
tail –f /var/log/mail.log
Aug 17 23:08:09 izenibm postfix/smtpd[6806]: connect from smtp2-g21.free.fr[212.27.42.2]
Aug 17 23:08:09 izenibm postfix/smtpd[6806]: NOQUEUE: reject: RCPT from smtp2-g21.free.fr[212.27.42.2]: 554 5.7.1 : Relay access denied; from= to= proto=ESMTP helo=
Aug 17 23:08:10 izenibm postfix/smtpd[6806]: disconnect from smtp2-g21.free.fr[212.27.42.2]
Another…
[...]Centers are very important for the hotels as the people who come for the shopping will certainly visit the nearby hotels for[...]…