Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions cmd/pebble/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package main

import (
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
Expand All @@ -27,6 +29,7 @@ type config struct {
TLSPort int
Certificate string
PrivateKey string
SSLKeyLogFile string
OCSPResponderURL string
// Require External Account Binding for "newAccount" requests
ExternalAccountBindingRequired bool
Expand Down Expand Up @@ -162,13 +165,28 @@ func main() {
logger.Print("Management interface is disabled")
}

var ssllog io.Writer
ssllogfile, err := os.OpenFile(os.Getenv("SSLKEYLOGFILE"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
if err != nil {
ssllog = nil
} else {
logger.Printf("TLS session key of Pebble will be logged at %s", c.Pebble.SSLKeyLogFile)
ssllog = ssllogfile
defer ssllogfile.Close()
}
pebbleserver := http.Server{
TLSConfig: &tls.Config{
KeyLogWriter: ssllog,
},
Addr: c.Pebble.ListenAddress,
Handler: muxHandler,
}

logger.Printf("Listening on: %s\n", c.Pebble.ListenAddress)
logger.Printf("ACME directory available at: https://%s%s",
c.Pebble.ListenAddress, wfe.DirectoryPath)
err = http.ListenAndServeTLS(
c.Pebble.ListenAddress,
err = pebbleserver.ListenAndServeTLS(
c.Pebble.Certificate,
c.Pebble.PrivateKey,
muxHandler)
c.Pebble.PrivateKey)
cmd.FailOnError(err, "Calling ListenAndServeTLS()")
}
Loading