Skip to content

Commit 354d5e7

Browse files
committed
Merge pull request #442 from mhaskel/MODULES-556
MODULES-556: tcp_flags support for ip6tables
2 parents 024563a + 2271a94 commit 354d5e7

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

lib/puppet/provider/firewall/ip6tables.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def self.iptables_save(*args)
8888
:stat_probability => '--probability',
8989
:state => "-m state --state",
9090
:table => "-t",
91+
:tcp_flags => "-m tcp --tcp-flags",
9192
:todest => "--to-destination",
9293
:toports => "--to-ports",
9394
:tosource => "--to-source",
@@ -133,7 +134,7 @@ def self.iptables_save(*args)
133134
# I put it when calling the command. So compability with manual changes
134135
# not provided with current parser [georg.koester])
135136
@resource_list = [:table, :source, :destination, :iniface, :outiface,
136-
:proto, :ishasmorefrags, :islastfrag, :isfirstfrag, :gid, :uid, :sport, :dport,
137+
:proto, :ishasmorefrags, :islastfrag, :isfirstfrag, :tcp_flags, :gid, :uid, :sport, :dport,
137138
:port, :pkttype, :name, :state, :ctstate, :icmp, :hop_limit, :limit, :burst,
138139
:recent, :rseconds, :reap, :rhitcount, :rttl, :rname, :rsource, :rdest,
139140
:jump, :todest, :tosource, :toports, :log_level, :log_prefix, :reject,

spec/acceptance/firewall_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,30 @@ class { '::firewall': }
10921092
end
10931093
end
10941094
end
1095+
1096+
describe 'tcp_flags' do
1097+
context 'FIN,SYN ACK' do
1098+
it 'applies' do
1099+
pp = <<-EOS
1100+
class { '::firewall': }
1101+
firewall { '593 - test':
1102+
proto => tcp,
1103+
action => accept,
1104+
tcp_flags => 'FIN,SYN ACK',
1105+
provider => 'ip6tables',
1106+
}
1107+
EOS
1108+
1109+
apply_manifest(pp, :catch_failures => true)
1110+
end
1111+
1112+
it 'should contain the rule' do
1113+
shell('ip6tables-save') do |r|
1114+
expect(r.stdout).to match(/-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN ACK -m comment --comment "593 - test" -j ACCEPT/)
1115+
end
1116+
end
1117+
end
1118+
end
10951119
end
10961120

10971121
describe 'limit' do

0 commit comments

Comments
 (0)