看板 Linux 關於我們 聯絡資訊
※ [本文轉錄自 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 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.70.167.69 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.70.167.69
ago1414:ssh 可以自訂 log 檔案 # man sshd_config 11/28 13:36
operationcow:我是看 man sshd_config 裡面的 LogLevel, 那個似乎 11/28 15:17
operationcow:只能設定不同的 LogLevel, 不能看到所有可能的 11/28 15:17
operationcow:message, 請問有什麼方式可以看到所有的 log message 11/28 15:18
operationcow:呢?? 感謝 11/28 15:18
※ 編輯: operationcow 來自: 219.70.167.69 (11/28 15:56) operationcow:轉錄至看板 LinuxDev 11/28 15:57 operationcow:轉錄至看板 FreeBSD 11/28 15:58 ※ 編輯: operationcow 來自: 219.70.167.69 (11/28 15:59)
dwj:要擋暴力try ssh密碼有現成軟體啊, 請裝denyhosts即可. 11/28 19:34