1. 程式人生 > >Centos7 下 denyHosts 安裝及使用

Centos7 下 denyHosts 安裝及使用

安裝

撰寫部落格時,庫內的denyhosts版本為2.9

yum install -y denyhosts

配置

配置檔案路徑

vim /etc/denyhosts.conf

配置(yum安裝時,大部分配置已寫好,稍作改動即可)

DENY_THRESHOLD_INVALID = 5 #無效使用者名稱限制登陸次數
DENY_THRESHOLD_VALID = 10 #有效使用者名稱限制登陸次數
DENY_THRESHOLD_ROOT = 5 #root限制登陸次數
AGE_RESET_ROOT = 1d  #root使用者登入失敗計數歸零的時間
ADMIN_EMAIL = root@localhost
#管理員郵箱

黑名單白名單

vim /etc/hosts.deny
vim /etc/hosts.allow

hosts.allow(hosts.deny同規則)

sshd:*.*.*.*

相關命令

啟動命令(yum安裝,已預設配好)

service denyhosts start
service denyhosts stop
service denyhosts status

加入自啟動

chkconfig denyhosts on