sendmail ではリレーの制御を /etc/mail/access で行う。 (postfix でも同様の /etc/postfix/access があるが書式は異なる)
[タグ] :[ターゲット](タブ|空白)[アクション]
access を変更したら、DB形式に変換する(aliasese同様)
# cd /etc/mail # vi access (修正) # Check the /usr/share/doc/sendmail/README.cf file for a description # of the format of this file. (search for access_db in that file) # The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc # package. # # by default we allow relaying from localhost... Connect:localhost.localdomain RELAY Connect:localhost RELAY Connect:127.0.0.1 RELAY Connect:192.168.151.0 RELAY # makemap -v hash access.db < access key=`connect:localhost.localdomain', val=`RELAY' key=`connect:localhost', val=`RELAY' key=`connect:127.0.0.1', val=`RELAY' key=`connect:192.168.151.0', val=`RELAY'* CentOS では、詳しいドキュメントは sendmail-doc パッケージに含まれる。
RBL(TM)はトレンドマイクロ社の登録商標であり、一般的には DNSBL (DNS Blackhole List) と呼称する。
迷惑メールや不正DNSなどのホスト名を収集したリスト。Realtime black list, block list など様々な呼び方がある。
基本的には、検証したいドメイン名に続けて、RBLサイトのドメインを連結したホスト名で A レコードがあれば、
迷惑サイトという扱いになる。
例) xxx.com が RBL に該当するかどうかを確認 $ nslookup xxx.com.RBL-DOMAIN 同様に IP 1.2.3.4 について検査する場合は $ nslookup 4.3.2.1.RBL-DOMAIN主な RBLサイト
ドメイン | 概要 |
---|---|
sbl-xbl.spamhaus.org | spamhaus NPO, SBL/XBL/PBL/DBLなど多くの情報を提供。 |
bl.spamcop.net | SpamCop社によるSPAMおよび中継ホストリスト |
list.dsbl.org | |
virus.rbl.jp | ウイルスが発信された IP アドレス |
short.rbl.jp | SPAM が発信された IP アドレス |
all.rbl.jp | virus.rbl.jp と short.rbl.jp の合算 |
url.rbl.jp | SMAP中にあるURLのホスト |
dyndns.rbl.jp | SPAM中のダイナミックDNSホスト |
Server | Client | |
← | AUTH PLAIN | |
334 | → | |
VVNFUgBVU0VSAFBBU1MKCg== | ← | Base64(USER\0USER\0PASS) |
235 | → |
Server | Client | |
← | AUTH LOGIN | |
334 Base64("Username:") | → | VXNlcm5hbWU6 |
← | Base64(USER) | |
334 Base64("Password:") | → | UGFzc3dvcmQ6 |
← | Base64(PASS) | |
235 | → |
Server | Client | |
← | AUTH CRAM-MD5 | |
334 Base64(Time) | → | |
← | Base64(USER+MD5(TIME,PASS)) | |
235 | → |
$ echo "Login:" | perl -MMIME::Base64 -ne 'print encode_base64($_."\n");' TG9naW46Cgo=
#mailbox_command = /some/where/procmail #mailbox_command = /some/where/procmail -a "$EXTENSION" # ycos enable mailbox_command = /usr/bin/procmail # 追加
20MB以上のメールは破棄する
:0
* > 20000000
/dev/null
レシピのフォーマット | 各種設定 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
ClamAV の導入(9-8)
ClamAV はフリーのウイルススキャナで、ファイル、ディレクトリ、標準入力からウイルスを検知する。
# yum install clamav clamd : Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: clamav i386 0.97.5-2.el5.rf rpmforge 2.2 M clamd i386 0.97.5-2.el5.rf rpmforge 243 k Installing for dependencies: clamav-db i386 0.97.5-2.el5.rf rpmforge 34 M Transaction Summary ================================================================================ Install 3 Package(s) Upgrade 0 Package(s) :
# freshclam ClamAV update process started at Wed Aug 8 08:20:49 2012 main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven) Downloading daily.cvd [100%] daily.cvd updated (version: 15229, sigs: 250067, f-level: 63, builder: jesler) Downloading bytecode.cvd [100%] bytecode.cvd updated (version: 188, sigs: 38, f-level: 63, builder: neo) :
# /etc/init.d/clamd start Starting Clam AntiVirus Daemon: [ OK ] (http://www.eicar.org/85-0-Download.html からテストウイルス入手) $ http://www.eicar.org/download/eicarcom2.zip # clamscan -r /home/ /home/user/.bash_logout: OK /home/user/john179w2.zip: OK /home/user/.elinks/globhist: OK : /home/user/tmp/eicarcom2.zip: Eicar-Test-Signature FOUND /home/user/html: Symbolic link : ----------- SCAN SUMMARY ----------- Known viruses: 1293663 Engine version: 0.97.5 Scanned directories: 24 Scanned files: 320 Infected files: 1 Data scanned: 79.60 MB Data read: 38.17 MB (ratio 2.09:1) Time: 35.916 sec (0 m 35 s) # ls -l /var/log/clamav/ total 28 -rw-r----- 1 clamav clamav 19719 Aug 10 08:44 clamd.log -rw-r----- 1 clamav clamav 4267 Aug 10 08:44 freshclam.log # tail /var/log/clamav/clamd.log Fri Aug 10 08:42:58 2012 -> SelfCheck: Database status OK. Fri Aug 10 08:44:09 2012 -> Reading databases from /var/clamav Fri Aug 10 08:44:19 2012 -> Database correctly reloaded (1293669 signatures)
# chkconfig --level 2345 clamd on # vi /etc/cron.daily/freshclam #!/bin/sh PATH=/sbin:/usr/sbin:/bin/:/usr/bin ### A simple update script for the clamav virus database. ### This could as well be replaced by a SysV script. /usr/bin/freshclam --quiet # ycos add 2012/08/08 /usr/bin/clamscan -ir /home /tmp /var/tmp /var/spool/mail
AMaVis はオープンソースのメールフィルターで、添付ファイルの展開、解凍などを行います。
ClamAV と連携させることで、ウイルス付きメールを遮断することができます。
# yum -y install amavisd-new : ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: amavisd-new i386 2.6.6-3.el5.rf rpmforge 857 k Installing for dependencies: altermime i386 0.3.10-1.el5.rf rpmforge 55 k arc i386 5.21p-1.el5.rf rpmforge 64 k arj i386 3.10.22-6.el5 epel 169 k cabextract i386 1.4-1.el5.rf rpmforge 49 k freeze i386 2.5.0-9.el5 epel 26 k lha i386 1.14i-19.2.2.el5.rf rpmforge 48 k lzo i386 2.06-1.el5.rf rpmforge 135 k lzop i386 1.03-2.el5 epel 52 k ncompress i386 4.2.4-47 base 23 k nomarch i386 1.4-2.el5 epel 17 k p7zip i386 9.20.1-2.el5 epel 748 k perl-Archive-Zip noarch 1.16-1.2.1 base 138 k perl-BerkeleyDB i386 0.43-1.el5.rf rpmforge 271 k perl-Convert-BinHex noarch 1.119-5.el5 epel 47 k perl-Convert-TNEF noarch 0.17-7.el5 epel 19 k perl-Convert-UUlib i386 2:1.4-1.el5 epel 229 k perl-Crypt-OpenSSL-RSA i386 0.28-1.el5.rf rpmforge 61 k perl-Crypt-OpenSSL-Random i386 0.04-7.el5 epel 21 k perl-Digest-SHA i386 5.71-1.el5.rf rpmforge 93 k perl-Email-Date-Format noarch 1.002-4.el5 epel 15 k perl-IO-stringy noarch 2.110-5.el5 epel 70 k perl-MIME-Lite noarch 3.028-1.el5.rf rpmforge 97 k perl-MIME-tools noarch 5.420-3.el5 epel 285 k perl-Mail-DKIM noarch 0.39-1.el5.rf rpmforge 129 k perl-MailTools noarch 2.09-1.el5.rf rpmforge 100 k perl-Net-Server noarch 0.99-1.el5.rf rpmforge 171 k perl-Pod-Escapes noarch 1.04-5.el5 epel 15 k perl-Pod-Simple noarch 3.16-1.el5.rf rpmforge 212 k perl-Test-Pod noarch 1.45-1.el5.rf rpmforge 13 k perl-TimeDate noarch 1:1.16-5.el5 base 32 k perl-Unix-Syslog i386 1.1-1.el5.rf rpmforge 51 k ripole i386 0.2.0-1.2.el5.rf rpmforge 47 k unrar i386 4.2.3-1.el5.rf rpmforge 123 k zoo i386 2.10-2.2.el5.rf rpmforge 71 k Transaction Summary ================================================================================ Install 35 Package(s) Upgrade 0 Package(s) :
# Run as another user (clamd must be started by root for this option to work) # Default: don't drop privileges #User clamav User root
# AMaViSd smtp-amavis unix - - n - 10 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_commands=yes -o disable_dns_lookups=yes 127.0.0.1:10025 inet n - n - - smtpd -o content_filter= -o local_recipient_maps= -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8master.cf ファイルのフォーマットは以下の通りで、各項目は空白またはタブで区切る。
# コメント | |||||||
サービス名 service |
タイプ type |
当事者 private |
権限なし unpriviledged |
場所制約 Chroot |
自動起動 Wake up time [s] |
プロセス数 Wake up time [s] |
コマンドと引数 Command name + arguments |
# for AMaViSd / ycos 2012/08/10 content_filter = smtp-amavis:[127.0.0.1]:10024
$ mutt -a tmp/eicarcom2.zip -s "Test virus" root ( 内容を確認し、'y' で送信)当該ログ (/var/log/maillog)
Aug 10 14:17:07 localhost postfix/qmgr[24208]: 847932900126: from=<virusalert@bbtec.net>, size=2365, nrcpt=1 (queue active) Aug 10 14:17:07 localhost postfix/smtpd[24219]: disconnect from localhost.localdomain[127.0.0.1] Aug 10 14:17:07 localhost amavis[23412]: (23412-03) Blocked INFECTED (Eicar-Test-Signature), <user@softbank219198124025.bbtec.net> -> <root@softbank219198124025.bbtec.net>, quarantine: virus-SU83CKwB2G4u, Message-ID: <20120810051707.GA24247@softbank219198124025.bbtec.net>, mail_id: SU83CKwB2G4u, Hits: -, size: 1201, 299 ms Aug 10 14:17:07 localhost postfix/smtp[24216]: 3F97C2900128: to=<root@softbank219198124025.bbtec.net>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.32, delays=0.01/0/0.01/0.3, dsn=2.7.0, status=sent (250 2.7.0 Ok, discarded, id=23412-03 - INFECTED: Eicar-Test-Signature) Aug 10 14:17:07 localhost postfix/qmgr[24208]: 3F97C2900128: removed Aug 10 14:17:07 localhost postfix/local[24220]: 847932900126: to=<root@softbank219198124025.bbtec.net>, orig_to=<virusalert@bbtec.net>, relay=local, delay=0.04, delays=0.01/0/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox) Aug 10 14:17:07 localhost postfix/qmgr[24208]: 847932900126: removed届いたメール
From: "Content-filter at softbank219198124025.bbtec.net" <virusalert@bbtec.net> Date: Fri, 10 Aug 2012 14:17:07 +0900 (JST) Subject: VIRUS (Eicar-Test-Signature) in mail FROM <user@softbank219198124025.bbtec.net> To: <virusalert@bbtec.net> This is a multi-part message in MIME format... ------------=_1344575827-23412-0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 7bit A virus was found: Eicar-Test-Signature Scanner detecting a virus: ClamAV-clamd Content type: Virus Internal reference code for the message is 23412-03/SU83CKwB2G4u Return-Path: <user@softbank219198124025.bbtec.net> From: SAMBOA USER <user@softbank219198124025.bbtec.net> Message-ID: <20120810051707.GA24247@softbank219198124025.bbtec.net> Subject: Test virus The message has been quarantined as: virus-SU83CKwB2G4u Notification to sender will not be mailed.
用語補足
APOP : Authenticated POP は、認証部分に MD5 を用いていたが、脆弱性により非推奨
POP3 におけるサーバ認証鍵については、Apache SSL/TLS と同様。
LPIC2 SSL/TLS参照
Tips:
* spamassassin は 5.8 より default install
* ベイジアンネットワーク ... 機械学習(統計解析)