Solaris10でsyslogでログイン失敗を記録する
Solaris10でsyslogでログイン失敗を記録する
0.改訂履歴
1.はじめに
このドキュメントでは,Solaris
10にて,ログインエラーをsyslogに残す設定とする手順を説明する.デフォルトではsyslogのauth.noticeが有効になっていない為,
ログイン失敗が記録されない. セキュリティポリシー等でログ記録が求められているので,これを記録する様に設定する.
なお,loghostが有効になってなく,loghost could not be resolvedというエラーがでるので,これを修正してloggerコマンド等を使用して動作を確認する.
2.syslog.cofの設定を行う(auth.notice)
-bash-3.00$ cat /etc/syslog.conf #ident "@(#)syslog.conf 1.5 98/12/14 SMI" /* SunOS 5.0 */ # # Copyright (c) 1991-1998 by Sun Microsystems, Inc. # All rights reserved. # # syslog configuration file. # # This file is processed by m4 so be careful to quote (`') names # that match m4 reserved words. Also, within ifdef's, arguments # containing commas must be quoted. # *.err;kern.notice;auth.notice /dev/sysmsg *.err;kern.debug;daemon.notice;mail.crit /var/adm/messages
*.alert;kern.err;daemon.err operator *.alert root
*.emerg *
# if a non-loghost machine chooses to have authentication messages # sent to the loghost machine, un-comment out the following line: #auth.notice ifdef(`LOGHOST', /var/log/authlog, @loghost)
mail.debug ifdef(`LOGHOST', /var/log/syslog, @loghost)
# # non-loghost machines will use the following lines to cause "user" # log messages to be logged locally. # ifdef(`LOGHOST', , user.err /dev/sysmsg user.err /var/adm/messages user.alert `root, operator' user.emerg * ) -bash-3.00$
|
-
auth.noticeがコメントになっているので,#を消してコメントを外す.
bash-3.00# cat /etc/syslog.conf #ident "@(#)syslog.conf 1.5 98/12/14 SMI" /* SunOS 5.0 */ # # Copyright (c) 1991-1998 by Sun Microsystems, Inc. # All rights reserved. # # syslog configuration file. # # This file is processed by m4 so be careful to quote (`') names # that match m4 reserved words. Also, within ifdef's, arguments # containing commas must be quoted. # *.err;kern.notice;auth.notice /dev/sysmsg *.err;kern.debug;daemon.notice;mail.crit /var/adm/messages
*.alert;kern.err;daemon.err operator *.alert root
*.emerg *
# if a non-loghost machine chooses to have authentication messages # sent to the loghost machine, un-comment out the following line: auth.notice ifdef(`LOGHOST', /var/log/authlog, @loghost)
mail.debug ifdef(`LOGHOST', /var/log/syslog, @loghost)
# # non-loghost machines will use the following lines to cause "user" # log messages to be logged locally. # ifdef(`LOGHOST', , user.err /dev/sysmsg user.err /var/adm/messages user.alert `root, operator' user.emerg * ) bash-3.00#
|
-
設定を有効化させる為に,syslogdを再起動する.
bash-3.00# ps -ef|grep syslog root 383 1 0 5月 2 ? 0:00 /usr/sbin/syslogd bash-3.00# pkill -HUP syslogd bash-3.00# ps -ef|grep syslog root 383 1 0 5月 2 ? 0:00 /usr/sbin/syslogd bash-3.00#
|
3.ログ出力を確認する
bash-3.00# ssh ujpadmin@localhost パスワード: パスワード: パスワード: アクセス権がありません (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive)。 bash-3.00#
|
bash-3.00# ls -lat /var/log/ 合計 192 -rw------- 1 root root 944 5月 30日 16:37 vmware-tools-guestd -rw-r--r-- 1 root root 43540 5月 29日 23:28 Xorg.0.log drwxr-xr-x 5 root sys 512 5月 29日 22:09 . -rw-r--r-- 1 root root 43666 5月 29日 22:06 Xorg.0.log.old drwxr-xr-x 47 root sys 1024 5月 29日 21:45 .. -rw-r--r-- 1 root other 598 5月 29日 01:43 sysidconfig.log -rw-r--r-- 1 root other 2152 5月 29日 00:17 postrun.log drwxr-xr-x 2 root sys 512 5月 28日 23:46 webconsole drwxr-xr-x 2 root sys 512 5月 28日 23:45 swupas drwxr-xr-x 2 root sys 512 5月 28日 23:24 pool -rw------- 1 root sys 0 3月 18日 02:41 authlog -rw-r--r-- 1 root sys 0 3月 18日 02:41 syslog bash-3.00#
|
-
ログファイルが更新されていない.
- syslogのエラーを確認する.
bash-3.00# grep syslog /var/adm/messages May 29 03:10:42 unknown syslogd: line 24: WARNING: loghost could not be resolved May 29 19:17:27 unknown syslogd: going down on signal 15 May 29 19:19:33 unknown syslogd: line 24: WARNING: loghost could not be resolved May 29 19:30:15 unknown syslogd: line 24: WARNING: loghost could not be resolved May 29 19:44:56 unknown syslogd: line 24: WARNING: loghost could not be resolved May 29 20:29:59 unknown syslogd: line 24: WARNING: loghost could not be resolved May 29 20:50:54 solaris syslogd: line 24: WARNING: loghost could not be resolved May 29 22:07:28 solaris syslogd: going down on signal 15 May 29 23:26:54 solaris syslogd: line 24: WARNING: loghost could not be resolved May 30 22:13:36 solaris syslogd: line 22: WARNING: loghost could not be resolved May 30 22:13:56 solaris syslogd: line 24: WARNING: loghost could not be resolved bash-3.00#
|
-
loghostがみつからないので,エラーが出ている模様.
4.loghostを設定する
- loghostが,/etc/hostsファイルに記載があるか確認する.
bash-3.00# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.54.129 solaris # Added by DHCP bash-3.00#
|
bash-3.00# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost loghost 192.168.54.129 solaris # Added by DHCP bash-3.00#
|
bash-3.00# ping loghost loghost is alive bash-3.00#
|
5.authログを確認する
- loggerコマンドにて,auth.noticeにテストメッセージを送信する.
bash-3.00# logger -p auth.notice "TEST" bash-3.00#
|
bash-3.00# ls -lat /var/log 合計 194 -rw------- 1 root sys 59 5月 30日 22:36 authlog -rw------- 1 root root 944 5月 30日 16:37 vmware-tools-guestd -rw-r--r-- 1 root root 43540 5月 29日 23:28 Xorg.0.log drwxr-xr-x 5 root sys 512 5月 29日 22:09 . -rw-r--r-- 1 root root 43666 5月 29日 22:06 Xorg.0.log.old drwxr-xr-x 47 root sys 1024 5月 29日 21:45 .. -rw-r--r-- 1 root other 598 5月 29日 01:43 sysidconfig.log -rw-r--r-- 1 root other 2152 5月 29日 00:17 postrun.log drwxr-xr-x 2 root sys 512 5月 28日 23:46 webconsole drwxr-xr-x 2 root sys 512 5月 28日 23:45 swupas drwxr-xr-x 2 root sys 512 5月 28日 23:24 pool -rw-r--r-- 1 root sys 0 3月 18日 02:41 syslog bash-3.00#
|
-
更新されている模様.
- ログファイルの中身を確認する.
bash-3.00# cat /var/log/authlog May 30 22:36:38 solaris root: [ID 702911 auth.notice] TEST bash-3.00#
|
6.ログインエラーを発生させてログを確認する
bash-3.00# ssh ujpadmin@localhost パスワード: パスワード: パスワード: アクセス権がありません (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive)。 bash-3.00#
|
bash-3.00# cat /var/log/authlog May 30 22:36:38 solaris root: [ID 702911 auth.notice] TEST May 30 22:42:16 solaris sshd[6614]: [ID 800047 auth.notice] Failed keyboard-inter active for ujpadmin from 127.0.0.1 port 32977 ssh2 bash-3.00#
|