-
Notifications
You must be signed in to change notification settings - Fork 235
feat(relay): reloading certificate resolver #2999
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
Conversation
19d291b
to
d232285
Compare
From @flub in discord (moving the discussion over here to make things a bit easier)
👍
Correct
I guess what I wanted it to be is mostly it's own separate thing. It's both generally useful outside of iroh and also makes the relay codebase less cluttered. I also expect this to crop up with other services we're running, I'd rather not copy it over.
I agree, the Thanks for the input! |
This is not that much code and I think it fits just fine inside the relay server for now. Once we have to start copy-pasting it we can re-visit that I guess. |
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2999/docs/iroh/ Last updated: 2024-12-12T14:49:55Z |
iroh-relay/src/server/resolver.rs
Outdated
/// The inner reloadable value. | ||
reloadable: Arc<Reloadable<CertifiedKey, Loader>>, | ||
/// The handle to the task that reloads the certificate. | ||
_handle: JoinHandle<()>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbortingDropJoinHandle
?
Looking to get back to this tonight |
675778a
to
caf438d
Compare
iroh-relay/src/server/resolver.rs
Outdated
/// The handle to the task that reloads the certificate. | ||
_handle: AbortOnDropHandle<()>, | ||
/// Shutdown signal sender | ||
_shutdown_tx: tokio::sync::oneshot::Sender<()>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I bubble this up into the relay so we call it on relay.shutdown() or is the AbortOnDropHandle enough for this usecase?
Do we have to bump the MSRV because redb got bumped to 2.3? |
what's their new MSRV? we probably want to bump it to normalize cargo.lock to v4 |
|
lets bump MSRV to 1.81 then, this will make live easier for us |
but in a new PR |
Rest of the PR good now? |
iroh-relay/src/server/resolver.rs
Outdated
tracing::info!("Reloaded the certificate"); | ||
} | ||
} => {}, | ||
_ = shutdown_rx => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we usually use cancellation token for this
MSRV fix is in now |
cdb0bc1
to
183bc97
Compare
iroh-relay/Cargo.toml
Outdated
reqwest = { version = "0.12", default-features = false, features = [ | ||
"rustls-tls", | ||
] } | ||
ring = "0.17" | ||
rustls = { version = "0.23", default-features = false, features = ["ring"] } | ||
rustls-cert-reloadable-resolver = "0.7.1" | ||
rustls-cert-file-reader = "0.4.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the new dependencies should be optional and only for the server feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert this noisy change?
@@ -135,4 +141,4 @@ required-features = ["server"] | |||
|
|||
[package.metadata.docs.rs] | |||
all-features = true | |||
rustdoc-args = ["--cfg", "iroh_docsrs"] | |||
rustdoc-args = ["--cfg", "iroh_docsrs"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also a needless change. It is better to leave newlines at the end of files.
use tokio_util::{sync::CancellationToken, task::AbortOnDropHandle}; | ||
|
||
/// The default certificate reload interval. | ||
pub const DEFAULT_CERT_RELOAD_INTERVAL: u64 = 60 * 60 * 24; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No units! Maybe make it a Duration
? Or is that still not const
? Should definitely document the units though.
lol, i miss the review window again 😄 |
I'll do a follow up, just for you :D |
Description
This sets us up so we can have manually/externally managed certs that will reload on a daily basis. This should close #1108 and we should follow up on the ops side to utilize this where needed.
Ok, this turned out to be much grosser than expected.
iroh
repo or move it intotokio-rustls-acme
(think it should move over, but for the sake of this discussion, included it here)_handle
for the reloader in regards to shutting down?Most of this still feels necessary. I could maybe feature flag it?
I had a really hard time trying to extract the loader creation into a standalone func which also aligns all the traits and error types so the thing compiles.
Suggestions are welcome :)
Example config:
Breaking Changes
Notes & open questions
Change checklist