railwayapp-templates / postgres-ssl

MIT License
13 stars 36 forks source link

Generate valid x509v3 Certificate #15

Closed brody192 closed 4 months ago

brody192 commented 4 months ago

Main change -

Other changes -

Miscellaneous changes -

melissa-hale commented 4 months ago

@brody192 this looks 🔥

~just curious though if you tested to make sure the init-ssl script only runs when the conditions are met?~

~i had moved it out of the docker-entrypoint-initdb.d/ dir because (I think) the postgres image will execute anything in that directory on startup.~

ignore above 😄 -> https://hub.docker.com/_/postgres#:~:text=Warning%3A%20scripts%20in%20/docker%2Dentrypoint%2Dinitdb.d%20are%20only%20run%20if%20you%20start%20the%20container%20with%20a%20data%20directory%20that%20is%20empty

brody192 commented 4 months ago

Yep, additionally I have tested the added logic in wrapper.sh by both deploying the current postgres-ssl based template and a template that deploys from postgres:16 and then replacing the source image with my image I built in my fork, in both tests the correct logic is triggered and either the invalid cert is regenerated or a cert is generated if one doesn't exist. The logic for the expired certificate also works as I tested that by deploying with SSL_CERT_DAYS set to 20, upon the next deploy it regenerated them, still with 20 days but it was proof the logic worked.