mirror of
https://github.com/ribbybibby/ssl_exporter.git
synced 2026-05-19 23:06:35 +00:00
added pop3 STARTTLS queryResponse (#84)
* added pop3 STARTTLS queryResponse * implemented pop3 test, added pop3 starttls parameter to README Co-authored-by: Timo Boldt <tb@teuto.net>
This commit is contained in:
committed by
GitHub
parent
8e318931c5
commit
65249bc2e7
27
test/tcp.go
27
test/tcp.go
@@ -164,6 +164,33 @@ func (t *TCPServer) StartIMAP() {
|
||||
}()
|
||||
}
|
||||
|
||||
// StartPOP3 starts a listener that negotiates a TLS connection with an pop3
|
||||
// client using STARTTLS
|
||||
func (t *TCPServer) StartPOP3() {
|
||||
go func() {
|
||||
conn, err := t.Listener.Accept()
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Error accepting on socket: %s", err))
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
fmt.Fprintf(conn, "+OK XPOP3 ready.\n")
|
||||
if _, e := fmt.Fscanf(conn, "STLS\n"); e != nil {
|
||||
panic("Error in dialog. No STLS received.")
|
||||
}
|
||||
fmt.Fprintf(conn, "+OK Begin TLS negotiation now.\n")
|
||||
|
||||
// Upgrade to TLS.
|
||||
tlsConn := tls.Server(conn, t.TLS)
|
||||
if err := tlsConn.Handshake(); err != nil {
|
||||
level.Error(t.logger).Log("msg", err)
|
||||
}
|
||||
defer tlsConn.Close()
|
||||
|
||||
t.stopCh <- struct{}{}
|
||||
}()
|
||||
}
|
||||
|
||||
// StartPostgreSQL starts a listener that negotiates a TLS connection with an postgresql
|
||||
// client using STARTTLS
|
||||
func (t *TCPServer) StartPostgreSQL() {
|
||||
|
||||
Reference in New Issue
Block a user