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

server+runtime: add cert refreshing #4107

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented Dec 7, 2021

This adds a new flag to opa run, intended for server usage with HTTPS listeners:
--tls-cert-refresh-period. If used with a positive duration, such as "5m" (5 minutes),
"24h", etc, the server will track the certificate and key files' contents. When their
content changes, the certificates will be reloaded.

On an error in reloading, it will log (info) the error and try again in the next round.

Fixes #2500.

@srenatus srenatus force-pushed the sr/server+runtime/add-cert-refreshing branch from 2be9a7c to 981c05f Compare December 7, 2021 13:53
@srenatus srenatus force-pushed the sr/server+runtime/add-cert-refreshing branch 2 times, most recently from 4170582 to 8773707 Compare December 8, 2021 12:54
@srenatus srenatus marked this pull request as ready for review December 8, 2021 13:00
superff
superff previously approved these changes Dec 9, 2021
tsandall
tsandall previously approved these changes Dec 9, 2021
Copy link
Member

@tsandall tsandall left a comment

Choose a reason for hiding this comment

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

Let's add a note about the new flag to this section of the security docs: https://www.openpolicyagent.org/docs/latest/security/#tls-and-https. Otherwise, these changes LGTM. Feel free to merge whenever.

@srenatus
Copy link
Contributor Author

srenatus commented Dec 9, 2021

🤦 I somehow dropped my docs commit on the floor. I'll go find it 😅

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
…run.go

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
With two flags, one for enable/disable and one for the period of
refreshes, we can avoid overloading the period flag with something
like "0" disables.

There's no need to use the VarP etc variants if the flag has no
shorthand. So, cleaned up a few of those.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
@srenatus srenatus dismissed stale reviews from tsandall and superff via a19f53c December 9, 2021 08:31
@srenatus srenatus force-pushed the sr/server+runtime/add-cert-refreshing branch 2 times, most recently from a19f53c to 373ca6f Compare December 9, 2021 08:36
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
@srenatus srenatus force-pushed the sr/server+runtime/add-cert-refreshing branch from 373ca6f to 6a8d482 Compare December 9, 2021 08:48
@srenatus srenatus merged commit cc4816e into open-policy-agent:main Dec 9, 2021
@srenatus srenatus deleted the sr/server+runtime/add-cert-refreshing branch December 9, 2021 09:13
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.

Add support for TLS certificate rotation in OPA's HTTP server
3 participants