Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chain) add variable to specify chain #1

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# @param zabbix_package_state The state of the package that needs to be installed: present or latest.
# @param zabbix_package_agent The name of the agent package that we manage
# @param manage_firewall When true, it will create iptables rules.
# @param use_firewall_chain When true, it will create iptables rules in a chain.
# @param firewall_priority Set the number to use for the firewall rule.
# @param manage_repo When true, it will create repository for installing the agent.
# @param manage_choco
# When true on windows, it will use chocolatey to install the agent.
Expand Down Expand Up @@ -144,6 +146,8 @@
Optional[Stdlib::Windowspath] $zabbix_package_source = undef,
Boolean $manage_choco = $zabbix::params::manage_choco,
Boolean $manage_firewall = $zabbix::params::manage_firewall,
Boolean $use_firewall_chain = $zabbix::params::use_firewall_chain,
Integer $firewall_priority = $zabbix::params::firewall_priority,
Boolean $manage_repo = $zabbix::params::manage_repo,
Boolean $manage_resources = $zabbix::params::manage_resources,
$monitored_by_proxy = $zabbix::params::monitored_by_proxy,
Expand Down Expand Up @@ -386,13 +390,28 @@

# Manage firewall
if $manage_firewall {
if $use_firewall_chain {
firewallchain { 'ZABBIX_AGENT:filter:IPv4':
ensure => present,
purge => true,
}
firewall { "${firewall_priority} zabbix-agent":
chain => 'INPUT',
jump => 'ZABBIX_AGENT',
}
}
$chain = $use_firewall_chain ? {
true => 'ZABBIX_AGENT',
default => 'INPUT'
}
$servers = split($server, ',')
$servers.each |$_server| {
firewall { "150 zabbix-agent from ${_server}":
firewall { "${firewall_priority} zabbix-agent from ${_server}":
dport => $listenport,
proto => 'tcp',
action => 'accept',
jump => 'accept',
source => $_server,
chain => $chain,
state => [
'NEW',
'RELATED',
Expand Down
2 changes: 1 addition & 1 deletion manifests/javagateway.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
firewall { '152 zabbix-javagateway':
dport => $listenport,
proto => 'tcp',
action => 'accept',
jump => 'accept',
state => ['NEW','RELATED', 'ESTABLISHED'],
}
}
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
$manage_service = true
$default_vhost = false
$manage_firewall = false
$use_firewall_chain = false
$firewall_priority = 150
$manage_apt = true
$repo_location = undef
$unsupported_repo_location = undef
Expand Down
2 changes: 1 addition & 1 deletion manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@
firewall { '151 zabbix-proxy':
dport => $listenport,
proto => 'tcp',
action => 'accept',
jump => 'accept',
state => [
'NEW',
'RELATED',
Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@
firewall { '151 zabbix-server':
dport => $listenport,
proto => 'tcp',
action => 'accept',
jump => 'accept',
state => [
'NEW',
'RELATED',
Expand Down
Loading