]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Add the FrozenStrings magic comment
authorDavid Schmitt <david.schmitt@puppet.com>
Wed, 16 Dec 2020 13:36:32 +0000 (13:36 +0000)
committerDavid Schmitt <david.schmitt@puppet.com>
Mon, 4 Jan 2021 12:04:24 +0000 (12:04 +0000)
37 files changed:
lib/facter/ip6tables_version.rb
lib/facter/iptables_persistent_version.rb
lib/facter/iptables_version.rb
lib/puppet/provider/firewall.rb
lib/puppet/provider/firewall/ip6tables.rb
lib/puppet/provider/firewall/iptables.rb
lib/puppet/provider/firewallchain/iptables_chain.rb
lib/puppet/type/firewall.rb
lib/puppet/type/firewallchain.rb
lib/puppet/util/firewall.rb
lib/puppet/util/ipcidr.rb
spec/acceptance/class_spec.rb
spec/acceptance/firewall_attributes_exceptions_spec.rb
spec/acceptance/firewall_attributes_happy_path_spec.rb
spec/acceptance/firewall_attributes_ipv6_exceptions_spec.rb
spec/acceptance/firewall_attributes_ipv6_happy_path_spec.rb
spec/acceptance/firewallchain_spec.rb
spec/acceptance/resource_cmd_spec.rb
spec/acceptance/rules_spec.rb
spec/acceptance/standard_usage_spec.rb
spec/fixtures/iptables/conversion_hash.rb
spec/spec_helper_acceptance_local.rb
spec/spec_helper_local.rb
spec/unit/classes/firewall_linux_archlinux_spec.rb
spec/unit/classes/firewall_linux_debian_spec.rb
spec/unit/classes/firewall_linux_redhat_spec.rb
spec/unit/classes/firewall_linux_spec.rb
spec/unit/classes/firewall_spec.rb
spec/unit/facter/iptables_persistent_version_spec.rb
spec/unit/facter/iptables_spec.rb
spec/unit/puppet/provider/ip6tables_spec.rb
spec/unit/puppet/provider/iptables_chain_spec.rb
spec/unit/puppet/provider/iptables_spec.rb
spec/unit/puppet/type/firewall_spec.rb
spec/unit/puppet/type/firewallchain_spec.rb
spec/unit/puppet/util/firewall_spec.rb
spec/unit/puppet/util/ipcidr_spec.rb

index fded4bcc2b7067c1f4b692ba18dfcbfdeda5c332..964ae7460191942b8bfe345b62b39986460e976a 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 Facter.add(:ip6tables_version) do
   confine kernel: :Linux
   setcode do
index 7e9ffd02ec76e2cc191db54fe3375f6e56f2f649..98fb5b0c6133ce736aadeef7406eb64b886aa978 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 Facter.add(:iptables_persistent_version) do
   confine operatingsystem: ['Debian', 'Ubuntu']
   setcode do
index 3253b9749c230fa4834208b12dcdfa058e405923..873a37e031e670477eed5f06e9bf5db3ce558f29 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 Facter.add(:iptables_version) do
   confine kernel: :Linux
   setcode do
index 851b4b31e783b4e97304802bfb9dbf936a1f1416..f8403a80bb81d0470dd27905f5eb29891c2b3299 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 #
 # firewall.rb
 #
index efab4f88c87b55ef65b751656d5b36903404d52b..b4c2b8715fcc2abe8995d5e3228e9fc2f4a123d3 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 Puppet::Type.type(:firewall).provide :ip6tables, parent: :iptables, source: :ip6tables do
   @doc = 'Ip6tables type provider'
 
index c101ddcd2433e94f2dc18b8791358acce4f7a17d..203191932f8059be51a074429c3a712aa2a42989 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'puppet/provider/firewall'
 require 'digest'
 
@@ -858,7 +860,7 @@ Puppet::Type.type(:firewall).provide :iptables, parent: Puppet::Provider::Firewa
           }.transpose
           wrong_values = wrong_values.compact
           unless wrong_values.empty?
-            raise "All values of the '#{res}' property must be prefixed with a '!' when inverting, but '#{wrong_values.join("', '")}' #{(wrong_values.length > 1) ? 'are' : 'is'} not prefixed; aborting" # rubocop:disable Metrics/LineLength : Line length cannot be reduced
+            raise "All values of the '#{res}' property must be prefixed with a '!' when inverting, but '#{wrong_values.join("', '")}' #{(wrong_values.length > 1) ? 'are' : 'is'} not prefixed; aborting" # rubocop:disable Layout/LineLength : Line length cannot be reduced
           end
           args.insert(-2, '!')
           # rubocop:enable Metrics/BlockNesting
