Skip to content

Commit 4260f17

Browse files
committed
Removed auto-generation of self-signed certs
1 parent 6dc09b3 commit 4260f17

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

crates/cli/src/docker_init.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use docker_compose_types::{
3131
};
3232
use eyre::Result;
3333
use indexmap::IndexMap;
34-
use rcgen::generate_simple_self_signed;
3534

3635
/// Name of the docker compose file
3736
pub(super) const CB_COMPOSE_FILE: &str = "cb.docker-compose.yml";
@@ -427,18 +426,11 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
427426
std::fs::create_dir(certs_path.clone())?;
428427
}
429428

430-
if !certs_path.join(SIGNER_TLS_CERTIFICATE_NAME).try_exists()? ||
431-
!certs_path.join(SIGNER_TLS_KEY_NAME).try_exists()?
432-
{
433-
let (cert, key): (String, String) =
434-
generate_simple_self_signed(vec!["cb_signer".to_string()])
435-
.map(|x| (x.cert.pem(), x.key_pair.serialize_pem()))
436-
.map_err(|e| {
437-
eyre::eyre!("Failed to generate TLS certificate: {e}")
438-
})?;
439-
440-
std::fs::write(certs_path.join(SIGNER_TLS_CERTIFICATE_NAME), &cert)?;
441-
std::fs::write(certs_path.join(SIGNER_TLS_KEY_NAME), &key)?;
429+
if !certs_path.join(SIGNER_TLS_CERTIFICATE_NAME).try_exists()? {
430+
return Err(eyre::eyre!("Signer TLS certificate not found at {}, please provide a valid certificate or create one", certs_path.join(SIGNER_TLS_CERTIFICATE_NAME).display()));
431+
}
432+
if !certs_path.join(SIGNER_TLS_KEY_NAME).try_exists()? {
433+
return Err(eyre::eyre!("Signer TLS key not found at {}, please provide a valid key or create one", certs_path.join(SIGNER_TLS_KEY_NAME).display()));
442434
}
443435

444436
volumes.push(create_cert_binding(certs_path));
@@ -569,8 +561,7 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
569561
environment: Environment::KvPair(signer_envs),
570562
healthcheck: Some(Healthcheck {
571563
test: Some(HealthcheckTest::Single(format!(
572-
// TODO: needs -k if using self-signed certs, how do we pass that in?
573-
"curl -f {signer_http_prefix}://localhost:{signer_port}/status"
564+
"curl -k -f {signer_server}/status"
574565
))),
575566
interval: Some("30s".into()),
576567
timeout: Some("5s".into()),

0 commit comments

Comments
 (0)