Заточен postfix+mysql+clamsmtp
Вначале, установил postfix+mysql, все отлично работало. Затем прикрутил clamav+clamsmtp, spamassassin. После этого перестали работать aliases. В логи валит
Mar 21 11:15:43 router0 spamd[659]: prefork: child states: II
Mar 21 11:15:43 router0 postfix/cleanup[9794]: AC0335D73: message-id=<281082296.20060321111124@galaform.ru>
Mar 21 11:15:43 router0 postfix/qmgr[9787]: AC0335D73: from=<mad@galaform.ru>, size=1066, nrcpt=1 (queue active)
Mar 21 11:15:43 router0 postfix/smtpd[9798]: disconnect from localhost.galaform.ru[127.0.0.1]
Mar 21 11:15:43 router0 postfix/pipe[9795]: 851305D71: to=<test@galaform.ru>, relay=spamfilter, delay=6, status=sent (router0.galaform.ru)
Mar 21 11:15:43 router0 postfix/qmgr[9787]: 851305D71: removed
Mar 21 11:15:43 router0 postfix/virtual[9799]: AC0335D73: to=<test@galaform.ru>, relay=virtual, delay=6, status=bounced (unknown user: "test@galaform.ru")
Mar 21 11:15:43 router0 postfix/cleanup[9794]: 210C95CFE: message-id=<20060321081543.210C95CFE@router0.galaform.ru>
Mar 21 11:15:43 router0 postfix/qmgr[9787]: 210C95CFE: from=<>, size=2727, nrcpt=1 (queue active)
Mar 21 11:15:43 router0 postfix/qmgr[9787]: AC0335D73: removedmysql> select *from aliases where rcpt='mad@galaform.ru';
+--------------------------+-----------------+---------+
| alias | rcpt | comment |
+--------------------------+-----------------+---------+
| test@galaform.ru | mad@galaform.ru | NULL |
mysql> describe aliases;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| alias | varchar(255) | | PRI | | |
| rcpt | varchar(255) | | | | |
| comment | text | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
3 rows in set (0.01 sec)main.cf
alias_maps = hash:/etc/mail/aliases
alias_database = hash:/etc/mail/aliases
virtual_alias_maps=mysql:/usr/local/etc/postfix/sql/aliases.cf
local_recipient_maps=$virtual_mailbox_maps $virtual_maps $transport_maps $alias_mapsaliases.cf
user=mailer
password=password
dbname=mail
table=aliases
select_field=rcpt
where_field=alias
hosts=localhostuser: mailer
mysql> select * from aliases;
+--------------------------+-----------------+---------+
| alias | rcpt | comment |
+--------------------------+-----------------+---------+
| test@galaform.ru | mad@galaform.ru | NULL |
Есть предположение, что после того, как только clamsmtp возвращает письмо postfix, тот не знает куда его отправлять. Возможно необходимо изменить последовательность работы postfix, как не знаю.
Подскажите пожайлуста.
>local_recipient_maps=$virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
Мдя...
postconf -n показывайте.
>>local_recipient_maps=$virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
>Мдя...
>postconf -n показывайте.alias_database = hash:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
content_filter = scan:127.0.0.1:10025
daemon_directory = /usr/local/libexec/postfix
debug_peer_level = 2
default_privs = nobody
html_directory = no
local_recipient_maps = $virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
mail_owner = postfix
mail_spool_directory = /var/mail
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
message_size_limit = 10000000
mynetworks = 127.0.0.0/8, 192.168.0.0/24
queue_directory = /var/spool/postfix
readme_directory = no
receive_override_options = no_address_mappings
relay_domains = $transport_maps
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = $smtp_tls_key_file
smtp_tls_cert_file = $smtp_tls_key_file
smtp_tls_key_file = /usr/local/share/courier-imap/pop3d.pem
smtp_tls_note_starttls_offer = yes
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rbl_client list.dsbl.org, reject_rbl_client relays.ordb.org, reject_rbl_client dynablock.wirehub.net, reject_rbl_client blackholes.wirehub.net, reject_rbl_client dnsbl.njabl.org, reject_rbl_client dul.ru
smtpd_sasl_auth_enable = yes
smtpd_tls_CAfile = $smtpd_tls_key_file
smtpd_tls_cert_file = $smtpd_tls_key_file
smtpd_tls_key_file = /usr/local/share/courier-imap/pop3d.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = mysql:/usr/local/etc/postfix/sql/transport.cf
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/usr/local/etc/postfix/sql/aliases.cf
virtual_gid_maps = mysql:/usr/local/etc/postfix/sql/gids.cf
virtual_mailbox_base = /var/mail/virtual
virtual_mailbox_maps = mysql:/usr/local/etc/postfix/sql/users.cf
virtual_uid_maps = mysql:/usr/local/etc/postfix/sql/uids.cf
>>>local_recipient_maps=$virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
>>Мдя...
>>postconf -n показывайте.
>
>alias_database = hash:/etc/mail/aliases
>alias_maps = hash:/etc/mail/aliases
>broken_sasl_auth_clients = yes
>command_directory = /usr/local/sbin
>config_directory = /usr/local/etc/postfix
>content_filter = scan:127.0.0.1:10025
>daemon_directory = /usr/local/libexec/postfix
>debug_peer_level = 2
>default_privs = nobody
>html_directory = no
>local_recipient_maps = $virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
>mail_owner = postfix
>mail_spool_directory = /var/mail
>mailq_path = /usr/local/bin/mailq
>manpage_directory = /usr/local/man
>message_size_limit = 10000000
>mynetworks = 127.0.0.0/8, 192.168.0.0/24
>queue_directory = /var/spool/postfix
>readme_directory = no
>receive_override_options = no_address_mappings
>relay_domains = $transport_maps
>sample_directory = /usr/local/etc/postfix
>sendmail_path = /usr/local/sbin/sendmail
>setgid_group = maildrop
>smtp_sasl_security_options = noanonymous
>smtp_tls_CAfile = $smtp_tls_key_file
>smtp_tls_cert_file = $smtp_tls_key_file
>smtp_tls_key_file = /usr/local/share/courier-imap/pop3d.pem
>smtp_tls_note_starttls_offer = yes
>smtp_use_tls = yes
>smtpd_banner = $myhostname ESMTP $mail_name
>smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rbl_client list.dsbl.org, reject_rbl_client relays.ordb.org, reject_rbl_client dynablock.wirehub.net, reject_rbl_client
>blackholes.wirehub.net, reject_rbl_client dnsbl.njabl.org, reject_rbl_client dul.ru
>smtpd_sasl_auth_enable = yes
>smtpd_tls_CAfile = $smtpd_tls_key_file
>smtpd_tls_cert_file = $smtpd_tls_key_file
>smtpd_tls_key_file = /usr/local/share/courier-imap/pop3d.pem
>smtpd_tls_loglevel = 1
>smtpd_tls_received_header = yes
>smtpd_tls_session_cache_timeout = 3600s
>smtpd_use_tls = yes
>tls_random_source = dev:/dev/urandom
>transport_maps = mysql:/usr/local/etc/postfix/sql/transport.cf
>unknown_local_recipient_reject_code = 550
>virtual_alias_maps = mysql:/usr/local/etc/postfix/sql/aliases.cf
>virtual_gid_maps = mysql:/usr/local/etc/postfix/sql/gids.cf
>virtual_mailbox_base = /var/mail/virtual
>virtual_mailbox_maps = mysql:/usr/local/etc/postfix/sql/users.cf
>virtual_uid_maps = mysql:/usr/local/etc/postfix/sql/uids.cfподскажите пожайлуста, где допущены грубые ошибки.
>local_recipient_maps = $virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
Может все-таки объясните, зачем Вы запихали все сюда? Я так понимаю, Вы настраиваете virtual mailbox domains? Список этих доменов? Покажите master.cf и уберите receive_override_options = no_address_mappings из main.cf.
>>local_recipient_maps = $virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
>Может все-таки объясните, зачем Вы запихали все сюда? Я так понимаю, Вы
>настраиваете virtual mailbox domains? Список этих доменов? Покажите master.cf и уберите
>receive_override_options = no_address_mappings из main.cf.
Совершенно верно,
mysql> select *from transport;
+------------------+-----------+---------+
| domain | transport | comment |
+------------------+-----------+---------+
| galaform.ru | virtual: | NULL |
| siberianneft.com | virtual: | NULL |
| smanngroup.com | virtual: | NULL |
+------------------+-----------+---------+main.cf
# Postfix master process configuration file. For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - 16 smtpd -o content_filter=spamfilter
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix - n n - - pipe
flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus unix - n n - - pipe
user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#filter unix - n n - - pipe
# flags=R user=drweb argv=/usr/local/drweb/drweb-postfix --conf=/usr/local/et#c/drweb/drweb_postfix.conf -f ${sender} -- ${recipient}
#Clamav
scan unix - - n - 16 smtp
-o smtp_send_xforward_command=yes
127.0.0.1:10026 inet n - n - 16 smtpd
-o content_filter=spamfilter
-o recive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smptd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
#Spamassassin
spamfilter unix - n n - 10 pipe
flags=R
user=filter
argv=/usr/local/etc/postfix/scripts/spam.pl "localhost:10027" "spamfilter"
"${sender}" "$(recipient)" "/usr/local/bin/spamc"localhost:10027 inet n - n - 10 smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o myhostname=localhost
>>>local_recipient_maps = $virtual_mailbox_maps $virtual_maps $transport_maps $alias_maps
>>Может все-таки объясните, зачем Вы запихали все сюда? Я так понимаю, Вы
>>настраиваете virtual mailbox domains? Список этих доменов? Покажите master.cf и уберите
>>receive_override_options = no_address_mappings из main.cf.
>
>
>Совершенно верно,
>mysql> select *from transport;
>+------------------+-----------+---------+
>| domain
>| transport | comment |
>+------------------+-----------+---------+
>| galaform.ru | virtual: | NULL
> |
>| siberianneft.com | virtual: | NULL |
>| smanngroup.com | virtual: | NULL
>|
>+------------------+-----------+---------+
>
>main.cf
>
># Postfix master process configuration file. For details on the format
>
># of the file, see the Postfix master(5) manual page.
>#
># ==========================================================================
># service type private unpriv chroot wakeup maxproc
>command + args
>#
> (yes) (yes) (yes)
> (never) (100)
># ==========================================================================
>smtp inet n
> - n
> -
> 16 smtpd -o
>content_filter=spamfilter
>#submission inet n -
> n -
> -
> smtpd
># -o smtpd_etrn_restrictions=reject
># -o smtpd_client_restrictions=permit_sasl_authenticated,reject
>#smtps inet n
> - n
> -
>- smtpd
># -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
>#submission inet n
> - n
> -
> - smtpd
># -o smtpd_etrn_restrictions=reject
># -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
>#628 inet n
> - n
> -
> - qmqpd
>pickup fifo n
> - n
> 60 1
> pickup
>cleanup unix n
>- n
> - 0
> cleanup
>qmgr fifo n
> - n
> 300
>1 qmgr
>#qmgr fifo n
> - n
> 300 1
> oqmgr
>tlsmgr unix -
> - n
> 1000? 1
> tlsmgr
>rewrite unix -
>- n
> - -
> trivial-rewrite
>bounce unix -
> - n
> -
>0 bounce
>defer unix -
> - n
> -
> 0 bounce
>trace unix -
> - n
> -
> 0 bounce
>verify unix -
> - n
> -
>1 verify
>flush unix n
> - n
> 1000? 0
> flush
>proxymap unix - -
> n
> - -
> proxymap
>smtp unix -
> - n
> -
> - smtp
># When relaying mail as backup MX, disable fallback_relay to avoid MX
>loops
>relay unix -
> - n
> -
> - smtp
> -o fallback_relay=
># -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
>showq unix n
> - n
> -
> - showq
>error unix -
> - n
> -
> - error
>discard unix -
>- n
> - -
> discard
>local unix -
> n n
> -
> - local
>virtual unix -
>n n
> - -
> virtual
>lmtp unix -
> - n
> -
> - lmtp
>anvil unix -
> - n
> -
> 1 anvil
>scache unix -
> - n
> -
>1 scache
>#
># ====================================================================
># Interfaces to non-Postfix software. Be sure to examine the manual
># pages of the non-Postfix software to find out what options it
>wants.
>#
># Many of the following services use the Postfix pipe(8) delivery
># agent. See the pipe(8) man page for information about ${recipient}
>
># and other message envelope options.
># ====================================================================
>#
># maildrop. See the Postfix MAILDROP_README file for details.
># Also specify in main.cf: maildrop_destination_recipient_limit=1
>#
>maildrop unix - n
> n
> - -
> pipe
> flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
>#
># The Cyrus deliver program has changed incompatibly, multiple times.
>#
>old-cyrus unix - n
> n
> - -
> pipe
> flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
># Cyrus 2.1.5 (Amos Gouaux)
># Also specify in main.cf: cyrus_destination_recipient_limit=1
>cyrus unix -
> n n
> -
> - pipe
> user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
>#
># See the Postfix UUCP_README file for configuration details.
>#
>uucp unix -
> n n
> -
> - pipe
> flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
>
>#
># Other external delivery methods.
>#
>ifmail unix -
> n n
> -
>- pipe
> flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
>bsmtp unix -
> n n
> -
> - pipe
> flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
>#filter unix -
>n n
> - -
> pipe
> # flags=R user=drweb argv=/usr/local/drweb/drweb-postfix --conf=/usr/local/et#c/drweb/drweb_postfix.conf -f ${sender} -- ${recipient}
>
>#Clamav
>scan unix -
> - n
> -
> 16 smtp
> -o smtp_send_xforward_command=yes
>127.0.0.1:10026 inet n
>- n
> - 16
> smtpd
> -o content_filter=spamfilter
> -o recive_override_options=no_unknown_recipient_checks,no_header_body_checks
> -o smtpd_helo_restrictions=
> -o smptd_client_restrictions=
> -o smtpd_sender_restrictions=
> -o smtpd_recipient_restrictions=permit_mynetworks,reject
> -o mynetworks_style=host
> -o smtpd_authorized_xforward_hosts=127.0.0.0/8
>#Spamassassin
>spamfilter unix - n
> n
>- 10
> pipe
> flags=R
> user=filter
> argv=/usr/local/etc/postfix/scripts/spam.pl "localhost:10027" "spamfilter"
> "${sender}" "$(recipient)" "/usr/local/bin/spamc"
>
>localhost:10027 inet n
>- n
> - 10
> smtpd
> -o content_filter=
> -o local_recipient_maps=
> -o relay_recipient_maps=
> -o smtpd_helo_restrictions=
> -o smtpd_client_restrictions=
> -o smtpd_sender_restrictions=
> -o mynetworks=127.0.0.0/8
> -o smtpd_recipient_restrictions=permit_mynetworks,reject
> -o myhostname=localhostreceive_override_options = no_address_mappings -
postfix не делал никаких манипуляций с адресами до того, как они дойдут до content_filter. Так что получается, что фильтр работает с реальными почтовыми адресами, а не с результатами перевода в виртуальные псевдонимы, маскарадингом и т.п. я убрал и алиас отработал. Т.е. получается данная схема не позволяет работать с алиасами. Подскажите если Вам не трудно, какие ошибки не стоит делать из данной конфигурации, первый сервак делаю.
>receive_override_options = no_address_mappings -
>
> postfix не делал никаких манипуляций с адресами до того, как они
>дойдут до content_filter. Так что получается, что фильтр работает с реальными
>почтовыми адресами, а не с результатами перевода в виртуальные псевдонимы, маскарадингом
>и т.п. я убрал и алиас отработал. Т.е. получается данная схема
>не позволяет работать с алиасами. Подскажите если Вам не трудно, какие
>ошибки не стоит делать из данной конфигурации, первый сервак делаю.
Ну тогда и указывайте его не в main.cf, а в master.cf:smtp inet n - n - 16 smtpd
-o content_filter=spamfilter
-o receive_override_options=no_address_mappings
1. Верните local_recipient_maps в default
2. Уберите все из transport_maps.
3. Добавьте в main.cf
virtual_mailbox_domains = galaform.ru, siberianneft.com, smanngroup.com
4. Перезапустите postfix.
>1. Верните local_recipient_maps в default
>2. Уберите все из transport_maps.
>3. Добавьте в main.cf
>virtual_mailbox_domains = galaform.ru, siberianneft.com, smanngroup.com
>4. Перезапустите postfix.
1.local_recipient_maps закоментировал, прописано, что по умолчанию, он отсекает почту для несуществующих пользователей.
т.е. у меня сейчас закоментировано.
2. Я убрал значение
т.е.
transport_maps=
relay_domains=$transport_maps
3. добавил строчку virtual_mailbox_domains=galaform.ru, siberianneft.com, smanngroup.com
>1.local_recipient_maps закоментировал, прописано, что по умолчанию, он отсекает почту для несуществующих пользователей.
Вызубрите
http://www.postfix.org/ADDRESS_CLASS_README.html
только после этого будете понимать что и зачем.
>т.е. у меня сейчас закоментировано.
>2. Я убрал значение
>т.е.
>transport_maps=
Я имел ввиду удалить все из самой таблицы.
>relay_domains=$transport_maps
Верните в default transport_maps и relay_domains (просто закоменнтируйте в main.cf).
>>1.local_recipient_maps закоментировал, прописано, что по умолчанию, он отсекает почту для несуществующих пользователей.
>Вызубрите
>http://www.postfix.org/ADDRESS_CLASS_README.html
>только после этого будете понимать что и зачем.
>>т.е. у меня сейчас закоментировано.
>>2. Я убрал значение
>>т.е.
>>transport_maps=
>Я имел ввиду удалить все из самой таблицы.
>>relay_domains=$transport_maps
>Верните в default transport_maps и relay_domains (просто закоменнтируйте в main.cf).
Плонял, спасибо большое.