index 6182283cb19fc11fa24f300a761342f4e5dd9ae0..ecd45900e96b6f9fb8657e6a40167a3c63e0ec2f 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 Puppet::Type.type(:firewallchain).provide :iptables_chain do
   include Puppet::Util::Firewall
 
index 3901b3e35bbe4544a9396f260044b5ea0c84195b..dbce633213fd2324a630de68980ddad4b35d89e8 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 # See: #10295 for more details.
 #
 # This is a workaround for bug: #4248 whereby ruby files outside of the normal
index 3a38b7f33e793273d72118a7e2739f574efad5f2..4c0215ad21b39169c5dacf45ce3559be3dd5fb40 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 # This is a workaround for bug: #4248 whereby ruby files outside of the normal
 # provider/type path do not load until pluginsync has occured on the puppet server
 #
index add4ac06d7413d24dd9339aeca0ea2d027d4f3dc..b43f7a015dcef6c5a36f51d81df4d75e0d12ec89 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'socket'
 require 'resolv'
 require 'puppet/util/ipcidr'
index d5ab06f98b764ae516d3f02b4d8a0e301b6e3def..b44ce31ec8a922d6a500b94dd29ad781fadac352 100644 (file)
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
 
 require 'ipaddr'
 
index d030da2b114bbf0bf98c9fae8c2c33e5a522c1e4..9695831a87da91090e5ee040b824c2ba4c1c4688 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 describe 'firewall class' do
index 0d9c4b185bc76b826c480561851560efd4c7a4df..67e59c2aa2d544d5e767bfc818b7f2258f5aaa13 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 describe 'firewall basics', docker: true do
@@ -1039,7 +1041,7 @@ describe 'firewall basics', docker: true do
         it 'contains the rule' do
           run_shell('iptables-save') do |r|
             expect(r.stdout).to match(
-              %r{-A OUTPUT -p tcp -m multiport --dports 8080 -m time --timestart 06:00:00 --timestop 17:00:00 --monthdays 7 --weekdays Tue --datestart 2016-01-19T04:17:07 --datestop 2038-01-19T04:17:07 --kerneltz -m comment --comment "805 - test" -j ACCEPT}, # rubocop:disable Metrics/LineLength
+              %r{-A OUTPUT -p tcp -m multiport --dports 8080 -m time --timestart 06:00:00 --timestop 17:00:00 --monthdays 7 --weekdays Tue --datestart 2016-01-19T04:17:07 --datestop 2038-01-19T04:17:07 --kerneltz -m comment --comment "805 - test" -j ACCEPT}, # rubocop:disable Layout/LineLength
             )
           end
         end
@@ -1335,7 +1337,7 @@ describe 'firewall basics', docker: true do
       end
     end
     it 'hashlimit_upto is set' do
-      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto --hashlimit-htable-size 1000000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "806 - hashlimit_upto test" -j ACCEPT}) # rubocop:disable Metrics/LineLength : Cannot reduce line to required length
+      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto --hashlimit-htable-size 1000000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "806 - hashlimit_upto test" -j ACCEPT}) # rubocop:disable Layout/LineLength : Cannot reduce line to required length
     end
   end
 
index 8bb3a03878ab75298d1547cdb66a8e7262812274..fe77619753ffa912433ce2b7ee60597c60cad2a2 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 describe 'firewall attribute testing, happy path' do
@@ -368,7 +370,7 @@ describe 'firewall attribute testing, happy path' do
     end
     # it 'contains the connlimit and connlimit_mask rule' do
     #   expect(result.stdout).to match(
-    #     %r{-A INPUT -p tcp -m multiport --dports 2222 -m connlimit --connlimit-above 10 --connlimit-mask 24 (--connlimit-saddr )?-m comment --comment "501 - connlimit" -j REJECT --reject-with icmp-port-unreachable}, # rubocop:disable Metrics/LineLength
+    #     %r{-A INPUT -p tcp -m multiport --dports 2222 -m connlimit --connlimit-above 10 --connlimit-mask 24 (--connlimit-saddr )?-m comment --comment "501 - connlimit" -j REJECT --reject-with icmp-port-unreachable}, # rubocop:disable Layout/LineLength
     #   )
     # end
     it 'contains connmark' do
@@ -432,10 +434,10 @@ describe 'firewall attribute testing, happy path' do
       expect(result.stdout).to match(%r{-A INPUT -p tcp -f -m multiport --dports 583 -m comment --comment "583 - isfragment" -j ACCEPT})
     end
     it 'ipsec_policy ipsec and dir out' do
