Документация по ОС FreeBSD Четверг, 05.12.2024, 04:29
Приветствую Вас Гость | RSS
Меню сайта

Категории каталога
Apache [58]
DNS [25]
FTP [27]
Mail [74]
Samba [24]
Squid [46]
SSH [23]
VPN [35]
РРР [20]
Net [173]

Главная » Статьи » Сеть » Mail

Установка Postfix + некоторые штучки от спама [2011]
Идем в директорию где у нас хранятся порты системы, а именно postfix
 
/usr/ports/mail/postfix/stable
 
Выполним следующие команды:
 
# make show=FLAVORS
 
Система выдаст ответ:
 
sasl2 ldap mysql pgsql
 
Поставим Postfix с поддержкой mysql для этого введем следующие команды:
Соберем собственно сам пакет:
 
# env FLAVOR=”mysql” make
 
Установим пакет:
 
# env FLAVOR=”mysql” make install
 
Настраиваем Postfix:
 
Открываем файл /etc/rc.conf для редактирования и правим такую строчку:
 
syslogd_flags=”-a /var/spool/postfix/dev/log”

Отключим sendmail и включим Postfix:
 
# /usr/local/sbin/postfix-enable
 
Открываем файл /etc/rc.conf для редактирования и правим такую строчку:
 
sendmail_flags=”-bd -q30m”
 
