标签: ip6tables

阻止对 IPv6 的 SSH 暴力攻击

我最近不得不使用一些具有 IPv6 连接的服务器,我惊讶地发现 fail2ban 不支持 IPv6,denyhosts 也不支持。在谷歌上搜索我发现人们普遍推荐:

  • 通过 IPv6 停用 ssh 登录(对我来说不是解决方案)
  • 在服务器上仅使用私钥/公钥身份验证,没有密码身份验证(有效,但很多攻击可能会消耗服务器大量的处理能力,或者甚至可能通过 DDoS 攻击使其不可用)
  • 使用 ip6tables 阻止来自同一 IP 的连续攻击
  • 使用支持 IPv6 的 sshguard

从我目前收集到的信息来看,禁止在 IPv6 中使用地址与在 IPv4 中有点不同,因为 ISP 不会为用户提供单个地址 (/128),而是整个子网(我目前有一个 /48)。因此,禁止单个 IPv6 地址对攻击无效。我在 ip6tables 和 sshguard 阻止子网攻击检测的主题上进行了高低搜索,但我没有找到任何信息。

有谁知道 sshguard 是否禁止子网进行 IPv6 攻击?
有谁知道如何进行 ip6tables 配置来禁止 IPv6 攻击的子网?
或者有没有人知道比我已经发现的更好的减轻攻击的方法?

PS:我在系统上使用 CentOS 7。

security ssh ipv6 sshd ip6tables

9
推荐指数
1
解决办法
2416
查看次数

IPv6 正常工作的基本 iptables 规则是什么?

我遇到了一个问题,一段时间后我失去了与 IPv6 地址上的服务器的连接,结果证明是由默认INPUT策略丢弃的 DHCPv6 客户端数据包(端口 546)引起的DROP是我关于这个问题的问题,我的规则是:

-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p ipv6-icmp -j ACCEPT
-A INPUT -s IP_OF_ANOTHER_HOST -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-P INPUT DROP
Run Code Online (Sandbox Code Playgroud)

我认为这些规则已经足够了,特别是允许RELATEDESTABLISHED连接,因为我的OUTPUT链的默认策略是ACCEPT,但我不得不添加这个规则来接受 …

linux iptables ipv6 ip6tables netfilter

9
推荐指数
2
解决办法
7327
查看次数

127.0.0.0/8 的 IPv6 等效项是什么

我正在尝试在 Linux 上设置 IP6tables 防火墙,我基本上想开始复制我的 IPv4 配置。

我的规则之一只是接受到本地主机子网的所有流量:

iptables -A INPUT -s 127.0.0.0/8 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

尽管 IPv6 的等价物是什么,但我有点困惑。是不是就这么简单:

ip6tables -A INPUT -s ::/128 -m comment --comment localhost -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

互联网上的许多来源解释了 127.0.0.1,但我专门寻找 127.0.0.0/8 等效项,但我还没有找到确认。

顺便说一句ip6tables -vnL,当我发出以下命令时,我希望计数器增加:

telnet -6 localhost 22
Run Code Online (Sandbox Code Playgroud)

但这不会发生。

linux iptables ipv6 ip6tables

8
推荐指数
1
解决办法
4378
查看次数

为什么我们需要 ip6tables 规则才能使 DHCP6 发挥作用?(相比之下,IPv4 不需要任何)

为什么我们需要 DHCP6 的 ip6tables 规则?(相比之下,IPv4 不需要它)


这是我编写的最小 IPv4 规则,您看不到特殊的 DHCPv4(维基百科)规则

IPv4:iptables --list-rules INPUT

-P INPUT DROP
-A INPUT -i lo -m comment --comment loopback -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment traffic4 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

这是我编写的最小 IPv6 规则,您会看到一个特殊的 DHCPv6(维基百科)规则

IPv6:ip6tables --list-rules INPUT

-P INPUT DROP
-A INPUT -i lo -m comment --comment loopback -j ACCEPT
-A INPUT -p ipv6-icmp -m limit --limit 10/sec --limit-burst 30 -m comment …
Run Code Online (Sandbox Code Playgroud)

linux dhcp ipv6 ip6tables

5
推荐指数
1
解决办法
970
查看次数

Debian buster/sid 中​​的 ip6table-restore 失败

我有以下 iptable 规则/etc/iptables/rule.V6/etc/iptables/rule.V4

-4 -A INPUT -p icmp -j ACCEPT
-6 -A INPUT -p ipv6-icmp -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

当我尝试重新启动 时netfilter-persistent,它在内部调用iptables-restoreip6tables-restore

ip6tables-restore 失败,因为它无法理解以下规则

-4 -A INPUT -p icmp -j ACCEPT
Run Code Online (Sandbox Code Playgroud)

下面是错误

root@rs-dal:/etc/iptables# ip6tables-restore rules.q
Error occurred at line: 15
Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information.
Run Code Online (Sandbox Code Playgroud)

理想情况下,开头的规则-4将被 忽略ip6tables-restore,但这似乎不适用于 Debian Buster。

但是,iptables-restore工作正常,这只是ip6tables-restore. 如何解决这个问题?

debian iptables ip6tables nftables

4
推荐指数
1
解决办法
3171
查看次数

标签 统计

ip6tables ×5

ipv6 ×4

iptables ×3

linux ×3

debian ×1

dhcp ×1

netfilter ×1

nftables ×1

security ×1

ssh ×1

sshd ×1