@doc = 'Ip6tables type provider'
has_feature :iptables
+ has_feature :condition
has_feature :connection_limiting
has_feature :conntrack
has_feature :hop_limiting
burst: '--limit-burst',
checksum_fill: '--checksum-fill',
clamp_mss_to_pmtu: '--clamp-mss-to-pmtu',
+ condition: '--condition',
connlimit_above: '-m connlimit --connlimit-above',
connlimit_mask: '--connlimit-mask',
connmark: '-m connmark --mark',
addrtype: [:src_type, :dst_type],
iprange: [:src_range, :dst_range],
owner: [:uid, :gid],
+ condition: [:condition],
conntrack: [:ctstate, :ctproto, :ctorigsrc, :ctorigdst, :ctreplsrc, :ctrepldst,
:ctorigsrcport, :ctorigdstport, :ctreplsrcport, :ctrepldstport, :ctstatus, :ctexpire, :ctdir],
time: [:time_start, :time_stop, :month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone],
:set_mark, :match_mark, :connlimit_above, :connlimit_mask, :connmark, :time_start, :time_stop, :month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone,
:src_cc, :dst_cc, :hashlimit_upto, :hashlimit_above, :hashlimit_name, :hashlimit_burst,
:hashlimit_mode, :hashlimit_srcmask, :hashlimit_dstmask, :hashlimit_htable_size,
- :hashlimit_htable_max, :hashlimit_htable_expire, :hashlimit_htable_gcinterval, :bytecode, :zone, :helper, :rpfilter, :name, :notrack]
+ :hashlimit_htable_max, :hashlimit_htable_expire, :hashlimit_htable_gcinterval, :bytecode, :zone, :helper, :rpfilter, :name, :notrack, :condition]
end
@doc = 'Iptables type provider'
has_feature :iptables
+ has_feature :condition
has_feature :connection_limiting
has_feature :conntrack
has_feature :rate_limiting
burst: '--limit-burst',
checksum_fill: '--checksum-fill',
clamp_mss_to_pmtu: '--clamp-mss-to-pmtu',
+ condition: '--condition',
connlimit_above: '-m connlimit --connlimit-above',
connlimit_mask: '--connlimit-mask',
connmark: '-m connmark --mark',
addrtype: [:src_type, :dst_type],
iprange: [:src_range, :dst_range],
owner: [:uid, :gid],
+ condition: [:condition],
conntrack: [:ctstate, :ctproto, :ctorigsrc, :ctorigdst, :ctreplsrc, :ctrepldst,
:ctorigsrcport, :ctorigdstport, :ctreplsrcport, :ctrepldstport, :ctstatus, :ctexpire, :ctdir],
time: [:time_start, :time_stop, :month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone],
:month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone,
:src_cc, :dst_cc, :hashlimit_upto, :hashlimit_above, :hashlimit_name, :hashlimit_burst,
:hashlimit_mode, :hashlimit_srcmask, :hashlimit_dstmask, :hashlimit_htable_size,
- :hashlimit_htable_max, :hashlimit_htable_expire, :hashlimit_htable_gcinterval, :bytecode, :ipvs, :zone, :helper, :cgroup, :rpfilter, :name, :notrack
+ :hashlimit_htable_max, :hashlimit_htable_expire, :hashlimit_htable_gcinterval, :bytecode, :ipvs, :zone, :helper, :cgroup, :rpfilter, :name, :notrack, :condition
]
def insert
# Invert any rules that are prefixed with a '!'
[
:connmark,
+ :condition,
:ctstate,
:ctproto,
:ctorigsrc,
* clusterip: Configure a simple cluster of nodes that share a certain IP and MAC address without an explicit load balancer in front of them.
+ * condition: Match if a specific condition variable is (un)set (requires xtables-addons)
+
* connection_limiting: Connection limiting features.
* conntrack: Connection tracking features.
PUPPETCODE
feature :connection_limiting, 'Connection limiting features.'
+ feature :condition, 'Match if a specific condition variable is (un)set.'
feature :conntrack, 'Connection tracking features.'
feature :hop_limiting, 'Hop limiting features.'
feature :rate_limiting, 'Rate limiting features.'
PUPPETCODE
newvalues(:true, :false)
end
+
+ newproperty(:condition, required_features: :condition) do
+ desc <<-PUPPETCODE
+ Match on boolean value (0/1) stored in /proc/net/nf_condition/name.
+ PUPPETCODE
+ validate do |value|
+ unless value.is_a?(String)
+ raise ArgumentError, <<-PUPPETCODE
+ Condition must be a string.
+ PUPPETCODE
+ end
+ end
+ end
autorequire(:firewallchain) do
reqs = []
end
end
+ describe ':condition' do
+ it 'accepts value as a string' do
+ resource[:condition] = 'somefile'
+ expect(resource[:condition]).to eq('somefile')
+ end
+ end
+
describe 'autorequire packages' do
[:iptables, :ip6tables].each do |provider|
it "provider #{provider} should autorequire package iptables" do