Session credentials for Ankusa.BlobStore.OCI from the instance's own
identity, for a node on OCI compute or OKE: no API key to store or rotate.
{Ankusa.BlobStore.OCI,
region: "us-ashburn-1",
namespace: "…",
bucket: "ankusa-segments",
key_provider:
{Ankusa.BlobStore.OCI.InstancePrincipal, :credentials, [[region: "us-ashburn-1"]]}}The federation the OCI SDKs perform, in four steps:
- the instance metadata service (
http://169.254.169.254/opc/v2, headerAuthorization: Bearer Oracle) gives the instance's leaf certificate, its private key and the intermediate certificates; - a fresh RSA session key pair is generated;
POST https://auth.<region>.oraclecloud.com/v1/x509sends the leaf certificate, the intermediates and the session public key, signed with the leaf key (keyId<tenancy>/fed-x509-sha256/<sha256 fingerprint>, the tenancy read from the certificate'sopc-tenant:organizational unit);- the answer is a short-lived
ST$<token>session token; objects are then signed with the session private key underkey_id: "ST$<token>".
The credentials are cached node-wide until five minutes before the token's own
exp, so the adapter's per-request call is an ETS read; a 401 makes the
adapter call invalidate/1, and its retry federates again.
Arguments (a keyword list, the one optional argument of credentials/1 and
invalidate/1):
:region— required, e.g."us-ashburn-1"; picks the auth service:tenancy_ocid— override the tenancy read from the certificate:imds_endpoint— default"http://169.254.169.254/opc/v2":auth_endpoint— default"https://auth.<region>.oraclecloud.com":timeout_ms— default10_000:req_options— transport options, e.g.plug:forReq.Test
Summary
Functions
{:ok, %{key_id: "ST$…", private_key: pem}}, or :error when federation failed.
Drop the cached session: the next credentials/1 federates again.
Functions
{:ok, %{key_id: "ST$…", private_key: pem}}, or :error when federation failed.
@spec invalidate(keyword()) :: :ok
Drop the cached session: the next credentials/1 federates again.