在 puppet 3.8.7 中使用防火墙模块版本 1.9,出现以下错误:
服务器上出现错误 400:防火墙上的参数字符串无效
这是我的 Puppet 防火墙规则。
firewall {
"051 asterisk-set-rate-limit-register":
string => "REGISTER sip:",
string_algo => "bm",
dport => '5060',
proto => 'udp',
recent => 'set',
rname => 'VOIPREGISTER',
rsource => 'true';
"052 asterisk-drop-rate-limit-register":
string => "REGISTER sip:",
string_algo => "bm",
dport => '5060',
proto => 'udp',
action => 'drop',
recent => 'update',
rseconds => '600',
rhitcount => '5',
rname => 'VOIPREGISTER',
rsource => true,
rttl => true;
}
答案1
问题似乎是防火墙类没有实例化。我还添加了防火墙清除命令,以便只存在以下规则。这很方便,这样就不会意外在防火墙中留下漏洞。
以下是在我的系统上运行的代码:
class { 'firewall': }
resources { 'firewall':
purge => true,
}
firewall { "051 asterisk-set-rate-limit-register":
string => "REGISTER sip:",
string_algo => "bm",
dport => '5060',
proto => 'udp',
recent => 'set',
rname => 'VOIPREGISTER',
rsource => 'true';
}
firewall { "052 asterisk-drop-rate-limit-register":
string => "REGISTER sip:",
string_algo => "bm",
dport => '5060',
proto => 'udp',
action => 'drop',
recent => 'update',
rseconds => '600',
rhitcount => '5',
rname => 'VOIPREGISTER',
rsource => true,
rttl => true;
}
笔记
我在安装了该模块的 puppet 安装上进行了测试puppetlabs-firewall
。
申請成功。