101 Commits
Author SHA1 Message Date
Jeremy Schneider 0c6740f146 feat: include authenticated user identity in HTTP access log (#9991)
Set an X-Remote-User response header containing the authenticated username
on every request when the LOG_AUTHENTICATED_USER config option is enabled
(disabled by default). This allows the HTTP access log to be configured to
include user identity via standard log format directives
(%({x-remote-user}o)s in gunicorn, %{X-Remote-User}o in Apache) without
requiring any changes to pgAdmin's session or authentication behaviour. The
default gunicorn access log format is updated to surface the header.

The username is sanitised to a header-safe value: it is transliterated to
Latin-1 (HTTP headers are Latin-1 only) and any non-printable characters,
including CR/LF, are stripped, so unusual usernames cannot cause a 500 on
every response.
2026-06-19 09:26:32 +01:00
Ashesh Vashi c88c8f612e docker: read PGADMIN_CONFIG_CONFIG_DATABASE_URI safely via os.environ (#9984)
The container entrypoint substituted ${PGADMIN_CONFIG_CONFIG_DATABASE_URI}
into a double-quoted Python string for `python3 -c`. Combined with the
config_distro.py convention (where the env var's value must itself be a
Python literal, i.e. users set it to 'postgresql+psycopg://...'), the
entrypoint re-wrapped the already-quoted value, producing a string with
literal quotes inside that SQLAlchemy could not parse -- and the Python
crash made the first-launch check capture an empty string, silently
skipping PGADMIN_DEFAULT_EMAIL / PGADMIN_DEFAULT_PASSWORD setup.

Read the env var inside Python via os.environ so the shell no longer
participates in Python-literal quoting (also removing a shell-injection
surface), and use ast.literal_eval to unwrap the legacy quoted form while
letting raw values pass through. external_config_db_exists now stays
"False" on any Python failure so first-launch setup still runs.

Adds a 9.16 release note.
2026-06-09 14:44:26 +01:00
Ashesh Vashi 0d11dbc173 fix(docker): make CAP_NET_BIND_SERVICE optional for restricted runtimes (#9985)
The container previously applied CAP_NET_BIND_SERVICE to the python
interpreter so the non-root pgadmin user could bind to ports 80/443.
Some platforms refuse to honor file capabilities:

  - --cap-drop=ALL / OpenShift restricted-v2 SCC zero the bounding set,
    so the kernel returns EPERM on exec of any capability-tagged binary.
    This makes the image fail to start (issue #9657).
  - --security-opt=no-new-privileges / allowPrivilegeEscalation: false
    causes the kernel to silently strip file capabilities on exec, so
    the binary runs but a subsequent bind() to <1024 still fails.

Split the interpreter so neither default behavior nor restricted-runtime
support has to give up the other:

  - Dockerfile copies python3.X to /usr/local/bin/python3-cap and applies
    setcap to the copy. /usr/local/bin/python3.X stays un-capped, so
    /venv/bin/python3 (which symlinks to it) execs cleanly under
    restricted SCCs. A parallel /venv/bin/python3-cap symlink keeps the
    venv activation working when the capped interpreter is used.
  - entrypoint.sh reads /proc/self/status at startup. If NoNewPrivs is
    set, or CAP_NET_BIND_SERVICE is missing from the bounding set,
    gunicorn is invoked through the un-capped python and (when
    PGADMIN_LISTEN_PORT is unset) the default port falls back to 8080
    for plain HTTP or 8443 for TLS. A startup message records the
    choice.
  - Existing deployments with the default 80/443 mapping are unaffected:
    on every unrestricted runtime the bounding set still contains
    NET_BIND_SERVICE and gunicorn runs through the capped interpreter
    exactly as before.
  - PGADMIN_LISTEN_PORT, if set, is honored in both paths.

Docs gain a "Restricted Security Contexts" subsection covering the new
auto-detected fallback and the OpenShift / --cap-drop=ALL invocation.

Fixes #9657
2026-05-28 19:31:55 +05:30
Ashesh Vashi 4ddb16f47a fix: customize container user permissions using PUID and PGID. #9657 (#9833)
Add support for custom container user permissions via PUID and PGID
environment variables. When the container is started as root
(--user root), the pgadmin user is reassigned to the requested UID/GID
and all initialization runs under that user via su-exec, ensuring
files are created with correct ownership from the start.

Key changes:
- Dockerfile: add su-exec package, add chmod g=u for /run/pgadmin
  (fixes OpenShift random UID access)
- entrypoint.sh: add PUID/PGID validation and privilege dropping
  before initialization (not after), preserving OpenShift compatibility

Three modes supported:
- Default (USER 5050): unchanged behavior
- Custom UID (--user root -e PUID=N -e PGID=N): drops to target user
  before any init
- OpenShift (random UID, GID 0): passwd fixup + group permissions
2026-04-13 14:34:18 +05:30
Khushboo Vashi 5b231ddd3f Revert "Customize container user permissions using PUID and PGID. #9657"
This reverts commit 97c90f1e69.
2026-03-02 18:05:26 +05:30
kon-foo 97c90f1e69 Customize container user permissions using PUID and PGID. #9657 2026-02-24 16:49:43 +05:30
kon-foo b15f15960f Fix misleading error when _FILE secret is not readable. 2026-02-18 12:10:23 +05:30
Yogesh Mahajan 596b14a0f4 Ensure the container deployment supports boolean values in yaml format. #9522 2026-01-30 12:10:36 +05:30
Akshay Joshi 5c9acc1c3d 1) Added PG 18 in the github runner.
2) Added PG 18 in the docker container file.
2025-09-29 13:40:03 +05:30
Yogesh Mahajan 68627ab44e Allow user to configure security related gunicorn parameters. #8891 2025-08-25 11:52:07 +05:30
Allen HernandezandAllen Hernandez 0a2db9bc59 Supports JSON logging for gunicorn process within Docker. #8665
Co-authored-by: Allen Hernandez <2349718+AllenSH12@users.noreply.github.com>
2025-06-03 13:33:09 +05:30
Lau Ernebjerg Josefsen 2d10e95311 Add an option to load/replace the servers.json file on each container startup. #8540 2025-03-11 16:14:06 +05:30
Igor Serko ae76ea3585 Fixed Docker image entrypoint.sh email validation. #8410
Introduces a GLOBALLY_DELIVERABLE variable so that it can be passed to the email validator library
and ultimately allowing the email admin@localhost to be valid, as long as False is passed in.

Also:
* Adjusted the indentation of a command above it in the entrypoint.sh
* Added printing out the output of the validation library so that we can better find what the actual issue is
2025-02-07 12:34:23 +05:30
Grégoire Bellon-Gervais 776e092a89 Fix in case of the file does not exist (#8258) 2024-12-16 14:53:18 +05:30
Akshay Joshi fe6e21a08b Enhanced pgAdmin 4 with support for Workspace layouts. #7708 2024-12-16 14:52:56 +05:30
Yogesh Mahajan 1cf9ced260 Fixed the issues reported while testing #7330. 2024-12-06 12:08:24 +05:30
Yogesh Mahajan 42018e69a5 Add support to deploy pgAdmin in container with readOnlyRootFilesystem to true. #7330 2024-12-03 17:50:20 +05:30
Yogesh Mahajan f8192b82b8 Allow the use of a pgpass file in the pgAdmin container via Docker secrets. #5786 2024-11-14 13:09:21 +05:30
Akshay Joshi 17883fbd84 Use PG17 as the default in the container. #8022 2024-10-10 15:55:43 +05:30
Yogesh Mahajan 866db40f48 Fixed the issues reported while testing. #5869 2024-10-09 17:05:34 +05:30
Yogesh Mahajan 1fe840fcac Allow to pass PGADMIN_CONFIG_CONFIG_DATABASE_URI from docker secrets. #5869 2024-10-07 11:44:20 +05:30
Aditya Toshniwal 8fd5efaa84 Make sure ALLOW_SPECIAL_EMAIL_DOMAINS should also work for pgAdmin docker apps. #6222 2024-09-19 14:03:43 +05:30
Pravesh Sharma ed211a2bbb Fixed an issue where servers listed in the servers.json file were being reimported upon container restart. #7811 2024-09-11 13:06:31 +05:30
Pravesh Sharma a75273a714 Updated entrypoint.sh to utilize the email-validator package for email validation. #7297 2024-07-18 11:05:37 +05:30
István Lantos 715839d295 Expose UNIX socket in entrypoint.sh for Docker implementation. #7221 2024-03-26 18:22:29 +05:30
Pravesh Sharma 6971d8c3a1 Fixed an issue where preferences.json mapped to container was not having any effect on preferences. #6058 2024-02-27 12:11:59 +05:30
Yogesh Mahajan 5a74022e8a Allow preferences customization using a configuration file. #6058 2024-02-15 14:58:31 +05:30
Khushboo Vashi 0d287df6dd Administer pgAdmin Users and Preferences Using the Command Line Interface (CLI). #2483 2023-12-21 12:07:26 +05:30
Akshay Joshi 5736e173ea 1) Fixed an issue where PG 16 binaries not getting copied into the docker container.
2) Remove support for PostgreSQL 11.
2023-09-26 13:45:08 +05:30
sprayzcs 5cf9dea9a8 Change grep regex in the docker's entrypoint to find env variables starting with PGADMIN_CONFIG_ only. 2023-09-04 13:06:15 +05:30
Dave Page 8ef3f232ab Support PostgreSQL 15. 2022-10-17 10:02:45 +01:00
Dave Page 992dff64af Expose the Gunicorn limit_request_line parameter in the container, with the default set to the maximum 8190.
See #5390.
2022-10-03 14:09:25 +01:00
Dave Page 3cffcc8f5b Sonarqube fixes for Docker. 2022-08-11 09:30:43 +01:00
Yogesh Mahajan 3297546e0a Added support for passing password using Docker Secret to Docker images. Fixes #7332 2022-06-15 11:07:56 +05:30
Dave Page e7dc6df723 Support running the container under OpenShift with alternate UIDs. Fixes #7257 2022-03-21 11:19:33 +00:00
Dave Page 1438eb6364 Update to the latest Alpine release
Add libldap, which is now required for libpq, and remove 9.6 support.
2021-11-30 11:56:41 +00:00
Akshay Joshi 7d5668141d Updated PostgreSQL version from 13 to 14, to get the latest utility files. 2021-10-04 16:12:45 +05:30
Akshay Joshi 16d2a3096a 1) Fixed an issue where the binary path is not correctly parsed for version 9.6. Fixes #6534
2) Added the default binary path in the container. 
3) Fixed the typo in the documentation.
2021-06-15 19:49:46 +05:30
Dave Page 0c154deeec Fix dict definition. 2021-06-15 14:19:31 +01:00
Akshay Joshi 082c9707c0 Fixed documentation issue 'Definition list ends without a blank line; unexpected unindent.' 2021-06-15 16:45:16 +05:30
Akshay Joshi 15798ee168 Updated DEFAULT_BINARY_PATHS for container. 2021-06-15 16:08:15 +05:30
Dave Page cafd2af96d Ensure PGADMIN_DEFAULT_EMAIL looks sane when initialising a container deployment. Fixes #6227 2021-02-26 16:57:09 +00:00
Dave Page 589663d7d9 Fix filenames. 2021-02-09 16:15:13 +00:00
Dave Page 884d9db54b A bunch of size optimisation for the container.
The new Rust requirement for the Cryptography module bloated it significantly.
2021-02-09 13:12:26 +00:00
Dave Page 530eb3972b Convert READMEs to lightly formatted markdown, so they display nicely on Github etc. 2021-02-05 16:18:50 +00:00
Dave Page b41557b54b Instead of rotating logs, don't write them to the container in the first place.
This is inline with container best practices (logs go to the container console).

Fixes #6170
2021-02-02 13:45:49 +00:00
Dave Page e10dd6a80f Rotate the logfile in the container distribution. Fixes #6170 2021-02-01 17:35:23 +00:00
Dave Page 32e3da7857 Make sure pgAdmin can find the root certificates for upgrade checks. 2021-02-01 17:26:39 +00:00
Dave Page 32cdfa2969 Include PostgreSQL 13 utilities in the container. Fixes #6162 2021-01-20 13:17:27 +00:00
Dave Page 850afd7402 Add a container option (PGADMIN_DISABLE_POSTFIX) to disable the Postfix server. 2021-01-20 11:50:05 +00:00