Skip to content

Commit

Permalink
fixes error log-wrong cert
Browse files Browse the repository at this point in the history
  • Loading branch information
justkhbby committed Aug 14, 2024
1 parent 7efcd04 commit ca61abf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/honeypot/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package honeypot
import (
"fmt"
"io"
"log"
"sort"

"log/slog"
Expand Down Expand Up @@ -329,6 +330,7 @@ func (h *httpHoneypot) Start() error {
envString += fmt.Sprintf("%s=%s\n", strings.ToUpper(key), value)
}
}
w.Header().Set("Content-Type", "text/plain")
fmt.Fprint(w, envString)
})
slog.Info("HTTP Honeypot started", "port", h.port)
Expand All @@ -344,7 +346,12 @@ func (h *httpHoneypot) Start() error {
// HTTPS server
go func() {
for {
err := http.ListenAndServeTLS(":443", h.cert, h.key, mux)
svc := http.Server{
Addr: ":443",
Handler: mux,
ErrorLog: log.New(io.Discard, "", 0),
}
err := svc.ListenAndServeTLS(h.cert, h.key)
if err != nil {
slog.Error("Error starting HTTPS server", "port", h.port, "err", err)
}
Expand Down

0 comments on commit ca61abf

Please sign in to comment.