Postfix: Difference between revisions
Jump to navigation
Jump to search
>Homaar |
(No difference)
|
Latest revision as of 10:13, 3 October 2015
Links
- http://www.linuxforen.de/forums/showthread.php?t=240031 Mailserver Debian Howto
- http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_p2 Howtoforge MySQL Integration
- http://www.mxtoolbox.com Spamlist Check
Hints
Maximalgröße
message_size_limit = 51200000
Mail aus mailq löschen:
postsuper -d ID
header_checks
Beispiel:
/^Subject: (.*)$/ REPLACE Subject: [security bulletin] $
Ersetzt alle Subjects mit einem Tag. In der Nachbetrachtung ist das Einbinden von procmail sinnvoller, da flexibler!
DNS manuell umbiegen
- http://www.linuxquestions.org/questions/linux-software-2/force-postfix-to-refer-etc-hosts-857662/
- http://www.irbs.net/internet/postfix/0508/1083.html
- http://www.postfix.org/DEBUG_README.html
- http://comments.gmane.org/gmane.mail.postfix.user.german/42413
#postconf | grep lookup disable_dns_lookups = no empty_address_default_transport_maps_lookup_key = <> empty_address_relayhost_maps_lookup_key = <> ignore_mx_lookup_error = no lmtp_host_lookup = native smtp_host_lookup = native smtpd_null_access_lookup_key = <> smtpd_peername_lookup = yes nano /etc/resolv.conf nano /etc/hosts
mailq erneut senden
postqueue -f ALL
mailq exportieren
x=`mailq | awk '/MAILER-DAEMON/ {print $1}' |sed s/\!// ` for m in $x;do echo "== $m ==" ;echo; postcat -q $m > $m ; postsuper -d $m; echo ;done
SASL
apt-get install postfix postfix-tls sasl2-bin libsasl2-2 libsasl2-modules
Links
- http://www.huschi.net/4_111_de-debian-postfix-smtp-auth-einrichten.html
- http://www.adomas.org/2006/08/postfix-dovecot/ (gutes Howto)
apt-get install postfix postfix-tls sasl2-bin libsasl2-2 libsasl2-modules #/etc/postfix/sasl/smtpd.conf pwcheck_method: saslauthd mech_list: PLAIN LOGIN saslauthd_path: /var/run/saslauthd/mux autotransition:true #/etc/pam.d/smtp auth required /lib/security/pam_unix_auth.so account required /lib/security/pam_unix_acct.so password required /lib/security/pam_unix_passwd.so session required /lib/security/pam_unix_session.so #Chroot fixes mkdir /var/spool/postfix/etc/pam.d cp -p /etc/pam.d/smtp /var/spool/postfix/etc/pam.d/ mkdir -p /var/spool/postfix/var/run cd /var/run mv saslauthd/ /var/spool/postfix/var/run ln -s /var/spool/postfix/var/run/saslauthd/ saslauthd #Da es vereinzelt Probleme gab noch sicherheitshalber die Rechte setzten: chown -R postfix /var/spool/postfix/var/run/saslauthd #/etc/default/saslauthd START=yes MECHANISMS="pam" #ganz unten OPTIONS="-m /var/spool/postfix/var/run/saslauthd/mux" adduser postfix sasl /etc/init.d/saslauthd restart /etc/init.d/postfix reload testsaslauthd -f /var/run/saslauthd/mux -u USER -p PASSWORT testsaslauthd -f /var/spool/postfix/var/run/saslauthd/mux -u USER -p PASSWORT
main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) 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 readme_directory = no # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = <your Hostname> alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases virtual_alias_maps = mysql:/etc/postfix/mysql-aliases.cf myorigin = /etc/mailname mydestination = <your Hostname>, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_transport = procmail: procmail_destination_recipient_limit = 1 recipient_delimiter = + inet_interfaces = all smtpd_helo_required = yes disable_vrfy_command = yes strict_rfc821_envelopes = yes invalid_hostname_reject_code = 554 multi_recipient_bounce_reject_code = 554 non_fqdn_reject_code = 554 relay_domains_reject_code = 554 unknown_address_reject_code = 554 unknown_client_reject_code = 554 unknown_hostname_reject_code = 554 unknown_local_recipient_reject_code = 554 unknown_relay_recipient_reject_code = 554 unknown_sender_reject_code = 554 unknown_virtual_alias_reject_code = 554 unknown_virtual_mailbox_reject_code = 554 unverified_recipient_reject_code = 554 unverified_sender_reject_code = 554 content_filter = scan:[127.0.0.1]:10025 receive_override_options = no_address_mappings smtpd_recipient_restrictions = permit_sasl_authenticated, reject_invalid_hostname, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, reject_unauth_destination, reject_rbl_client multi.uribl.com, reject_rbl_client dsn.rfc-ignorant.org, reject_rbl_client dul.dnsbl.sorbs.net, reject_rbl_client list.dsbl.org, reject_rbl_client sbl-xbl.spamhaus.org, reject_rbl_client bl.spamcop.net, reject_rbl_client dnsbl.sorbs.net, reject_rbl_client cbl.abuseat.org, reject_rbl_client ix.dnsbl.manitu.net, reject_rbl_client combined.rbl.msrbl.net, reject_rbl_client rabl.nuclearelephant.com, permit smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname
master.cf
# # 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 -o content_filter=spamassassin #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} # # ==================================================================== # # Recent Cyrus versions can use the existing "lmtp" master.cf entry. # # Specify in cyrus.conf: # lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4 # # Specify in main.cf one or more of the following: # mailbox_transport = lmtp:inet:localhost # virtual_transport = lmtp:inet:localhost # # ==================================================================== # # Cyrus 2.1.5 (Amos Gouaux) # Also specify in main.cf: cyrus_destination_recipient_limit=1 # #cyrus unix - n n - - pipe # user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} # # ==================================================================== # Old example of delivery via Cyrus. # #old-cyrus unix - n n - - pipe # flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} # # ==================================================================== # # 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} procmail unix - n n - 10 pipe user=vmail argv=/usr/bin/procmail -a ${user} # AV scan filter (used by content_filter) scan unix - - n - 16 smtp -o smtp_send_xforward_command=yes # For injecting mail back into postfix from the filter 127.0.0.1:10026 inet n - n - 16 smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks_style=host -o smtpd_authorized_xforward_hosts=127.0.0.0/8 # SPAMASSASIN spamassassin unix - n n - - pipe user=postfix argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}