soft_bounce=yes default_database_type = cdb smtpd_sender_login_maps = cdb:/etc/postfix/virtual smtpd_restriction_classes = pass_postmaster # get mail for abuse@ and postmaster@ after greylisting pass_postmaster = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service inet:127.0.0.1:2501, permit #=============================================================================# # Общесистемные ограничения #=============================================================================# # 100Mb -- максимальный размер сообщения message_size_limit = 100000000 virtual_mailbox_limit = 1024000000 mailbox_size_limit = 1024000000 #=============================================================================# # TLS #=============================================================================# # Если клиенты поддерживают TLS -- мы используем TLS, если нет, то позволяем # работать без TLS smtpd_use_tls = yes smtpd_enforce_tls = no smtp_tls_cert_file=/var/lib/ssl/certs/smtp.pem smtp_tls_dcert_file=/var/lib/ssl/certs/smtp.pem #=============================================================================# # Параноидальные настройки #=============================================================================# # Требование для клиентских приложений соблюдения RFC # это адекватное требование, так как своих клиентов надо учить пользоваться # корректным ПО, а снаружи почта должна в любом случае проходить через почтовые # сервера smtpd_helo_required = yes #strict_rfc821_envelopes = yes # Запрещаем исходящую почту с наших доменов, но с несуществующих у нас адресов smtpd_reject_unlisted_sender = yes smtpd_reject_unlisted_recipient = yes # для соблюдения стандарта и чтобы не сносило крышу тупым серверам smtpd_delay_reject = yes #=============================================================================# # Проверка существования адреса-отправителя #=============================================================================# # Любопытный side-effect -- почта не будет приниматься от пользователя, # который не принимает почту от нас #=============================================================================# # Правила-ограничения #=============================================================================# # (должен содержать в себе и hostname, и домен, иначе снесёт крышу) myhostname = smtp.freesource.info inet_interfaces = all mydestination = localhost, $myhostname # 550 -- reject mail # 450 -- try again later # Необходимо для того, чтобы при ошибках конфигурации почта все же доходила unknown_local_recipient_reject_code = 450 mynetworks = 127.0.0.1/32, 10.254.200.0/24 # INPUT RATE CONTROL # A Postfix process will pause for $in_flow_delay seconds before # accepting a new message, when the message arrival rate exceeds the # message delivery rate. With the default 100 SMTP server process # limit, this limits the mail inflow to 100 messages a second more # than the number of messages delivered per second. # # Specify 0 to disable the feature. Valid delays are 0..10. #in_flow_delay = 1s mailbox_command = /usr/bin/procmail -a $DOMAIN -d $LOGNAME #mailbox_transport = lmtp:unix:/file/name #mailbox_transport = cyrus # NOTE: if you use this feature for accounts not in the UNIX password # file, then you must update the "local_recipient_maps" setting in # the main.cf file, otherwise the SMTP server will reject mail for # non-UNIX accounts with "User unknown in local recipient table". #fallback_transport = lmtp:unix:/file/name #fallback_transport = cyrus #fallback_transport = # The luser_relay parameter specifies an optional destination address # for unknown recipients. By default, mail for unknown@$mydestination # and unknown@[$inet_interfaces] is returned as undeliverable. # # The following expansions are done on luser_relay: $user (recipient # username), $shell (recipient shell), $home (recipient home directory), # $recipient (full recipient address), $extension (recipient address # extension), $domain (recipient domain), $local (entire recipient # localpart), $recipient_delimiter. Specify ${name?value} or # ${name:value} to expand value only when $name does (does not) exist. # # luser_relay works only for the default Postfix local delivery agent. # # NOTE: if you use this feature for accounts not in the UNIX password # file, then you must specify "local_recipient_maps =" (i.e. empty) in # the main.cf file, otherwise the SMTP server will reject mail for # non-UNIX accounts with "User unknown in local recipient table". # #luser_relay = $user@other.host #luser_relay = $local@other.host #luser_relay = admin+$local # JUNK MAIL CONTROLS header_checks = regexp:/etc/postfix/header_checks smtpd_banner = $myhostname ESMTP $mail_name #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) # The smtpd_etrn_restrictions parameter restricts what clients are # allowed to issue the ETRN command. # # The Postfix ETRN command accepts only destinations that are eligible # for the Postfix "fast flush" service. See the samples/flush.cf file # for details. # # The default is to allow ETRN from any host. The following restrictions # are available: # # reject_unknown_client: reject the request if the client hostname is unknown. # permit_mynetworks: permit if the client address matches $mynetworks. # check_client_access maptype:mapname # look up client name, parent domains, client address, # or networks obtained by stripping octets. # see access(5) for possible lookup results. # reject_rbl_client domain.tld: reject if the reverse client network # address is listed in an A record under domain.tld. # reject_rhsbl_client domain.tld: reject if the client hostname is listed # in an A record under domain.tld. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. # # You may also list any helo or client restrictions here (see below). # smtpd_etrn_restrictions = permit_mynetworks, reject # Так как почтовые ящики находятся на быстром RAID-массиве с _кэшированием_, # логичнее направлять сразу несколько сообщений local_destination_concurrency_limit = 16 default_destination_concurrency_limit = 16 # INSTALL-TIME CONFIGURATION INFORMATION readme_directory = /etc/postfix/README_FILES sample_directory = /etc/postfix/samples sendmail_path = /usr/sbin/sendmail #setgid_group = postdrop command_directory = /usr/sbin manpage_directory = /usr/share/man daemon_directory = /usr/libexec/postfix newaliases_path = /usr/bin/newaliases mailq_path = /usr/bin/mailq queue_directory = /var/spool/postfix mail_owner = postfix ## START: Virtual hosting virtual_alias_maps = cdb:/etc/postfix/virtual virtual_alias_expansion_limit = 999 virtual_transport = virtual virtual_mailbox_base = /var/spool/popboxes virtual_mailbox_maps = cdb:/etc/postfix/virtual-mailboxes virtual_mailbox_domains = cdb:/etc/postfix/virtual-domains virtual_minimum_uid = 100 virtual_uid_maps = static:109 virtual_gid_maps = static:502 # All domains and users delivered by the local delivery agent. # local_recipient_maps is used by the SMTP server to reject mail # for unknown users. local_transport = local local_recipient_maps = $alias_maps, cdb:/etc/postfix/local-recipients ## END: Virtual hosting smtpd_sasl_auth_enable = yes ### START: ordb.org #strict_rfc811_envelopes = yes # If server for some time in blacklist, I want to wait, not reject maps_rbl_reject_code = 410 # Очень много вменяемый почтовиков нарушают эти правила smtpd_helo_restrictions = permit_mynetworks, # Проверки на этапе соединения # - Диалапщиков, напрямую рассылающих письма, давить # - С открытых релеев почту мы принимать не станем # - С почтовых серверов, нарушающих RFC, мы почту тоже принимать не станем smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, # TIDI use rbl here # Проверки на этапе MAIL FROM # sender must be valid e-mail # if sender domain not exists, it can be only spam # кривые адреса не позволять даже от своих (неизвестные и non-FQDN) smtpd_sender_restrictions = # get mail for abuse and postmaster check_recipient_access pcre:/etc/postfix/recipient_checks.pcre, # Есть ламера, от которых стоит принимать почту (ибо verify не проходит) check_sender_access cdb:/etc/postfix/sender_access, # На несуществующие мыльники мы отказываемся принять почту даже от "своих" reject_unlisted_sender, reject_unverified_sender, reject_sender_login_mismatch, permit_mynetworks, reject_unknown_sender_domain, reject_non_fqdn_sender, # if user not logged in we can't send mail from it permit_sasl_authenticated, reject_invalid_hostname, reject_unknown_hostname, reject_non_fqdn_hostname # reject_rbl_client cbl.abuseat.org # Проверки на этапе SEND TO # reject_unverified_recipient -- медленная операция, но позволяет "зачистить" большую часть спама, оставшегося после check_policy_service smtpd_recipient_restrictions = permit_mynetworks, reject_unknown_recipient_domain, reject_non_fqdn_recipient, permit_sasl_authenticated, reject_unauth_destination, reject_unverified_recipient, check_sender_access cdb:/etc/postfix/sender_access, reject_unknown_recipient_domain, reject_unverified_recipient check_policy_service inet:127.0.0.1:2501, # Без этой строки обратная проверка существования имён пользователей # будет выполняться слишком долго address_verify_map = btree:/etc/postfix/address_verify_cache address_verify_negative_expire_time = 3d address_verify_negative_refresh_time = 1h address_verify_positive_refresh_time = 28d # Параноя disable_vrfy_command = yes #policy_time_limit = 3600 # I don't know why someone can needs more then this smtpd_recipient_limit = 16 html_directory = /usr/share/doc/postfix-2.3.11/html