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

Allow to define SSL keys for configuration and chown then for proper usage #205

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
21 changes: 20 additions & 1 deletion src/pgsql/bin/postgres/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,26 @@ else
fi
fi

chown -R postgres $PGDATA && chmod -R 0700 $PGDATA

echo ">>> Trying to configure SSL"
# Tweak keys to avoid permission issues:
ORIGKEYS=$(echo $CONFIGS|tr "," "\n"|egrep '(ssl_cert_file|ssl_key_file)'|cut -d ":" -f 2-|tr "\n" " "|tr -d "\'")
KEYS=""

echo ">>> Trying to move ${ORIGKEYS} to proper folder"
for file in ${ORIGKEYS}; do
# Check for file or link pointing to file
if [ -e /pg-ssl/$(basename ${file}) ]; then
echo ">>> Copying SSL file from /pg-ssl/$(basename ${file}) to ${file}"
mkdir -p $(dirname ${file})
cat /pg-ssl/$(basename ${file}) > ${file}
KEYS="$KEYS ${file}"
else
echo ">>> ERROR: SSL File ${file} doesn't exist on disk"
fi
done

chown -R postgres $PGDATA $KEYS && chmod -R 0700 $PGDATA $KEYS

source /usr/local/bin/cluster/repmgr/configure.sh

Expand Down