【文件属性】:
文件名称:sshban:控制您的 SSH 登录
文件大小:1KB
文件格式:ZIP
更新时间:2021-06-14 18:31:45
Shell
sshban
仅允许从您首选的国家/地区进行 ssh 登录。
此脚本的主要原因是阻止来自某些国家/地区的所有 ssh 登录。 在这个脚本中,我只允许美国和印度进行 SSH 登录。
您需要安装 geoip-bin 和 geoip-database。
$ sudo apt-get install geoip-bin geoip-database
通过执行确保它有效
$ sudo geoiplookup 8.8.8.8
将此脚本复制到您的 /usr/local/bin/
然后使用您的 /etc/hosts.deny 和 /etc/hosts.allow 来控制您的 SSHD。
在 /etc/hosts.deny 添加以下行
sshd: ALL
在 /etc/hosts.allow 添加以下行
sshd: ALL: aclexec /usr/local/bin/sshban.sh
【文件预览】:
sshban-master
----sshban.sh(534B)
----README.md(1KB)