Skip to content

Commit d9a26d6

Browse files
committed
feat(providers): gateway-minted OCI principal refresh strategies
Add oci_instance_principal, oci_resource_principal, and oci_oke_workload_identity to ProviderCredentialRefreshStrategy. Each mints OCI_KEY_ID as an ST$ security token and co-mints OCI_PRIVATE_KEY as the paired session key through additional_outputs, so sandboxes bound to the provider sign through credential_signing: oci without a long-lived key. - Instance principal federates the host's identity certificate from the instance metadata service at auth.<region>.<realm_domain>/v1/x509, signing under <tenancy>/fed-x509/<sha1 fingerprint> with an ephemeral RSA session key in the request. - Resource principal re-reads the platform-rotated RPST and private key on every refresh from files, literal material, or the OCI_RESOURCE_PRINCIPAL_* environment. - OKE workload identity exchanges the projected service-account token at the cluster proxymux (port 12250, TLS pinned to the projected CA) for a token bound to the session public key; 403 names the enhanced-cluster requirement. - Expiry is the token exp capped by max_lifetime_seconds; 401/403 and other 4xx map to fix_configuration, the rest retry. Identity endpoint overrides exist only under cfg(test) for loopback, and the configure API rejects metadata_base_url, federation_endpoint_url, and proxymux_endpoint_url material. Move the OCI signing primitives into openshell-core so the gateway and the sandbox proxy share one signer; the supervisor module keeps the HTTP framing. Add the profile plumbing (YAML names, mintable set, pinned OCI_KEY_ID/OCI_PRIVATE_KEY outputs), CLI and TUI names, Go SDK constants and converters with regenerated bindings, three endpointless example profiles, and the strategy, material, and mapping rows in the profiles docs. Re-pin the public and durable schema fingerprints for the additive enum values. Closes #3961 Signed-off-by: Federico Kamelhar <federico.kamelhar@oracle.com>
1 parent 2395f5b commit d9a26d6

25 files changed

Lines changed: 2487 additions & 452 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-cli/src/commands/provider.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,11 @@ fn provider_refresh_strategy(strategy: &str) -> Result<ProviderCredentialRefresh
21072107
Ok(ProviderCredentialRefreshStrategy::GoogleServiceAccountJwt)
21082108
}
21092109
"aws_sts_assume_role" => Ok(ProviderCredentialRefreshStrategy::AwsStsAssumeRole),
2110+
"oci_instance_principal" => Ok(ProviderCredentialRefreshStrategy::OciInstancePrincipal),
2111+
"oci_resource_principal" => Ok(ProviderCredentialRefreshStrategy::OciResourcePrincipal),
2112+
"oci_oke_workload_identity" => {
2113+
Ok(ProviderCredentialRefreshStrategy::OciOkeWorkloadIdentity)
2114+
}
21102115
_ => Err(miette!("unsupported provider refresh strategy: {strategy}")),
21112116
}
21122117
}
@@ -2158,6 +2163,9 @@ fn provider_refresh_strategy_name(strategy: ProviderCredentialRefreshStrategy) -
21582163
ProviderCredentialRefreshStrategy::Oauth2ClientCredentials => "oauth2_client_credentials",
21592164
ProviderCredentialRefreshStrategy::GoogleServiceAccountJwt => "google_service_account_jwt",
21602165
ProviderCredentialRefreshStrategy::AwsStsAssumeRole => "aws_sts_assume_role",
2166+
ProviderCredentialRefreshStrategy::OciInstancePrincipal => "oci_instance_principal",
2167+
ProviderCredentialRefreshStrategy::OciResourcePrincipal => "oci_resource_principal",
2168+
ProviderCredentialRefreshStrategy::OciOkeWorkloadIdentity => "oci_oke_workload_identity",
21612169
ProviderCredentialRefreshStrategy::Unspecified => "unspecified",
21622170
}
21632171
}

‎crates/openshell-cli/src/main.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ enum CliProviderRefreshStrategy {
793793
Oauth2ClientCredentials,
794794
GoogleServiceAccountJwt,
795795
AwsStsAssumeRole,
796+
OciInstancePrincipal,
797+
OciResourcePrincipal,
798+
OciOkeWorkloadIdentity,
796799
}
797800

798801
impl CliProviderRefreshStrategy {
@@ -802,6 +805,9 @@ impl CliProviderRefreshStrategy {
802805
Self::Oauth2ClientCredentials => "oauth2_client_credentials",
803806
Self::GoogleServiceAccountJwt => "google_service_account_jwt",
804807
Self::AwsStsAssumeRole => "aws_sts_assume_role",
808+
Self::OciInstancePrincipal => "oci_instance_principal",
809+
Self::OciResourcePrincipal => "oci_resource_principal",
810+
Self::OciOkeWorkloadIdentity => "oci_oke_workload_identity",
805811
}
806812
}
807813
}

‎crates/openshell-core/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ uuid = { workspace = true }
3434
ipnet = "2"
3535
rustls = { workspace = true }
3636
base64 = { workspace = true }
37+
rcgen = { workspace = true }
3738
jsonwebtoken = { workspace = true, optional = true }
3839
zeroize = { workspace = true, optional = true }
3940
chrono = { version = "0.4", default-features = false, features = ["clock", "std"], optional = true }
@@ -72,7 +73,6 @@ protoc-bin-vendored = { workspace = true }
7273

7374
[dev-dependencies]
7475
h2 = "0.4"
75-
rcgen = { workspace = true }
7676
tempfile = "3"
7777
tracing-subscriber = { workspace = true }
7878
tokio-rustls = { workspace = true }

‎crates/openshell-core/src/lib.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub mod net;
4545
pub mod network_trust;
4646
#[cfg(feature = "oauth")]
4747
pub mod oauth;
48+
pub mod oci_signature;
4849
pub mod paths;
4950
pub mod policy;
5051
pub use openshell_policy_schema::yaml;

0 commit comments

Comments
 (0)