Fixed usage Vault with non-vault DB credentials

This commit is contained in:
Alexey Pustovalov 2024-07-22 16:51:42 +09:00
parent eb7636b8b1
commit 8269cadced
10 changed files with 120 additions and 50 deletions

View File

@ -377,20 +377,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -374,20 +374,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -374,20 +374,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -374,20 +374,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -374,20 +374,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -390,20 +390,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -390,20 +390,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -390,20 +390,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -390,20 +390,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi

View File

@ -390,20 +390,27 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
if [ -n "${ZBX_VAULTDBPATH}" ] && [ -n "${ZBX_VAULTURL}" ]; then
if [ -n "${ZBX_VAULT}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "Vault" "${ZBX_VAULT}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultTLSCertFile" "${ZBX_VAULTTLSCERTFILE}"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile" "${ZBX_VAULTTLSKEYFILE}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
if [ -n "${ZBX_VAULTDBPATH}" ]; then
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
else
update_config_var $ZBX_CONFIG "Vault"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultTLSCertFile"
update_config_var $ZBX_CONFIG "VaultTLSKeyFile"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi