mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
Check postgresql ALPN value for direct SSL connections
This commit is contained in:
@@ -137,7 +137,13 @@ pub(crate) async fn handshake<S: AsyncRead + AsyncWrite + Unpin + Send>(
|
|||||||
|
|
||||||
// check the ALPN, if exists, as required.
|
// check the ALPN, if exists, as required.
|
||||||
match conn_info.alpn_protocol() {
|
match conn_info.alpn_protocol() {
|
||||||
None | Some(PG_ALPN_PROTOCOL) => {}
|
None => {
|
||||||
|
if direct.is_some() {
|
||||||
|
warn!("missing ALPN protocol 'postgresql'");
|
||||||
|
return Err(HandshakeError::ProtocolViolation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Some(PG_ALPN_PROTOCOL) => {}
|
||||||
Some(other) => {
|
Some(other) => {
|
||||||
let alpn = String::from_utf8_lossy(other);
|
let alpn = String::from_utf8_lossy(other);
|
||||||
warn!(%alpn, "unexpected ALPN");
|
warn!(%alpn, "unexpected ALPN");
|
||||||
|
|||||||
Reference in New Issue
Block a user