Quelques fonctionnalités du plugin vont disparaître, donc on adapte main.cf
This commit is contained in:
parent
a26eb6ed05
commit
10d42f96dd
1 changed files with 199 additions and 209 deletions
|
@ -36,14 +36,12 @@ def db_file(suffix):
|
|||
'''Nom des fichiers de conf pour la base de donnees'''
|
||||
return "%(db)s:/etc/postfix/%(db)s-%(suffix)s.cf" % {"db": db, "suffix": suffix}
|
||||
|
||||
# Pour les lignes commençant par un %
|
||||
keysep = " = "
|
||||
def add(*values):
|
||||
'''Continue une ligne logique (voif postconf(5))'''
|
||||
out((len(last_definition)+len(keysep)) * " " + ", ".join([tostring(v) for v in values]) + "\n")
|
||||
|
||||
# La liste des variables de configuration de postfix
|
||||
import commands
|
||||
exports = [s.split(' ', 2)[0] for s in commands.getoutput("/usr/sbin/postconf -d").split("\n")]
|
||||
######################################
|
||||
# Début effectif du fichier #
|
||||
######################################
|
||||
|
||||
# Les différents réseaux
|
||||
local_networks = ["127.0.0.0/8", '[::1]/128']
|
||||
|
@ -56,124 +54,111 @@ client_networks = ["138.231.136.0/21", "138.231.144.0/21", "138.231.148.0/22", "
|
|||
|
||||
@# Definition par securite (sinon il utilise gethostname)
|
||||
if nonadherent:
|
||||
myhostname = admhostname
|
||||
%myhostname admhostname
|
||||
else:
|
||||
myhostname = pubhostname
|
||||
mydomain = "crans.org"
|
||||
%myhostname pubhostname
|
||||
@mydomain = crans.org
|
||||
|
||||
@# Origine des mails
|
||||
myorigin = "crans.org"
|
||||
@myorigin = crans.org
|
||||
|
||||
@# Reseaux locaux
|
||||
mynetworks = local_networks
|
||||
%mynetworks local_networks
|
||||
if mx and not users:
|
||||
add(client_networks + adm_networks)
|
||||
out(" " + tostring(client_networks + adm_networks) + "\n")
|
||||
elif users:
|
||||
add(adm_networks)
|
||||
out(" " + tostring(adm_networks) + "\n")
|
||||
elif tracker:
|
||||
add(adm_networks)
|
||||
out(" " + tostring(adm_networks) + "\n")
|
||||
|
||||
if not mx:
|
||||
if tracker or corbeau:
|
||||
@# Ecoute en local et sur adm (récupération des mails @tracker.adm.crans.org
|
||||
inet_interfaces = ["127.0.0.1", admip()]
|
||||
%inet_interfaces ["127.0.0.1", admip()]
|
||||
else:
|
||||
@# Ecoute en local uniquement
|
||||
inet_interfaces = "loopback-only"
|
||||
@inet_interfaces = loopback-only
|
||||
|
||||
if mx:
|
||||
@# Destinations acceptees
|
||||
mydestination = [hostname, "$myhostname",
|
||||
"localhost", "localhost.$mydomain"]
|
||||
%mydestination [hostname, "$myhostname", "localhost", "localhost.$mydomain"]
|
||||
if main or users:
|
||||
add(["$mydomain",
|
||||
"crans.ens-cachan.fr",
|
||||
"clubs.ens-cachan.fr",
|
||||
"install-party.ens-cachan.fr"])
|
||||
out(" " + tostring(["$mydomain", "crans.ens-cachan.fr", "clubs.ens-cachan.fr", "install-party.ens-cachan.fr"]) + "\n")
|
||||
if manage_ml:
|
||||
add(["lists.$mydomain"])
|
||||
out(" " + tostring(["lists.$mydomain"]) + "\n")
|
||||
|
||||
@# Domaine relaye par ce MX
|
||||
relay_domains = ["$mydestination"]
|
||||
@relay_domains = $mydestination
|
||||
if secondary:
|
||||
add(["$mydomain",
|
||||
"crans.ens-cachan.fr",
|
||||
"clubs.ens-cachan.fr",
|
||||
"install-party.ens-cachan.fr"])
|
||||
out(" " + tostring(["$mydomain", "crans.ens-cachan.fr", "clubs.ens-cachan.fr", "install-party.ens-cachan.fr"]) + "\n")
|
||||
if public and not manage_ml:
|
||||
add(["lists.$mydomain"])
|
||||
out(" " + tostring(["lists.$mydomain"]) + "\n")
|
||||
|
||||
if not mx:
|
||||
if tracker:
|
||||
@# On accepte les mails destinés au tracker
|
||||
mydestination = "tracker.adm.crans.org",
|
||||
@mydestination = tracker.adm.crans.org
|
||||
if corbeau:
|
||||
@# On accepte les mails destinés au corbeau
|
||||
mydestination = "crans.org"
|
||||
@mydestination = crans.org
|
||||
@# Les mails sont envoyes au MX principal
|
||||
relayhost = "smtp.adm.crans.org",
|
||||
@relayhost = smtp.adm.crans.org
|
||||
|
||||
@# Etre notifie ou non de l'arrive de nouveaux mails
|
||||
biff = users
|
||||
%biff users
|
||||
|
||||
if mx:
|
||||
@# Pour pouvoir tester sans tout casser, on active les soft bounces.
|
||||
@# Ca permet aux mails de ne pas etre bounces en cas d'erreur, mais
|
||||
@# a la place, de renvoyer une erreur non permanente. En production
|
||||
@# il faut enlever ca.
|
||||
soft_bounce = False
|
||||
@soft_bounce = no
|
||||
|
||||
if users:
|
||||
@# On delivre dans des maildir
|
||||
mail_spool_directory = "/home/mail/"
|
||||
@mail_spool_directory = /home/mail/
|
||||
|
||||
@# +--------+
|
||||
@# | Divers |
|
||||
@# +--------+
|
||||
|
||||
@# Delais pour les warnings
|
||||
delay_warning_time = "24h"
|
||||
@delay_warning_time = 24h
|
||||
|
||||
@# Esthetisme
|
||||
smtpd_banner = "$myhostname ESMTP $mail_name (Debian/GNU)"
|
||||
@smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
||||
|
||||
if not mx:
|
||||
@# Reecriture des entetes: @host.crans.org -> @crans.org
|
||||
canonical_maps = "regexp:/etc/postfix/canonical"
|
||||
@canonical_maps = regexp:/etc/postfix/canonical
|
||||
|
||||
if has("postfix.transport"):
|
||||
@# Par ou passer (notement pour la distrtibution des adresse
|
||||
@# locales par le serveur des adherents)
|
||||
transport_maps = "hash:/etc/postfix/transport"
|
||||
@transport_maps = hash:/etc/postfix/transport
|
||||
|
||||
@# Une infinite d'adresses mail par personne
|
||||
recipient_delimiter = "+"
|
||||
@recipient_delimiter = +
|
||||
|
||||
@# +-----------------+
|
||||
@# | Bases d'adresse |
|
||||
@# +-----------------+
|
||||
|
||||
@# Les fichiers d'alias (pour newaliases)
|
||||
alias_database = "hash:/etc/postfix/aliases"
|
||||
@alias_database = hash:/etc/postfix/aliases
|
||||
if manage_ml:
|
||||
add("hash:/var/lib/mailman/data/aliases")
|
||||
@ hash:/var/lib/mailman/data/aliases
|
||||
|
||||
alias_maps = "$alias_database"
|
||||
if mx:
|
||||
@# Plus les alias dans la base de donnees
|
||||
add(db_file("search"))
|
||||
|
||||
if mx:
|
||||
@# On prend aussi en compte les utilisateurs de /etc/passwd
|
||||
local_recipient_maps = "$alias_maps unix:passwd.byname"
|
||||
|
||||
if mx:
|
||||
@# Les anciennes ML @crans.org, @crans.ens-cachan.fr -> @lists.crans.org
|
||||
virtual_alias_maps = "hash:/etc/postfix/virtual"
|
||||
@alias_maps = $alias_database
|
||||
|
||||
# Pour les non-mx il n'y a plus rien d'interessant
|
||||
if not mx:
|
||||
done()
|
||||
if mx:
|
||||
@# Plus les alias dans la base de donnees
|
||||
out(" " + tostring(db_file("search")) + "\n")
|
||||
@# On prend aussi en compte les utilisateurs de /etc/passwd
|
||||
@local_recipient_maps = $alias_maps unix:passwd.byname
|
||||
@# Les anciennes ML @crans.org, @crans.ens-cachan.fr -> @lists.crans.org
|
||||
@virtual_alias_maps = hash:/etc/postfix/virtual
|
||||
@
|
||||
@# +-------------+
|
||||
@# | TLS et SASL |
|
||||
|
@ -222,13 +207,13 @@ if main:
|
|||
@# reject_unknown_hostname value not recommended, because it may causes mail losting.
|
||||
@# (for example: after paypal.com registration you don't receive activation mail! I've tried it.)
|
||||
@#
|
||||
smtpd_helo_restrictions = "permit_mynetworks, reject_invalid_hostname"
|
||||
@smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname
|
||||
|
||||
@## Limitation des messages envoyés par minute
|
||||
@# On n'ignore que les messages venant d'adresses "protégées"
|
||||
@smtpd_client_event_limit_exceptions = local_networks
|
||||
if mx:
|
||||
add(adm_networks)
|
||||
out(" " + tostring(adm_networks) + "\n")
|
||||
@
|
||||
@# On limite à 10 messages par minute
|
||||
@smtpd_client_message_rate_limit = 10
|
||||
|
@ -244,34 +229,39 @@ if main:
|
|||
@# test contre cluebringer pour les quota / rate par utilisateur sasl
|
||||
@# check_policy_service inet:127.0.0.1:10031
|
||||
@# rejette les recipients sans nom de domaine totalement qualifie
|
||||
add("reject_non_fqdn_recipient")
|
||||
@ reject_non_fqdn_recipient
|
||||
|
||||
if main:
|
||||
@# permet si le client est authentifie
|
||||
add("permit_sasl_authenticated")
|
||||
@ permit_sasl_authenticated
|
||||
|
||||
@# rejette les destinations non locales
|
||||
add("reject_unauth_destination")
|
||||
@ reject_unauth_destination
|
||||
|
||||
if public:
|
||||
@# accepte si le champ contourneGreylist de la base est a OK
|
||||
add("check_recipient_access " + db_file("sqlgrey"))
|
||||
@ permit_sasl_authenticated
|
||||
out(" check_recipient_access " + tostring(db_file("sqlgrey")) + "\n")
|
||||
@# accepte si la greylist est d'accord
|
||||
add("check_policy_service inet:127.0.0.1:2501")
|
||||
@ check_policy_service inet:127.0.0.1:2501
|
||||
@# jette le reste
|
||||
@
|
||||
|
||||
if main:
|
||||
@#smtpd_end_of_data_restrictions=check_policy_service inet:127.0.0.1:10031
|
||||
@# Tailles maximales : 20Mo pour les msgs et 75 pour les mbox
|
||||
message_size_limit = 20971520
|
||||
mailbox_size_limit = 78643000
|
||||
@message_size_limit = 20971520
|
||||
@mailbox_size_limit = 78643000
|
||||
|
||||
@# Obligation de specifier le nom de domaine complet
|
||||
append_dot_mydomain = secondary
|
||||
%append_dot_mydomain secondary
|
||||
|
||||
if main:
|
||||
@#Ajout de cyrus pour l'authentification SMTP
|
||||
smtpd_sasl_type = "cyrus"
|
||||
@smtpd_sasl_type = cyrus
|
||||
|
||||
@# Pieces jointes
|
||||
mime_header_checks = "regexp:/etc/postfix/mime_header_checks"
|
||||
@mime_header_checks = regexp:/etc/postfix/mime_header_checks
|
||||
|
||||
@# Transport slow
|
||||
@slow_destination_recipient_limit = 20
|
||||
|
@ -284,7 +274,7 @@ if not secondary:
|
|||
@#POUR SECOURS
|
||||
if not has("rescue-mode"):
|
||||
out("#")
|
||||
relayhost = "[ovh.adm.crans.org]:25"
|
||||
@relayhost = [ovh.adm.crans.org]:25
|
||||
|
||||
if has("titanic"):
|
||||
@relayhost = [ovh.adm.crans.org]:25
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue