Skip to content

Commit

Permalink
MODULES-556: tcp_flags support for ip6tables
Browse files Browse the repository at this point in the history
tcp_flags was listed as a supported feature for the ip6tables provider,
but it wasn't actually implemented
  • Loading branch information
Morgan Haskel committed Dec 16, 2014
1 parent 024563a commit 2271a94
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/puppet/provider/firewall/ip6tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def self.iptables_save(*args)
:stat_probability => '--probability',
:state => "-m state --state",
:table => "-t",
:tcp_flags => "-m tcp --tcp-flags",
:todest => "--to-destination",
:toports => "--to-ports",
:tosource => "--to-source",
Expand Down Expand Up @@ -133,7 +134,7 @@ def self.iptables_save(*args)
# I put it when calling the command. So compability with manual changes
# not provided with current parser [georg.koester])
@resource_list = [:table, :source, :destination, :iniface, :outiface,
:proto, :ishasmorefrags, :islastfrag, :isfirstfrag, :gid, :uid, :sport, :dport,
:proto, :ishasmorefrags, :islastfrag, :isfirstfrag, :tcp_flags, :gid, :uid, :sport, :dport,
:port, :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,
Expand Down
24 changes: 24 additions & 0 deletions spec/acceptance/firewall_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,30 @@ class { '::firewall': }
end
end
end

describe 'tcp_flags' do
context 'FIN,SYN ACK' do
it 'applies' do
pp = <<-EOS
class { '::firewall': }
firewall { '593 - test':
proto => tcp,
action => accept,
tcp_flags => 'FIN,SYN ACK',
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 tcp --tcp-flags FIN,SYN ACK -m comment --comment "593 - test" -j ACCEPT/)
end
end
end
end
end

describe 'limit' do
Expand Down

0 comments on commit 2271a94

Please sign in to comment.