Skip to content

Commit 284a61d

Browse files
authored
Merge pull request #1 from puppetlabs/main
Sync fork
2 parents 1ef615e + 7644792 commit 284a61d

File tree

7 files changed

+45
-39
lines changed

7 files changed

+45
-39
lines changed

.github/workflows/labeller.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/mend.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: "mend"
22

33
on:
4-
pull_request_target:
5-
types:
6-
- opened
7-
- synchronize
4+
pull_request:
5+
branches:
6+
- "main"
87
schedule:
98
- cron: "0 0 * * *"
109
workflow_dispatch:

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
55

66
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
77

8+
## [v8.0.3](https://github.com/puppetlabs/puppetlabs-firewall/tree/v8.0.3) - 2024-07-19
9+
10+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v8.0.2...v8.0.3)
11+
12+
### Fixed
13+
14+
- Fix resource generation ipcidr dependency [#1204](https://github.com/puppetlabs/puppetlabs-firewall/pull/1204) ([2fa](https://github.com/2fa))
15+
16+
## [v8.0.2](https://github.com/puppetlabs/puppetlabs-firewall/tree/v8.0.2) - 2024-05-22
17+
18+
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v8.0.1...v8.0.2)
19+
20+
### Fixed
21+
22+
- Fix "creation" of empty built-in firewall chains [#1206](https://github.com/puppetlabs/puppetlabs-firewall/pull/1206) ([2fa](https://github.com/2fa))
23+
824
## [v8.0.1](https://github.com/puppetlabs/puppetlabs-firewall/tree/v8.0.1) - 2024-03-20
925

1026
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v8.0.0...v8.0.1)
@@ -22,6 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
2238
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v7.0.2...v8.0.0)
2339

2440
### Changed
41+
2542
- [CAT-1425] : Removing RedHat/Scientific/OracleLinux 6 [#1163](https://github.com/puppetlabs/puppetlabs-firewall/pull/1163) ([rajat-puppet](https://github.com/rajat-puppet))
2643

2744
### Fixed
@@ -49,6 +66,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
4966
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v6.0.0...v7.0.0)
5067

5168
### Changed
69+
5270
- (CAT-376) Rework firewall module to use the resource_api [#1145](https://github.com/puppetlabs/puppetlabs-firewall/pull/1145) ([david22swan](https://github.com/david22swan))
5371

5472
### Fixed
@@ -61,6 +79,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6179
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v5.0.0...v6.0.0)
6280

6381
### Changed
82+
6483
- (CONT-242) Fix duplicate rule detection [#1140](https://github.com/puppetlabs/puppetlabs-firewall/pull/1140) ([david22swan](https://github.com/david22swan))
6584
- pdksync - (MAINT) - Require Stdlib 9.x only [#1135](https://github.com/puppetlabs/puppetlabs-firewall/pull/1135) ([LukasAud](https://github.com/LukasAud))
6685

@@ -80,6 +99,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
8099
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v4.1.0...v5.0.0)
81100

82101
### Changed
102+
83103
- (Cont 779) Add Support for Puppet 8 / Drop Support for Puppet 6 [#1118](https://github.com/puppetlabs/puppetlabs-firewall/pull/1118) ([david22swan](https://github.com/david22swan))
84104

85105
## [v4.1.0](https://github.com/puppetlabs/puppetlabs-firewall/tree/v4.1.0) - 2023-03-31
@@ -112,6 +132,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
112132
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v3.6.0...v4.0.0)
113133

114134
### Changed
135+
115136
- (CONT-256) Removing outdated code [#1084](https://github.com/puppetlabs/puppetlabs-firewall/pull/1084) ([LukasAud](https://github.com/LukasAud))
116137

117138
### Added
@@ -228,6 +249,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
228249
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/v2.8.1...v3.0.0)
229250

230251
### Changed
252+
231253
- pdksync - (MAINT) Remove SLES 11 support [#977](https://github.com/puppetlabs/puppetlabs-firewall/pull/977) ([sanfrancrisko](https://github.com/sanfrancrisko))
232254
- pdksync - (MAINT) Remove RHEL 5 family support [#976](https://github.com/puppetlabs/puppetlabs-firewall/pull/976) ([sanfrancrisko](https://github.com/sanfrancrisko))
233255
- pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0 [#972](https://github.com/puppetlabs/puppetlabs-firewall/pull/972) ([carabasdaniel](https://github.com/carabasdaniel))
@@ -350,6 +372,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
350372
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/1.15.3...v2.0.0)
351373

352374
### Changed
375+
353376
- pdksync - (MODULES-8444) - Raise lower Puppet bound [#841](https://github.com/puppetlabs/puppetlabs-firewall/pull/841) ([david22swan](https://github.com/david22swan))
354377

355378
### Added
@@ -462,6 +485,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
462485
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/1.9.0...1.10.0)
463486

464487
### Changed
488+
465489
- (MODULES-5501) - Remove unsupported Ubuntu [#715](https://github.com/puppetlabs/puppetlabs-firewall/pull/715) ([pmcmaw](https://github.com/pmcmaw))
466490
- (Modules-1141) No longer accepts an array for icmp types #puppethack [#705](https://github.com/puppetlabs/puppetlabs-firewall/pull/705) ([spynappels](https://github.com/spynappels))
467491

@@ -526,6 +550,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
526550
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/1.8.0...1.8.1)
527551

528552
### Changed
553+
529554
- (maint) Remove nat flush [#625](https://github.com/puppetlabs/puppetlabs-firewall/pull/625) ([hunner](https://github.com/hunner))
530555

531556
### Added
@@ -579,6 +604,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
579604
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/1.7.0...1.7.1)
580605

581606
### Changed
607+
582608
- Deprecate port parameter [#570](https://github.com/puppetlabs/puppetlabs-firewall/pull/570) ([hunner](https://github.com/hunner))
583609

584610
### Fixed
@@ -686,6 +712,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
686712
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/1.1.3...1.2.0)
687713

688714
### Changed
715+
689716
- Doesn't actually support OEL5 [#418](https://github.com/puppetlabs/puppetlabs-firewall/pull/418) ([underscorgan](https://github.com/underscorgan))
690717

691718
### Added
@@ -728,6 +755,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
728755
[Full Changelog](https://github.com/puppetlabs/puppetlabs-firewall/compare/1.0.2...1.1.0)
729756

730757
### Changed
758+
731759
- Apply firewall resources alphabetically [#342](https://github.com/puppetlabs/puppetlabs-firewall/pull/342) ([mcanevet](https://github.com/mcanevet))
732760

733761
### Added

lib/puppet/provider/firewallchain/firewallchain.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class Puppet::Provider::Firewallchain::Firewallchain
3030
$chain_delete_command = '-X'
3131
# Command to set chain policy, works on inbuilt chains only
3232
$chain_policy_command = '-P'
33+
# Command to list specific table so it will generate necessary output for iptables-save
34+
# The retrieval of in-built chains may get confused by `iptables-save` tendency to not return table information
35+
# for tables that have not yet been interacted with.
36+
$table_list_command = '-L'
3337
# Check if the given chain name references a built in one
3438
$built_in_regex = %r{^(?:INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING)$}
3539

@@ -94,7 +98,12 @@ def set(context, changes)
9498

9599
def create(context, name, should)
96100
context.notice("Creating Chain '#{name}' with #{should.inspect}")
97-
Puppet::Provider.execute([$base_command[should[:protocol]], should[:table], $chain_create_command, should[:chain]].join(' '))
101+
# If a built-in chain is not present we assume that corresponding table has not been interacted with
102+
if $built_in_regex.match(should[:chain])
103+
Puppet::Provider.execute([$base_command[should[:protocol]], should[:table], $table_list_command].join(' '))
104+
else
105+
Puppet::Provider.execute([$base_command[should[:protocol]], should[:table], $chain_create_command, should[:chain]].join(' '))
106+
end
98107
PuppetX::Firewall::Utility.persist_iptables(context, name, should[:protocol])
99108
end
100109

@@ -150,10 +159,7 @@ def self.process_input(is, should)
150159
should[:name] = should[:title] if should[:name].nil?
151160
should[:chain], should[:table], should[:protocol] = should[:name].split(':')
152161

153-
# If an in-built chain, always treat it as being present and ensure it is assigned a policy
154-
# The retrieval of in-built chains may get confused by `iptables-save` tendency to not return table information
155-
# for tables that have not yet been interacted with.
156-
is[:ensure] = 'present' if $built_in_regex.match(is[:chain])
162+
# If an in-built chain, ensure it is assigned a policy
157163
is[:policy] = 'accept' if $built_in_regex.match(is[:chain]) && is[:policy].nil?
158164
# For the same reason assign it the default policy as an intended state if it does not have one
159165
should[:policy] = 'accept' if $built_in_regex.match(should[:chain]) && should[:policy].nil?

lib/puppet_x/puppetlabs/firewall/utility.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'puppet_x'
44
require 'socket'
55
require 'resolv'
6-
require 'puppet_x/puppetlabs/firewall/ipcidr'
6+
require_relative 'ipcidr'
77

88
module PuppetX::Firewall # rubocop:disable Style/ClassAndModuleChildren
99
# A utility class meant to contain re-usable code

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-firewall",
3-
"version": "8.0.1",
3+
"version": "8.0.3",
44
"author": "puppetlabs",
55
"summary": "Manages Firewalls such as iptables",
66
"license": "Apache-2.0",

spec/unit/puppet/provider/firewallchain/firewallchain_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
should: { name: 'INPUT:filter:IPv4', ensure: 'present' }
294294
},
295295
output: {
296-
is: { title: 'INPUT:filter:IPv4', name: 'INPUT:filter:IPv4', chain: 'INPUT', table: 'filter', protocol: 'IPv4', purge: false, ignore_foreign: false, ensure: 'present', policy: 'accept' },
296+
is: { title: 'INPUT:filter:IPv4', name: 'INPUT:filter:IPv4', chain: 'INPUT', table: 'filter', protocol: 'IPv4', purge: false, ignore_foreign: false, policy: 'accept' },
297297
should: { name: 'INPUT:filter:IPv4', chain: 'INPUT', table: 'filter', protocol: 'IPv4', ensure: 'present', policy: 'accept' }
298298
}
299299
},

0 commit comments

Comments
 (0)