Отключим sendmail в corn`e для этого правим crontab:
 
# crontab -e
 
B закоментируйте строчку где упоминается sendmail:
 
# sendmail clientmqueue runner
#*/30 * * * * /usr/sbin/sendmail -L sm-msp-queue -Ac -q
 
Конфигурация Postfix:
 
Создадим директорию где у нас будут храниться пиьсма. Так как у нас Postfix будет запускаться в chroot то место должно быть где то в /var/spool/postfix.
 
Делаем директорию:
 
# mkdir /var/spool/postfix/vmail
 
Меняем владельца директории:
 
# chown -R _postfix._postfix /var/spool/postfix/vmail
 
Назначаем права:
 
# chmod -R 771 /var/spool/postfix/vmail

 Далее правим основной файл конфигурации Postfix. Для этого откроем файл для редактирования /etc/postfix/main.cf:
 
И внесем такие изменения в файл найдите и исправьте каждую строчку если такой нету то допишите:
 
# general settings
 myorigin = $mydomain
 mydestination = $myhostname localhost.$mydomain $mydomain
 alias_database = hash:/etc/mail/aliases
 alias_maps = hash:/etc/mail/aliases
# postfixadmin stuff
 virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
 virtual_gid_maps = static:507
 virtual_mailbox_base = /var/spool/postfix/vmail
 virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
 virtual_mailbox_limit = 51200000
 virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
 virtual_minimum_uid = 507
 virtual_transport = virtual
 virtual_uid_maps = static:507
# Additional for quota support
 virtual_create_maildirsize = yes
 virtual_mailbox_extended = yes
 virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
 virtual_mailbox_limit_override = yes
 virtual_maildir_limit_message = Sorry, the user’s maildir has overdrawn his diskspace quota, please try again later.
 virtual_overquota_bounce = yes
# store backup mx domains in mysql
 relay_domains = mysql:/etc/postfix/mysql_relay_domains_maps.cf
 delay_notice_recipient = postmaster@domain.com
 bounce_notice_recipient = postmaster@domain.com
 2bounce_notice_recipient = postmaster@domain.com
 error_notice_recipient = postmaster@domain.com
#spam stuff
 strict_rfc821_envelopes = yes
 strict_mime_encoding_domain = yes
 disable_vrfy_command = yes
 smtpd_helo_required = yes
 smtpd_helo_restriction = permit_mynetworks, reject_invalid_hostname, reject_non_fqdn_hostname
 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname,
 reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining,
 reject_invalid_hostname, reject_rbl_client opm.blitzed.org, reject_rbl_client list.dsbl.org, reject_rbl_client
 bl.spamcop.net, reject_rbl_client sbl-xbl.spamhaus.org
# H/B Checks
 header_checks = regexp:/etc/postfix/maps/header_checks
 mime_header_checks = regexp:/etc/postfix/maps/mime_header_checks
 body_checks = regexp:/etc/postfix/maps/body_checks
 
Создадим файлы для коннекта к базе данных с следующим содержанием:
 
# touch /etc/postfix/mysql_relay_domains_maps.cf
 
 user = postfix
 password = postfix
 hosts = localhost
 dbname = postfix
 query = SELECT domain FROM domain WHERE domain=’%s’ and backupmx = ’1′
 # touch /etc/postfix/mysql_virtual_alias_maps.cf
 user = postfix
 password = postfix
 hosts = localhost
 dbname = postfix
 query = SELECT goto FROM alias WHERE address=’%s’
 # touch /etc/postfix/mysql_virtual_domains_maps.cf
 user = postfix
 password = postfix
 hosts = localhost
 dbname = postfix
 query = SELECT domain FROM domain WHERE domain=’%s’
 # touch /etc/postfix/mysql_virtual_mailbox_limit_maps.cf
 user = postfix
 password = postfix
 hosts = localhost
 dbname = postfix
 query = SELECT quota FROM mailbox WHERE username=’%s’
 # touch /etc/postfix/mysql_virtual_mailbox_maps.cf
 user = postfix
 password = postfix
 hosts = localhost
 dbname = postfix
 query = SELECT maildir FROM mailbox WHERE username=’%s’
 
И некоторые штучки от спама:
 
 # mkdir /etc/postfix/maps
 # touch /etc/postfix/maps/body_checks
 # This will reject emails where any line contains eight or more script/comment tags.
 #/(]*>).*){8}/ REJECT Your email contained a lot of script tags. Please
 # correct this (try setting your mail program to use plain text) and resend your message.
 # This will reject emails with script/comment tags that are in the middle of a word.
 #/^.*[a-z][a-z]/ REJECT Your email contained wrongly placed script tags.
 # Please correct this (try setting your mail program to use plain text) and resend your message.
 # This will reject some variants of Sobig viruses
 /^RSLxwtYBDB6FCv8ybBcS0zp9VU5of3K4BXuwyehTM0RI9IrSjVuwP94xfn0wgOjouKWzGXHVk3qg$/ REJECT Your email looked like it \
 contained a virus. Please run a virus scanner on your computer and try again.
 /^TVqQAAMAAAAEAAAA\/\/8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA$/ REJECT Your email looked like \
 it contained a virus. Please run a virus scanner on your computer and try again.
 ## Bad worlds
 /porno/ REJECT Body Spam Rule 1
 /viagra/ REJECT Body Spam Rule 2
 /penis/ REJECT Body Spam Rule 3
 /kamasutra/ REJECT Body Spam Rule 4
 /bitch/ REJECT Body Spam Rule 5
 /V~I~A~G~R~A/ REJECT Body Spam Rule 6
 /p”enis/ REJECT Body Spam Rule 7
 /e”nlarde/ REJECT Body Spam Rule 8
 
# touch /etc/postfix/maps/header_checks
 /^Subject .*Free Money/ REJECT Spam Header Rule #1
 #X-Mailer Blocks
 IF/^X-Mailer:/
 / Virtual MailSender; www.vpro.ru/ OK
 / 0001/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Avalanche/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Crescent Internet Tool/ REJECT Your email had spam-like header contents. (X-Mailer)
 / DiffondiCool/ REJECT Your email had spam-like header contents. (X-Mailer)
 / E-Mail Delivery Agent/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Emailer Platinum/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Entity/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Extractor/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Floodgate/ REJECT Your email had spam-like header contents. (X-Mailer)
 / GOTO Software Sarbacane/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MailWorkz/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MassE-Mail/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MaxBulk.Mailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / News Breaker Pro/ REJECT Your email had spam-like header contents. (X-Mailer)
 / SmartMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / StormPort/ REJECT Your email had spam-like header contents. (X-Mailer)
 / SuperMail-2/ REJECT Your email had spam-like header contents. (X-Mailer)
 / RAdvanced Direct Remailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Advanced Mass Sender/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Spammer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Bomber/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Mega-Mailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / SuperMail/ REJECT Your email had spam-like header contents. (X-Mailer)
 / FastMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / PObox/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Ligra Mailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Dynamic Opt-In Emailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Group Spamer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Mail Sender/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Mailloop/ REJECT Your email had spam-like header contents. (X-Mailer)
 / PersMail/ REJECT Your email had spam-like header contents. (X-Mailer)
 / LK SendI/ REJECT Your email had spam-like header contents. (X-Mailer)
 / WC Mail/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Virtual MailSender/ REJECT Your email had spam-like header contents. (X-Mailer)
 / ZUBA ZUB/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MailList Express/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Caretop/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Mailer Signature/ REJECT Your email had spam-like header contents. (X-Mailer)
 / FiG/ REJECT Your email had spam-like header contents. (X-Mailer)
 / PG-MAILINGLIST/ REJECT Your email had spam-like header contents. (X-Mailer)
 / advcomtest/ REJECT Your email had spam-like header contents. (X-Mailer)
 / ailerv/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Gailerj/ REJECT Your email had spam-like header contents. (X-Mailer)
 / User$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / \.\.\.\.\.\.\. / REJECT Your email had spam-like header contents. (X-Mailer)
 / sklsgwd/ REJECT Your email had spam-like header contents. (X-Mailer)
 / yo yo mail/ REJECT Your email had spam-like header contents. (X-Mailer)
 / ZanziMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / smsmtp/ REJECT Your email had spam-like header contents. (X-Mailer)
 / BulkMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / diffondi/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Virtual MailSender/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Version 5.0 / REJECT Your email had spam-like header contents. (X-Mailer)
 / NetMasters/ REJECT Your email had spam-like header contents. (X-Mailer)
 / nethack/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Dipost/ REJECT Your email had spam-like header contents. (X-Mailer)
 / (ACE ContactManager|CyberCreek Avalanche)/ REJECT Your email had spam-like header contents. (X-Mailer)
 / (Achi-Kochi Mail|E-mail Magnet|Mailcast)/ REJECT Your email had spam-like header contents. (X-Mailer)
 / (Group Mail|Aristotle Mail|WorldMerge)/ REJECT Your email had spam-like header contents. (X-Mailer)
 / (Extractor Pro|Floodgate Pro|MultiMailer)/ REJECT Your email had spam-like header contents. (X-Mailer)
 / (Ellipse Bulk Emailer|RamoMail|MultiMailer)/ REJECT Your email had spam-like header contents. (X-Mailer)
 / (Emailer Platinum.*Internet Marketing)/ REJECT Your email had spam-like header contents. (X-Mailer)
 / E-Magazine/ REJECT Your email had spam-like header contents. (X-Mailer)
 / ExclamationSoft/ REJECT Your email had spam-like header contents. (X-Mailer)
 / IM2K/ REJECT Your email had spam-like header contents. (X-Mailer)
 / PostMaster General/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Advanced Mass Sender/ REJECT Your email had spam-like header contents. (X-Mailer)
 / EZ Version/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Email Collector/ REJECT Your email had spam-like header contents. (X-Mailer)
 / SBZ systems/ REJECT Your email had spam-like header contents. (X-Mailer)
 / The Red Spider/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Dynamic Opt-In Emailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / IM2000 Version 1.01/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Prospect Mailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Inet_Mail_Out/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MailKing/ REJECT Your email had spam-like header contents. (X-Mailer)
 / David/ REJECT Your email had spam-like header contents. (X-Mailer)
 / EzyMassMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Oshirase-Mailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / The Red Spider/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Mega-Mailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / FletMail/i REJECT Your email had spam-like header contents. (X-Mailer)
 / Floodgate/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Extractor/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Fusion/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MassE-Mail/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Quick Shot/ REJECT Your email had spam-like header contents. (X-Mailer)
 / NetMailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / WorldMerge/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Powermailer/ REJECT Your email had spam-like header contents. (X-Mailer)
 / homosexual/ REJECT Your email had spam-like header contents. (X-Mailer)
 / PSS Bulk Mailer.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / ccMail Link.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / IXO-Mail.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MMailer.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / K-ML.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / GoldMine.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / MAGIC.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / bomber.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / expeditor.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Brooklyn North.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Broadcast.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / DMailer.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Extractor.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / EMailing List Pro .*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Fusion.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / News Breaker .*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / dbMail.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Unity.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / PG-MAILINGLIST PRO .*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Dynamic.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Splio.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Sarbacane.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / sMailing.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / Broadc@st.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / WorkZ.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / ABMailer.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / QuickSender .*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 /.* over 2182 or.$/ REJECT Your email had spam-like header contents. (X-Mailer)
 / SpeedMail_.*$/ REJECT Your email had spam-like header contents. (X-Mailer)
 ENDIF
 #Other Headers Blocks
 /^X-Unsent: 1/ REJECT Possible you have a virus Nimbda. Try resend your message.
 # These are headers used to track some spam messages.
 /^Bel-Tracking: .*/ REJECT Confirmed spam. Go away.
 /^Hel-Tracking: .*/ REJECT Confirmed spam. Go away.
 /^Kel-Tracking: .*/ REJECT Confirmed spam. Go away.
 /^BIC-Tracking: .*/ REJECT Confirmed spam. Go away.
 /^Lid-Tracking: .*/ REJECT Confirmed spam. Go away.
 
# touch /etc/postfix/maps/mime_header_checks
 # This entry will reject messages with attachments that could be dangerous, and will inform the sender of what type
 of attachemnt was rejected.
 /^\s*Content-
 (Disposition|Type).*name\s*=\s*”?(.+\.(ad[ep]|asd|ba[st]|c[ho]m|cmd|cpl|crt|dbx|dll|exe|hlp|hta|in[fs]|isp|js|jse|lnk
 |md[etw]|ms[cipt]|nws|ocx|ops|pcd|pi|pif|prf|reg|scf|scr|sct|sh[bms]|swf|uue|vb|vb[esx]|vxd|wab|ws[cfh]))”?\s*$/
 REJECT Files attached to emails that contain or end in "$3″ are prohibited on this server as they may contain
 viruses. The file named "$2″ was rejected.


Источник: http://blogfreebsd.com/freebsd/ustanovka-postfix-nekotorye-shtuchki-ot-spama.html
Категория: Mail | Добавил: oleg (26.07.2011) | Автор: admin
Просмотров: 1325 | Рейтинг: 0.0/0 |
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Форма входа

Beastie

Друзья сайта

Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
links

Copyright MyCorp © 2024