Skip to content

Instantly share code, notes, and snippets.

@deekayen
Last active August 29, 2015 14:22
Show Gist options
  • Save deekayen/4b9f7964e6e554547bdc to your computer and use it in GitHub Desktop.
Save deekayen/4b9f7964e6e554547bdc to your computer and use it in GitHub Desktop.
The main Postfix configuration for my Debian 8 server which is decent at filtering most spam.
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# 100M
message_size_limit = 102400000
# appending .domain is the MUA's job.
append_dot_mydomain = no
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/private/deekayen.chained.crt
smtpd_tls_key_file=/etc/ssl/private/deekayen.key
smtpd_use_tls=yes
smtpd_tls_auth_only=yes
smtpd_tls_security_level=may
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA
# Seems like Vanguard might only support SSLv3
smtpd_tls_protocols = !SSLv2
smtpd_tls_dh1024_param_file = /etc/ssl/dh3072.pem
#Enabling SMTP for authenticated users, and handing off authentication to Dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
# David's custom abuse settings
smtpd_client_connection_rate_limit = 20
smtpd_client_message_rate_limit = 20
header_checks = regexp:/etc/postfix/header_checks
body_checks = regexp:/etc/postfix/body_checks
smtpd_helo_restrictions =
check_helo_access regexp:/etc/postfix/helo_restrictions
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
permit_dnswl_client swl.spamhaus.org,
permit_dnswl_client accredit.habeas.com,
permit_dnswl_client wl.mailspike.net=127.0.0.20,
permit_dnswl_client query.bondedsender.org,
permit_rhswl_client hostkarma.junkemailfilter.com=127.0.0.1,
permit_dnswl_client hostkarma.junkemailfilter.com=127.0.0.1,
permit_dnswl_client whitelist.surriel.com,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client b.barracudacentral.org,
reject_rbl_client dnsbl.sorbs.net=127.0.0.[2..6],
reject_rbl_client dnsbl-1.uceprotect.net,
reject_rbl_client psbl.surriel.com,
reject_rbl_client truncate.gbudb.net,
reject_rbl_client bl.mailspike.net=127.0.0.[10..11],
reject_rbl_client bl.nosolicitado.org,
reject_rbl_client hostkarma.junkemailfilter.com=127.0.0.2,
check_policy_service unix:private/policy-spf
smtpd_sender_restrictions =
reject_unknown_sender_domain,
reject_rhsbl_sender hostkarma.junkemailfilter.com=127.0.0.2
smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
myhostname = deekayen.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 50.73.85.21/32 [::ffff:127.0.0.0]/104 [::1]/128 [2600:3c02::f03c:91ff:fe73:ef28]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_protocols = all
inet_interfaces = 50.116.38.157 [2600:3c02::f03c:91ff:fe73:ef28]
#Handing off local delivery to Dovecot's LMTP, and telling it where to store mail
virtual_transport = lmtp:unix:private/dovecot-lmtp
#Virtual domains, users, and aliases
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
policy-spf_time_limit = 3600s
# DKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345
anvil_rate_time_unit = 10s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment