postgres password appears in process table
@fila43 đang làm issue này rồi.
Từ ngày 24/4/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
as deployed by awx-operator, the postgres container will execute a
psql --set ON_ERROR_STOP=1 --set=username=awx --set=password=ZTH7V8R1wg2GwI..
Reproducer
cd 16 && ; podman build -t db -f ./Dockerfile.c9s
sudo auditctl -a exit,always -F arch=x86_64 -S execve
podman run -ti -v /var/lib/pgsql/data --name db -e POSTGRESQL_USER=awx -e POSTGRESQL_PASSWORD=lepassword -e POSTGRESQL_DATABASE=awx -e POSTGRESQL_MASTER_USER=lemaster -e POSTGRESQL_MASTER_PASSWORD=lemaster -e POSTGRESQL_ADMIN_PASSWORD=more --rm db
sudo grep psql /var/log/audit/audit.log | grep lepassword
type=EXECVE msg=audit(1713081027.200:82065): argc=5 a0="psql" a1="--set" a2="ON_ERROR_STOP=1" a3="--set=username=awx" a4="--set=password=lepassword"
something in this fashion would work
--- a/16/root/usr/share/container-scripts/postgresql/start/set_passwords.sh
+++ b/16/root/usr/share/container-scripts/postgresql/start/set_passwords.sh
@@ -1,23 +1,21 @@
#!/bin/bash
-_psql () { psql --set ON_ERROR_STOP=1 "$@" ; }
+_psql () { setsid psql --set ON_ERROR_STOP=1 "$@" ; }
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
-_psql --set=username="$POSTGRESQL_USER" \
- --set=password="$POSTGRESQL_PASSWORD" \
-<<< "ALTER USER :\"username\" WITH ENCRYPTED PASSWORD :'password';"
+(echo "${POSTGRESQL_PASSWORD}" ; echo "${POSTGRESQL_PASSWORD}"
+) | _psql --set=username="$POSTGRESQL_USER" \
+ -f <(echo '\password :username')
fi
- Ngôn ngữ chính
- PLpgSQL
- Star
- 178
- Fork
- 220
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sclorg/postgresql-container
-
PostgreSQL 16 images based on EL10 have an incorrect POSTGRESQL_PREV_VERSION setCó thể đã có người làm @ShimShtein đã nhận 120 ngày trước. Đang mở
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 72/100
sclorg/postgresql-container#661 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
sclorg/postgresql-container#669 · 1 bình luận ·
-
c10s images are not multi-arch while their corresponding c9s images are.Có thể đã có người làm @kkyrazis đã nhận 79 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
sclorg/postgresql-container#668 ·
-
Dockerfile failingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
sclorg/postgresql-container#656 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
sclorg/postgresql-container#654 ·