Skip to content

Commit

Permalink
Merge pull request ghostunnel#222 from phamann/phamann/fix-disable-au…
Browse files Browse the repository at this point in the history
…thentication

Don't set VerifyPeerCertificate function if authentication is disabled
  • Loading branch information
csstaub authored Apr 18, 2019
2 parents 95a1265 + d789a3d commit b0ab870
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,10 @@ func serverListen(context *Context) error {
}

config.GetCertificate = context.cert.GetCertificate
config.VerifyPeerCertificate = serverACL.VerifyPeerCertificateServer
if *serverDisableAuth {
config.ClientAuth = tls.NoClientCert
} else {
config.VerifyPeerCertificate = serverACL.VerifyPeerCertificateServer
}

listener, err := reuseport.NewReusablePortListener("tcp", (*serverListenAddress).String())
Expand Down
12 changes: 11 additions & 1 deletion tests/test-server-disable-authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'--cacert=root.crt',
'--disable-authentication'])

# connect with client1, confirm that the tunnel is up
# connect with no client cert, confirm that the tunnel is up
pair = SocketPair(TlsClient(None, 'root', 13001), TcpServer(13002))
pair.validate_can_send_from_client(
"hello world", "1: client -> server")
Expand All @@ -38,6 +38,16 @@
pair.validate_closing_client_closes_server(
"1: client closed -> server closed")

# connect with client1 cert, confirm that the tunnel is up
pair2 = SocketPair(
TlsClient('client1', 'root', 13001), TcpServer(13002))
pair2.validate_can_send_from_client(
"hello world", "1: client -> server")
pair2.validate_can_send_from_server(
"hello world", "1: server -> client")
pair2.validate_closing_client_closes_server(
"1: client closed -> server closed")

# connect with client2, confirm that the tunnel isn't up
try:
pair = SocketPair(
Expand Down

0 comments on commit b0ab870

Please sign in to comment.