Skip to content

Commit

Permalink
configure default owner/group for zabbix agent configs
Browse files Browse the repository at this point in the history
We hardcoded the default owner/group, this was bad. This is now
configureable. Also we use a separate user on archlinux. This prohibits
the agent from reading the configs from the proxy or server.
  • Loading branch information
bastelfreak committed May 21, 2017
1 parent 9a630a8 commit 8bdcadd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 8 additions & 5 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@
$tlspskfile = $zabbix::params::agent_tlspskfile,
$tlspskidentity = $zabbix::params::agent_tlspskidentity,
$tlsservercertissuer = $zabbix::params::agent_tlsservercertissuer,
$tlsservercertsubject = $zabbix::params::agent_tlsservercertsubject,) inherits zabbix::params {
$tlsservercertsubject = $zabbix::params::agent_tlsservercertsubject,
String $agent_config_owner = $zabbix::params::agent_config_owner,
String $agent_config_group = $zabbix::params::agent_config_group,
) inherits zabbix::params {
# Check some if they are boolean

# Find if listenip is set. If not, we can set to specific ip or
Expand Down Expand Up @@ -343,8 +346,8 @@
# Configuring the zabbix-agent configuration file
file { $agent_configfile_path:
ensure => present,
owner => 'zabbix',
group => 'zabbix',
owner => $agent_config_owner,
group => $agent_config_group,
mode => '0644',
notify => Service['zabbix-agent'],
require => Package[$zabbix_package_agent],
Expand All @@ -355,8 +358,8 @@
# Include dir for specific zabbix-agent checks.
file { $include_dir:
ensure => directory,
owner => 'zabbix',
group => 'zabbix',
owner => $agent_config_owner,
group => $agent_config_group,
recurse => true,
purge => $include_dir_purge,
notify => Service['zabbix-agent'],
Expand Down
8 changes: 8 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
$manage_repo = true
$zabbix_package_agent = 'zabbix-agent'
$agent_configfile_path = '/etc/zabbix/zabbix_agentd.conf'
$agent_config_owner = 'zabbix'
$agent_zabbix_user = 'zabbix'
$agent_config_group = 'zabbix'
$agent_pidfile = undef
}
'Archlinux': {
Expand All @@ -32,7 +34,9 @@
$manage_repo = false
$zabbix_package_agent = 'zabbix-agent'
$agent_configfile_path = '/etc/zabbix/zabbix_agentd.conf'
$agent_config_owner = 'zabbix-agent'
$agent_zabbix_user = 'zabbix-agent'
$agent_config_group = 'zabbix-agent'
$agent_pidfile = undef
}
'Fedora': {
Expand All @@ -43,7 +47,9 @@
$manage_repo = false
$zabbix_package_agent = 'zabbix-agent'
$agent_configfile_path = '/etc/zabbix_agentd.conf'
$agent_config_owner = 'zabbix'
$agent_zabbix_user = 'zabbix'
$agent_config_group = 'zabbix'
$agent_pidfile = '/var/run/zabbix/zabbix_agentd.pid'
}
default : {
Expand All @@ -54,7 +60,9 @@
$manage_repo = true
$zabbix_package_agent = 'zabbix-agent'
$agent_configfile_path = '/etc/zabbix/zabbix_agentd.conf'
$agent_config_owner = 'zabbix'
$agent_zabbix_user = 'zabbix'
$agent_config_group = 'zabbix'
$agent_pidfile = '/var/run/zabbix/zabbix_agentd.pid'
}
}
Expand Down

0 comments on commit 8bdcadd

Please sign in to comment.