![需要帮助将速率限制 iptables 规则转换为 Puppet 格式](https://linux22.com/image/639944/%E9%9C%80%E8%A6%81%E5%B8%AE%E5%8A%A9%E5%B0%86%E9%80%9F%E7%8E%87%E9%99%90%E5%88%B6%20iptables%20%E8%A7%84%E5%88%99%E8%BD%AC%E6%8D%A2%E4%B8%BA%20Puppet%20%E6%A0%BC%E5%BC%8F.png)
我使用 Puppet Iptables 模块来管理我机器上的 Iptables 规则。我想实现对失败的 SSH 连接的速率限制,如所述这里:
iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 5 --name SSH --rsource -j DROP
iptables -A INPUT -p tcp --dport 22 -m recent --set --name SSH --rsource -j ACCEPT
是否可以将其翻译成 Puppet 语法,例如
firewall { '015 drop 5 failed attemps to connect to SSH in a minute ':
proto => 'tcp',
port => 22,
action => 'drop',
// what are the other paramters ?
}
答案1
这puppetlabs-防火墙模块尽力支持所有iptabels
参数。recent
特定参数以单个 为前缀r
,例如rseconds
而不是--seconds
。
尝试
firewall { '015 drop 5 failed attemps to connect to SSH in a minute ':
proto => 'tcp',
port => 22,
action => 'drop',
recent => 'update',
rseconds => '60',
rhitcount => '5',
rname => 'SSH',
rsource => true,
}