Skip to content

Commit fda2e94

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 6dbf444 commit fda2e94

22 files changed

Lines changed: 2372 additions & 412 deletions

File tree

‎Cargo.lock‎

Lines changed: 2 additions & 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
@@ -2065,6 +2065,11 @@ fn provider_refresh_strategy(strategy: &str) -> Result<ProviderCredentialRefresh
20652065
Ok(ProviderCredentialRefreshStrategy::GoogleServiceAccountJwt)
20662066
}
20672067
"aws_sts_assume_role" => Ok(ProviderCredentialRefreshStrategy::AwsStsAssumeRole),
2068+
"oci_instance_principal" => Ok(ProviderCredentialRefreshStrategy::OciInstancePrincipal),
2069+
"oci_resource_principal" => Ok(ProviderCredentialRefreshStrategy::OciResourcePrincipal),
2070+
"oci_oke_workload_identity" => {
2071+
Ok(ProviderCredentialRefreshStrategy::OciOkeWorkloadIdentity)
2072+
}
20682073
_ => Err(miette!("unsupported provider refresh strategy: {strategy}")),
20692074
}
20702075
}
@@ -2116,6 +2121,9 @@ fn provider_refresh_strategy_name(strategy: ProviderCredentialRefreshStrategy) -
21162121
ProviderCredentialRefreshStrategy::Oauth2ClientCredentials => "oauth2_client_credentials",
21172122
ProviderCredentialRefreshStrategy::GoogleServiceAccountJwt => "google_service_account_jwt",
21182123
ProviderCredentialRefreshStrategy::AwsStsAssumeRole => "aws_sts_assume_role",
2124+
ProviderCredentialRefreshStrategy::OciInstancePrincipal => "oci_instance_principal",
2125+
ProviderCredentialRefreshStrategy::OciResourcePrincipal => "oci_resource_principal",
2126+
ProviderCredentialRefreshStrategy::OciOkeWorkloadIdentity => "oci_oke_workload_identity",
21192127
ProviderCredentialRefreshStrategy::Unspecified => "unspecified",
21202128
}
21212129
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,9 @@ enum CliProviderRefreshStrategy {
776776
Oauth2ClientCredentials,
777777
GoogleServiceAccountJwt,
778778
AwsStsAssumeRole,
779+
OciInstancePrincipal,
780+
OciResourcePrincipal,
781+
OciOkeWorkloadIdentity,
779782
}
780783

781784
impl CliProviderRefreshStrategy {
@@ -785,6 +788,9 @@ impl CliProviderRefreshStrategy {
785788
Self::Oauth2ClientCredentials => "oauth2_client_credentials",
786789
Self::GoogleServiceAccountJwt => "google_service_account_jwt",
787790
Self::AwsStsAssumeRole => "aws_sts_assume_role",
791+
Self::OciInstancePrincipal => "oci_instance_principal",
792+
Self::OciResourcePrincipal => "oci_resource_principal",
793+
Self::OciOkeWorkloadIdentity => "oci_oke_workload_identity",
788794
}
789795
}
790796
}

‎crates/openshell-core/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ipnet = "2"
3434
rustls = { workspace = true }
3535
rustls-pemfile = { workspace = true }
3636
base64 = { workspace = true }
37+
aws-lc-rs = { 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 }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub mod middleware;
3737
pub mod net;
3838
#[cfg(feature = "oauth")]
3939
pub mod oauth;
40+
pub mod oci_signature;
4041
pub mod paths;
4142
pub mod policy;
4243
pub mod policy_identity;

0 commit comments

Comments
 (0)