====== Gnarwl ====== ===== Installation ===== apt-get install gnarwl adduser --system --home /var/lib/gnarwl --no-create-home --gid 8 gnarwl chown gnarwl: -R /var/lib/gnarwl /etc/gnarwl.cfg ===== Configuration ===== Fichier ///etc/postfix/master.cf// : # Gnarwl gnarwl unix - n n - 1 pipe flags=F user=gnarwl argv=/usr/bin/gnarwl -c /etc/gnarwl.cfg -a ${nexthop} Fichier ///etc/gnarwl.cfg// : map_sender $sender map_receiver $recepient map_subject $subject map_field $begin vacationStart map_field $end vacationEnd map_field $fullname cn map_field $deputy vacationForward server ldap.example.com port 389 scope sub login uid=gnarwl,ou=sysaccounts,o=example password mdpldap protocol 0 base o=example queryfilter (&(|(mail=$recepient)(mailAlternateAddress=$recepient))(vacationActive=TRUE)) result vacationInfo blockfiles /var/lib/gnarwl/block/ umask 0644 blockexpire 48 mta /usr/sbin/sendmail -F $recepient -t $sender maxreceivers 64 maxheader 512 charset UTF-8 badheaders /var/lib/gnarwl/badheaders.db blacklist /var/lib/gnarwl/blacklist.db forceheader /var/lib/gnarwl/header.txt forcefooter /var/lib/gnarwl/footer.txt recvheader To Cc loglevel 2 Fichier ///var/lib/gnarwl/header.txt// : From: $fullname <$recepient> To: $sender X-mailer: GNARWL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: $subject Il suffira ensuite d'envoyer le mail automatiquement sur le transport //gnarwl://. Différente solutions existent pour cela : ==== Via recipient_bcc_maps ==== **Le principe :** Utiliser un mapping LDAP pour ajouter automatiquement une adresse mail destinatrice en //BCC// via la directive //recipient_bcc_maps//. L'adresse mail ajouté sera dans un domaine //spécial// dont les mails seront destinés au transport //gnarwl:// Fichier ///etc/postfix/main.cf// : transport_maps = proxy:ldap:gnarwl_transport ldap_mailbox_vacation_bcc_server_host = ldap0.example.com,ldap1.example.com ldap_mailbox_vacation_bcc_server_port = 389 ldap_mailbox_vacation_bcc_search_base = o=example ldap_mailbox_vacation_bcc_timeout = 30 ldap_mailbox_vacation_bcc_query_filter = (&(|(mail=%s)(mailAlternateAddress=%s))(vacationActive=TRUE)) ldap_mailbox_vacation_bcc_result_attribute = uid ldap_mailbox_vacation_bcc_result_format = %s@autoreponse.example.com ldap_mailbox_vacation_bcc_expansion_limit = 1 ldap_mailbox_vacation_bcc_scope = sub ldap_mailbox_vacation_bcc_bind = yes ldap_mailbox_vacation_bcc_version = 3 ldap_mailbox_vacation_bcc_bind_dn = uid=postfix,ou=sysaccounts,o=example ldap_mailbox_vacation_bcc_bind_pw = mdpldap recipient_bcc_maps = ldap:ldap_mailbox_vacation_bcc gnarwl_transport_server_host = ldap0.example.com,ldap1.example.com gnarwl_transport_server_port = 389 gnarwl_transport_search_base = o=example gnarwl_transport_domain = autoreponse.example.com gnarwl_transport_query_filter = (&(vacationActive=TRUE)(uid=%u)) gnarwl_transport_result_attribute = mail gnarwl_transport_result_format = gnarwl:%s gnarwl_transport_expansion_limit = 1 gnarwl_transport_scope = sub gnarwl_transport_bind = yes gnarwl_transport_version = 3 gnarwl_transport_cache = no gnarwl_transport_bind_dn = uid=postfix,ou=sysaccounts,o=example gnarwl_transport_bind_pw = mdpldap ===== Script de désactivation du message d'auto-réponse lorsqu'il a expiré ===== Le principe est de repasser la valeur de l'attribut //vacationActive// à //FALSE// lorsque la date dans l'attribut //vacationEnd// est dépassée. Cela n'est dans l'absolu pas forcément nécessaire car gnarwl vérifie également que la date d'expiration n'est pas dépassée avant d'envoyer le mail. En outre, cela permet : * de le plus envoyer de mail vers le transport //gnarwl// inutilement * de désactiver visuellement le message d'auto-réponse pour l'utilisateur dans son interface de gestion Le script est téléchargeable {{ :informatique:reseau:messagerie:disable-vacation.py |ici}}. Il utilise en dépendance la librairie [[http://git.zionetrix.net/?a=summary&p=python-mylib|mylib]] installable de la manière suivante : apt-get install git python-ldap cd /usr/local/src git clone http://git.zionetrix.net/git/python-mylib Ce script doit idéalement être installé dans ///usr/local/sbin// et être exécuté par cron au moins une fois par jour.