Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| utilisateurs:mcpeter:postfix_dovecot_mysql_postfixadmin [Le 12/10/2012, 03:12] – suite brouillon McPeter | utilisateurs:mcpeter:postfix_dovecot_mysql_postfixadmin [Le 20/07/2018, 01:06] (Version actuelle) – suppression brouillon McPeter | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | {{tag> | ||
| - | ---- | ||
| - | ====== Installation d'une solution mail complète : Postfix, Dovecot, MySQL, Postfixadmin ====== | ||
| - | |||
| - | Cette page propose un pas-à-pas pour mettre en place rapidement un serveur de messagerie en faisant appel à l' | ||
| - | * [[: | ||
| - | * [[: | ||
| - | * [[:MySql]] pour enregistrer les comptes mails virtuels | ||
| - | * [[http:// | ||
| - | |||
| - | =====Pré-requis===== | ||
| - | |||
| - | * Une solution [[: | ||
| - | * Un certificat SSL (auto-signé ou autre) valide. | ||
| - | < | ||
| - | sudo apt-get install ssl-cert | ||
| - | sudo make-ssl-cert generate-default-snakeoil --force-overwrite</ | ||
| - | |||
| - | |||
| - | ====Installation des paquets=== | ||
| - | |||
| - | - [[: | ||
| - | * **[[apt> | ||
| - | * **[[apt> | ||
| - | * **[[apt> | ||
| - | sudo apt-get install amavisd-new clamav clamav-daemon spamassassin | ||
| - | sudo apt-get install php5-imap</ | ||
| - | - Relancez le [[: | ||
| - | - Installez la seconde série de paquets utiles à savoir : | ||
| - | * **[[apt> | ||
| - | * **[[apt> | ||
| - | sudo apt-get install arj bzip2 cabextract cpio file gzip nomarch pax unzip zip | ||
| - | </ | ||
| - | |||
| - | ====Création de l' | ||
| - | |||
| - | < | ||
| - | Créez la base de données (ici // | ||
| - | < | ||
| - | grant all on postfixadmin.* to ' | ||
| - | </ | ||
| - | |||
| - | Plus d' | ||
| - | |||
| - | =====Postfixadmin===== | ||
| - | |||
| - | Postfixadmin permet de gérer graphiquement les domaines et les boites e-mail rattachées. Il permet de créer des administrateurs par domaine qui peuvent eux-mêmes créer des boites ainsi que des alias. Le tout se pilotant au travers d'un [[: | ||
| - | |||
| - | ==== Installation ==== | ||
| - | Un paquet tout prêt est disponible et évite plusieurs étapes de configuration/ | ||
| - | - le télécharger à [[http:// | ||
| - | - l' | ||
| - | Ceci se résume dans un [[: | ||
| - | < | ||
| - | sudo dpkg -i postfixadmin_2.3.5-1_all.deb</ | ||
| - | |||
| - | ==== Configuration ==== | ||
| - | === Paramètres principaux === | ||
| - | [[: | ||
| - | |||
| - | <file php> | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | $CONF[' | ||
| - | </ | ||
| - | |||
| - | === Définition de la base de données === | ||
| - | |||
| - | [[: | ||
| - | |||
| - | <file php> | ||
| - | $dbuser=' | ||
| - | $dbpass=' | ||
| - | $basepath=''; | ||
| - | $dbname=' | ||
| - | $dbserver=''; | ||
| - | $dbport=''; | ||
| - | $dbtype=' | ||
| - | </ | ||
| - | |||
| - | === Mise en place === | ||
| - | |||
| - | Lancez la configuration en saisissant dans votre navigateur l' | ||
| - | Créez un administrateur Postfixadmin. Il est **fortement conseillé** de bien le différencier de l' | ||
| - | < | ||
| - | |||
| - | [[: | ||
| - | <file php> | ||
| - | |||
| - | Il faut ensuite protéger cette page (vous pourrez créer d' | ||
| - | [[: | ||
| - | |||
| - | < | ||
| - | deny from all | ||
| - | </ | ||
| - | |||
| - | Se rendre sur la page http:// | ||
| - | À ce stade, Postfixadmin est opérationnel. | ||
| - | |||
| - | |||
| - | =====Répertoire des e-mails===== | ||
| - | |||
| - | Ici les utilisateurs sont virtuels, et donc indépendant | ||
| - | Pour l' | ||
| - | |||
| - | * Création du groupe **mail** puis de l' | ||
| - | sudo useradd -r -u 150 -g mail -d /home/vmail -s / | ||
| - | * Création du répertoire dédié et les droits associés < | ||
| - | sudo chmod 770 / | ||
| - | * Désignation du // | ||
| - | |||
| - | =====Dovecot===== | ||
| - | |||
| - | [[: | ||
| - | Il gère également l' | ||
| - | |||
| - | ==== Configuration ==== | ||
| - | |||
| - | Vous allez attaquer la partie la plus " | ||
| - | |||
| - | === Définition de la base de données ? === | ||
| - | [[: | ||
| - | |||
| - | < | ||
| - | # defined in / | ||
| - | passdb { | ||
| - | driver = sql | ||
| - | args = / | ||
| - | } | ||
| - | # Look up user information from a SQL database as | ||
| - | # defined in / | ||
| - | userdb { | ||
| - | driver = sql | ||
| - | args = / | ||
| - | }</ | ||
| - | |||
| - | === Définition des accès à la base de données ? === | ||
| - | Vérifiez avant tout l' | ||
| - | < | ||
| - | devrait répondre quelque chose comme | ||
| - | < | ||
| - | Notez bien ces informations avant d' [[: | ||
| - | * Type de base de données: < | ||
| - | driver = mysql</ | ||
| - | * Ici remplacez // | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | connect = host=localhost dbname=postfixadmin user=postfixadmin password=mot_de_passe_postfixadmin</ | ||
| - | * Type d' | ||
| - | # | ||
| - | # List of supported schemes is in | ||
| - | # http:// | ||
| - | # | ||
| - | default_pass_scheme = MD5-CRYPT</ | ||
| - | * Requète de mot de passe (adaptez avec les informations obtenues en début de ce chapitre) < | ||
| - | password_query = \ | ||
| - | SELECT username as user, password, '/ | ||
| - | ' | ||
| - | FROM mailbox WHERE username = ' | ||
| - | * Information utilisateur (adaptez avec les informations obtenues en début de ce chapitre) < | ||
| - | user_query = \ | ||
| - | SELECT '/ | ||
| - | 150 AS uid, 1001 AS gid, concat(' | ||
| - | FROM mailbox WHERE username = ' | ||
| - | |||
| - | === FIXME === | ||
| - | |||
| - | [[: | ||
| - | |||
| - | < | ||
| - | # SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP | ||
| - | # matches the local IP (ie. you're connecting from the same computer), the | ||
| - | # connection is considered secure and plaintext authentication is allowed. | ||
| - | disable_plaintext_auth = yes</ | ||
| - | |||
| - | < | ||
| - | # plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey | ||
| - | # | ||
| - | # NOTE: See also disable_plaintext_auth setting. | ||
| - | auth_mechanisms = plain login</ | ||
| - | |||
| - | < | ||
| - | ## Password and user databases | ||
| - | ## | ||
| - | |||
| - | # | ||
| - | # Password database is used to verify user's password (and nothing more). | ||
| - | # You can have multiple passdbs and userdbs. This is useful if you want to | ||
| - | # allow both system users (/ | ||
| - | # duplicating the system users into virtual database. | ||
| - | # | ||
| - | # < | ||
| - | # | ||
| - | # User database specifies where mails are located and what user/group IDs | ||
| - | # own them. For single-UID configuration use " | ||
| - | # | ||
| - | # < | ||
| - | |||
| - | #!include auth-deny.conf.ext | ||
| - | #!include auth-master.conf.ext | ||
| - | |||
| - | #!include auth-system.conf.ext | ||
| - | # Use the SQL database configuration rather than any of these others. | ||
| - | !include auth-sql.conf.ext | ||
| - | #!include auth-ldap.conf.ext | ||
| - | #!include auth-passwdfile.conf.ext | ||
| - | #!include auth-checkpassword.conf.ext | ||
| - | #!include auth-vpopmail.conf.ext | ||
| - | #!include auth-static.conf.ext</ | ||
| - | |||
| - | === FIXME === | ||
| - | |||
| - | [[: | ||
| - | |||
| - | < | ||
| - | # tries to find the mailboxes automatically. This won't work if the user | ||
| - | # doesn' | ||
| - | # location. | ||
| - | # | ||
| - | # If you're using mbox, giving a path to the INBOX file (eg. / | ||
| - | # isn't enough. You'll also need to tell Dovecot where the other mailboxes are | ||
| - | # kept. This is called the "root mail directory", | ||
| - | # path given in the mail_location setting. | ||
| - | # | ||
| - | # There are a few special variables you can use, eg.: | ||
| - | # | ||
| - | # %u - username | ||
| - | # %n - user part in user@domain, | ||
| - | # %d - domain part in user@domain, | ||
| - | # %h - home directory | ||
| - | # | ||
| - | # See doc/ | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # < | ||
| - | # | ||
| - | mail_location = maildir:/ | ||
| - | |||
| - | < | ||
| - | # can override these by returning uid or gid fields. You can use either numbers | ||
| - | # or names. < | ||
| - | mail_uid = vmail | ||
| - | mail_gid = mail</ | ||
| - | |||
| - | < | ||
| - | # to make sure that users can't log in as daemons or other system users. | ||
| - | # Note that denying root logins is hardcoded to dovecot binary and can't | ||
| - | # be done even if first_valid_uid is set to 0. | ||
| - | # | ||
| - | # Use the vmail user uid here. | ||
| - | first_valid_uid = 150 | ||
| - | last_valid_uid = 150</ | ||
| - | |||
| - | === FIXME === | ||
| - | |||
| - | [[: | ||
| - | Si vous voulez utiliser le support SSL/TLS et/ou utiliser votre propre certificat. Dans le cas de votre propre certificat, il vous faudra renseigner les parties // | ||
| - | |||
| - | < | ||
| - | ssl = yes | ||
| - | |||
| - | # PEM encoded X.509 SSL/TLS certificate and private key. They' | ||
| - | # dropping root privileges, so keep the key file unreadable by anyone but | ||
| - | # root. Included doc/ | ||
| - | # certificate, | ||
| - | ssl_cert = </ | ||
| - | ssl_key = </ | ||
| - | |||
| - | === FIXME === | ||
| - | |||
| - | [[: | ||
| - | Ajout des options de Postfix à Dovecot.\\ | ||
| - | |||
| - | < | ||
| - | # auth_socket_path points to this userdb socket by default. It's typically | ||
| - | # used by dovecot-lda, | ||
| - | # permissions make it readable only by root, but you may need to relax these | ||
| - | # permissions. Users that have access to this socket are able to get a list | ||
| - | # of all usernames and get results of everyone' | ||
| - | unix_listener auth-userdb { | ||
| - | mode = 0600 | ||
| - | user = vmail | ||
| - | group = mail | ||
| - | } | ||
| - | |||
| - | # Postfix smtp-auth | ||
| - | unix_listener / | ||
| - | mode = 0666 | ||
| - | # Assuming the default Postfix user and group | ||
| - | user = postfix | ||
| - | group = postfix | ||
| - | }</ | ||
| - | | ||
| - | Rendre accessible la configuration à Dovecot et aux utilisateurs vmail.\\ | ||
| - | |||
| - | < | ||
| - | sudo chmod -R o-rwx / | ||
| - | | ||
| - | |||
| - | |||
| - | ===== Amavis ClamAV, SpamAssassin ===== | ||
| - | |||
| - | Ajout des utilisateurs clamav et amavis et partage de leurs droits : | ||
| - | < | ||
| - | sudo adduser amavis clamav</ | ||
| - | |||
| - | ====Configuration Amavis ClamAV==== | ||
| - | |||
| - | [[: | ||
| - | |||
| - | < | ||
| - | |||
| - | # You can modify this file to re-enable SPAM checking through spamassassin | ||
| - | # and to re-enable antivirus checking. | ||
| - | |||
| - | # | ||
| - | # Default antivirus checking mode | ||
| - | # Please note, that anti-virus checking is DISABLED by | ||
| - | # default. | ||
| - | # If You wish to enable it, please uncomment the following lines: | ||
| - | |||
| - | @bypass_virus_checks_maps = ( | ||
| - | | ||
| - | |||
| - | # | ||
| - | # Default SPAM checking mode | ||
| - | # Please note, that anti-spam checking is DISABLED by | ||
| - | # default. | ||
| - | # If You wish to enable it, please uncomment the following lines: | ||
| - | |||
| - | @bypass_spam_checks_maps = ( | ||
| - | | ||
| - | |||
| - | 1; # ensure a defined return</ | ||
| - | |||
| - | ====Configuration SpamAssassin==== | ||
| - | |||
| - | [[: | ||
| - | |||
| - | < | ||
| - | ENABLED=1</ | ||
| - | |||
| - | < | ||
| - | # Set to anything but 0 to enable the cron job to automatically update | ||
| - | # spamassassin' | ||
| - | CRON=1</ | ||
| - | |||
| - | On relance les services :\\ | ||
| - | |||
| - | < | ||
| - | sudo service spamassassin restart</ | ||
| - | |||
| - | =====Postfix===== | ||
| - | |||
| - | ====Configuration==== | ||
| - | |||
| - | |||
| - | =====Relancer tous les services===== | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | =====Postfixadmin===== | ||
| - | |||
| - | ====Configuration==== | ||
| - | |||
| - | =====Postfixadmin===== | ||
| - | |||
| - | ====Configuration==== | ||
| - | |||
| - | =====Postfixadmin===== | ||
| - | |||
| - | ====Configuration==== | ||
| - | |||
| - | =====Liens===== | ||
| - | * [[http:// | ||
| - | |||
| - | ---- | ||
| - | // | ||
