Skip to content

Commit

Permalink
Merge pull request #575 from capsi-informatique/proxy-remote-commands
Browse files Browse the repository at this point in the history
Add Remote Commands capabilities on Zabbix Proxy
  • Loading branch information
bastelfreak authored Jan 16, 2019
2 parents 92d2867 + ffea1f7 commit 641d942
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
$proxy_database_user = 'zabbix-proxy'
$proxy_datasenderfrequency = '1'
$proxy_debuglevel = '3'
$proxy_enableremotecommands = 0
$proxy_externalscripts = '/usr/lib/zabbix/externalscripts'
$proxy_heartbeatfrequency = '60'
$proxy_historycachesize = '8M'
Expand All @@ -308,6 +309,7 @@
$proxy_localbuffer = '0'
$proxy_logfile = '/var/log/zabbix/zabbix_proxy.log'
$proxy_logfilesize = '10'
$proxy_logremotecommands = 0
$proxy_logslowqueries = '0'
$proxy_mode = '0'
$proxy_offlinebuffer = '1'
Expand Down
8 changes: 8 additions & 0 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
# [*sourceip*]
# Source ip address for outgoing connections.
#
# [*enableremotecommands*]
# Whether remote commands from zabbix server are allowed.
#
# [*logremotecommands*]
# Enable logging of executed shell commands as warnings.
#
# [*logfile*]
# Name of log file.
#
Expand Down Expand Up @@ -347,6 +353,8 @@
$hostname = $zabbix::params::proxy_hostname,
$listenport = $zabbix::params::proxy_listenport,
$sourceip = $zabbix::params::proxy_sourceip,
Integer[0] $enableremotecommands = $zabbix::params::proxy_enableremotecommands,
Integer[0] $logremotecommands = $zabbix::params::proxy_logremotecommands,
$logfile = $zabbix::params::proxy_logfile,
$logfilesize = $zabbix::params::proxy_logfilesize,
$debuglevel = $zabbix::params::proxy_debuglevel,
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,19 @@
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSPSKIdentity=/etc/zabbix/keys/identity.file$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSPSKFile=/etc/zabbix/keys/file.key$} }
end

context 'with zabbix_proxy.conf and version 3.4' do
let :params do
{
enableremotecommands: 1,
logremotecommands: 1,
zabbix_version: '3.4'
}
end

it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^EnableRemoteCommands=1$} }
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^LogRemoteCommands=1$} }
end
end
end
end
Expand Down
16 changes: 16 additions & 0 deletions templates/zabbix_proxy.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@ DBPassword=<%= @database_password %>
#
<% if @database_port %>DBPort=<%= @database_port %><% end %>
<% if @zabbix_version.to_f >= 3.4 %>
### Option: EnableRemoteCommands
# Whether remote commands from Zabbix server are allowed.
# 0 - not allowed
# 1 - allowed
#
EnableRemoteCommands=<%= @enableremotecommands %>

### Option: LogRemoteCommands
# Enable logging of executed shell commands as warnings.
# 0 - disabled
# 1 - enabled
#
LogRemoteCommands=<%= @logremotecommands %>
<% end %>

######### PROXY SPECIFIC PARAMETERS #############

### Option: ProxyLocalBuffer
Expand Down

0 comments on commit 641d942

Please sign in to comment.