Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions linkerd/app/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pub enum EnvError {
NoDestinationAddress,
#[error("no policy service configured")]
NoPolicyAddress,
#[error("linkerd identity requires a TLS Id and server name to be the same")]
TlsIdAndServerNameNotMatching,
}

#[derive(Debug, Error, Eq, PartialEq)]
Expand Down Expand Up @@ -906,6 +908,13 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
}
},
None => {
match (&tls.id, &tls.server_name) {
(linkerd_app_core::identity::Id::Dns(id), sni) if id == sni => {}
(_id, _sni) => {
return Err(EnvError::TlsIdAndServerNameNotMatching);
}
};

let (addr, certify) = parse_linkerd_identity_config(strings)?;

// If the address doesn't have a server identity, then we're on localhost.
Expand Down
13 changes: 1 addition & 12 deletions linkerd/app/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ use std::{future::Future, pin::Pin, time::SystemTime};
use tokio::sync::watch;
use tracing::Instrument;

#[derive(Debug, thiserror::Error)]
#[error("linkerd identity requires a TLS Id and server name to be the same")]
pub struct TlsIdAndServerNameNotMatching(());

#[derive(Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum Config {
Expand Down Expand Up @@ -83,14 +79,7 @@ impl Config {
certify,
tls,
} => {
// TODO: move this validation into env.rs
let name = match (&tls.id, &tls.server_name) {
(Id::Dns(id), sni) if id == sni => id.clone(),
(_id, _sni) => {
return Err(TlsIdAndServerNameNotMatching(()).into());
}
};

let name = tls.server_name.clone();
let certify = Certify::from(certify);
let (store, receiver, ready) = watch(tls, metrics.cert)?;

Expand Down
Loading