-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add icinga2 rule for outgoing traffic
- Loading branch information
1 parent
e338551
commit 33cd933
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# allow outgoing icinga2 | ||
# @param ports icinga2 ports | ||
class nftables::rules::out::icinga2 ( | ||
Array[Stdlib::Port,1] $ports = [5665], | ||
) { | ||
nftables::rule { | ||
'default_out-icinga2': | ||
content => "tcp dport {${join($ports,', ')}} accept", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'nftables::rules::out::icinga2' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
|
||
context 'default options' do | ||
it { is_expected.to compile } | ||
it { is_expected.to contain_nftables__rule('default_out-icinga2').with_content('tcp dport {5665} accept') } | ||
end | ||
|
||
context 'with ports set' do | ||
let(:params) do | ||
{ | ||
ports: [55, 60], | ||
} | ||
end | ||
|
||
it { is_expected.to compile } | ||
it { is_expected.to contain_nftables__rule('default_out-icinga2').with_content('tcp dport {55, 60} accept') } | ||
end | ||
end | ||
end | ||
end |