自動擋暴力 try ssh 的 script (with pf)

從 http://anp.ath.cx/sshit/sshit.pl 改進的,現在不會 fork 一堆出來了。
這個版本是用 tail -F 讀 /var/log/auth.log,跟 sshit.pl 的作法不同。

Link: http://www.csie.nctu.edu.tw/~jnlin/script/chkfw_select_pf.txt

你必須要在 /etc/pf.conf 加上:

table <$PF_TABLE> persist
block on $extdev from <$PF_TABLE> to any

才會真正 block 有惡意者的 IP。