FreeBSD 板


LINE

已经有人写好了 官方网站: http://samm.kiev.ua/bruteblock/ 参考: http://skeletor.ho.ua/index.php?name=articles&op=read&art=33&cat=10 以下是安装方法 OS版本: FreeBSD 7.2 cd /usr/ports/security/bruteblock make install clean /etc/rc.conf firewall_enable="YES" #kernel里要开firewall syslogd_flags="-c" #怕syslog一直出现 message repeat XXX bruteblockd_enable="YES" bruteblockd_table="1" bruteblockd_flags="-s 5" /etc/syslog.conf auth.info;authpriv.info /var/log/auth.log #加上这行代表把syslog丢给bruteblock auth.info;authpriv.info |exec /usr/local/sbin/bruteblock -f /usr/local/et\ c/bruteblock/ssh.conf #/etc/rc.d/syslogd restart /usr/local/etc/bruteblock/ssh.conf #预设两个不够再加上 regexp = sshd.*Illegal user \S+ from (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1\ ,3}) regexp1 = sshd.*Failed password for (?:illegal user )?\S+ from (\d{1,3\ }\.\d{1,3}\.\d{1,3}\.\d{1,3}) regexp2 = sshd.*error: PAM: authentication error for illegal user \S+ \ from (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) regexp3 = "sshd.*Failed keyboard-interactive\/pam for \S+ from (\d{1,3\ }\.\d{1,3}\.\d{1,3}\.\d{1,3})" regexp4 = sshd.*Invalid user \S+ from (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1\ ,3}) regexp5 = sshd.*error: PAM: authentication error for \S+ from (\d{1,3}\ \.\d{1,3}\.\d{1,3}\.\d{1,3}) regexp6 = sshd.*Did not receive identification string from (\d{1,3}\.\\ d{1,3}\.\d{1,3}\.\d{1,3}) regexp7 = sshd.*User \S+ from (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) not\ allowed because not listed in AllowUsers #/usr/local/etc/rc.d/bruteblockd restart /etc/rc.firewall setup_loopback () { ############ # Only in rare cases do you want to change these rules # ${fwcmd} add 100 pass all from any to any via lo0 ${fwcmd} add 200 deny all from any to 127.0.0.0/8 ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any + # BruteBlock + ${fwcmd} add deny ip from me to table\(1\) + ${fwcmd} add deny ip from table\(1\) to me } #/etc/rc.d/ipfw restart ※ 引述《operationcow (香蕉公车)》之铭言: : ※ [本文转录自 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 --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.167.45.251







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP