[postfix]
#まずはclamavのインストール
#ユーザclamavを追加
[root@sample clamav-0.87]# groupadd clamav
[root@sample clamav-0.87]# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
#configureしてインストール
[root@sample clamav-0.87]# ./configure --sysconfdir=/etc
[root@sample clamav-0.87]# make
[root@sample clamav-0.87]# make install
#スキャンのテスト
[root@sample clamav-0.87]# clamscan -r -i /usr/local/src/clamav-0.87 /usr/local/src/clamav-0.87/test/clam.cab: ClamAV-Test-File FOUND /usr/local/src/clamav-0.87/test/clam.exe: ClamAV-Test-File FOUND /usr/local/src/clamav-0.87/test/clam.rar: ClamAV-Test-File FOUND /usr/local/src/clamav-0.87/test/clam.zip: ClamAV-Test-File FOUND /usr/local/src/clamav-0.87/test/clam.exe.bz2: ClamAV-Test-File FOUND ----------- SCAN SUMMARY ----------- Known viruses: 40192 Engine version: 0.87 Scanned directories: 44 Scanned files: 740 Infected files: 5 Data scanned: 10.83 MB Time: 4.506 sec (0 m 4 s)
#ログファイルを作成 [root@sample clamav-0.87]# touch /var/log/clam-update.log
[root@sample clamav-0.87]# chmod 600 /var/log/clam-update.log
[root@sample clamav-0.87]# chown clamav /var/log/clam-update.log
#freshclam設定ファイル(/etc/freshclam.conf)の編集 (変更箇所は以下の通り)
#Example LogVerbose Checks 24
#freshclamのログ用ファイルを作成
[root@sample clamav-0.87]# touch /var/log/freshclam.log
[root@sample clamav-0.87]# chown clamav:clamav /var/log/freshclam.log
#ウィルス定義ファイルのアップデート
[root@sample clamav-0.87]# freshclam -d
#clamd設定ファイル(clamd.conf)の編集 (変更箇所は以下の通り)
#Example LogFile /var/log/clamd.log LogTime PidFile /var/run/clamd.pid LocalSocket /tmp/clamd FixStaleSocket User clamav
#clamdを起動
clamd
#起動時にclamdが起動するよう/etc/rc.localに以下の二行を記述
/usr/local/bin/freshclam -d
/usr/local/sbin/clamd
#----amavisのインストール----#
まず下準備
#amavisユーザの作成
[root@sample mtroot]# groupadd amavis
[root@sample mtroot]# useradd -g amavis -c "quot;Amavis User"quot; -s /bin/false amavis
#virusalertユーザの作成(Virusファイルがみつかった場合に警告メールが届く)
[root@sample mtroot]# useradd -s /bin/false virusalert
#arc archiverをRPMにてインストール
[root@sample src]# wget ftp://rpmfind.net/linux/fedora/extras/3/i386/arc-5.21j-1.i386.rpm [root@sample src]# rpm -ivh ./arc-5.21j-1.i386.rpm 警告: ./arc-5.21j-1.i386.rpm: V3 DSA signature: NOKEY, key ID 1ac70ce6 Preparing... ########################################### [100%] 1:arc ########################################### [100%] #unarjをRPMにてインストール [root@sample src]# rpm -ivh ./unarj-2.43-13.i386.rpm Preparing... ########################################### [100%] 1:unarj ########################################### [100%]
#unrarをRPMにてインストール
[root@sample src]# rpm -ivh ./unrar-3.3.6-1.fr.i386.rpm
#zooをRPMにてインストール
[root@sample src]# rpm -ivh ./zoo-2.10-2.2.el4.rf.i386.rpm
#amavisに必要なPerlモジュールをCPANからインストール
perl -MCPAN -e shellとしたのち以下のように順番にモジュールをインストール
install Unix::Syslog install Convert::UUlib install Convert::TNEF install Compress::Zlib install Archive::Tar install Archive::Zip install G/GB/GBARR/MailTools-1.15.tar.gz install MIME::Tools install libnet
#amavisのダウンロード
[root@sample src]# wget http://www.amavis.org/dist/perl/amavis-0.3.13pre2.tar.gz [root@sample src]# tar xvzf amavis-0.3.13pre2.tar.gz [root@sample amavis-0.3.13pre2]# cd amavis-0.3.13pre2
#amavisのconfigure
./configure
** Configuration summary for amavis 0.3.13pre2 "quot;2004-01-28"quot;:
Install amavis as: ${exec_prefix}/sbin/amavis
Configured for use with: postfix
Configuration type: SMTP
Use virus scanner(s): Clam Antivirus Clam Antivirus Daemon
Scanner runs as: amavis
Logging to syslog: yes
Run-time directory: /var/amavis
Quarantine directory: /var/virusmails
Max. recursion depth: 20
Max. archive nesting depth: 3
Max. number of extracted files: 500
Add X-Virus-Scanned header: yes
Display AMaViS credits: no
Reports sent to: virusalert
Reports sent by: postmaster
To accept the above, type "quot;make"quot;
#makeしてmake install
make
make isntall
#postfixの設定ファイルを編集
/etc/postfix/main.cfに以下の一行を追加
content_filter = amavis:[127.0.0.1]:10025;
/etc/postfix/master.cfに以下の九行を追加
amavis unix - n n - 10 pipe user=amavis argv=/usr/sbin/amavis ${sender} ${recipient}
localhost: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/8
#postfixをリロード
[root@sample mqueue]# /etc/rc.d/init.d/postfix reload
あとは実際にウィルスメール(eicarファイル)を送信して、ウィルスとしてはじかれるかどうか確認してください。
関連記事
postfix relayhost
smtpd_client_connection_rate_limit - 同一クライアントからの接続制限
smtpd_recipient_limit - 同時配信数の制限
fatal: unsupported dictionary type: sdbm
postfixadmin + mysql + courier-imapによるバーチャルドメイン
postfixadminでメールボックスが作成されない
fatal: execvp script_path: Permission denied
postfix - rblの参照
postfix + spamassassin
postfixでのsmtp auth
postfix + amavis + clamav のインストール(RPM編)
postfix - postalias
postfix - メールのサイズ制限
postfix - 基本設定
postfix - pop before smtp
postfix - MaildirとMailbox形式の切り替え
postfix - dracd.dbのエラー
postfix + amavis + clamのインストール
postfix - キューの削除
postfix - transport
postfix - 逆引きが引けないアドレスからのメールを拒否
smtpd_client_connection_rate_limit - 同一クライアントからの接続制限
smtpd_recipient_limit - 同時配信数の制限
fatal: unsupported dictionary type: sdbm
postfixadmin + mysql + courier-imapによるバーチャルドメイン
postfixadminでメールボックスが作成されない
fatal: execvp script_path: Permission denied
postfix - rblの参照
postfix + spamassassin
postfixでのsmtp auth
postfix + amavis + clamav のインストール(RPM編)
postfix - postalias
postfix - メールのサイズ制限
postfix - 基本設定
postfix - pop before smtp
postfix - MaildirとMailbox形式の切り替え
postfix - dracd.dbのエラー
postfix + amavis + clamのインストール
postfix - キューの削除
postfix - transport
postfix - 逆引きが引けないアドレスからのメールを拒否
広告