File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ mandatory = false
2626cert_dir = " /etc/kms/certs"
2727subject_postfix = " .dstack"
2828admin_token_hash = " "
29+ # Whether trusted RPCs require the KMS to first attest itself to its own
30+ # auth API. Defaults to true (strict). Set to false ONLY when running KMS
31+ # outside a TEE (e.g. local dev/testing) where the local guest agent socket
32+ # is unavailable.
33+ enforce_self_authorization = true
2934
3035[core .image ]
3136verify = true
Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ pub(crate) struct KmsConfig {
4040 pub image : ImageConfig ,
4141 #[ serde( with = "serde_human_bytes" ) ]
4242 pub admin_token_hash : Vec < u8 > ,
43+ /// Whether trusted RPCs require the KMS to first attest itself to its
44+ /// own auth API. Defaults to `true` (strict). Set `false` only for local
45+ /// dev/testing where the KMS runs outside a TEE and cannot reach a guest
46+ /// agent socket.
47+ #[ serde( default = "default_true" ) ]
48+ pub enforce_self_authorization : bool ,
49+ }
50+
51+ fn default_true ( ) -> bool {
52+ true
4353}
4454
4555impl KmsConfig {
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ use ra_tls::{
2626use scale:: Decode ;
2727use sha2:: Digest ;
2828use tokio:: sync:: OnceCell ;
29- use tracing:: info;
29+ use tracing:: { info, warn } ;
3030use upgrade_authority:: { build_boot_info, local_kms_boot_info, BootInfo } ;
3131
3232use crate :: {
@@ -76,6 +76,9 @@ impl KmsState {
7676 config. image . download_timeout ,
7777 config. pccs_url . clone ( ) ,
7878 ) ;
79+ if !config. enforce_self_authorization {
80+ warn ! ( "self-authorization is disabled; trusted RPCs will not be gated by KMS self-attestation - do not use in production TEE deployments" ) ;
81+ }
7982 Ok ( Self {
8083 inner : Arc :: new ( KmsStateInner {
8184 config,
@@ -102,6 +105,9 @@ struct BootConfig {
102105
103106impl RpcHandler {
104107 async fn ensure_self_allowed ( & self ) -> Result < ( ) > {
108+ if !self . state . config . enforce_self_authorization {
109+ return Ok ( ( ) ) ;
110+ }
105111 let boot_info = self
106112 . state
107113 . self_boot_info
Original file line number Diff line number Diff line change @@ -206,6 +206,9 @@ pub(crate) fn pad64(hash: [u8; 32]) -> Vec<u8> {
206206}
207207
208208pub ( crate ) async fn ensure_self_kms_allowed ( cfg : & KmsConfig ) -> Result < ( ) > {
209+ if !cfg. enforce_self_authorization {
210+ return Ok ( ( ) ) ;
211+ }
209212 let boot_info = local_kms_boot_info ( cfg. pccs_url . as_deref ( ) )
210213 . await
211214 . context ( "failed to build local KMS boot info" ) ?;
You can’t perform that action at this time.
0 commit comments