Commit 878de9db authored by mh's avatar mh
Browse files

initial release

parents
# firewall module
This module dispatches between shorewall and nftables, depending on what you like to use.
It should be a simple and small shim, so that modules requiring to have firewall rules in place should not care about which implemention is used.
# dispatch between firewall stuff
class firewall {
if ($facts['os']['name'] == 'CentOS') and versioncmp($facts['os']['release']['major'],'8') < 0 {
$use_nftables = false
} else {
$use_nftables = true
}
}
# manage outgoing time protocol
class firewall::rules::out::chrony {
include firewall
if $firewall::use_nftables {
include nftables::rules::out::chrony
} else {
include shorewall::rules::ntp::client
}
}
class firewall::rules::out::smtp {
include firewall
if $firewall::use_nftables {
include nftables::rules::out::smtp
} else {
include shorewall::rules::out::smtp
}
}
class firewall::rules::out::ssh {
include firewall
if $firewall::use_nftables {
include nftables::rules::out::ssh
} else {
include shorewall::rules::out::ssh
}
}
# remove out firewall ssh
class firewall::rules::out::ssh::remove {
include firewall
if $firewall::use_nftables {
include nftables::rules::out::ssh::remove
} else {
include shorewall::rules::out::ssh::remove
}
}
class firewall::rules::smtp::disable {
include firewall
if $firewall::use_nftables {
notice 'to be implemented'
} else {
include shorewall::rules::smtp::disable
}
}
class firewall::rules::smtps::disable {
include firewall
if $firewall::use_nftables {
notice 'to be implemented'
} else {
include shorewall::rules::smtps::disable
}
}
# manage incoming ssh
class firewall::rules::ssh(
Array[Integer[1,65535]] $ports,
String $source = 'net',
){
include firewall
if $firewall::use_nftables {
class{'nftables::rules::ssh':
ports => $ports,
}
} else {
class{'shorewall::rules::ssh':
ports => $ports,
source => $source,
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment