-
Notifications
You must be signed in to change notification settings - Fork 609
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
zabbix packages - update to 3.0 #126
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a19a234
zabbix proxy lts - update to 3.0 and add tls options
dbaio fc8efa6
zabbix agent lts - update to 3.0 and add tls options
dbaio 781db78
zabbix proxy/agent - rename a function used by both packages
dbaio 29a845f
zabbix proxy/agent - remove unused reference
dbaio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,12 @@ require_once("util.inc"); | |
require_once("functions.inc"); | ||
require_once("pkg-utils.inc"); | ||
require_once("globals.inc"); | ||
require_once("certs.inc"); | ||
|
||
define('ZABBIX_PROXY_BASE', '/usr/local'); | ||
|
||
function php_deinstall_zabbix_proxy_lts() { | ||
unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy_lts.conf"); | ||
unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix3/zabbix_proxy_lts.conf"); | ||
unlink_if_exists("/var/log/zabbix-proxy-lts/zabbix_proxy_lts.log"); | ||
unlink_if_exists("/var/run/zabbix-proxy-lts/zabbix_proxy_lts.pid"); | ||
|
||
|
@@ -84,6 +85,44 @@ function sync_package_zabbix_proxy_lts() { | |
if ($zbproxy_config['proxyenabled'] == "on") { | ||
$Mode = (is_numericint($zbproxy_config['proxymode']) ? $zbproxy_config['proxymode'] : 0); | ||
$AdvancedParams = base64_decode($zbproxy_config['advancedparams']); | ||
$TLSConnect = $zbproxy_config['tlsconnect']; | ||
$TLSAccept = $zbproxy_config['tlsaccept'] ?: "unencrypted"; | ||
|
||
if ($zbproxy_config['tlscaso']) { | ||
$TlsCAfile = "TLSCAFile=/usr/local/etc/ssl/cert.pem"; | ||
} else { | ||
if ($zbproxy_config['tlscafile'] != "none") { | ||
$ca = lookup_ca($zbproxy_config['tlscafile']); | ||
zabbix_proxy_add_keyfile($ca['crt'], "ca"); | ||
$TlsCAfile = "TLSCAFile=/usr/local/etc/zabbix3/zabbix_proxy.ca"; | ||
} | ||
} | ||
|
||
if ($zbproxy_config['tlscrlfile'] != "none") { | ||
$crl = lookup_crl($zbproxy_config['tlscrlfile']); | ||
crl_update($crl); | ||
zabbix_proxy_add_keyfile($crl['text'], "crl-verify"); | ||
$TlsCRLfile = "TLSCRLFile=/usr/local/etc/zabbix3/zabbix_proxy.crl-verify"; | ||
} | ||
|
||
if ($zbproxy_config['tlscertfile'] != "none") { | ||
$cert = lookup_cert($zbproxy_config['tlscertfile']); | ||
|
||
zabbix_proxy_add_keyfile($cert['crt'], "cert"); | ||
$TlsCERTfile = "TLSCertFile=/usr/local/etc/zabbix3/zabbix_proxy.cert"; | ||
|
||
zabbix_proxy_add_keyfile($cert['prv'], "key"); | ||
$TlsKEYfile = "TLSKeyFile=/usr/local/etc/zabbix3/zabbix_proxy.key"; | ||
} | ||
|
||
if (! empty($zbproxy_config['tlspskidentity']) ) { | ||
$TLSPSKIdentity = "TLSPSKIdentity={$zbproxy_config['tlspskidentity']}"; | ||
} | ||
|
||
if (! empty($zbproxy_config['tlspskfile']) ) { | ||
zabbix_proxy_add_keyfile($zbproxy_config['tlspskfile'], "psk"); | ||
$TLSPSKFile = "TLSPSKFile=/usr/local/etc/zabbix3/zabbix_proxy.psk"; | ||
} | ||
|
||
$zbproxy_conf_file = <<< EOF | ||
Server={$zbproxy_config['server']} | ||
|
@@ -98,10 +137,18 @@ FpingLocation=/usr/local/sbin/fping | |
# but if there was, the binary would likely also be in /usr/local/sbin. | ||
Fping6Location=/usr/local/sbin/fping6 | ||
ProxyMode={$Mode} | ||
TLSConnect={$TLSConnect} | ||
TLSAccept={$TLSAccept} | ||
{$TlsCAfile} | ||
{$TlsCRLfile} | ||
{$TlsCERTfile} | ||
{$TlsKEYfile} | ||
{$TLSPSKIdentity} | ||
{$TLSPSKFile} | ||
{$AdvancedParams} | ||
|
||
EOF; | ||
file_put_contents(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => ""))); | ||
file_put_contents(ZABBIX_PROXY_BASE . "/etc/zabbix3/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => ""))); | ||
} | ||
} | ||
|
||
|
@@ -153,8 +200,8 @@ EOF; | |
|
||
// Check startup script files | ||
// Create a few directories and ensure the sample files are in place | ||
if (!is_dir(ZABBIX_PROXY_BASE . "/etc/zabbix22")) { | ||
mwexec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/zabbix22"); | ||
if (!is_dir(ZABBIX_PROXY_BASE . "/etc/zabbix3")) { | ||
mwexec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/zabbix3"); | ||
} | ||
|
||
$dir_checks = <<< EOF | ||
|
@@ -218,4 +265,14 @@ EOF; | |
conf_mount_ro(); | ||
} | ||
|
||
// Based on openvpn_add_keyfile() function | ||
function zabbix_proxy_add_keyfile(& $data, $directive) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
|
||
$fpath = "/usr/local/etc/zabbix3/zabbix_proxy.{$directive}"; | ||
|
||
file_put_contents($fpath, base64_decode($data)); | ||
@chmod($fpath, 0600); | ||
@chown($fpath, "zabbix"); | ||
} | ||
|
||
?> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is $data a reference here if it's not modified inside the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy/paste sorry