就像有手機就會接到詐騙電話一樣,只要 server 連上網路,就會有人想 try 密碼。
SSHBlock 是藉由監控 ssh 記錄檔,將惡意的來源 IP 加到 TCP Wrappers 設定檔中以進行封鎖。
SSHBlock 的 ports 路徑為 security/sshblock/ ,其中的套件說明如下:
SSHBlock is a daemon to monitor a syslog log for break-in attempts using
SSH, and to automatically block bad hosts by adding lines to /etc/hosts.allow
(TCP Wrappers). Several thresholds are pre-defined, to be able to block those
trying many attempts within a longer or shorter period.
WWW: http://www.bsdconsulting.no/tools/
下指令 make install clean 安裝之後,出現後續的操作說明:
To enable and use the sshblock daemon, use the following in /etc/rc.conf or
/etc/rc.conf.local:
sshblock_enable="YES"
To set flags/options (optional), add:
sshblock_flags=""
See /usr/local/sbin/sshblock -h for possible command line options.
Use /usr/local/etc/rc.d/sshblock to stop and start it.
sshblock 語法說明如下:
Usage: sshblock [ -b <blockfile> ] [ -l <logfile> ] [ -t <trigger list> ]
Trigger list is a list of seconds:attempts threshold pairs for determining
whether a host should be blocked
Default blockfile: /etc/hosts.allow
Default logfile: /var/log/auth.log
因此利用 ports 安裝完成之後,可以執行以下指令啟動 sshblock
/usr/local/etc/rc.d/sshblock start
若要系統開機時自動啟動 sshblcok,則在 /etc/rc.conf 加入
sshblock_enable="YES"
繼續閱讀 »