請問 sshd(openssh) 的 log 資訊 - BBS

Table of Contents

※ [本文轉錄自 Linux 看板]

作者: operationcow (香蕉公車) 看板: Linux
標題: [問題] 請問 sshd(openssh) 的 log 資訊
時間: Sat Nov 28 12:30:25 2009

※ [本文轉錄自 LinuxDev 看板]

作者: operationcow (香蕉公車) 看板: LinuxDev
標題: [問題] 請問 sshd(openssh) 的 log 資訊
時間: Sat Nov 28 12:29:58 2009

小弟我最近在研究 log, 希望撰寫一個可以防止 ssh bruteforce

attempt 的 script

因此我看了 /etc/syslog.conf 後決定從 /var/log/messages 下手

我發現每次只要 ssh 失敗, 就會出現

sshd[816]: error: PAM: authentication error for xxxx

如果是某一次登入連續三次輸入密碼失敗而被踢出

就會出現

sshd[816]: error: PAM: authentication error for xxxx

last message repeated 2 times

我有兩個疑問

(1) error: PAM: authentication error for xxxx 這個 log 可以很容易

看出是由 pid 為 816 的 sshd 所 syslog 的, 但 last message

repeated 2 times 卻沒有說是哪一個 process 所 syslog 的. 請問這是

哪裡來的呢??

(2) 上網找了資料, 看到有的資料是藉由分析 error: PAM: authentication

error for xxxx 來獲得該被阻擋的 IP, 但是我有一個問題, 就是怎麼知

道 ssh 失敗只會產生這種 log, 有什麼地方可以看到 openssh 所會產生

的所有 log 嗎?? 我有嘗試把 openssh 下載下來 trace code, 不過看了

一下就眼花了 OTZ...

[其實我主要想問的是, 大家為不同的 application 撰寫 log analysis

script, 都是去哪裡獲得該 application 資料及確保自己撰寫的 script

是正確的呢??]

問題有點長, 感謝大家 <(__)>

-----------------------------------------------------------------------

(1)

以下是我查到的資料:

http://0rz.tw/mptVm

因為是 disable 這個功能是在 syslogd 的 option, 所以可以很合理的推斷這是

屬於 syslogd 所 log 的資訊, 目的應該是為了避免太多重複的 log message

--

All Comments

Erin avatarErin2009-11-30
ssh 可以自訂 log 檔案 # man sshd_config
Ethan avatarEthan2009-12-04
我是看 man sshd_config 裡面的 LogLevel, 那個似乎
只能設定不同的 LogLevel, 不能看到所有可能的
David avatarDavid2009-12-08
message, 請問有什麼方式可以看到所有的 log message
呢?? 感謝