Skip to content

Commit 91e35e4

Browse files
committed
Rm no longer needed allow self signed option
1 parent feec7ca commit 91e35e4

1 file changed

Lines changed: 6 additions & 29 deletions

File tree

src/main.rs

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
use anyhow::{anyhow, ensure};
22
use attestation::{AttestationType, AttestationVerifier, measurements::MeasurementPolicy};
33
use clap::{Parser, Subcommand};
4-
use std::{
5-
fs::File,
6-
net::{IpAddr, SocketAddr},
7-
path::PathBuf,
8-
};
4+
use std::{fs::File, net::SocketAddr, path::PathBuf};
95
use tokio::io::AsyncWriteExt;
106
use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer};
117
use tracing::level_filters::LevelFilter;
@@ -78,9 +74,6 @@ enum CliCommand {
7874
// Address to listen on for health checks
7975
#[arg(long)]
8076
listen_addr_healthcheck: Option<SocketAddr>,
81-
/// Enables verification of self-signed TLS certificates
82-
#[arg(long)]
83-
allow_self_signed: bool,
8477
},
8578
/// Run a proxy server
8679
Server {
@@ -118,9 +111,6 @@ enum CliCommand {
118111
/// Additional CA certificate to verify against (PEM) Defaults to no additional TLS certs.
119112
#[arg(long)]
120113
tls_ca_certificate: Option<PathBuf>,
121-
/// Enables verification of self-signed TLS certificates
122-
#[arg(long)]
123-
allow_self_signed: bool,
124114
/// Filename to write measurements as JSON to
125115
#[arg(long)]
126116
out_measurements: Option<PathBuf>,
@@ -158,9 +148,6 @@ enum CliCommand {
158148
/// Additional CA certificate to verify against (PEM) Defaults to no additional TLS certs.
159149
#[arg(long)]
160150
tls_ca_certificate: Option<PathBuf>,
161-
/// Enables verification of self-signed TLS certificates
162-
#[arg(long)]
163-
allow_self_signed: bool,
164151
},
165152
}
166153

@@ -235,7 +222,6 @@ async fn main() -> anyhow::Result<()> {
235222
tls_ca_certificate,
236223
dev_dummy_dcap,
237224
listen_addr_healthcheck,
238-
allow_self_signed,
239225
} => {
240226
let target_addr = target_addr
241227
.strip_prefix("https://")
@@ -304,11 +290,8 @@ async fn main() -> anyhow::Result<()> {
304290
health_check::server(listen_addr_healthcheck).await?;
305291
}
306292

307-
let tls_cert_and_chain = load_tls_cert_and_key_server(
308-
tls_certificate_path,
309-
tls_private_key_path,
310-
listen_addr.ip(),
311-
)?;
293+
let tls_cert_and_chain =
294+
load_tls_cert_and_key_server(tls_certificate_path, tls_private_key_path)?;
312295

313296
let local_attestation_generator =
314297
AttestationGenerator::new_with_detection(server_attestation_type, dev_dummy_dcap)
@@ -333,7 +316,6 @@ async fn main() -> anyhow::Result<()> {
333316
CliCommand::GetTlsCert {
334317
server,
335318
tls_ca_certificate,
336-
allow_self_signed,
337319
out_measurements,
338320
} => {
339321
let remote_tls_cert = match tls_ca_certificate {
@@ -392,7 +374,6 @@ async fn main() -> anyhow::Result<()> {
392374
target_addr,
393375
url_path,
394376
tls_ca_certificate,
395-
allow_self_signed,
396377
} => {
397378
let remote_tls_cert = match tls_ca_certificate {
398379
Some(remote_cert_filename) => Some(
@@ -429,7 +410,6 @@ async fn main() -> anyhow::Result<()> {
429410
fn load_tls_cert_and_key_server(
430411
cert_chain: Option<PathBuf>,
431412
private_key: Option<PathBuf>,
432-
ip: IpAddr,
433413
) -> anyhow::Result<TlsCertAndKey> {
434414
if let Some(private_key) = private_key {
435415
load_tls_cert_and_key(
@@ -438,13 +418,10 @@ fn load_tls_cert_and_key_server(
438418
)
439419
} else {
440420
if cert_chain.is_some() {
441-
return Err(anyhow!("Certificate chain provided but no private key"));
421+
Err(anyhow!("Certificate chain provided but no private key"))
422+
} else {
423+
Err(anyhow!("No private key provided"))
442424
}
443-
tracing::warn!("No TLS ceritifcate provided - generating self-signed");
444-
todo!()
445-
// Ok(attested_tls_proxy::self_signed::generate_self_signed_cert(
446-
// ip,
447-
// )?)
448425
}
449426
}
450427

0 commit comments

Comments
 (0)