File tree Expand file tree Collapse file tree 9 files changed +30
-3
lines changed
Expand file tree Collapse file tree 9 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ mod tests {
9494 rvps_config: RvpsConfig :: BuiltIn ( RvpsCrateConfig {
9595 storage: ReferenceValueStorageConfig :: LocalFs ( local_fs:: Config :: default ( ) ) ,
9696 extractors: None ,
97+ rvps_read_only: false ,
9798 } ) ,
9899 attestation_token_broker: AttestationTokenConfig :: Simple ( simple:: Configuration {
99100 duration_min: 5 ,
@@ -107,6 +108,7 @@ mod tests {
107108 rvps_config: RvpsConfig :: BuiltIn ( RvpsCrateConfig {
108109 storage: ReferenceValueStorageConfig :: LocalFs ( local_fs:: Config :: default ( ) ) ,
109110 extractors: None ,
111+ rvps_read_only: false ,
110112 } ) ,
111113 attestation_token_broker: AttestationTokenConfig :: Simple ( simple:: Configuration {
112114 duration_min: 5 ,
@@ -124,6 +126,7 @@ mod tests {
124126 rvps_config: RvpsConfig :: BuiltIn ( RvpsCrateConfig {
125127 storage: ReferenceValueStorageConfig :: LocalFs ( local_fs:: Config :: default ( ) ) ,
126128 extractors: None ,
129+ rvps_read_only: false ,
127130 } ) ,
128131 attestation_token_broker: AttestationTokenConfig :: Ear ( ear_broker:: Configuration {
129132 duration_min: 5 ,
@@ -140,6 +143,7 @@ mod tests {
140143 rvps_config: RvpsConfig :: BuiltIn ( RvpsCrateConfig {
141144 storage: ReferenceValueStorageConfig :: LocalFs ( local_fs:: Config :: default ( ) ) ,
142145 extractors: None ,
146+ rvps_read_only: false ,
143147 } ) ,
144148 attestation_token_broker: AttestationTokenConfig :: Ear ( ear_broker:: Configuration {
145149 duration_min: 5 ,
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ impl TestHarness {
157157 storage : ReferenceValueStorageConfig :: LocalJson ( local_json:: Config {
158158 file_path : rv_path,
159159 } ) ,
160+ rvps_read_only : false ,
160161 } ) ,
161162 RvpsType :: Remote => {
162163 info ! ( "Starting Remote RVPS" ) ;
Original file line number Diff line number Diff line change 33 "policy_engine" : " opa" ,
44 "rvps_config" : {
55 "type" : " GrpcRemote" ,
6- "address" : " http://rvps:50003"
6+ "address" : " http://rvps:50003" ,
7+ "rvps_read_only" : false
78 },
89 "attestation_token_broker" : {
910 "type" : " Ear" ,
Original file line number Diff line number Diff line change 22 "storage" : {
33 "type" :" LocalFs" ,
44 "file_path" : " /opt/confidential-containers/attestation-service/reference_values"
5- }
5+ },
6+ "rvps_read_only" : false
67}
Original file line number Diff line number Diff line change @@ -320,6 +320,7 @@ mod tests {
320320 file_path: "/opt/confidential-containers/attestation-service/reference_values" . into( ) ,
321321 } ) ,
322322 extractors: None ,
323+ rvps_read_only: false ,
323324 } ) ,
324325 attestation_token_broker: AttestationTokenConfig :: Simple ( simple:: Configuration {
325326 duration_min: 5 ,
Original file line number Diff line number Diff line change @@ -98,11 +98,13 @@ RVPS can be launched with a specified configuration file by `-c` flag. A configu
9898 "storage" : {
9999 "type" : " LocalFs" ,
100100 "file_path" : " /opt/confidential-containers/attestation-service/reference_values"
101- }
101+ },
102+ "rvps_read_only" : false
102103}
103104```
104105- ` storage.type ` : backend storage type to store reference values. Currently ` LocalFs ` and ` LocalJson ` are supported.
105106- ` storage.* ` : Each different type of storage has its own associated configuration parameters. This is also a JSON map object.
107+ - ` rvps_read_only ` : Whether RVPS should run in read-only mode (disable reference value registration). Defaults to ` false ` .
106108
107109## Integrate RVPS into the Attestation Service
108110
Original file line number Diff line number Diff line change @@ -53,6 +53,12 @@ async fn main() -> Result<()> {
5353
5454 info ! ( "Listen socket: {}" , & cli. address) ;
5555
56+ if config. rvps_read_only {
57+ info ! ( "RVPS is running in READ-ONLY mode. Reference value registration is disabled." ) ;
58+ } else {
59+ info ! ( "RVPS is running in normal mode. Reference value registration is enabled." ) ;
60+ }
61+
5662 let socket = cli. address . parse ( ) . context ( "parse socket addr failed" ) ?;
5763
5864 server:: start ( socket, config) . await
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ pub struct Config {
1515
1616 #[ serde( default ) ]
1717 pub extractors : Option < ExtractorsConfig > ,
18+
19+ #[ serde( default ) ]
20+ pub rvps_read_only : bool ,
1821}
1922
2023impl Config {
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ fn default_version() -> String {
5252pub struct Rvps {
5353 extractors : Extractors ,
5454 storage : Box < dyn ReferenceValueStorage + Send + Sync > ,
55+ read_only : bool ,
5556}
5657
5758impl Rvps {
@@ -63,10 +64,17 @@ impl Rvps {
6364 Ok ( Rvps {
6465 extractors,
6566 storage,
67+ read_only : config. rvps_read_only ,
6668 } )
6769 }
6870
6971 pub async fn verify_and_extract ( & mut self , message : & str ) -> Result < ( ) > {
72+ if self . read_only {
73+ bail ! (
74+ "RVPS is configured in read-only mode. Reference value registration is disabled."
75+ ) ;
76+ }
77+
7078 let message: Message = serde_json:: from_str ( message) . context ( "parse message" ) ?;
7179
7280 // Judge the version field
You can’t perform that action at this time.
0 commit comments