Configuratie files
Postfix
Postfix heeft meerdere configuratie files. Sommige zijn in hash format, andere vormen het interface naar MySQL. De eigenlike confuguratie van de MTA staat in main.cf en master.cf.
access
Wordt op het ogenblik niet gebruikt.
aliases
Alleen bit-bucket en de (verplichte) doorverwijzing van root toegevoegd. Uiteindelijk komt alles naar root.
main.cf
Hiet in staat de hele configuratie van de MTA. Alle wijzigingen t.o.v. default zijn op te vragen met postconf -n. In de configuratie file staat heel veel commentaar. Bovendien zijn alle keywords op te zoeken in de online documentatie. Een paar belangrijke instellingen:
- content_filter = smtp-amavis:[127.0.0.1]:10024. Zie master.cf waar het content filter wordt gedefinieerd.
- home_mailbox = Maildir/. Wat voor soort mailbox hebben de gebruikers. Postfix in combinatie met Dovecot gebruikt eigenlijk altijd Maildir format i.p.v. de platte mail file.
- mynetworks = 212.72.224.0/19, 172.31.1.0/24, 172.31.2.0/24, 127.0.0.0/8, [::ffff:127.0.0.0]/104, [::1]/128. Vanaf welke netwerken accepteren we mail.
- relay_domains = proxy:mysql:$config_directory/mysql_relay_domains_maps.cf. Lookup van relay domeinen. Wij relayeren niet op deze server. Zie ook onder MySQL *.cf files.
- smtp(d)_tls_CAfile = /etc/ssl/certs/cacert.org.pem. Lijst van root certificaten.
- smtp(d)_tls_cert_file = /disk/site/etc/ssl/hobby.nl/hobby.nl.crt. Ons wildcard certificaat.
- smtp(d)_tls_key_file = /disk/site/etc/ssl/hobby.nl/hobby.nl.key. De key van ons wildcard certificaat.
- transport_maps = hash:/etc/postfix/transport (zie onder transports). Doorverwijzingen naar andere (hidden) mailservers. Wij hebben één gebruiker die op deze manier zelf zijn mail afhandelt op een eigen mailserver.
- virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf, proxy:mysql:$config_directory/mysql_virtual_alias_alias_maps.cf. De lookup van de aliassen.
- virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf. De lookup van de domeinen.
- virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf, proxy:mysql:$config_directory/mysql_virtual_mailbox_alias_maps.cf. De lookup van de mailboxen.
- virtual_transport = dovecot. Vertelt aan Postfix dat Dovecot wordt gebruikt als POP en IMAP server.
master.cf
In master.cf staan de processen die tot Postfix behoren. Bij ons zijn toegevoegd: mta3525 als alternatieve smtp poort, submission staat aan op poort 587. Verder zijn mailman en dovecot enabled. Onder de Filter Customizations is amavis toegevoegd (in en uit). Zoals al in main.cf te zien was, wordt het filter op poort 10024 aangesproken waarna het antwoord via 10025 terug komt.
# # Postfix master process configuration file. For details on the format # of the file, see the master(5) manual page (command: "man 5 master"). # # Do not forget to execute "postfix reload" after editing this file. # # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - - - - smtpd mta3525 inet n - - - - smtpd submission inet n - - - - smtpd -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING smtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING #628 inet n - - - - qmqpd pickup fifo n - - 60 1 pickup cleanup unix n - - - 0 cleanup qmgr fifo n - n 300 1 qmgr #qmgr fifo n - - 300 1 oqmgr tlsmgr unix - - - 1000? 1 tlsmgr rewrite unix - - - - - trivial-rewrite bounce unix - - - - 0 bounce defer unix - - - - 0 bounce trace unix - - - - 0 bounce verify unix - - - - 1 verify flush unix n - - 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - - - - smtp # When relaying mail as backup MX, disable fallback_relay to avoid MX loops relay unix - - - - - smtp -o smtp_fallback_relay= # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - - - - showq error unix - - - - - error retry unix - - - - - error discard unix - - - - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - - - - lmtp anvil unix - - - - 1 anvil scache unix - - - - 1 scache # # ==================================================================== # Interfaces to non-Postfix software. Be sure to examine the manual # pages of the non-Postfix software to find out what options it wants. # # Many of the following services use the Postfix pipe(8) delivery # agent. See the pipe(8) man page for information about ${recipient} # and other message envelope options. # ==================================================================== # # maildrop. See the Postfix MAILDROP_README file for details. # Also specify in main.cf: maildrop_destination_recipient_limit=1 # #maildrop unix - n n - - pipe # flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} # # See the Postfix UUCP_README file for configuration details. # #uucp unix - n n - - pipe # flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) # # Other external delivery methods. # #ifmail unix - n n - - pipe # flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) #bsmtp unix - n n - - pipe # flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient #scalemail-backend unix - n n - 2 pipe # flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} # ##### START OF CONTENT FILTER CUSTOMIZATIONS ##### # Please see the Postfix FILTER_README for details. # These sample entries expect your content filter to # listen on port 10025 and to inject mail back into # postfix on port 10026. # # to enable such content filter run the command # postconf -e content_filter=smtp-filter:127.0.0.1:10025 # postconf -e smtp-filter_destination_concurrency_limit=2 # or # postconf -e content_filter=lmtp-filter:127.0.0.1:10025 # postconf -e lmtp-filter_destination_concurrency_limit=2 # and the command # postconf -e receive_override_options=no_address_mappings # # 127.0.0.1:10025 inet n - y - - smtpd -o content_filter= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o smtpd_restriction_classes= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_unknown_recipient_checks,no_milters -o local_header_rewrite_clients= # smtp-amavis unix - - - - - smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes -o max_use=20 # ##### END OF CONTENT FILTER CUSTOMIZATIONS #####
MySQL *.cf files
- mysql_alias_maps.cf. Zoekt bij de alias de werkelijke user op. Dit kan weer een alias die ook weer opgezocht moet worden. De alias moet actief zijn om gevonden te worden. Deze lookup wordt niet gebruikt in onze configuratie.
- mysql_relay_domains_maps.cf. Zal nooit data terug geven omdat bij alle domeinen het backupmx bit in de database tabel uit staat en het active bit aan staat.
user = postfixadmin password = xxxxxxxx hosts = localhost dbname = postfixadmin #additional_conditions = and backupmx = '1' and active = '1' query = (SELECT domain FROM domain WHERE domain = '%s' AND backupmx = '1' AND active = '0')
- mysql_virtual_alias_maps.cf en mysql_virtual_alias_alias_maps.cf. Zoekt bij de alias de werkelijke user op. Dit kan weer een alias die ook weer opgezocht moet worden. De alias moet actief zijn om gevonden te worden.
user = postfixadmin password = xxxxxxxx hosts = localhost dbname = postfixadmin query = (SELECT goto FROM alias WHERE address = '%s' AND active = '1')
Voorbeeld:
mysql> SELECT goto FROM alias WHERE address = 'secr@hobbynet.hcc.nl' AND active = '1'; +----------------------------+ | goto | +----------------------------+ | secretaris@hobbynet.hcc.nl | +----------------------------+ 1 row in set (0.00 sec) mysql> SELECT goto FROM alias WHERE address = 'secretaris@hobbynet.hcc.nl' AND active = '1'; +--------------------------------+ | goto | +--------------------------------+ | h.e.j.v.d.bussche@kader.hcc.nl | +--------------------------------+ 1 row in set (0.00 sec)
De tweede query is iets ingewikkelder:
user = postfixadmin password = xxxxxxxx hosts = localhost dbname = postfixadmin query = (SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' AND alias.address=concat('%u', '@', alias_domain.target_domain) AND alias.active = 1)
Bijvoorbeeld het opzoeken van het juiste domein bij een alias domein en tevens de echte naam:
mysql> SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = 'kader.hobby.nl' ->AND alias.address=concat('h.e.j.v.d.bussche', '@', alias_domain.target_domain) ->AND alias.active = 1; +----------------------+ | goto | +----------------------+ | 0000103@kader.hcc.nl | +----------------------+ 1 row in set (0.00 sec)
- mysql_virtual_domains_maps.cf. Deze query doet de lookup van een domein. ook hier geld weer dat het domein ingeschakeld moet zijn. Dit is het geval voor alle domeinen waar wij de afhandeling voor doen.
user = postfixadmin password = xxxxxxxx hosts = localhost dbname = postfixadmin #additional_conditions = and backupmx = '0' and active = '1' query= (SELECT description FROM domain WHERE domain ='%s' AND active = '1')
- mysql_virtual_mailbox_alias_maps.cf
- mysql_virtual_mailbox_limit_maps.cf
- mysql_virtual_mailbox_maps.cf
recipient_checks.pcre
transport
De tranport tabel voorziet in een mapping van email adres naar aflever protocol en next-hop. de protocols zijn in master.cf gedefinieerd. Bij wijzigingen in deze file moet altijd postmap /etc/postfix/transport gedraaid worden. Zie ook man transport. Alles voor lists.hobby.nl wordt naar het protocol mailmangestuurd op localhost.
lists.hobby.nl mailman: ksla.nl smtp:[80.100.88.52] ddutch.nl smtp:[80.100.88.52]