Postfix + AntiVir on Cent-OS

Last updated @ 19/May/2012

めにゅ〜


Postfix2の設定

Cent-OS5には Postfix2.3が含まれている(Cent-OS6にはPostfix2.6)ので,インストール作業は不要です.
Cent-OS上で,「Mail Transport Agent Switcher」を使って,『postfix』を選択しておきます.


ソースファイルの取得,コンパイル(参考)


/etc/postfix/main.cfの設定

以下に設定例を示します(OB25対応設定例です).
変数等の詳細は, http://www.postfix.org/postconf.5.html 等を参照.
「postconf -n」で現状の設定値,
「postconf -d」でデフォルトの設定値を表示.

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix

myhostname = mail.kmisu.net	#メールサーバのドメイン名を含めたホスト名
mydomain = kmisu.net	# メールサーバのドメイン名
myorigin = $mydomain

inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain, thisserver.$mydomain	# 受信するドメイン名
unknown_local_recipient_reject_code = 450
mynetworks_style = subnet
mynetworks = 192.168.0.0/24, 127.0.0.0/8	# ルータの内側にいるので,プライベートアドレスで指定
relay_domains = $mydestination
relayhost = [smtp.xxx.ne.jp]:587 	#プロバイダのSMTPサーバを指定

# SMTP認証のための設定(認証不要の場合は,不要)
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter =
smtp_sasl_password_maps = hash:/etc/postfix/saslpass

# Mailbox上限を約1GB,メッセージ上限を約50MB
mailbox_size_limit = 1024000000
message_size_limit = 51200000

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
manpage_directory = /usr/local/man
sample_directory = /etc/postfix
readme_directory = no

##
smtpd_client_restrictions=permit_mynetworks,reject_unauth_destination

# ClamSMTP + ClamAV のための設定
content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings

html_directory = no


/etc/postfix/master.cfの設定

以下に設定例を示します.
smtp      inet  n       -       n       -       -       smtpd
submission inet n       -       n       -       -       smtpd
  -o smtpd_enforce_tls=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp

maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
old-cyrus unix  -       n       n       -       -       pipe
  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
cyrus     unix  -       n       n       -       -       pipe
  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)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
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify

### ClamSMTP + 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=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_helo_restrictions=
        -o smtpd_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

SMTP認証用ファイルの設定


ClamSMTP + ClamAVのインストール


メールサーバの構築に当たり,
http://www.aconus.com/~oyaji/
http://kajuhome.com/tips/tips_05_003.shtml
http://engineersideline.com/debian-gnu-linuxでlinuxサーバー構築/debianのデーモンの設定/outbound-port-25-blocking対応/
を参考にさせて頂きました.
この場を借りてお礼申し上げます.

注 意

このサイト上で提供しているインストール法,設定例を,
適用した結果生じたいかなる障害・損害に対しても,
私(K.Misu)は責任を負いません.
このサイト上で提供している情報を利用する場合は,
各人の自己責任にて判断,適用して下さい.


[ Top of This Page | Index-Page (SW settings) | Index-Page (Top of this site) ]


by K.Misu <webmaster <at> DeleteThiskmisu.net>
(DeleteThisを除いたアドレスに送信して下さい)