-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Duplicate: Add sensitive support #857
Open
teluq-pbrideau
wants to merge
28
commits into
voxpupuli:master
Choose a base branch
from
teluq-pbrideau:feat/sensitive_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
892e593
Add sensitive support
d975ad9
Fix exposing password for debug mode
31ac5d7
Lint fixes
58ec2af
Make mysql db password undef by default
f34d865
test: fix mysql test for password as variable
teluq-pbrideau fbb5a45
test: fix postgresql sensitive /root/.pgpass content
teluq-pbrideau a4ad064
fix: values are already masked when Sensitive type is used within epp
teluq-pbrideau 3ff1d95
fix: use known types (and what tests are using) in zabbix_server.conf…
teluq-pbrideau 2819839
test: cleartext password to not mask part of template
teluq-pbrideau e5ced74
fix: define settings similar to what was in old erb
teluq-pbrideau b4729ac
test: fix for the new template (erb to epp)
teluq-pbrideau 2733015
test: cleartext password to not mask part of template
teluq-pbrideau 02662c5
test: fix linter
teluq-pbrideau e206bbd
fix: linter
teluq-pbrideau 1032eee
test: enable tests of proxy on CentOS
teluq-pbrideau ee0c75b
fix: define settings similar to what was in old erb
teluq-pbrideau de0755c
test: cleartext password to not mask part of template
teluq-pbrideau bdab8bf
test: is_expected_to compile when sensitive password is passed
teluq-pbrideau 1081c1b
test: linter
teluq-pbrideau 1ac4869
fix: add sensitive type for api_pass in web.pp
teluq-pbrideau 90576c9
refactor: Remove vmwareperffrequency parameter
teluq-pbrideau 8cf6557
refactor: remove sslcalocation_dir parameter
teluq-pbrideau 5a4b258
Merge branch 'master' into feat/sensitive_support
teluq-pbrideau e0e2d07
fix: duplicate parameter after merge
teluq-pbrideau 4080c66
Merge remote-tracking branch 'upstream/master' into feat/sensitive_su…
teluq-pbrideau fe65cd9
fix: update REFERENCE.md
teluq-pbrideau 887219d
doc: sslcalocation_dir
teluq-pbrideau 0a42efb
fix: add back unsensitive password removed from upstream merge
teluq-pbrideau 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,23 +64,23 @@ | |
# the zabbix_server and zabbix_web parameter. | ||
# @author Werner Dijkerman [email protected] | ||
class zabbix::database ( | ||
$zabbix_type = 'server', | ||
$zabbix_web = $zabbix::params::zabbix_web, | ||
$zabbix_web_ip = $zabbix::params::zabbix_web_ip, | ||
$zabbix_server = $zabbix::params::zabbix_server, | ||
$zabbix_server_ip = $zabbix::params::zabbix_server_ip, | ||
$zabbix_proxy = $zabbix::params::zabbix_proxy, | ||
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip, | ||
$manage_database = $zabbix::params::manage_database, | ||
Zabbix::Databases $database_type = $zabbix::params::database_type, | ||
$database_schema_path = $zabbix::params::database_schema_path, | ||
$database_name = $zabbix::params::server_database_name, | ||
$database_user = $zabbix::params::server_database_user, | ||
$database_password = $zabbix::params::server_database_password, | ||
$database_host = $zabbix::params::server_database_host, | ||
$database_host_ip = $zabbix::params::server_database_host_ip, | ||
$database_charset = $zabbix::params::server_database_charset, | ||
$database_collate = $zabbix::params::server_database_collate, | ||
$zabbix_type = 'server', | ||
$zabbix_web = $zabbix::params::zabbix_web, | ||
$zabbix_web_ip = $zabbix::params::zabbix_web_ip, | ||
$zabbix_server = $zabbix::params::zabbix_server, | ||
$zabbix_server_ip = $zabbix::params::zabbix_server_ip, | ||
$zabbix_proxy = $zabbix::params::zabbix_proxy, | ||
$zabbix_proxy_ip = $zabbix::params::zabbix_proxy_ip, | ||
$manage_database = $zabbix::params::manage_database, | ||
Zabbix::Databases $database_type = $zabbix::params::database_type, | ||
$database_schema_path = $zabbix::params::database_schema_path, | ||
$database_name = $zabbix::params::server_database_name, | ||
$database_user = $zabbix::params::server_database_user, | ||
Optional[Variant[String[1], Sensitive[String[1]]]] $database_password = $zabbix::params::server_database_password, | ||
$database_host = $zabbix::params::server_database_host, | ||
$database_host_ip = $zabbix::params::server_database_host_ip, | ||
$database_charset = $zabbix::params::server_database_charset, | ||
$database_collate = $zabbix::params::server_database_collate, | ||
Optional[String[1]] $database_tablespace = $zabbix::params::server_database_tablespace, | ||
) inherits zabbix::params { | ||
# So lets create the databases and load all files. This can only be | ||
|
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 |
---|---|---|
|
@@ -11,18 +11,24 @@ | |
# @param database_path Path to the database executable | ||
# @author Werner Dijkerman <[email protected]> | ||
class zabbix::database::mysql ( | ||
$zabbix_type = '', | ||
$zabbix_version = $zabbix::params::zabbix_version, | ||
$database_schema_path = '', | ||
$database_name = '', | ||
$database_user = '', | ||
$database_password = '', | ||
$database_host = '', | ||
Optional[Stdlib::Port::Unprivileged] $database_port = undef, | ||
$database_path = $zabbix::params::database_path, | ||
$zabbix_type = '', | ||
$zabbix_version = $zabbix::params::zabbix_version, | ||
$database_schema_path = '', | ||
$database_name = '', | ||
$database_user = '', | ||
Optional[Variant[String[1], Sensitive[String[1]]]] $database_password = undef, | ||
$database_host = '', | ||
Optional[Stdlib::Port::Unprivileged] $database_port = undef, | ||
$database_path = $zabbix::params::database_path, | ||
) inherits zabbix::params { | ||
assert_private() | ||
|
||
$database_password_unsensitive = if $database_password =~ Sensitive[String] { | ||
$database_password.unwrap | ||
} else { | ||
$database_password | ||
} | ||
|
||
if ($database_schema_path == false) or ($database_schema_path == '') { | ||
if versioncmp($zabbix_version, '6.0') >= 0 { | ||
$schema_path = '/usr/share/zabbix-sql-scripts/mysql/' | ||
|
@@ -43,34 +49,37 @@ | |
case $zabbix_type { | ||
'proxy': { | ||
$zabbix_proxy_create_sql = versioncmp($zabbix_version, '6.0') >= 0 ? { | ||
true => "cd ${schema_path} && mysql -h '${database_host}' -u '${database_user}' -p'${database_password}' ${port}-D '${database_name}' < proxy.sql && touch /etc/zabbix/.schema.done", | ||
false => "cd ${schema_path} && if [ -f schema.sql.gz ]; then gunzip -f schema.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p'${database_password}' ${port}-D '${database_name}' < schema.sql && touch /etc/zabbix/.schema.done" | ||
true => "cd ${schema_path} && mysql -h '${database_host}' -u '${database_user}' -p\"\${database_password}\" ${port}-D '${database_name}' < proxy.sql && touch /etc/zabbix/.schema.done", | ||
false => "cd ${schema_path} && if [ -f schema.sql.gz ]; then gunzip -f schema.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p\"\${database_password}\" ${port}-D '${database_name}' < schema.sql && touch /etc/zabbix/.schema.done" | ||
} | ||
} | ||
default: { | ||
$zabbix_server_create_sql = versioncmp($zabbix_version, '6.0') >= 0 ? { | ||
true => "cd ${schema_path} && if [ -f server.sql.gz ]; then gunzip -f server.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p'${database_password}' ${port}-D '${database_name}' < server.sql && touch /etc/zabbix/.schema.done", | ||
false => "cd ${schema_path} && if [ -f create.sql.gz ]; then gunzip -f create.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p'${database_password}' ${port}-D '${database_name}' < create.sql && touch /etc/zabbix/.schema.done" | ||
true => "cd ${schema_path} && if [ -f server.sql.gz ]; then gunzip -f server.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p\"\${database_password}\" ${port}-D '${database_name}' < server.sql && touch /etc/zabbix/.schema.done", | ||
false => "cd ${schema_path} && if [ -f create.sql.gz ]; then gunzip -f create.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p\"\${database_password}\" ${port}-D '${database_name}' < create.sql && touch /etc/zabbix/.schema.done" | ||
} | ||
} | ||
} | ||
|
||
# Loading the sql files. | ||
$_mysql_env = ["database_password=${database_password_unsensitive}"] | ||
case $zabbix_type { | ||
'proxy' : { | ||
exec { 'zabbix_proxy_create.sql': | ||
command => $zabbix_proxy_create_sql, | ||
path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}", | ||
unless => 'test -f /etc/zabbix/.schema.done', | ||
provider => 'shell', | ||
command => $zabbix_proxy_create_sql, | ||
path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}", | ||
unless => 'test -f /etc/zabbix/.schema.done', | ||
provider => 'shell', | ||
environment => $_mysql_env, | ||
} | ||
} | ||
'server' : { | ||
exec { 'zabbix_server_create.sql': | ||
command => $zabbix_server_create_sql, | ||
path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}", | ||
unless => 'test -f /etc/zabbix/.schema.done', | ||
provider => 'shell', | ||
command => $zabbix_server_create_sql, | ||
path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}", | ||
unless => 'test -f /etc/zabbix/.schema.done', | ||
provider => 'shell', | ||
environment => $_mysql_env, | ||
} | ||
} | ||
default : { | ||
|
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 |
---|---|---|
|
@@ -11,18 +11,24 @@ | |
# @param database_path Path to the database executable | ||
# @author Werner Dijkerman <[email protected]> | ||
class zabbix::database::postgresql ( | ||
$zabbix_type = '', | ||
$zabbix_version = $zabbix::params::zabbix_version, | ||
$database_schema_path = '', | ||
$database_name = '', | ||
$database_user = '', | ||
$database_password = '', | ||
$database_host = '', | ||
Stdlib::Port::Unprivileged $database_port = 5432, | ||
$database_path = $zabbix::params::database_path, | ||
$zabbix_type = '', | ||
$zabbix_version = $zabbix::params::zabbix_version, | ||
$database_schema_path = '', | ||
$database_name = '', | ||
$database_user = '', | ||
Optional[Variant[String[1], Sensitive[String[1]]]] $database_password = undef, | ||
$database_host = '', | ||
Stdlib::Port::Unprivileged $database_port = 5432, | ||
$database_path = $zabbix::params::database_path, | ||
) inherits zabbix::params { | ||
assert_private() | ||
|
||
$database_password_unsensitive = if $database_password =~ Sensitive[String] { | ||
$database_password.unwrap | ||
} else { | ||
$database_password | ||
} | ||
|
||
if $database_schema_path != false and $database_schema_path != '' { | ||
$schema_path = $database_schema_path | ||
} elsif versioncmp($zabbix_version, '6.0') >= 0 { | ||
|
@@ -56,7 +62,7 @@ | |
"PGHOST=${database_host}", | ||
"PGPORT=${database_port}", | ||
"PGUSER=${database_user}", | ||
"PGPASSWORD=${database_password}", | ||
"PGPASSWORD=${database_password_unsensitive}", | ||
"PGDATABASE=${database_name}", | ||
] | ||
|
||
|
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
Oops, something went wrong.
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.
I’m not sure if we should set default values as sensitive.
I’ve changed some tests because of this: if the default value is
Sensitive
, the output may be masked during tests, and the validation cannot be made. These lines are marked with this comment below:For example, see
spec/classes/proxy_spec.rb:115
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.
IMO that's okay