From: "Денис Смирнов" <mithraen@altlinux.ru> To: ALT Linux sysadmin discuss <sysadmins@lists.altlinux.org> Subject: Re: [Sysadmins] postfix Date: Wed, 7 Nov 2007 09:33:49 +0300 Message-ID: <20071107063349.GB10978@mw.local.seiros.ru> (raw) In-Reply-To: <20071106154417.GB6203@basalt.office.altlinux.org> [-- Attachment #1.1: Type: text/plain, Size: 1339 bytes --] On Tue, Nov 06, 2007 at 06:44:17PM +0300, Dmitry V. Levin wrote: > >>> 1. достал спам, который идет якобы от адресов наших же доменов. Типа > >>> abc@seiros.ru, при том что такого аккаунта нет. Как запретить доставку с > >>> from из нашего домена без авторизации? >> А reject_unlisted_sender для именно этой задачи не шустрее будет? Сам с >> собой коннектиться для проверки это странно. DVL> Быстрее. Но довольно скоро тебе этого будет мало. В смысле использовать это параллельно с sender verify имеет смысл? >> Я правильно понмиаю, что приходящее локально через smtpd_*_restrictions >> никакие и ни коим образом проверяться не может, поэтому если я сделал >> запрет на прием почты для данного адреса, это не помешает мне отправлять >> эту почту локально? DVL> В обход smtpd, конечно, не помешает. Понял, спасибо. Я приаттачил свой конфиг -- в нынешем виде он по сравнению с вариантом без sender verify и грейлистинга уменьшил количество спама в мой адрес на два порядка. Заодно smtpd_sender_login_maps добавил, чтобы параноя спала спокойно. Что там можно было бы еще улучшить в плане безопасности? -- С уважением, Денис http://freesource.info ---------------------------------------------------------------------------- Без хорошо закрученных гаек нынче никак нельзя. -- ldv in devel-kernel@ [-- Attachment #1.2: main.cf --] [-- Type: text/plain, Size: 10268 bytes --] 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 [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-11-07 6:33 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-11-05 1:11 [Sysadmins] postgresql Денис Смирнов 2007-11-05 13:54 ` [Sysadmins] postfix Dmitry V. Levin 2007-11-06 3:40 ` Денис Смирнов 2007-11-06 15:44 ` Dmitry V. Levin 2007-11-07 6:33 ` Денис Смирнов [this message] 2007-11-07 11:14 ` Dmitry V. Levin 2007-11-07 16:26 ` Денис Смирнов 2007-11-07 7:13 ` Sergey 2007-11-07 16:48 ` Денис Смирнов 2007-11-07 22:47 ` Sergey 2007-11-07 22:51 ` Dmitry V. Levin 2007-11-07 23:23 ` Sergey 2007-11-07 23:36 ` Dmitry V. Levin 2007-11-07 23:59 ` Sergey 2007-11-08 10:38 ` Vladimir V. Kamarzin 2007-11-06 3:42 ` [Sysadmins] postgresql Денис Смирнов
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20071107063349.GB10978@mw.local.seiros.ru \ --to=mithraen@altlinux.ru \ --cc=sysadmins@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux sysadmins discussion This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \ sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com public-inbox-index sysadmins Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.sysadmins AGPL code for this site: git clone https://public-inbox.org/public-inbox.git