diff --git a/README.md b/README.md index f7b745d..c05b94b 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ pgadmin needs a default credential to login: `admin@nethserver.org` `Nethesis,12 psql -h IP_of_Node -U postgres -d postgres -p ${TCP_PORT_PGSQL} ``` -The password of postgres user can be found inside a secret file `/home/postgresql1/.config/state/secrets/passwords.secret` +The password of postgres user can be found inside a secret file `/home/postgresql1/.config/state/secrets/passwords.env` `${TCP_PORT_PGSQL} `is set inside the environment of the module diff --git a/imageroot/bin/create-secrets b/imageroot/bin/create-secrets index 3fb834d..e72dc2a 100755 --- a/imageroot/bin/create-secrets +++ b/imageroot/bin/create-secrets @@ -16,7 +16,7 @@ fi # restict to 400 umask 266 -if [[ ! -f ~/.config/state/secrets/passwords.secret ]]; then +if [[ ! -f ~/.config/state/secrets/passwords.env ]]; then password_postgres=$(/usr/bin/openssl rand -hex 20) - /usr/bin/echo "POSTGRES_PASSWORD=$password_postgres" > ~/.config/state/secrets/passwords.secret + /usr/bin/echo "POSTGRES_PASSWORD=$password_postgres" > ~/.config/state/secrets/passwords.env fi diff --git a/imageroot/systemd/user/pgadmin-app.service b/imageroot/systemd/user/pgadmin-app.service index ca43782..14eb8d9 100644 --- a/imageroot/systemd/user/pgadmin-app.service +++ b/imageroot/systemd/user/pgadmin-app.service @@ -11,7 +11,6 @@ After=postgresql.service pgadmin-app.service [Service] Environment=PODMAN_SYSTEMD_UNIT=%n EnvironmentFile=%S/state/environment -EnvironmentFile=%S/state/secrets/passwords.secret EnvironmentFile=-%S/state/smarthost.env WorkingDirectory=%S/state Restart=always diff --git a/imageroot/systemd/user/postgresql-app.service b/imageroot/systemd/user/postgresql-app.service index 0e9df30..c90c9d5 100644 --- a/imageroot/systemd/user/postgresql-app.service +++ b/imageroot/systemd/user/postgresql-app.service @@ -11,7 +11,7 @@ After=postgresql.service [Service] Environment=PODMAN_SYSTEMD_UNIT=%n EnvironmentFile=%S/state/environment -EnvironmentFile=%S/state/secrets/passwords.secret +EnvironmentFile=%S/state/secrets/passwords.env Restart=always TimeoutStopSec=70 ExecStartPre=/bin/rm -f %t/postgresql-app.pid %t/postgresql-app.ctr-id diff --git a/imageroot/update-module.d/10upgrade-to-private-secrets b/imageroot/update-module.d/10upgrade-to-private-secrets index 84641d9..cb7370f 100755 --- a/imageroot/update-module.d/10upgrade-to-private-secrets +++ b/imageroot/update-module.d/10upgrade-to-private-secrets @@ -14,9 +14,9 @@ exec 1>&2 # we want to migrate from 1.0.5 when the postgres password was default and no secrets were created -if [[ ! -f ~/.config/state/secrets/passwords.secret ]]; then +if [[ ! -f ~/.config/state/secrets/passwords.env ]]; then ../bin/create-secrets - source ~/.config/state/secrets/passwords.secret + source ~/.config/state/secrets/passwords.env # change the password of the postgres user podman exec -ti postgresql-app sh -c "PGPASSWORD=${POSTGRES_PASSWORD} psql -U postgres -d postgres -c \"ALTER USER postgres WITH PASSWORD '${POSTGRES_PASSWORD}';\"" fi