* `ip6tables`: Ip6tables type provider
* Required binaries: `ip6tables-save`, `ip6tables`.
- * Supported features: `connection_limiting`, `dnat`, `hop_limiting`, `icmp_match`, `interface_match`, `iptables`, `isfirstfrag`, `ishasmorefrags`, `islastfrag`, `log_level`, `log_prefix`, `mark`, `owner`, `pkttype`, `rate_limiting`, `recent_limiting`, `reject_type`, `snat`, `state_match`, `tcp_flags`.
+ * Supported features: `connection_limiting`, `dnat`, `hop_limiting`, `icmp_match`, `interface_match`, `iptables`, `isfirstfrag`, `ishasmorefrags`, `islastfrag`, `log_level`, `log_prefix`, `mark`, `owner`, `pkttype`, `rate_limiting`, `recent_limiting`, `reject_type`, `snat`, `socket`, `state_match`, `tcp_flags`.
* `iptables`: Iptables type provider
* Required binaries: `iptables-save`, `iptables`.
has_feature :ishasmorefrags
has_feature :islastfrag
has_feature :isfirstfrag
+ has_feature :socket
has_feature :address_type
has_feature :iprange
:rseconds => "--seconds",
:rsource => "--rsource",
:rttl => "--rttl",
+ :socket => "-m socket",
:source => "-s",
:sport => ["-m multiport --sports", "--sport"],
:src_range => '-m iprange --src-range',
# These are known booleans that do not take a value, but we want to munge
# to true if they exist.
- @known_booleans = [:ishasmorefrags, :islastfrag, :isfirstfrag, :rsource, :rdest, :reap, :rttl]
+ @known_booleans = [
+ :ishasmorefrags,
+ :islastfrag,
+ :isfirstfrag,
+ :rsource,
+ :rdest,
+ :reap,
+ :rttl,
+ :socket
+ ]
# Create property methods dynamically
(@resource_map.keys << :chain << :table << :action).each do |property|
@resource_list = [:table, :source, :destination, :iniface, :outiface,
:proto, :ishasmorefrags, :islastfrag, :isfirstfrag, :src_range, :dst_range,
:tcp_flags, :gid, :uid, :mac_source, :sport, :dport, :port, :dst_type,
- :src_type, :pkttype, :name, :state, :ctstate, :icmp, :hop_limit, :limit,
- :burst, :recent, :rseconds, :reap, :rhitcount, :rttl, :rname, :rsource,
- :rdest, :jump, :todest, :tosource, :toports, :log_level, :log_prefix,
- :reject, :connlimit_above, :connlimit_mask, :connmark]
+ :src_type, :socket, :pkttype, :name, :state, :ctstate, :icmp, :hop_limit,
+ :limit, :burst, :recent, :rseconds, :reap, :rhitcount, :rttl, :rname,
+ :rsource, :rdest, :jump, :todest, :tosource, :toports, :log_level,
+ :log_prefix, :reject, :connlimit_above, :connlimit_mask, :connmark]
end
end
end
+ # ip6tables has limited `-m socket` support
+ if default['platform'] !~ /el-5/ and default['platform'] !~ /ubuntu-1004/ and default['platform'] !~ /debian-6/ and default['platform'] !~ /sles/
+ describe 'socket' do
+ context 'true' do
+ it 'applies' do
+ pp = <<-EOS
+ class { '::firewall': }
+ firewall { '605 - test':
+ ensure => present,
+ proto => tcp,
+ port => '605',
+ action => accept,
+ chain => 'INPUT',
+ socket => true,
+ provider => 'ip6tables',
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ it 'should contain the rule' do
+ shell('ip6tables-save') do |r|
+ expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --ports 605 -m socket -m comment --comment "605 - test" -j ACCEPT/)
+ end
+ end
+ end
+
+ context 'false' do
+ it 'applies' do
+ pp = <<-EOS
+ class { '::firewall': }
+ firewall { '606 - test':
+ ensure => present,
+ proto => tcp,
+ port => '606',
+ action => accept,
+ chain => 'INPUT',
+ socket => false,
+ provider => 'ip6tables',
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ it 'should contain the rule' do
+ shell('ip6tables-save') do |r|
+ expect(r.stdout).to match(/-A INPUT -p tcp -m multiport --ports 606 -m comment --comment "606 - test" -j ACCEPT/)
+ end
+ end
+ end
+ end
+ end
+
# ip6tables only support addrtype on a limited set of platforms
if default['platform'] =~ /el-7/ or default['platform'] =~ /debian-7/ or default['platform'] =~ /ubuntu-1404/
['dst_type', 'src_type'].each do |type|