-      expect(result.stdout).to match(%r{-A OUTPUT -d 20.0.0.0\/(8|255\.0\.0\.0) -m policy --dir out --pol ipsec -m comment --comment "595 - ipsec_policy ipsec and out" -j REJECT --reject-with icmp-net-unreachable}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A OUTPUT -d 20.0.0.0\/(8|255\.0\.0\.0) -m policy --dir out --pol ipsec -m comment --comment "595 - ipsec_policy ipsec and out" -j REJECT --reject-with icmp-net-unreachable}) # rubocop:disable Layout/LineLength
     end
     it 'ipsec_policy none and dir in' do
-      expect(result.stdout).to match(%r{-A INPUT -d 20.0.0.0\/(8|255\.0\.0\.0) -m policy --dir in --pol none -m comment --comment "596 - ipsec_policy none and in" -j REJECT --reject-with icmp-net-unreachable}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A INPUT -d 20.0.0.0\/(8|255\.0\.0\.0) -m policy --dir in --pol none -m comment --comment "596 - ipsec_policy none and in" -j REJECT --reject-with icmp-net-unreachable}) # rubocop:disable Layout/LineLength
     end
     it 'set_mss is set' do
       expect(result.stdout).to match(%r{-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1361:1541 -m comment --comment "604 - set_mss" -j TCPMSS --set-mss 1360})
@@ -456,7 +458,7 @@ describe 'firewall attribute testing, happy path' do
       expect(result.stdout).to match(%r{-A FORWARD -p tcp -m physdev\s+--physdev-out eth1 -m multiport --dports 712 -m comment --comment "712 - physdev_out" -j ACCEPT})
     end
     it 'physdev_in eth0 and physdev_out eth1 and physdev_is_bridged' do
-      expect(result.stdout).to match(%r{-A FORWARD -p tcp -m physdev\s+--physdev-in eth0 --physdev-out eth1 --physdev-is-bridged -m multiport --dports 713 -m comment --comment "713 - physdev_in physdev_out physdev_is_bridged" -j ACCEPT}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A FORWARD -p tcp -m physdev\s+--physdev-in eth0 --physdev-out eth1 --physdev-is-bridged -m multiport --dports 713 -m comment --comment "713 - physdev_in physdev_out physdev_is_bridged" -j ACCEPT}) # rubocop:disable Layout/LineLength
     end
     it 'gid set to root' do
       expect(result.stdout).to match(%r{-A OUTPUT -m owner --gid-owner (0|root) -m comment --comment "801 - gid root" -j ACCEPT})
@@ -477,16 +479,16 @@ describe 'firewall attribute testing, happy path' do
       expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m multiport --dports 997 -m comment --comment "1001 EF - set_dscp_class" -j DSCP --set-dscp 0x2e})
     end
     it 'all the modules with multiple args is set' do
-      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-in eth0 --physdev-out eth1 --physdev-is-bridged -m iprange --src-range 90.0.0.1-90.0.0.2\s+--dst-range 100.0.0.1-100.0.0.2 -m owner --uid-owner (0|root) --gid-owner 404 -m multiport --dports 8080 -m addrtype --src-type LOCAL --dst-type UNICAST -m comment --comment "807 - ipt_modules tests" -j REJECT --reject-with icmp-port-unreachable}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-in eth0 --physdev-out eth1 --physdev-is-bridged -m iprange --src-range 90.0.0.1-90.0.0.2\s+--dst-range 100.0.0.1-100.0.0.2 -m owner --uid-owner (0|root) --gid-owner 404 -m multiport --dports 8080 -m addrtype --src-type LOCAL --dst-type UNICAST -m comment --comment "807 - ipt_modules tests" -j REJECT --reject-with icmp-port-unreachable}) # rubocop:disable Layout/LineLength
     end
     it 'all the modules with single args is set' do
-      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-out eth1 --physdev-is-bridged -m iprange --dst-range 100.0.0.1-100.0.0.2 -m owner --gid-owner 404 -m multiport --dports 8080 -m addrtype --dst-type UNICAST -m comment --comment "808 - ipt_modules tests" -j REJECT --reject-with icmp-port-unreachable}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-out eth1 --physdev-is-bridged -m iprange --dst-range 100.0.0.1-100.0.0.2 -m owner --gid-owner 404 -m multiport --dports 8080 -m addrtype --dst-type UNICAST -m comment --comment "808 - ipt_modules tests" -j REJECT --reject-with icmp-port-unreachable}) # rubocop:disable Layout/LineLength
     end
     it 'recent set to set' do
       expect(result.stdout).to match(%r{-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m recent --set --name list1 (--mask 255.255.255.255 )?--rdest -m comment --comment "597 - recent set"})
     end
     it 'recent set to rcheck' do
