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

Switch to using /etc/pki/tls for the certificate source #32

Merged
merged 3 commits into from
Sep 29, 2023

Conversation

bdunne
Copy link
Member

@bdunne bdunne commented Nov 1, 2021

No longer dependent on other PRs
Requires: ManageIQ/manageiq-pods#923
Part of: ManageIQ/manageiq-pods#770

@bdunne bdunne changed the title Switch to using /etc/pki/tls for the certificate source [WIP] Switch to using /etc/pki/tls for the certificate source Nov 1, 2021
@bdunne bdunne requested a review from Fryguy as a code owner December 12, 2022 20:27
@bdunne bdunne changed the title [WIP] Switch to using /etc/pki/tls for the certificate source Switch to using /etc/pki/tls for the certificate source Dec 13, 2022
@nasark
Copy link
Member

nasark commented Feb 21, 2023

I hit the following issue when attempting to deploy with SSL enabled:

nasarkhan@Nasars-MacBook-Pro manageiq-operator % oc logs postgresql-598b495db7-5sxbn
=> sourcing /opt/app-root/src/postgresql-pre-start/pre-start.sh ...
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: error: directory "/var/lib/pgsql/data/userdata" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/pgsql/data/userdata" or run initdb
with an argument other than "/var/lib/pgsql/data/userdata".

This PR should fix the issue however, the current workaround is to create internal-certificates-secret after deploying and postgresql has initialized

Comment on lines 9 to 10
# Postgresql server will reject key files with liberal permissions
chmod og-rwx /var/lib/pgsql/data/userdata/server.key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep this?

The problem with /var/lib/pgsql/data/userdata is if this is a new install,
initalizing the database will fail because the userdata directory is not
empty and it is expected to be empty.  Since the postgres configs are always
mounted on the pod we need the certs to be in a predictable location.
Based on run-postgresql in v13 @ 481efd6
This needs to happen after generate_postgresql_config creates the ephemeral
config file which includes all configs from mounted volumes so that these
ssl settings are loaded last overwriting anything in included configs.
It also needs to happen before try_pgupgrade could potentially try to start
a server and before pg_ctl tries to start the server.
We also need to ensure hostssl in pg_hba.conf after initialize_database in
the case of a new empty volume.
@Fryguy Fryguy merged commit 852f301 into ManageIQ:master Sep 29, 2023
2 checks passed
@bdunne bdunne deleted the etc_pki branch September 29, 2023 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants