« PTHPasteboard 4.3.0 | メイン | ClamXav »

2008年1月23日

inetd サービスのアクセスログ取得方法

inetd 経由の TCP サービス(telnet, ftp など)のアクセスログを取得するにはOS バージョンにより必要な設定が異なる。

■ Solaris 8 以前

/etc/rc2.d/S72inetsvc と /etc/syslog.conf で設定を行う。

[設定例]

1) OS 起動時、-t オプション付きで inetd が起動するようにオプションの
追加を行う。

ctc# vi /etc/rc2.d/S72inetsvc
:
#
# Run inetd in "standalone" mode (-s flag) so that it doesn't have
# to submit to the will of SAF. Why did we ever let them change inetd?
#
/usr/sbin/inetd -s &
~~~~~~~~~~~~~~~~~~~~
↓ 変更

/usr/sbin/inetd -s -t &
~~
2) inetd のトレース情報は syslog を介して daemon.notice レベルで出力
されるようになっている。もし /etc/syslog.conf に daemon.notice
を出力する設定がない場合は、設定を追加して syslog に SIGHUP を送信
する。(デフォルトでは、daemon.notice 以上は /var/adm/messages に
出力されるようになっているため、通常この手順は必要なし。)

ctc# vi /etc/syslog.conf
:
daemon.notice /var/log/trace.log

ctc# touch /var/log/trace.log

// 指定したファイルが存在していない場合は作成する

ctc# ps -ef | grep syslogd
root 226 1 0 1月 16 ? 0:02 /usr/sbin/syslogd
ctc# kill -HUP 226


3) inetd を再起動するか、システムリブートを行い、inetd が -t オプショ
ン付きで起動するようにする。

ctc# ps -ef | grep inetd
root 142 1 0 1月 09 ? 0:00 /usr/sbin/inetd -s
ctc# kill 142
ctc# /usr/sbin/inetd -s -t &
ctc# ps -ef | grep inetd
root 7678 1 0 17:06:02 ? 0:00 /usr/sbin/inetd -s -t


■ Solaris 9

/etc/default/inetd で設定を行う。
このファイルに ENABLE_CONNECTION_LOGGING=YES と設定することにより、inetd
が -t オプション付きで起動するのと同様の動作となる。
デフォルトの設定は ENABLE_CONNECTION_LOGGING=NO となっている。

[設定例]

ctc# vi /etc/default/inetd
:
# ENABLE_CONNECTION_LOGGING affects the tracing of incoming TCP
# connections, see inetd(1M) for details. The default value is "NO". A
# value of "YES" (any case) results in tracing of connections; any other
# value is ignored.
#
#ENABLE_CONNECTION_LOGGING=NO
ENABLE_CONNECTION_LOGGING=YES << !!

ctc# ps -ef | grep inetd
root 29184 1 0 09:51:41 ? 0:00 /usr/sbin/inetd -s
ctc# kill -HUP 29184
ctc# ps -ef | grep inetd
root 29184 1 1 09:51:41 ? 0:00 /usr/sbin/inetd -s

// ENABLE_CONNECTION_LOGGING=YES で設定した場合、プロセス名
// には -t が付きませんが、実際には設定が有効になっている。

// Solaris 8 以前と同様、daemon.notice レベルで出力されるの
// で、必要があれば前述の 2) で syslog.conf への設定を行う。

--

設定が正しく行われると、リモートホストから telnet 等が行われた際に、
下記の例のようなログが記録される。

[出力例]

10.1.2.3 から ctc10 に rlogin,telnet,ftp を行った時のログ

Oct 21 17:55:16 ctc10 inetd[224]: [ID 317013 daemon.notice] login[1172] from 10.
1.2.3 1005
Oct 21 17:55:50 ctc10 inetd[224]: [ID 317013 daemon.notice] telnet[1186] from 10
.1.2.3 33331
Oct 21 17:26:54 ctc10 inetd[224]: [ID 317013 daemon.notice] ftp[1214] from 10.1.
2.3 33332


■ Solaris 10

Solaris 10 の場合の設定方法については、sdbid: 10120060383 を参照。

投稿者 AJ : 2008年1月23日 20:08

トラックバック

このエントリーのトラックバックURL:
http://www.factory-aj.com/cgi/mtctrl/mt-tb.cgi/279

 
Powered by Movable Type 4.27-ja | RSS1.0 | RSS2.0 | ATOM