From fc7abeb23e0c77e6ba99fed7c3131e16698886a3 Mon Sep 17 00:00:00 2001 From: Yukha Dharmeswara Date: Fri, 1 Nov 2024 10:51:28 +0700 Subject: [PATCH] [bitnami/postgresql-repmgr] Delay custom pg_hba.conf injection Signed-off-by: Yukha Dharmeswara --- .../12/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh | 9 ++++----- .../13/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh | 9 ++++----- .../14/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh | 9 ++++----- .../15/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh | 9 ++++----- .../16/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh | 9 ++++----- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/bitnami/postgresql-repmgr/12/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh b/bitnami/postgresql-repmgr/12/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh index f49f312a0cdbe..5235f9c2d282f 100644 --- a/bitnami/postgresql-repmgr/12/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh +++ b/bitnami/postgresql-repmgr/12/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() { else repmgr_inject_postgresql_configuration fi - if repmgr_is_file_external "pg_hba.conf"; then - cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" - else - repmgr_inject_pghba_configuration - fi + repmgr_inject_pghba_configuration if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}" chmod 600 "${REPMGR_PASSFILE_PATH}" @@ -864,6 +860,9 @@ repmgr_initialize() { fi if ! repmgr_is_file_external "pg_hba.conf"; then is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba + else + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf" fi if [[ "$REPMGR_ROLE" = "primary" ]]; then if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then diff --git a/bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh b/bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh index f49f312a0cdbe..5235f9c2d282f 100644 --- a/bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh +++ b/bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() { else repmgr_inject_postgresql_configuration fi - if repmgr_is_file_external "pg_hba.conf"; then - cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" - else - repmgr_inject_pghba_configuration - fi + repmgr_inject_pghba_configuration if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}" chmod 600 "${REPMGR_PASSFILE_PATH}" @@ -864,6 +860,9 @@ repmgr_initialize() { fi if ! repmgr_is_file_external "pg_hba.conf"; then is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba + else + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf" fi if [[ "$REPMGR_ROLE" = "primary" ]]; then if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then diff --git a/bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh b/bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh index f49f312a0cdbe..5235f9c2d282f 100644 --- a/bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh +++ b/bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() { else repmgr_inject_postgresql_configuration fi - if repmgr_is_file_external "pg_hba.conf"; then - cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" - else - repmgr_inject_pghba_configuration - fi + repmgr_inject_pghba_configuration if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}" chmod 600 "${REPMGR_PASSFILE_PATH}" @@ -864,6 +860,9 @@ repmgr_initialize() { fi if ! repmgr_is_file_external "pg_hba.conf"; then is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba + else + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf" fi if [[ "$REPMGR_ROLE" = "primary" ]]; then if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then diff --git a/bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh b/bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh index f49f312a0cdbe..5235f9c2d282f 100644 --- a/bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh +++ b/bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() { else repmgr_inject_postgresql_configuration fi - if repmgr_is_file_external "pg_hba.conf"; then - cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" - else - repmgr_inject_pghba_configuration - fi + repmgr_inject_pghba_configuration if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}" chmod 600 "${REPMGR_PASSFILE_PATH}" @@ -864,6 +860,9 @@ repmgr_initialize() { fi if ! repmgr_is_file_external "pg_hba.conf"; then is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba + else + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf" fi if [[ "$REPMGR_ROLE" = "primary" ]]; then if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then diff --git a/bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh b/bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh index f49f312a0cdbe..5235f9c2d282f 100644 --- a/bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh +++ b/bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh @@ -485,11 +485,7 @@ repmgr_postgresql_configuration() { else repmgr_inject_postgresql_configuration fi - if repmgr_is_file_external "pg_hba.conf"; then - cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" - else - repmgr_inject_pghba_configuration - fi + repmgr_inject_pghba_configuration if [[ "$REPMGR_USE_PASSFILE" = "true" ]] && [[ ! -f "${REPMGR_PASSFILE_PATH}" ]]; then echo "*:*:*:${REPMGR_USERNAME}:${REPMGR_PASSWORD}" >"${REPMGR_PASSFILE_PATH}" chmod 600 "${REPMGR_PASSFILE_PATH}" @@ -864,6 +860,9 @@ repmgr_initialize() { fi if ! repmgr_is_file_external "pg_hba.conf"; then is_boolean_yes "$REPMGR_PGHBA_TRUST_ALL" || postgresql_restrict_pghba + else + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_MOUNTED_CONF_DIR}/pg_hba.conf" + cp "${REPMGR_MOUNTED_CONF_DIR}/pg_hba.conf" "${POSTGRESQL_CONF_DIR}/pg_hba.conf" fi if [[ "$REPMGR_ROLE" = "primary" ]]; then if is_boolean_yes "$POSTGRESQL_FIRST_BOOT"; then