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

Add Remote Commands capabilities on Zabbix Proxy #575

Merged
merged 1 commit into from
Jan 16, 2019
Merged
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
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