-      expect(result.stdout).to match(%r{-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m recent --rcheck --seconds 60 --hitcount 5 --rttl --name list1 (--mask 255.255.255.255 )?--rsource -m comment --comment "598 - recent rcheck"}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m recent --rcheck --seconds 60 --hitcount 5 --rttl --name list1 (--mask 255.255.255.255 )?--rsource -m comment --comment "598 - recent rcheck"}) # rubocop:disable Layout/LineLength
     end
     it 'recent set to update' do
       expect(result.stdout).to match(%r{-A INPUT -d 30.0.0.0\/(8|255\.0\.0\.0) -m recent --update --name DEFAULT (--mask 255.255.255.255 )?--rsource -m comment --comment "599 - recent update"})
index 4dc141c437717f4426507c224b7d5d8af4e62885..216c981d45caca1127a5ee1a879443b53b4c1d00 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 describe 'firewall ipv6 attribute testing, exceptions' do
@@ -245,7 +247,7 @@ describe 'firewall ipv6 attribute testing, exceptions' do
           it 'contains the rule' do
             run_shell('ip6tables-save') do |r|
               expect(r.stdout).to match(
-                %r{-A OUTPUT -p tcp -m multiport --dports 8080 -m time --timestart 06:00:00 --timestop 17:00:00 --monthdays 7 --weekdays Tue --datestart 2016-01-19T04:17:07 --datestop 2038-01-19T04:17:07 --kerneltz -m comment --comment "805 - time" -j ACCEPT}, # rubocop:disable Metrics/LineLength
+                %r{-A OUTPUT -p tcp -m multiport --dports 8080 -m time --timestart 06:00:00 --timestop 17:00:00 --monthdays 7 --weekdays Tue --datestart 2016-01-19T04:17:07 --datestop 2038-01-19T04:17:07 --kerneltz -m comment --comment "805 - time" -j ACCEPT}, # rubocop:disable Layout/LineLength
               )
             end
           end
@@ -434,7 +436,7 @@ describe 'firewall ipv6 attribute testing, exceptions' do
       expect(result.stdout).to match(%r{-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "503 - clamp_mss_to_pmtu" -j TCPMSS --clamp-mss-to-pmtu})
     end
     it 'hashlimit_name set to "upto-ip6"' do
-      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto-ip6 --hashlimit-htable-size 1000000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "803 - hashlimit_upto test ip6" -j ACCEPT}) # rubocop:disable Metrics/LineLength : Cannot reduce line to required length
+      expect(result.stdout).to match(%r{-A INPUT -p tcp -m hashlimit --hashlimit-upto 16\/sec --hashlimit-burst 640 --hashlimit-name upto-ip6 --hashlimit-htable-size 1000000 --hashlimit-htable-max 320000 --hashlimit-htable-expire 36000000 -m comment --comment "803 - hashlimit_upto test ip6" -j ACCEPT}) # rubocop:disable Layout/LineLength : Cannot reduce line to required length
     end
     it 'match_mark is set' do
       expect(result.stdout).to match(%r{-A INPUT -m mark --mark 0x1 -m comment --comment "503 match_mark ip6tables - test" -j REJECT --reject-with icmp6-port-unreachable})
