Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kms/kms.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ gateway_app_id = "any"
[core.onboard]
enabled = true
auto_bootstrap_domain = ""
auto_onboard_url = ""
quote_enabled = true
address = "0.0.0.0"
port = 8000
1 change: 1 addition & 0 deletions kms/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@ pub(crate) struct OnboardConfig {
pub enabled: bool,
pub quote_enabled: bool,
pub auto_bootstrap_domain: String,
pub auto_onboard_url: String,
}
5 changes: 4 additions & 1 deletion kms/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ async fn run_onboard_service(kms_config: KmsConfig, figment: Figment) -> Result<
"OK"
}

if !kms_config.onboard.auto_bootstrap_domain.is_empty() {
if !kms_config.onboard.auto_onboard_url.is_empty() {
onboard_service::auto_onboard_keys(&kms_config).await?;
return Ok(());
} else if !kms_config.onboard.auto_bootstrap_domain.is_empty() {
onboard_service::bootstrap_keys(&kms_config).await?;
return Ok(());
}
Expand Down
23 changes: 23 additions & 0 deletions kms/src/onboard_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,29 @@ pub(crate) async fn update_certs(cfg: &KmsConfig) -> Result<()> {
Ok(())
}

pub(crate) async fn auto_onboard_keys(cfg: &KmsConfig) -> Result<()> {
let source_url = cfg
.onboard
.auto_onboard_url
.trim_end_matches('/')
.to_string();
let source_url = if source_url.ends_with("/prpc") {
source_url
} else {
format!("{source_url}/prpc")
};
let keys = Keys::onboard(
&source_url,
&cfg.onboard.auto_bootstrap_domain,
Copy link
Collaborator

@kvinwang kvinwang Feb 14, 2026

Choose a reason for hiding this comment

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

auto_bootstrap_domain is optional in config (default is empty), but here it is passed directly as the target domain for Keys::onboard. Could we validate it first (e.g. reject empty/whitespace-only value with a clear error)? Otherwise auto-onboard may generate an unusable cert/domain setup when only auto_onboard_url is set.

— gpt-5.3-codex

cfg.onboard.quote_enabled,
cfg.pccs_url.clone(),
)
.await
.context("failed to auto-onboard from source KMS")?;
keys.store(cfg)?;
Ok(())
}

pub(crate) async fn bootstrap_keys(cfg: &KmsConfig) -> Result<()> {
let keys = Keys::generate(
&cfg.onboard.auto_bootstrap_domain,
Expand Down