Open freedge opened 7 months ago
Thanks for the report. This makes sense to fix. Let's take a look.
The suggested solution is quite clever indeed. I've been thinking a bit how to approach this with a bit more straightforward solution and without shell hacks, and found out possibility to get an env variable value this way:
postgres=# \set mypass `echo $POSTGRESQL_ADMIN_PASSWORD`
postgres=# select :'mypass';
?column?
----------
test
(1 row)
However, I'm not sure whether this way is safe from the SQL injection perspective - something worth re-checking on postgresql forum?
Another way would be to install python3-psycopg2
and write a simple python script that would do what we need -- installing it into the container would only be a few hundreds of kB more.
Container platform
OCP 4
Version
quay.io/sclorg/postgresql-15-c9s:latest from awx-operator
OS version of the container image
CentOS Stream 9
Bugzilla, Jira
No response
Description
this image runs psql with the password set on the command line. As a result it appears in the process table and is recorded by auditing tools.
eg https://github.com/sclorg/postgresql-container/blob/d0cecca7766a6150489228dc2670143bf73a3997/10/root/usr/share/container-scripts/postgresql/start/set_passwords.sh#L6
as deployed by awx-operator, the postgres container will execute a
Reproducer
something in this fashion would work