Dav*_*ain 3 linux ssh openssh iptables
作为抵御蛮力攻击的第一道防线,我使用 TCP 包装器限制了 SSH 登录尝试(默认情况下拒绝访问,并在 中维护 IP 白名单/etc/hosts.allow)。
/etc/hosts.allow
但是,有时我需要从不在白名单中的 IP 地址访问我的服务器(并且我的系统最终阻止了我自己的尝试)。
是否可以允许所有 IP 地址的 SSH 密钥登录,但禁止来自不在给定白名单中的 IP 的仅密码登录?我知道我可以将 SSH 配置为仅允许使用密钥登录,但我想保留在一系列 IP 地址上使用密码登录的能力。
use*_*686 6
PasswordAuthentication no Match Address 192.168.1.0/24 PasswordAuthentication yes Match Address 2001:470:1f0b:915::/64 PasswordAuthentication yes
我还设置了不同的横幅文件,Banner用于明确何时接受密码登录。
Banner
归档时间:
12 年,9 月 前
查看次数:
561 次
最近记录: