Skip to content

Commit 211dbcd

Browse files
committed
fix(mmserver): improve error message when using self-signed certs
1 parent fc05438 commit 211dbcd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mm-server/src/server.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ impl Server {
101101
config
102102
}
103103
_ => {
104-
let tls_ctx = self_signed_tls_ctx(socket.local_addr()?)?;
104+
let addr = socket.local_addr()?;
105+
let ip = addr.ip();
106+
if ip_rfc::global(&ip) || ip.is_unspecified() {
107+
bail!("TLS is required for non-private addresses");
108+
}
109+
110+
let tls_ctx = self_signed_tls_ctx(addr)?;
105111
quiche::Config::with_boring_ssl_ctx_builder(quiche::PROTOCOL_VERSION, tls_ctx)?
106112
}
107113
};

0 commit comments

Comments
 (0)