Skip to content

config-manager: reload TLS certificates when file content changes#460

Open
smoczy123 wants to merge 1 commit into
scylladb:masterfrom
smoczy123:tls_when_file_content
Open

config-manager: reload TLS certificates when file content changes#460
smoczy123 wants to merge 1 commit into
scylladb:masterfrom
smoczy123:tls_when_file_content

Conversation

@smoczy123
Copy link
Copy Markdown
Collaborator

Add periodic monitoring of TLS certificate file modification times (every 30 seconds) so that in-place cert rotation is detected without requiring SIGHUP or a path change. When a file change is detected, the config manager re-reads the cert/key files and pushes the updated HttpServerConfig through the watch channel, triggering a server reload.

Fixes: VECTOR-550


// Monitor TLS certificate files for in-place content changes
let mut tls_monitor = TlsFileMonitor::new(&self.config_tx.borrow());
let mut tls_check_interval = tokio::time::interval(TLS_FILE_CHECK_INTERVAL);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we use some filesystem mechanisms to watch files? Most likely, there is a crate available for this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is such crate: https://crates.io/crates/notify but it needs quite a lot of integration (it is not async).

Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/config_manager.rs Outdated
Comment thread crates/vector-store/src/config_manager.rs
@smoczy123 smoczy123 force-pushed the tls_when_file_content branch from 2b5098a to 1b373e9 Compare May 28, 2026 09:46
Add periodic monitoring of TLS certificate file modification times
(every 30 seconds) so that in-place cert rotation is detected without
requiring SIGHUP or a path change. When a file change is detected,
the config manager re-reads the cert/key files and pushes the updated
HttpServerConfig through the watch channel, triggering a server reload.

Fixes: VECTOR-550
@smoczy123 smoczy123 force-pushed the tls_when_file_content branch from 1b373e9 to bc22247 Compare May 28, 2026 09:47
@smoczy123
Copy link
Copy Markdown
Collaborator Author

Changelog:

  • adressed the comments

@smoczy123 smoczy123 requested a review from ewienik May 28, 2026 09:49
Copy link
Copy Markdown
Collaborator

@ewienik ewienik left a comment

Choose a reason for hiding this comment

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

@knowack1 Do you have more comments?

@smoczy123 smoczy123 requested a review from knowack1 June 1, 2026 08:44
Copy link
Copy Markdown
Collaborator

@knowack1 knowack1 left a comment

Choose a reason for hiding this comment

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

Approved with some small comments. That can be addressed as follow-up if you see them useful.

}

/// Tracks TLS files to detect in-place content changes.
struct TlsFileMonitor {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider TlsFilesMonitor

}

/// Tracks TLS files to detect in-place content changes.
struct TlsFileMonitor {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider moving to dedicated file along with FileMonitor


async fn read_content_hash(path: Option<&Path>) -> Option<u64> {
let path = path?;
let content = tokio::fs::read(path).await.ok()?;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we read these files twice (in tls.rs as well). On the other this is minor inefficiency with rare path and the design separation is clean.

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