Merge pull request #2 from joshlf/stealchain-server

cmd/stealchain-server: Explicitly perform TLS handshake.
This commit is contained in:
Kyle Isom 2017-08-29 10:55:49 -07:00 committed by GitHub
commit be34ad263d
1 changed files with 5 additions and 0 deletions

View File

@ -55,6 +55,11 @@ func main() {
raddr := conn.RemoteAddr() raddr := conn.RemoteAddr()
tconn := tls.Server(conn, cfg) tconn := tls.Server(conn, cfg)
err = tconn.Handshake()
if err != nil {
fmt.Printf("[+] %v: failed to complete handshake: %v\n", raddr, err)
continue
}
cs := tconn.ConnectionState() cs := tconn.ConnectionState()
if len(cs.PeerCertificates) == 0 { if len(cs.PeerCertificates) == 0 {
fmt.Printf("[+] %v: no chain presented\n", raddr) fmt.Printf("[+] %v: no chain presented\n", raddr)