CONTENTS
Lastmodified 2022-02-08 (火) 10:47:02
例によってportupgradeした後で、/var/amavis/amavisd.sock が生成されなくなって・・・
kernel: Starting amavisd. Jun 14 07:09:16 amavis[996]: starting. /usr/local/sbin/amavisd at FQDN amavisd-new-2.10.1 (20141025), Unicode aware Jun 14 07:09:16 amavis[1004]: starting. /usr/local/sbin/amavisd at FQDN amavisd-new-2.10.1 (20141025), Unicode aware Jun 14 07:09:20 amavis[1006]: (!)Net::Server: 2016/06/14-07:09:20 Can't connect to UNIX socket at file /var/amavis/amavisd.sock [Address already in use]\n at line 70 in file /usr/local/lib/perl5/site_perl/Net/Server/Proto/UNIX.pm Jun 14 07:09:20 kernel: Starting clamav_clamd. Jun 14 07:09:20 amavis[1005]: Net::Server: Group Not Defined. Defaulting to EGID '106 106' Jun 14 07:09:20 amavis[1005]: Net::Server: User Not Defined. Defaulting to EUID '106' Jun 14 07:09:20 amavis[1005]: Module Amavis::Conf 2.404 Jun 14 07:09:20 amavis[1005]: Module Archive::Zip 1.57 Jun 14 07:09:20 amavis[1005]: Module BerkeleyDB 0.55
という風なエラー。
top では、amavisdのプロセスは起動しているものの、そのプロセスファイルが行方不明。
/var/amavis/amavisd.pid などが無いため、/usr/local/etc/rc.d/amavisd status 等のコマンドが正常動作しなくなっている。
monitなどで死活監視してると、延々とコンソールにエラーが・・・・
種々やった中で好奏したのが・・・w
987 10:03 locate amavisd-new 988 10:03 cd /usr/ports/security/amavisd-new 989 10:03 make config 991 10:04 make rmconfig 992 10:04 make config 993 10:05 portupgrade -fr security/amavisd-new
わらわらとportupgrade -r したら、amavisd がうごかなくなった。
再インストールしても、状況変わらず。
どうやら、なんか、依存しているパッケージがおかしくなったっぽい。で、portの依存関係をしらべてみる。
# cd /usr/ports/security/amavisd-new root@blackcube:/usr/ports/security/amavisd-new # make all-depends-list
/usr/ports/sysutils/p5-Unix-Syslog /usr/ports/mail/p5-MIME-Tools /usr/ports/converters/p5-Convert-TNEF /usr/ports/converters/p5-Convert-UUlib /usr/ports/archivers/p5-Archive-Zip /usr/ports/net/p5-Net-Server /usr/ports/mail/p5-Mail-DKIM /usr/ports/net/p5-IO-Socket-INET6 /usr/ports/databases/p5-BerkeleyDB /usr/ports/databases/p5-DBD-mysql /usr/ports/mail/p5-Mail-SpamAssassin /usr/ports/sysutils/file /usr/ports/archivers/unrar /usr/ports/archivers/arj /usr/ports/archivers/lha /usr/ports/archivers/arc /usr/ports/archivers/cabextract /usr/ports/archivers/rpm2cpio /usr/ports/archivers/zoo /usr/ports/archivers/lzop /usr/ports/archivers/freeze /usr/ports/archivers/p7zip /usr/ports/textproc/ripole /usr/ports/lang/perl5.14 /usr/ports/converters/p5-Convert-BinHex /usr/ports/devel/p5-IO-stringy /usr/ports/mail/p5-Mail-Tools /usr/ports/devel/p5-IO-Multiplex /usr/ports/net/p5-Socket6 /usr/ports/security/p5-Crypt-OpenSSL-RSA /usr/ports/dns/p5-Net-DNS /usr/ports/databases/db47 /usr/ports/databases/p5-DBI /usr/ports/security/p5-Crypt-SSLeay /usr/ports/databases/mysql51-client /usr/ports/net-mgmt/p5-NetAddr-IP /usr/ports/www/p5-HTML-Parser /usr/ports/www/p5-libwww /usr/ports/converters/p5-Encode-Detect /usr/ports/security/p5-IO-Socket-SSL /usr/ports/security/gnupg1 /usr/ports/mail/razor-agents /usr/ports/devel/libtool /usr/ports/devel/gmake /usr/ports/devel/autoconf /usr/ports/archivers/lzo2 /usr/ports/devel/p5-TimeDate /usr/ports/security/p5-Crypt-OpenSSL-Bignum /usr/ports/security/p5-Crypt-OpenSSL-Random /usr/ports/security/p5-Digest-HMAC /usr/ports/dns/p5-Net-LibIDN /usr/ports/www/p5-LWP-Protocol-https /usr/ports/www/p5-HTML-Tagset /usr/ports/security/p5-Authen-NTLM /usr/ports/converters/p5-Encode-Locale /usr/ports/sysutils/p5-File-Listing /usr/ports/www/p5-HTTP-Cookies /usr/ports/www/p5-HTTP-Daemon /usr/ports/www/p5-HTTP-Date /usr/ports/www/p5-HTTP-Message /usr/ports/www/p5-HTTP-Negotiate /usr/ports/www/p5-LWP-MediaTypes /usr/ports/net/p5-Net-HTTP /usr/ports/net/p5-URI /usr/ports/www/p5-WWW-RobotRules /usr/ports/devel/p5-ExtUtils-CBuilder /usr/ports/devel/p5-Module-Build /usr/ports/security/p5-Net-SSLeay /usr/ports/net/p5-IO-Socket-IP /usr/ports/net/p5-Socket /usr/ports/ftp/curl /usr/ports/devel/gettext /usr/ports/security/p5-Digest-SHA1 /usr/ports/converters/libiconv /usr/ports/devel/m4 /usr/ports/misc/help2man /usr/ports/devel/autoconf-wrapper /usr/ports/dns/libidn /usr/ports/www/p5-Mozilla-CA /usr/ports/devel/p5-IO-HTML /usr/ports/security/ca_root_nss /usr/ports/devel/p5-Locale-gettext /usr/ports/devel/pkgconf root@blackcube:/usr/ports/security/amavisd-new #
うわっ、こんなにある・・・。ということで、まず、リーフパッケージを掃除してみてから・・・ってことにする
# pkg_cleanup
で、amavisd-new とその依存リーフパッケージを削除。
http://gihyo.jp/admin/clip/01/fdt/201111/28
portinstall security/amavisd-new
依然として起動せず。(;。;)
reload オプションを試してみる。
root@blackcube:/root # /usr/local/etc/rc.d/amavisd reload ERROR: MISSING REQUIRED BASIC MODULES: IO::Stringy Unix::Syslog BEGIN failed--compilation aborted at /usr/local/sbin/amavisd line 246.
root@blackcube:/root # portupgrade -fr p5-IO-stringy-2.110 root@blackcube:/root # /usr/local/etc/rc.d/amavisd reload ERROR: MISSING REQUIRED BASIC MODULES: Unix::Syslog BEGIN failed--compilation aborted at /usr/local/sbin/amavisd line 246.
root@blackcube:/root # portupgrade -rf p5-Unix-Syslog-1.1
root@blackcube:/root # /usr/local/etc/rc.d/amavisd reload Problem in Amavis::DKIM code: Can't locate Crypt/OpenSSL/RSA.pm in @INC (@INC contains: /usr/local/lib/perl5/5.14/BSDPAN /usr/local/lib/perl5/site_perl/5.14/mach /usr/local/lib/perl5/site_perl/5.14 /usr/local/lib/perl5/5.14/mach /usr/local/lib/perl5/5.14) at (eval 97) line 50. BEGIN failed--compilation aborted at (eval 97) line 50.
root@blackcube:/root # portupgrade -rf p5-Crypt-OpenSSL-RSA-0.28
root@blackcube:/root # /usr/local/etc/rc.d/amavisd reload Problem in Amavis::Unpackers code: Can't locate Archive/Zip.pm in @INC (@INC contains: /usr/local/lib/perl5/5.14/BSDPAN /usr/local/lib/perl5/site_perl/5.14/mach /usr/local/lib/perl5/site_perl/5.14 /usr/local/lib/perl5/5.14/mach /usr/local/lib/perl5/5.14) at (eval 119) line 33. BEGIN failed--compilation aborted at (eval 119) line 33.
root@blackcube:/root # portupgrade -rf p5-Archive-Zip-1.30_1
root@blackcube:/root # /usr/local/etc/rc.d/amavisd reload Problem in Amavis::Unpackers code: Can't locate Convert/UUlib.pm in @INC (@INC contains: /usr/local/lib/perl5/5.14/BSDPAN /usr/local/lib/perl5/site_perl/5.14/mach /usr/local/lib/perl5/site_perl/5.14 /usr/local/lib/perl5/5.14/mach /usr/local/lib/perl5/5.14) at (eval 119) line 35. BEGIN failed--compilation aborted at (eval 119) line 35.
root@blackcube:/root # portupgrade -rf p5-Convert-UUlib-1.40,1
root@blackcube:/root # /usr/local/etc/rc.d/amavisd reload The amavisd daemon is apparently not running, no PID file /var/amavis/amavisd.pid
root@blackcube:/root # /usr/local/etc/rc.d/amavisd start Starting amavisd.
うっ・・・うごいた!ヽ(^。^)丿
と思ったら、エラー吐かずに動かない状態ですた。大泣き
どうやら、p5-関連で転けてる風味なので、
root@blackcube:/usr/ports/security/amavisd-new # make all-depends-list | grep p5- /usr/ports/sysutils/p5-Unix-Syslog /usr/ports/mail/p5-MIME-Tools /usr/ports/converters/p5-Convert-TNEF /usr/ports/converters/p5-Convert-UUlib /usr/ports/archivers/p5-Archive-Zip /usr/ports/net/p5-Net-Server /usr/ports/mail/p5-Mail-DKIM /usr/ports/net/p5-IO-Socket-INET6 /usr/ports/databases/p5-BerkeleyDB /usr/ports/databases/p5-DBD-mysql /usr/ports/mail/p5-Mail-SpamAssassin /usr/ports/converters/p5-Convert-BinHex /usr/ports/devel/p5-IO-stringy /usr/ports/mail/p5-Mail-Tools /usr/ports/devel/p5-IO-Multiplex /usr/ports/net/p5-Socket6 /usr/ports/security/p5-Crypt-OpenSSL-RSA /usr/ports/dns/p5-Net-DNS /usr/ports/databases/p5-DBI /usr/ports/security/p5-Crypt-SSLeay /usr/ports/net-mgmt/p5-NetAddr-IP /usr/ports/www/p5-HTML-Parser /usr/ports/www/p5-libwww /usr/ports/converters/p5-Encode-Detect /usr/ports/security/p5-IO-Socket-SSL /usr/ports/devel/p5-TimeDate /usr/ports/security/p5-Crypt-OpenSSL-Bignum /usr/ports/security/p5-Crypt-OpenSSL-Random /usr/ports/security/p5-Digest-HMAC /usr/ports/dns/p5-Net-LibIDN /usr/ports/www/p5-LWP-Protocol-https /usr/ports/www/p5-HTML-Tagset /usr/ports/security/p5-Authen-NTLM /usr/ports/converters/p5-Encode-Locale /usr/ports/sysutils/p5-File-Listing /usr/ports/www/p5-HTTP-Cookies /usr/ports/www/p5-HTTP-Daemon /usr/ports/www/p5-HTTP-Date /usr/ports/www/p5-HTTP-Message /usr/ports/www/p5-HTTP-Negotiate /usr/ports/www/p5-LWP-MediaTypes /usr/ports/net/p5-Net-HTTP /usr/ports/net/p5-URI /usr/ports/www/p5-WWW-RobotRules /usr/ports/devel/p5-ExtUtils-CBuilder /usr/ports/devel/p5-Module-Build /usr/ports/security/p5-Net-SSLeay /usr/ports/net/p5-IO-Socket-IP /usr/ports/net/p5-Socket /usr/ports/security/p5-Digest-SHA1 /usr/ports/www/p5-Mozilla-CA /usr/ports/devel/p5-IO-HTML /usr/ports/devel/p5-Locale-gettext root@blackcube:/usr/ports/security/amavisd-new #
もう、上から順番に、
portupgrade -rf devel/p5-IO-Multiplex net/p5-Socket6 security/p5-Crypt-OpenSSL-RSA dns/p5-Net-DNS databases/p5-DBI security/p5-Crypt-SSLeay net-mgmt/p5-NetAddr-IP www/p5-HTML-Parser www/p5-libwww converters/p5-Encode-Detect security/p5-IO-Socket-SSL devel/p5-TimeDate
みたいに、強制UPさせて、/usr/local/etc/rc.d/amavisd start /usr/local/etc/rc.d/amavisd reload してみたら、
root@blackcube:/usr/ports/security/amavisd-new # /usr/local/etc/rc.d/amavisd start Starting amavisd. root@blackcube:/usr/ports/security/amavisd-new # /usr/local/etc/rc.d/amavisd reload Signalling a SIGHUP to a running daemon [12278] root@blackcube:/usr/ports/security/amavisd-new # /usr/local/etc/rc.d/amavisd start amavisd already running? (pid=12278).
なんか、今度は、動いたっぽい! (?_?)
http://forums.freebsd.org/showthread.php?t=16379
WARNING: failed to start amavisdと言ってamavisdが起ち上がらない。 こうなると、connect to 127.0.0.1[127.0.0.1]:10024: Connection refused となって、メールがmailqにたまって不達となる。
コンソールで、
# /usr/local/etc/rc.d/amavisd start
してもダメなときは、さっさと
# rm -r /var/amavis
して、amavisd-newを再インストールする、ヨロシ。( ̄^ ̄)ゞ
VirusScan on FreeBSD 9.0R
amavisd-new のインストール
# cd /usr/ports/security/amavisd-new # make deinstall # cp Makefile Makefile_dist # vi Makefile
--------------------------------- - AMAVISUSER?= vscan #この部分を - AMAVISGROUP?= vscan --------------------------------- + AMAVISUSER?= clamav #このように編集 + AMAVISGROUP?= clamav ---------------------------------
# portinstall security/amavisd-new # rehash # /usr/local/etc/rc.d/amavisd start # /usr/local/etc/rc.d/amavisd status amavisd is running as pid 12663.
/var/log/console.log
Apr 1 09:24:35 flora kernel: Mon Apr 1 09:24:35 JST 2013 Apr 1 13:35:41 flora kernel: Apr 1 13:35:41 flora kernel: pid 1418 (clamd), uid 110, was killed: out of swap space Apr 1 16:41:59 flora kernel: Apr 1 16:41:59 flora postfix/scache[2967]: fatal: unexpected command-line argument: user=clamav Apr 1 16:43:02 flora kernel: Apr 1 16:43:01 flora postfix/scache[2972]: fatal: unexpected command-line argument: user=clamav
と言うわけで、pid 1418 (clamd)が落ちてるわけで・・・スクリプトで動作確認して落ちてたら上げる、って目論見だけど
flora{102} % ps aux | grep clamd clamav 1420 0.0 6.9 182920 16344 ?? Is 5:43PM 0:00.00 /usr/local/sbin/clamd root 1627 0.0 0.6 9636 1492 0 S+ 5:47PM 0:00.00 grep clamd
flora{103} % ps aux | grep clamav clamav 1415 0.0 1.7 83356 4056 ?? Ss 5:41PM 0:10.83 /usr/local/sbin/amavisd (master) (perl) clamav 1418 0.0 1.4 84172 3300 ?? I 5:42PM 0:00.04 /usr/local/sbin/amavisd (virgin child) (perl) clamav 1419 0.0 0.0 84172 0 ?? IW - 0:00.00 /usr/local/sbin/amavisd (virgin child) (perl) clamav 1420 0.0 6.9 182920 16344 ?? Is 5:43PM 0:00.00 /usr/local/sbin/clamd clamav 1423 0.0 1.5 21100 3592 ?? Is 5:45PM 0:03.57 /usr/local/bin/freshclam --daemon -p /var/run/clamav/freshclam.pid root 1629 0.0 0.6 9636 1492 0 S+ 5:48PM 0:00.00 grep clamav
どっちがよいのでしょうか?
参考URL
多量のspamが来て/usr/local/sbin/spamass-milter が停止
killedでclamd が動かなくなり、spam判定がスルーされて「***UNCHECKED***」がつきます。
これを避ける為にaddhock だけど、スクリプトを仕掛けcronで10分に1回監視する。
以下が /etc/crontab に追加した行、10分に1回立ち上がります。
10 * * * * root /root/bin/checkclamd.sh
checkclamd.shの内容
clamdというプロセスがあるかどうか調べ無かったら立ち上げたあと、再起動したよというレポートをpostmaster に送る。
#!/usr/local/bin/bash r=`ps -ax | grep clamd | grep -v grep` if [ "$r" == "" ] then /usr/local/etc/rc.d/clamav-clamd start echo "clamd@mail was down, it is UP now" | mail -s "clamd @mail_kuji-clinic.info was DOWN!" postmaster@kuji-clinic.info fi exit 0
これで安心。チェックする間隔があまりにも短いとまだswapが足りなくなっている状態で再起動するため起動しないかもしれません。(10分でいいかどうかもわかりませんが)
抜本的には多量のspamが来てもいいよう高速のCPUと大容量のメモリを搭載する、ヨロシ。
Total access 5764:本日 1:昨日 0