Postfix with DSPAM: различия между версиями
Внешний вид
Glorin (обсуждение | вклад) |
Glorin (обсуждение | вклад) |
||
| (не показано 8 промежуточных версий этого же участника) | |||
| Строка 38: | Строка 38: | ||
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key | smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key | ||
smtpd_use_tls=yes | smtpd_use_tls=yes | ||
smtpd_tls_wrappermode = yes | |||
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache | smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache | ||
smtp_use_tls = yes | |||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache | smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache | ||
smtp_tls_security_level = may | |||
smtp_tls_enforce_peername = no | |||
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for | # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for | ||
| Строка 99: | Строка 103: | ||
smtpd_client_restrictions = | smtpd_client_restrictions = | ||
permit_sasl_authenticated | permit_sasl_authenticated | ||
# reject_unknown_client_hostname | |||
reject_rbl_client sbl.spamhaus.org | reject_rbl_client sbl.spamhaus.org | ||
reject_rbl_client relays.ordb.org | reject_rbl_client relays.ordb.org | ||
| Строка 141: | Строка 145: | ||
smtpd_delay_reject = yes | smtpd_delay_reject = yes | ||
strict_rfc821_envelopes = yes | strict_rfc821_envelopes = yes | ||
message_size_limit = 204800000 | |||
==== /etc/postfix/checks/helo_checks.pcre ==== | ==== /etc/postfix/checks/helo_checks.pcre ==== | ||
| Строка 304: | Строка 309: | ||
=== /etc/postfixadmin/config.inc.php === | === /etc/postfixadmin/config.inc.php === | ||
$CONF['quota'] = 'NO'; | $CONF['quota'] = 'NO'; -> $CONF['quota'] = 'YES'; | ||
-> | |||
$CONF['used_quotas'] = 'NO'; -> $CONF['used_quotas'] = 'YES'; | |||
$CONF['new_quota_table'] = 'NO'; -> $CONF['new_quota_table'] = 'YES'; | |||
$CONF['new_quota_table'] = 'NO'; | |||
-> | |||
== Links == | == Links == | ||
Текущая версия от 12:52, 25 сентября 2013
Postfix
Install
Configs
/etc/postfix/master.cf
# transport from Postfix to DSpam
dspam unix - n n - 10 pipe
flags=Ru user=vmail argv=/usr/bin/dspam --deliver=innocent,spam --user $recipient -i -f $sender -- $recipient
# transport from DSpam to Postfix
127.0.0.1:10025 inet n - n - - smtpd
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o receive_override_options=no_unknown_recipient_checks,no_address_mappings
# Dovecot LDA
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}
# policyd-spf
spf unix - n n - 0 spawn
user=nobody argv=/opt/pyspf/policyd-spf /opt/pyspf/policyd-spf.conf
/etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
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_wrappermode = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_use_tls = yes
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_security_level = may
smtp_tls_enforce_peername = no
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mx.mailhost.ru
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $myhostname
mydestination = $myhostname
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
virtual_mailbox_domains = proxy:mysql:/etc/postfix/virtual-mailbox-domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/virtual-mailbox-maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/virtual-alias-maps.cf
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/virtual-login-maps.cf
proxy_read_maps =
$local_recipient_maps
$mydestination
$virtual_alias_maps
$virtual_alias_domains
$virtual_mailbox_maps
$virtual_mailbox_domains
$relay_recipient_maps
$relay_domains
$canonical_maps
$sender_canonical_maps
$recipient_canonical_maps
$relocated_maps
$transport_maps
$mynetworks
$sender_bcc_maps
$recipient_bcc_maps
$smtp_generic_maps
$lmtp_generic_maps
$smtpd_sender_login_maps
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
permit_sasl_authenticated
reject_unlisted_recipient
reject_non_fqdn_sender
reject_unknown_recipient_domain
reject_unauth_pipelining
reject_non_fqdn_recipient
reject_unauth_destination
permit
smtpd_client_restrictions =
permit_sasl_authenticated
# reject_unknown_client_hostname
reject_rbl_client sbl.spamhaus.org
reject_rbl_client relays.ordb.org
reject_rbl_client cbl.abuseat.org
reject_rbl_client bl.spamcop.net
reject_rbl_client sbl-xbl.spamhaus.org
reject_rbl_client zen.spamhaus.org
check_client_access pcre:/etc/postfix/dspam_filter_access.prce
permit
smtpd_helo_required = yes
smtpd_helo_restrictions =
permit_mynetworks
permit_sasl_authenticated
check_helo_access pcre:/etc/postfix/checks/helo_checks.pcre
reject_non_fqdn_helo_hostname
reject_unknown_helo_hostname
reject_invalid_helo_hostname
permit
smtpd_sender_restrictions =
reject_non_fqdn_sender
reject_unknown_sender_domain
# reject_sender_login_mismatch
permit_sasl_authenticated
permit
smtpd_data_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_pipelining
permit
smtpd_end_of_data_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_multi_recipient_bounce
permit
smtpd_reject_unlisted_sender = yes
smtpd_delay_reject = yes
strict_rfc821_envelopes = yes
message_size_limit = 204800000
/etc/postfix/checks/helo_checks.pcre
/mx\.mailhost\.ru/ REJECT You are not me
/127\.0\.0\.1/ REJECT You are not me
/\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}/ REJECT We don't like dynamic addressess
/etc/postfix/dspam_filter_access.pcre
/./ FILTER dspam:dspam
Maps
/etc/postfix/virtual-mailbox-domains.cf
user = postfixadmin password = password hosts = 127.0.0.1 dbname = postfixadmin query = select `domain` from `domain` where `domain` = '%s' and `active` = '1'
/etc/postfix/virtual-mailbox-maps.cf
user = postfixadmin password = password hosts = 127.0.0.1 dbname = postfixadmin query = select `maildir` from `mailbox` where `username` = '%s' and `active` = '1'
/etc/postfix/virtual-alias-maps.cf
user = postfixadmin password = password hosts = 127.0.0.1 dbname = postfixadmin query = select `goto` from `alias` where `address` = '%s' and `active` = '1'
/etc/postfix/virtual-login-maps.cf
user = postfixadmin password = password hosts = 127.0.0.1 dbname = postfixadmin query = select `username` from `mailbox` where `username` = '%s' and `active` = '1'
Dspam
Install
apt-get install clamav dpsam dovecot-antispam
Configs
/etc/default/dspam
Change START=no to START=yes
/etc/dspam/dspam.conf
Home /var/spool/dspam StorageDriver /usr/lib/x86_64-linux-gnu/dspam/libmysql_drv.so TrustedDeliveryAgent "/usr/bin/procmail" # Return checked mail to queue ( look postfix master.cf) DeliveryHost 127.0.0.1 DeliveryPort 10025 DeliveryIdent localhost DeliveryProto SMTP OnFail error Trust root Trust dspam Trust apache Trust mail Trust mailnull Trust smmsp Trust daemon Trust vmail TrainingMode teft TestConditionalTraining on Feature whitelist Algorithm graham burton Tokenizer chain PValue bcr WebStats on # Spam action, add headers (X-DSPAM-Result: Spam) Preference "spamAction=tag" Preference "signatureLocation=headers" Preference "showFactors=off" AllowOverride trainingMode AllowOverride spamAction spamSubject AllowOverride statisticalSedation AllowOverride enableBNR AllowOverride enableWhitelist AllowOverride signatureLocation AllowOverride showFactors AllowOverride optIn optOut AllowOverride whitelistThreshold HashRecMax 98317 HashAutoExtend on HashMaxExtents 0 HashExtentSize 49157 HashPctIncrease 10 HashMaxSeek 10 HashConnectionCache 10 Notifications off PurgeSignature off # Specified in purge.sql PurgeNeutral 90 PurgeUnused off # Specified in purge.sql PurgeHapaxes off # Specified in purge.sql PurgeHits1S off # Specified in purge.sql PurgeHits1I off # Specified in purge.sql LocalMX 127.0.0.1 SystemLog on UserLog on Opt out TrackSources spam nonspam ParseToHeaders on ChangeModeOnParse on ChangeUserOnParse full # ClamAV ClamAVPort 3310 ClamAVHost 127.0.0.1 ClamAVResponse accept ServerPID /var/run/dspam/dspam.pid ServerMode auto ServerParameters "--deliver=innocent" ServerIdent "localhost.localdomain" ServerDomainSocketPath "/var/run/dspam/dspam.sock" # Socket path ClientHost "/var/run/dspam/dspam.sock" ProcessorURLContext on ProcessorBias on StripRcptDomain off Include /etc/dspam/dspam.d/
ClamAV
/etc/clamav/clamd.conf
And to end of config
# Socket path LocalSocket /var/run/clamav/clamd.sock FixStaleSocket yes # TPC Port (Must by same dspam.conf) TCPSocket 3310 TCPAddr 127.0.0.1
PostfixAdmin
/etc/postfixadmin/config.inc.php
$CONF['quota'] = 'NO'; -> $CONF['quota'] = 'YES';
$CONF['used_quotas'] = 'NO'; -> $CONF['used_quotas'] = 'YES';
$CONF['new_quota_table'] = 'NO'; -> $CONF['new_quota_table'] = 'YES';
Links
- http://ru.gentoo-wiki.com/wiki/Настройка_почтового_сервера_(Postfix,_Dovecot,_DSpam,_SQLGrey,_DomainKeys,_SPF)
- http://www.debiantutorials.com/installing-dspam-with-clamav-for-postfix-on-lenny/
- http://www.kirya.net/articles/setting-up-dspam-as-a-filter-for-postfix-on-debian/
- http://www.postfix.org/postconf.5.html
- http://www.owlfish.com/thoughts/dovecot-antispam-2011-03-21.html