[core] Compilers: TLS server name for IP upstreams is the IP literal
This commit is contained in:
@@ -9,9 +9,7 @@ use crate::edge_config::{
|
|||||||
EDGE_CONFIG_VERSION, EdgeAcme, EdgeConfig, EdgeForwardAuth, EdgeHeaderOp, EdgeHealthCheck,
|
EDGE_CONFIG_VERSION, EdgeAcme, EdgeConfig, EdgeForwardAuth, EdgeHeaderOp, EdgeHealthCheck,
|
||||||
EdgeHost, EdgeTls, EdgeUpstream, EdgeValue,
|
EdgeHost, EdgeTls, EdgeUpstream, EdgeValue,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{AccessLog, AuthMode, HeaderRule, HeaderValue, Model, Scheme, TlsMode, Upstream};
|
||||||
AccessLog, AuthMode, HeaderRule, HeaderValue, Model, Scheme, TlsMode, Upstream, UpstreamHost,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub(super) fn compile(model: &Model, o: &CompileOptions) -> EdgeConfig {
|
pub(super) fn compile(model: &Model, o: &CompileOptions) -> EdgeConfig {
|
||||||
let site = model.site();
|
let site = model.site();
|
||||||
@@ -64,11 +62,9 @@ fn upstream(u: &Upstream) -> EdgeUpstream {
|
|||||||
EdgeUpstream {
|
EdgeUpstream {
|
||||||
address: u.authority(),
|
address: u.authority(),
|
||||||
tls: u.scheme == Scheme::Https,
|
tls: u.scheme == Scheme::Https,
|
||||||
// Like Go's TLS client in Caddy: SNI is the host name; IP literals send none.
|
// Like Go's TLS client in Caddy: the dial host is the server name; for an IP literal
|
||||||
sni: match &u.host {
|
// rustls sends no SNI and checks the IP SAN.
|
||||||
UpstreamHost::Name(n) => n.clone(),
|
sni: u.host_str(),
|
||||||
UpstreamHost::Ip(_) => String::new(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ pub struct EdgeUpstream {
|
|||||||
/// `host:port`, IPv6 in brackets.
|
/// `host:port`, IPv6 in brackets.
|
||||||
pub address: String,
|
pub address: String,
|
||||||
pub tls: bool,
|
pub tls: bool,
|
||||||
/// SNI and certificate name when `tls` is set.
|
/// Server name for TLS (SNI and certificate check): the host name or IP literal.
|
||||||
pub sni: String,
|
pub sni: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"upstream": {
|
"upstream": {
|
||||||
"address": "127.0.0.1:9091",
|
"address": "127.0.0.1:9091",
|
||||||
"tls": false,
|
"tls": false,
|
||||||
"sni": ""
|
"sni": "127.0.0.1"
|
||||||
},
|
},
|
||||||
"path_and_query": "/api/authz/forward-auth",
|
"path_and_query": "/api/authz/forward-auth",
|
||||||
"copy_headers": [
|
"copy_headers": [
|
||||||
@@ -34,12 +34,12 @@
|
|||||||
{
|
{
|
||||||
"address": "127.0.0.1:2342",
|
"address": "127.0.0.1:2342",
|
||||||
"tls": false,
|
"tls": false,
|
||||||
"sni": ""
|
"sni": "127.0.0.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "127.0.0.1:2343",
|
"address": "127.0.0.1:2343",
|
||||||
"tls": false,
|
"tls": false,
|
||||||
"sni": ""
|
"sni": "127.0.0.1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"forward_auth": false,
|
"forward_auth": false,
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
{
|
{
|
||||||
"address": "[::1]:3001",
|
"address": "[::1]:3001",
|
||||||
"tls": false,
|
"tls": false,
|
||||||
"sni": ""
|
"sni": "::1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"forward_auth": false,
|
"forward_auth": false,
|
||||||
|
|||||||
Reference in New Issue
Block a user