Skip to content

Commit c2220f9

Browse files
committed
fix: set CN in RcgenAuthority
1 parent 7d95c9b commit c2220f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/certificate_authority/rcgen_authority.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use async_trait::async_trait;
66
use http::uri::Authority;
77
use moka::future::Cache;
88
use rand::{thread_rng, Rng};
9-
use rcgen::{KeyPair, RcgenError, SanType};
9+
use rcgen::{DistinguishedName, DnType, KeyPair, RcgenError, SanType};
1010
use std::sync::Arc;
1111
use time::{Duration, OffsetDateTime};
1212
use tokio_rustls::rustls::{self, ServerConfig};
@@ -80,6 +80,10 @@ impl RcgenAuthority {
8080
params.not_before = not_before;
8181
params.not_after = not_before + Duration::seconds(TTL_SECS);
8282

83+
let mut distinguished_name = DistinguishedName::new();
84+
distinguished_name.push(DnType::CommonName, authority.host());
85+
params.distinguished_name = distinguished_name;
86+
8387
params
8488
.subject_alt_names
8589
.push(SanType::DnsName(authority.host().to_owned()));

0 commit comments

Comments
 (0)