Skip to content

Add Support for Custom TLS Certificates in Connection Pooler #2146

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

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

jeremie-seguin
Copy link
Contributor

This pull request is heavily inspired by this PR by @borchero and try to solve #1230 But do not include the additional annotations on the pgBouncer deployment.

The entrypoint.sh in pgbouncer docker image also need to be updated to use the certificates when present like so:

if [ -z "${CONNECTION_POOLER_CLIENT_TLS_CRT}" ]; then
    openssl req -nodes -new -x509 -subj /CN=spilo.dummy.org \
        -keyout /etc/ssl/certs/pgbouncer.key \
        -out /etc/ssl/certs/pgbouncer.crt
else
    ln ${CONNECTION_POOLER_CLIENT_TLS_CRT} /etc/ssl/certs/pgbouncer.crt
    ln ${CONNECTION_POOLER_CLIENT_TLS_KEY} /etc/ssl/certs/pgbouncer.key
fi

however the dockerfile of pgbouncer included in the operator does not seems to be public, is it accessible somewhere ?

If this solution is accepted, certificate renewal will need to be handled either on the operator side with a restart of the pooler deployment or directly on pgbouncer if the reload command is sufficient.

@FxKu
Copy link
Member

FxKu commented Dec 28, 2022

CN=spilo.dummy.org

Can this be any string? Does it matter or should it be configurable?

@jeremie-seguin
Copy link
Contributor Author

@FxKu The spilo.dummy.org is the value currently used in the self signed certificate of pgbouncer:master-24, it will not be used if a CONNECTION_POOLER_CLIENT_TLS_CRT is provided to the operator

@FxKu
Copy link
Member

FxKu commented Jan 4, 2023

@jeremie-seguin I've changed entrypoint.sh like you've suggested. Can you bump the pgbouncer docker image tag to master-26, pls?

@FxKu
Copy link
Member

FxKu commented Jan 5, 2023

@jeremie-seguin could you maybe cover the new feature in connection_pooler_test.go. Just a check that makes sure the volume section is there if tls options are specified in the manifest.

@jopadi
Copy link
Member

jopadi commented Jan 9, 2023

👍

1 similar comment
@FxKu
Copy link
Member

FxKu commented Jan 9, 2023

👍

@FxKu FxKu merged commit 3139c1f into zalando:master Jan 9, 2023
@FxKu
Copy link
Member

FxKu commented Jan 9, 2023

Thanks @jeremie-seguin . We will add the unit test ourselves.

owenthereal pushed a commit to owenthereal/postgres-operator that referenced this pull request Jan 9, 2023
…#2146)

* add volume with custom TLS config to pooler deployment
* bump pg bouncer image tag which support new feature

Co-authored-by: Jérémie Seguin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants