vps交流

扫描狗真多,利用 nftables防火墙开 sshd入站白名单


本帖最后由 KDE 于 2023-3-14 06:07 编辑

/etc/host.deny RHEL 8开始已经移除 tcp_wrappers不可用 以后 deb系也会移除的

还是用新版 nftables防火墙做入站白名单吧扫描狗真多,利用 nftables防火墙开 sshd入站白名单

# nfttables
nft flush ruleset

# 1
nft add table inet filter
nft add chain inet filter input { type filter hook input priority 0 ; policy drop ; }
nft add rule inet filter input iif "lo" accept
nft add rule inet filter input ct state { established, related } accept
nft add rule inet filter input ct state invalid drop
nft add rule inet filter input icmpv6 type { nd-nei**or-advert, nd-nei**or-solicit, nd-redirect, nd-router-advert, nd-router-solicit } accept
nft add rule inet filter input icmp type echo-request limit rate 1 /second accept
nft add rule inet filter input icmpv6 type echo-request limit rate 1 /second accept
nft add rule inet filter input iif "eth0" tcp dport 22 ip saddr 10.1.1.0/24 accept
nft add rule inet filter input iif "eth0" tcp dport 22 ip6 saddr 240e:350::/29 accept
nft add rule inet filter input iif "eth0" tcp dport { 80, 443 } accept
nft add rule inet filter input iif "eth0" udp dport { 53 } accept

补充:
这都关键词屏蔽,他们到底怕什么扫描狗真多,利用 nftables防火墙开 sshd入站白名单

扫描狗真多,利用 nftables防火墙开 sshd入站白名单

扫描狗真多,利用 nftables防火墙开 sshd入站白名单

是不是修改sshd的端口号,也可以达到不让别人乱扫的目的?

linearn 发表于 2023-3-14 06:29
是不是修改sshd的端口号,也可以达到不让别人乱扫的目的?

也可以改默认端口避免扫描狗,但我个人习惯用默认的。

KDE 发表于 2023-3-14 06:31
也可以改默认端口避免扫描狗,但我个人习惯用默认的。

你的方法也挺好的,改了端口号有时候会出现莫名其妙连不上的问题,还得改回缺省端口号

好帖,但是我选择堡垒机
改个端口号就行了,就这么简单
赞(0)
版权声明:本贴采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
帖子名称:《扫描狗真多,利用 nftables防火墙开 sshd入站白名单》
帖子链接:https://www.hostloc.xyz/224164.html