下載DenyHosts的rpm
我會使用下載是因為yum上沒有
# rpm -ivh DenyHosts-2.6-python2.5.rpm
結果出現訊息
錯誤:相依性偵測失敗:
python = 2.5 被 DenyHosts-2.6-0.noarch 所需要
但是我這台有安裝python是2.6版
# yum install python
………
Package python-2.6.5-3.el6_0.2.i686 already installed and latest version
Nothing to do
放棄rpm安裝,換下載DenyHosts-2.6.tar.gz
解壓
#tar zxvf DenyHosts-2.6.tar.gz
看一下讀我檔有寫
SOURCE DISTRIBUTION
===================
If you downloaded the source distribution file (DenyHosts-#.#.#-tar.gz)
then:
$ tar zxvf DenyHosts-#.#.#-tar.gz (Where #.#.# is the version)
$ cd DenyHosts-#.#.#
as root:
# python setup.py install
實作,切換目錄
#cd DenyHosts-2.6
再來安裝文件有寫到要cp cp denyhosts.cfg-dist 成為denyhosts.cfg並編輯
還有要 cp daemon-control-dist daemon-control
還有要 cp daemon-control-dist daemon-control
實作
先移動到
# cd /usr/share/denyhosts
# cp daemon-control-dist daemon-control
# chown root daemon-control
# chmod 700 daemon-control
先移動到
# cd /usr/share/denyhosts
# cp daemon-control-dist daemon-control
# chown root daemon-control
# chmod 700 daemon-control
# cp denyhosts.cfg-dist denyhosts.cfg
# vim denyhosts.cfg
找到
PURGE_DENY =
改成
PURGE_DENY = 1h
這樣IP過1小時後清除封鎖,我覺的應該是夠了
DENY_THRESHOLD_ROOT 我是改為 3
這個設定是root帳號可錯誤的次數,預設是1。
其它還沒研究… 如果要知道更詳細的設定,搜尋denyhosts.cfg關鍵字可以找到很多資料
找到
PURGE_DENY =
改成
PURGE_DENY = 1h
這樣IP過1小時後清除封鎖,我覺的應該是夠了
DENY_THRESHOLD_ROOT 我是改為 3
這個設定是root帳號可錯誤的次數,預設是1。
其它還沒研究… 如果要知道更詳細的設定,搜尋denyhosts.cfg關鍵字可以找到很多資料
再來要設定開機啟動
# cd /etc/init.d
# ln -s /usr/share/denyhosts/daemon-control denyhosts
再來如果主機可以用chkconfig指令的話就下
# chkconfig --add denyhosts
就可以在setup工貝上看到 denyhosts
再來啟動看看
如果有用chkconfig加入下
# service denyhosts start
不然就下
/usr/share/denyhosts/daemon-control start
不過應該是有在執行
#ps -ef | grep "denyhosts"
root 2281 2066 0 09:09 pts/0 00:00:00 grep denyhosts
先看一下 /etc/hosts.deny 都沒有任何的,來試看看ssh roo 密碼錯5次







沒有留言:
張貼留言