Enforce certhash-based bans and add strong certificate checking (non-working for now, crypto/tls doesn't verify client certificates)

This commit is contained in:
Mikkel Krautz 2011-11-12 23:55:33 +01:00
parent 0b1794f9b5
commit 1240fe3eb6
3 changed files with 55 additions and 20 deletions

View file

@ -7,6 +7,7 @@ package main
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/binary"
"goprotobuf.googlecode.com/hg/proto"
"grumble/blobstore"
@ -125,6 +126,15 @@ func (client *Client) ShownName() string {
return client.Username
}
// Check whether the client's certificate is
// verified.
func (client *Client) IsVerified() bool {
tlsconn := client.conn.(*tls.Conn)
state := tlsconn.ConnectionState()
client.Printf("%v", state.VerifiedChains)
return len(state.VerifiedChains) > 0
}
// Log a panic and disconnect the client.
func (client *Client) Panic(v ...interface{}) {
client.Print(v)