@@ -9,7 +9,7 @@ use attested_tls_proxy::{
99 attestation:: { measurements:: MeasurementPolicy , AttestationType , AttestationVerifier } ,
1010 attested_get:: attested_get,
1111 file_server:: attested_file_server,
12- get_tls_cert, AttestationGenerator , ProxyClient , ProxyServer , TlsCertAndKey ,
12+ get_tls_cert, health_check , AttestationGenerator , ProxyClient , ProxyServer , TlsCertAndKey ,
1313} ;
1414
1515#[ derive( Parser , Debug , Clone ) ]
@@ -63,6 +63,9 @@ enum CliCommand {
6363 /// dummy
6464 #[ arg( long) ]
6565 dev_dummy_dcap : Option < String > ,
66+ // Address to listen on for health checks
67+ #[ arg( long) ]
68+ listen_addr_healthcheck : Option < SocketAddr > ,
6669 } ,
6770 /// Run a proxy server
6871 Server {
@@ -89,11 +92,9 @@ enum CliCommand {
8992 /// dummy
9093 #[ arg( long) ]
9194 dev_dummy_dcap : Option < String > ,
92- // TODO missing:
93- // Name: "listen-addr-healthcheck",
94- // EnvVars: []string{"LISTEN_ADDR_HEALTHCHECK"},
95- // Value: "",
96- // Usage: "address to listen on for health checks",
95+ // Address to listen on for health checks
96+ #[ arg( long) ]
97+ listen_addr_healthcheck : Option < SocketAddr > ,
9798 } ,
9899 /// Retrieve the attested TLS certificate from a proxy server
99100 GetTlsCert {
@@ -193,12 +194,17 @@ async fn main() -> anyhow::Result<()> {
193194 tls_certificate_path,
194195 tls_ca_certificate,
195196 dev_dummy_dcap,
197+ listen_addr_healthcheck,
196198 } => {
197199 let target_addr = target_addr
198200 . strip_prefix ( "https://" )
199201 . unwrap_or ( & target_addr)
200202 . to_string ( ) ;
201203
204+ if let Some ( listen_addr_healthcheck) = listen_addr_healthcheck {
205+ health_check:: server ( listen_addr_healthcheck) . await ?;
206+ }
207+
202208 let tls_cert_and_chain = if let Some ( private_key) = tls_private_key_path {
203209 Some ( load_tls_cert_and_key (
204210 tls_certificate_path
@@ -254,7 +260,12 @@ async fn main() -> anyhow::Result<()> {
254260 client_auth,
255261 server_attestation_type,
256262 dev_dummy_dcap,
263+ listen_addr_healthcheck,
257264 } => {
265+ if let Some ( listen_addr_healthcheck) = listen_addr_healthcheck {
266+ health_check:: server ( listen_addr_healthcheck) . await ?;
267+ }
268+
258269 let tls_cert_and_chain =
259270 load_tls_cert_and_key ( tls_certificate_path, tls_private_key_path) ?;
260271
0 commit comments