Debian EtchにNepenthesしこむ

ハニーポットで検体収集したかったのでnepenthes仕込んでみた
http://nepenthes.mwcollect.org/


Debian etchにはパッケージがあるので

apt-get update
apt-get install nepenthes
で入る。バージョンは0.1.7-3。最新は0.2.2
設定ファイルとかは/etc/nepenthes/
ログは/var/log/nepenthes.log /var/log/nepenthes/

hexdumpsに溜まったファイルをチェック

/usr/sbin/nepenthes -f rmknown,rmnonop,dononp /var/lib/nepenthes/hexdumps

/var/lib/nepenthes/binaries/
に溜まったファイルをhttp://www.virustotal.com/に投げるプログラム


MailSend.pmはここから
http://www.mukairiku.net/PerlModule/MailSend.pm.html

#!/usr/bin/perl
use strict;
use MailSend;


my $dir = "/var/lib/nepenthes/binaries/";
my @file;
my $file;


opendir(DIR, $dir) or die;
@file = sort grep { -f "$dir/$_"} readdir(DIR);
closedir(DIR);


my $msg = < '',
"From" => '', #このアドレスに結果が届きます
"Subject" => 'SCAN',
"Msg" => "$msg",
"Server" => 'localhost',
"User" => '',
"Pass" => '',
"Attach" => "$dir/$file",
);
MailSend(\%data);
}

48時間たったものを送ってますが、この辺はCronを24時間ごとにまわすとかお好みで

せっかく捕獲した検体をviruschekしてみたいなら(avast,avg,antivir)
http://www12.atwiki.jp/linux2ch/pages/78.html
http://www.avast.com/jpn/download-avast-for-linux-edition.html
http://free.grisoft.com/doc/5390/jp/frt/0?prd=afl
http://www.free-av.com/en/download/download_servers.php
とかを利用するとよいかな

Monitを入れてみた

DAGよりredhat9用取得
# wget http://dag.wieers.com/rpm/packages/monit/monit-4.9-2.rh9.rf.i386.rpm
# rpm -Uvh monit-4.9-2.rh9.rf.i386.rpm

# vi /etc/monit.conf

set daemon 120
set logfile syslog facility log_daemon
set mailserver localhost
set alert server@example.jp


set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'


check process nagios with pidfile /var/run/nagios.pid
group nagios
start program = "/etc/init.d/nagios start"
stop program = "/etc/init.d/nagios stop"
if 5 restarts within 5 cycles then timeout


check process nrpe with pidfile /var/run/nrpe.pid
group nagios
start program = "/etc/init.d/nrpe start"
stop program = "/etc/init.d/nrpe stop"
# if failed host localhost port 5666 then restart
if 5 restarts within 5 cycles then timeout

#include /etc/monit.d/*

nagiosとnrpeが死んでいたら起動するように設定
2812のWEBサーバーは自動で必ず起動するようなのでlocalhostしかアクセスできないように

# /etc/init.d/monit start


しばらくしてnagiosとめる
# /etc/init.d/nagios stop
ログでもながめておく
# tail -f /var/log/messages

/var/run/nagios.pidが無いので/etc/init.d/nagios startしてくれるのを確認
これでnagiosが止まることは無いな…

公式のexampleとかいろいろのってます
http://www.tildeslash.com/monit/doc/examples.php

参考
http://labs.unoh.net/2008/03/_monit.html
http://www.simplegimmick.com/2007/08/monitor-processes-using-monit-1-about/
http://d.hatena.ne.jp/sakamoto_yuki/20060512/p1

ドコモメール

会社のnagiosはnagiosml@example.comのようなアドレスで携帯をML登録して
リブート依頼かけたとかわかるようにしているのだが
qmailSPFとかいれてないからなのか、DoCoMo迷惑メール対策でDOMAIN解除
しているにもかかわらず携帯からMLに送ったメール(ezweb.ne.jp or docomo.ne.jp)
が届かなかったりする不便さ

ふと迷惑メール設定のドメイン設定をすべて解除して放置してみたら
携帯からML経由でメールが届いている


やっぱり迷惑メール設定なのかSPF


http://www.nttdocomo.co.jp/service/mail/imode_mail/sender_id/
暇見て理解しとかんと…

追記(08/04/07)
MLとかはこの設定で届くと
http://www.nttdocomo.co.jp/info/news_release/page/080121_01.html

Mailbox sizeでwarning出す

初期状態ではこんな感じなので

/usr/share/logwatch/default.conf/services/sendmail-largeboxes.conf
Title = "sendmail-largeboxes (large mail spool files)"
LogFile = NONE
$sendmail_largeboxes_size = 40MB

mailboxの容量をいじっているなら変更する
/var/spool/mail/username
のときだけ有効なのかなぁ

/home/username/Mailbox
とかどういじるのか調べる…sendmail-largeboxesだからmbox形式のみか…

Debian Etch Xen

Pentium4 Prescott 4Mhzの修理が終わりAOPENから帰ってきたのでDebian Etchを放り込んでXenで仮想サーバーを構築することに


必要なもの全てをaptで入れる
# apt-get install xen-linux-system-2.6.18-5-xen-686 libc6-xen xen-tools bridge-utils


grubも自動で変えてくれる
# cat /boot/grub/menu.lst


# uname -a
Linux debian 2.6.18-5-xen-686 #1 SMP Wed Oct 3 04:02:16 UTC 2007 i686 GNU/Linux


HVM完全仮想化パッケージ(CPUが対応しているならいれる)
# apt-get install xen-ioemu-3.0.3-1
less /etc/xen/xend-config.sxp


HVM(Hardware Virtual Machine)
VT(Virtualization Technology)
対応CPUは本家より
http://wiki.xensource.com/xenwiki/HVM_Compatible_Processors

2.10 rpmができていたのでバージョンアップ

wget http://dag.wieers.com/rpm/packages/nagios/nagios-2.10-1.rh9.rf.i386.rpm
rpm -Uvh nagios-2.10-1.rh9.rf.i386.rpm
Preparing... ########################################### [100%]
1:nagios 警告: /etc/nagios/cgi.cfg created as /etc/nagios/cgi.cfg.rpmnew
警告: /etc/nagios/commands.cfg created as /etc/nagios/commands.cfg.rpmnew
警告: /etc/nagios/nagios.cfg created as /etc/nagios/nagios.cfg.rpmnew
警告: /etc/nagios/resource.cfg created as /etc/nagios/resource.cfg.rpmnew
########################################### [100%]

特に設定内容見ても変更なかったので問題なく稼動

Nagios 2.10 release

2.9からの変更点は下記
http://www.nagios.org/development/changelog.php#2x_branch

とりあえず監視サーバーは
# rpm -qa | grep nagios
nagios-2.9-1.rh9.rf
ということだったので
DAGのRPMパッケージ待ち
http://dag.wieers.com/rpm/packages/nagios/


ネットワーク監視ツール「Nagios Plugins」にシステムアクセスの脆弱性
http://japan.zdnet.com/security/story/0,3800079245,20358319,00.htm
Nagios Plugins バージョン 1.4.10にアップデートすること


[ZDNet Japan] Nagiosの可視化アドオン「NagVis」1.1.1と1.2b同時リリース
http://news.livedoor.com/article/detail/3354960/

こんなのもあったのか…