index 13d7b1e228ae5ebc202651a43c736cb3a15a53e1..9db540dd0f5a5ec6aa54a0110054e6eab53886e0 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 describe 'firewall attribute testing, happy path', unless: (os[:family] == 'redhat' && os[:release].start_with?('5', '6')) || (os[:family] == 'sles') do
@@ -319,17 +321,17 @@ describe 'firewall attribute testing, happy path', unless: (os[:family] == 'redh
     end
     it 'ipsec_policy when ipsec' do
       expect(result.stdout).to match(
-        %r{-A OUTPUT -d 2001:db8::1\/(128|ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff) -m policy --dir out --pol ipsec -m comment --comment "607 - ipsec_policy ipsec" -j REJECT --reject-with icmp6-adm-prohibited}, # rubocop:disable Metrics/LineLength
+        %r{-A OUTPUT -d 2001:db8::1\/(128|ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff) -m policy --dir out --pol ipsec -m comment --comment "607 - ipsec_policy ipsec" -j REJECT --reject-with icmp6-adm-prohibited}, # rubocop:disable Layout/LineLength
       )
     end
     it 'ipsec_policy when none' do
       expect(result.stdout).to match(
-        %r{-A OUTPUT -d 2001:db8::1\/(128|ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff) -m policy --dir out --pol none -m comment --comment "608 - ipsec_policy none" -j REJECT --reject-with icmp6-adm-prohibited}, # rubocop:disable Metrics/LineLength
+        %r{-A OUTPUT -d 2001:db8::1\/(128|ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff) -m policy --dir out --pol none -m comment --comment "608 - ipsec_policy none" -j REJECT --reject-with icmp6-adm-prohibited}, # rubocop:disable Layout/LineLength
       )
     end
     it 'ipsec_dir when out' do
       expect(result.stdout).to match(
-        %r{-A OUTPUT -d 2001:db8::1\/(128|ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff) -m policy --dir out --pol ipsec -m comment --comment "609 - ipsec_dir out" -j REJECT --reject-with icmp6-adm-prohibited}, # rubocop:disable Metrics/LineLength
+        %r{-A OUTPUT -d 2001:db8::1\/(128|ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff) -m policy --dir out --pol ipsec -m comment --comment "609 - ipsec_dir out" -j REJECT --reject-with icmp6-adm-prohibited}, # rubocop:disable Layout/LineLength
       )
     end
     it 'ipsec_dir when in' do
@@ -359,10 +361,10 @@ describe 'firewall attribute testing, happy path', unless: (os[:family] == 'redh
       expect(result.stdout).to match(%r{-A INPUT -p tcp -m addrtype --src-type LOCAL -m addrtype ! --src-type LOCAL -m comment --comment "620 - src_type multiple values" -j ACCEPT})
     end
     it 'all the modules with multiple args is set' do
-      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-in eth0 --physdev-out eth1 --physdev-is-bridged -m iprange --src-range 2001::-2002::\s+--dst-range 2003::-2004:: -m owner --uid-owner (0|root) --gid-owner 404 -m multiport --dports 8080 -m addrtype --src-type LOCAL --dst-type UNICAST -m comment --comment "801 - ipt_modules tests" -j REJECT --reject-with icmp6-port-unreachable}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-in eth0 --physdev-out eth1 --physdev-is-bridged -m iprange --src-range 2001::-2002::\s+--dst-range 2003::-2004:: -m owner --uid-owner (0|root) --gid-owner 404 -m multiport --dports 8080 -m addrtype --src-type LOCAL --dst-type UNICAST -m comment --comment "801 - ipt_modules tests" -j REJECT --reject-with icmp6-port-unreachable}) # rubocop:disable Layout/LineLength
     end
     it 'all the modules with single args is set' do
-      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-out eth1 --physdev-is-bridged -m iprange --dst-range 2003::-2004:: -m owner --gid-owner 404 -m multiport --dports 8080 -m addrtype --dst-type UNICAST -m comment --comment "802 - ipt_modules tests" -j REJECT --reject-with icmp6-port-unreachable}) # rubocop:disable Metrics/LineLength
+      expect(result.stdout).to match(%r{-A OUTPUT -p tcp -m physdev\s+--physdev-out eth1 --physdev-is-bridged -m iprange --dst-range 2003::-2004:: -m owner --gid-owner 404 -m multiport --dports 8080 -m addrtype --dst-type UNICAST -m comment --comment "802 - ipt_modules tests" -j REJECT --reject-with icmp6-port-unreachable}) # rubocop:disable Layout/LineLength
     end
     it 'tee_gateway is set' do
       expect(result.stdout).to match(%r{-A PREROUTING -m comment --comment "811 - tee_gateway6" -j TEE --gateway 2001:db8::1})
index 7f8e25b0c845f663b9ea61f1b212b3c66df441aa..facf204c72efeb1e5416687f93ee859f3e46de75 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 describe 'puppet resource firewallchain command' do
index 3c6137e921f326a6c86305cefbbfb40d0a68ae0c..a8affbf0b39996a36eb1034f3d76cb5cd0528b23 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 # Here we want to test the the resource commands ability to work with different
index 65f2a50245d35ae6c254c2ea9f9c77d93e6af6ff..5b5dfeb07f8193accaaeb65e83d535ab1afb8dcc 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 require 'spec_helper_acceptance_local'
 
@@ -103,7 +105,7 @@ describe 'rules spec' do
       %r{INPUT ACCEPT}, %r{FORWARD ACCEPT}, %r{OUTPUT ACCEPT},
       %r{-A FORWARD -s 10.0.0.0\/(8|255\.0\.0\.0) -d 10.0.0.0\/(8|255\.0\.0\.0) -m comment --comment \"090 forward allow local\" -j ACCEPT},
       %r{-A FORWARD -s 10.0.0.0\/(8|255\.0\.0\.0) (! -d|-d !) 10.0.0.0\/(8|255\.0\.0\.0) -p icmp -m comment --comment \"100 forward standard allow icmp\" -j ACCEPT},
-      %r{-A FORWARD -s 10.0.0.0\/(8|255\.0\.0\.0) (! -d|-d !) 10.0.0.0\/(8|255\.0\.0\.0) -p tcp -m multiport --sports 80,443,21,20,22,53,123,43,873,25,465 -m conntrack --ctstate NEW -m comment --comment \"100 forward standard allow tcp\" -j ACCEPT}, # rubocop:disable Metrics/LineLength
+      %r{-A FORWARD -s 10.0.0.0\/(8|255\.0\.0\.0) (! -d|-d !) 10.0.0.0\/(8|255\.0\.0\.0) -p tcp -m multiport --sports 80,443,21,20,22,53,123,43,873,25,465 -m conntrack --ctstate NEW -m comment --comment \"100 forward standard allow tcp\" -j ACCEPT}, # rubocop:disable Layout/LineLength
       %r{-A FORWARD -s 10.0.0.0\/(8|255\.0\.0\.0) (! -d|-d !) 10.0.0.0\/(8|255\.0\.0\.0) -p udp -m multiport --sports 53,123 -m comment --comment \"100 forward standard allow udp\" -j ACCEPT}
     ]
     it 'contains appropriate rules' do
index bcf8197e3bd1c2dc89288ebd421be61b362bf225..ccb787d7ba6e23af4938101bd5afaf21fd38174c 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper_acceptance'
 
 # Some tests for the standard recommended usage
index 3157cc9ef0409fbef34d453dea53f7e5861cbb5d..d593f93ca0698b6c8830b8bd5504f842995b10be 100644 (file)
@@ -595,7 +595,7 @@ ARGS_TO_HASH = {
     },
   },
   'connlimit_above' => {
-    line: '-A INPUT -p tcp -m multiport --dports 22 -m connlimit --connlimit-above 10 --connlimit-mask 32 -j REJECT --reject-with icmp-port-unreachable -m comment --comment "061 REJECT connlimit_above 10"', # rubocop:disable Metrics/LineLength
+    line: '-A INPUT -p tcp -m multiport --dports 22 -m connlimit --connlimit-above 10 --connlimit-mask 32 -j REJECT --reject-with icmp-port-unreachable -m comment --comment "061 REJECT connlimit_above 10"', # rubocop:disable Layout/LineLength
     table: 'filter',
     params: {
       proto: 'tcp',
@@ -605,7 +605,7 @@ ARGS_TO_HASH = {
     },
   },
   'connlimit_above_with_connlimit_mask' => {
-    line: '-A INPUT -p tcp -m multiport --dports 22 -m connlimit --connlimit-above 10 --connlimit-mask 24 -j REJECT --reject-with icmp-port-unreachable -m comment --comment "061 REJECT connlimit_above 10 with mask 24"', # rubocop:disable Metrics/LineLength,
+    line: '-A INPUT -p tcp -m multiport --dports 22 -m connlimit --connlimit-above 10 --connlimit-mask 24 -j REJECT --reject-with icmp-port-unreachable -m comment --comment "061 REJECT connlimit_above 10 with mask 24"', # rubocop:disable Layout/LineLength,
     table: 'filter',
     params: {
       proto: 'tcp',
@@ -634,7 +634,7 @@ ARGS_TO_HASH = {
     },
   },
   'drop_new_packets_without_syn' => {
-    line: '-t filter ! -s 10.0.0.0/8 ! -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP -m comment --comment "064 drop NEW non-tcp external packets with FIN/RST/ACK set and SYN unset"', # rubocop:disable Metrics/LineLength
+    line: '-t filter ! -s 10.0.0.0/8 ! -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP -m comment --comment "064 drop NEW non-tcp external packets with FIN/RST/ACK set and SYN unset"', # rubocop:disable Layout/LineLength
     table: 'filter',
     params: {
       name: '064 drop NEW non-tcp external packets with FIN/RST/ACK set and SYN unset',
@@ -659,7 +659,7 @@ ARGS_TO_HASH = {
     },
   },
   'match_mark' => {
-    line: '-A INPUT -p tcp -m mark --mark 0x1 -m connlimit --connlimit-above 10 --connlimit-mask 32 -j REJECT --reject-with icmp-port-unreachable -m comment --comment "066 REJECT connlimit_above 10 with mask 32 and mark matches"', # rubocop:disable Metrics/LineLength
+    line: '-A INPUT -p tcp -m mark --mark 0x1 -m connlimit --connlimit-above 10 --connlimit-mask 32 -j REJECT --reject-with icmp-port-unreachable -m comment --comment "066 REJECT connlimit_above 10 with mask 32 and mark matches"', # rubocop:disable Layout/LineLength
     table: 'filter',
     params: {
       proto: 'tcp',
@@ -811,7 +811,7 @@ HASH_TO_ARGS = {
       sport: ['7061', '7062'],
       table: 'filter',
     },
-    args: ['-t', :filter, '-s', '1.1.1.1/32', '-d', '1.1.1.1/32', '-p', :tcp, '-m', 'multiport', '--sports', '7061,7062', '-m', 'multiport', '--dports', '7061,7062', '-j', 'ACCEPT', '-m', 'comment', '--comment', '000 allow foo'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '-s', '1.1.1.1/32', '-d', '1.1.1.1/32', '-p', :tcp, '-m', 'multiport', '--sports', '7061,7062', '-m', 'multiport', '--dports', '7061,7062', '-j', 'ACCEPT', '-m', 'comment', '--comment', '000 allow foo'], # rubocop:disable Layout/LineLength
   },
   'long_rule_2' => {
     params: {
@@ -826,7 +826,7 @@ HASH_TO_ARGS = {
       sport: ['7061', '7062'],
       table: 'filter',
     },
-    args: ['-t', :filter, '-s', '1.1.1.1/32', '-d', '2.10.13.0/24', '-p', :udp, '-m', 'multiport', '--sports', '7061,7062', '-m', 'multiport', '--dports', '7061', '-j', 'my_custom_chain', '-m', 'comment', '--comment', '700 allow bar'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '-s', '1.1.1.1/32', '-d', '2.10.13.0/24', '-p', :udp, '-m', 'multiport', '--sports', '7061,7062', '-m', 'multiport', '--dports', '7061', '-j', 'my_custom_chain', '-m', 'comment', '--comment', '700 allow bar'], # rubocop:disable Layout/LineLength
   },
   'no_action' => {
     params: {
@@ -1286,7 +1286,7 @@ HASH_TO_ARGS = {
       connlimit_mask: '24',
       action: 'reject',
     },
-    args: ['-t', :filter, '-p', :tcp, '-m', 'multiport', '--dports', '22', '-j', 'REJECT', '-m', 'connlimit', '--connlimit-above', '10', '--connlimit-mask', '24', '-m', 'comment', '--comment', '061 REJECT connlimit_above 10 with mask 24'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '-p', :tcp, '-m', 'multiport', '--dports', '22', '-j', 'REJECT', '-m', 'connlimit', '--connlimit-above', '10', '--connlimit-mask', '24', '-m', 'comment', '--comment', '061 REJECT connlimit_above 10 with mask 24'], # rubocop:disable Layout/LineLength
   },
   'connmark' => {
     params: {
@@ -1318,7 +1318,7 @@ HASH_TO_ARGS = {
       source: '! 10.0.0.0/8',
       tcp_flags: '! FIN,SYN,RST,ACK SYN',
     },
-    args: ['-t', :filter, '!', '-s', '10.0.0.0/8', '!', '-p', :tcp, '-m', 'tcp', '!', '--tcp-flags', 'FIN,SYN,RST,ACK', 'SYN', '-m', 'state', '--state', 'NEW', '-j', 'DROP', '-m', 'comment', '--comment', '064 drop NEW non-tcp external packets with FIN/RST/ACK set and SYN unset'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '!', '-s', '10.0.0.0/8', '!', '-p', :tcp, '-m', 'tcp', '!', '--tcp-flags', 'FIN,SYN,RST,ACK', 'SYN', '-m', 'state', '--state', 'NEW', '-j', 'DROP', '-m', 'comment', '--comment', '064 drop NEW non-tcp external packets with FIN/RST/ACK set and SYN unset'], # rubocop:disable Layout/LineLength
   },
   'negate_dport_and_sport' => {
     params: {
@@ -1332,7 +1332,7 @@ HASH_TO_ARGS = {
       dport: ['! 67', '! 66'],
       proto: 'udp',
     },
-    args: ['-t', :filter, '-s', '0.0.0.0/32', '-d', '255.255.255.255/32', '-p', :udp, '-m', 'multiport', '!', '--sports', '68,69', '-m', 'multiport', '!', '--dports', '67,66', '-j', 'ACCEPT', '-m', 'comment', '--comment', '065 negate dport and sport'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '-s', '0.0.0.0/32', '-d', '255.255.255.255/32', '-p', :udp, '-m', 'multiport', '!', '--sports', '68,69', '-m', 'multiport', '!', '--dports', '67,66', '-j', 'ACCEPT', '-m', 'comment', '--comment', '065 negate dport and sport'], # rubocop:disable Layout/LineLength
   },
   'match_mark' => {
     params: {
@@ -1344,7 +1344,7 @@ HASH_TO_ARGS = {
       match_mark: '0x1',
       action: 'reject',
     },
-    args: ['-t', :filter, '-p', :tcp, '-j', 'REJECT', '-m', 'mark', '--mark', '0x1', '-m', 'connlimit', '--connlimit-above', '10', '--connlimit-mask', '32', '-m', 'comment', '--comment', '066 REJECT connlimit_above 10 with mask 32 and mark matches'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '-p', :tcp, '-j', 'REJECT', '-m', 'mark', '--mark', '0x1', '-m', 'connlimit', '--connlimit-above', '10', '--connlimit-mask', '32', '-m', 'comment', '--comment', '066 REJECT connlimit_above 10 with mask 32 and mark matches'], # rubocop:disable Layout/LineLength
   },
   'clamp_mss_to_pmtu' => {
     params: {
@@ -1432,7 +1432,7 @@ HASH_TO_ARGS = {
       queue_num: '50',
       queue_bypass: true,
     },
-    args: ['-t', :filter, '-s', '1.2.3.4/32', '-d', '4.3.2.1/32', '-p', :tcp, '-j', 'NFQUEUE', '--queue-num', '50', '--queue-bypass', '-m', 'comment', '--comment', '002 nfqueue specify queue_num and queue_bypass'], # rubocop:disable Metrics/LineLength
+    args: ['-t', :filter, '-s', '1.2.3.4/32', '-d', '4.3.2.1/32', '-p', :tcp, '-j', 'NFQUEUE', '--queue-num', '50', '--queue-bypass', '-m', 'comment', '--comment', '002 nfqueue specify queue_num and queue_bypass'], # rubocop:disable Layout/LineLength
   },
   'nfqueue_jump3' => {
     params: {
index d620d0803fe01411029e89ca8c458faa3896326b..461a9a8e3f322702342697847b7fac1930466452 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'singleton'
 
 class LitmusHelper
index d2346d39f78c75e7e246bb183ddd0a88d44b2c14..4cffcab68d89a6f0cb92ac24122f4daa2b0cdc47 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 if ENV['COVERAGE'] == 'yes'
   require 'simplecov'
   require 'simplecov-console'
index 5c69ae3a195cd34539d5e337475ce1385cd032db..eea80e15d7426756b40545c6126959f61a1fbe92 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'firewall::linux::archlinux', type: :class do
index 38fc7eda04309825cb48db2f43fa4152a721d5d7..4f74d21fb03c2e17d684eaa6bd53bdc07d0565cb 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'firewall::linux::debian', type: :class do
index 3f00e7c7513dbbf3ffd68dadfa90642e20508d39..d9b720da5ec2e1ecaa6f6f72838272a8f5bd3055 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 RSpec.shared_examples 'ensures iptables service' do
index c44600d66115169d2f18d78a103479825fa4847f..b45982ea71fbf4a7e9aff7c49339eb7fbecd4fd8 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'firewall::linux', type: :class do
index a26ddb540ea213a53148532ad65df47139c39bb2..5293613fa8f3bb90ebbfd54ed7e0564be4d60950 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'firewall', type: :class do
index 880487c5fe702d26fe1467a721d1558b9fac40fa..e9503a8dfc09f9c68a637f787170130abd81d3f2 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'Facter::Util::Fact iptables_persistent_version' do
index 0187540bbff5f8802a1ce611c51d5b960fe3c55a..f965002a22e4ee69e49100c7a82f3210c218598d 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'Facter::Util::Fact' do
index cf1ebfd201135ec04a659b7e14aec19e297f05e8..a991e46df601067b45ee5a33b2a0f2e7ea5e5f1b 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env rspec # rubocop:disable Lint/ScriptPermission : Puppet error?
+# frozen_string_literal: true
 
 require 'spec_helper'
 if Puppet::Util::Package.versioncmp(Puppet.version, '3.4.0') < 0
index 1aacb6bd6e9158ec2fef2a4265e44bafd1fb3d92..f7ccb9f691119b20a2bef23874d86446dd499bc3 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env rspec
+# frozen_string_literal: true
 
 require 'spec_helper'
 if Puppet::Util::Package.versioncmp(Puppet.version, '3.4.0') < 0
index e344773f08c4e4808809ce8162665ce054fd3ecb..5aaf9b82879236a109387dce1a7bf80759adebc0 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env rspec # rubocop:disable Lint/ScriptPermission : Puppet error?
+# frozen_string_literal: true
 
 require 'spec_helper'
 if Puppet::Util::Package.versioncmp(Puppet.version, '3.4.0') < 0
index 70d026febc249a27b2b28273843c04ad13056be6..b35a27391a7d8d15df63a613e8dab46f808ce37d 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env rspec
+# frozen_string_literal: true
 
 require 'spec_helper'
 
index 4ef2743efcfaa70dea0560cd6cf9f8a3f2a14ee8..d85332a8251e034aa3e85062620f3c8f4f682f42 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env rspec
+# frozen_string_literal: true
 
 require 'spec_helper'
 
index dc9580f81caf03abadf8b1da05adb552771c56af..aae3290b28018dd1ac8930d4e3da6438bc7e8948 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 describe 'Puppet::Util::Firewall' do
index 01f79e4ea925268a39f360373561d07cfd6d4cb1..8551928c5b75e6bdc8a16fc4398443deb94f85c2 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 require 'puppet/util/ipcidr'