From 51c5f27ca5ca3047630b414203ad81980a628ec6 Mon Sep 17 00:00:00 2001 From: aWZHY0yQH81uOYvH <32046476+aWZHY0yQH81uOYvH@users.noreply.github.com> Date: Sat, 27 May 2023 17:29:41 -0700 Subject: [PATCH 1/2] detect all Unix-like OSes --- httpserver/drop_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpserver/drop_unix.go b/httpserver/drop_unix.go index cb968b2..1b42df7 100644 --- a/httpserver/drop_unix.go +++ b/httpserver/drop_unix.go @@ -1,4 +1,4 @@ -//go:build linux || darwin +//go:build unix package httpserver From 2b8beb7d7ed5f602ce656988644e20fd6fc8bed5 Mon Sep 17 00:00:00 2001 From: aWZHY0yQH81uOYvH <32046476+aWZHY0yQH81uOYvH@users.noreply.github.com> Date: Sat, 27 May 2023 17:43:58 -0700 Subject: [PATCH 2/2] fix file-provided TLS certs --- httpserver/server.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/httpserver/server.go b/httpserver/server.go index 69b40c5..0b93b7d 100644 --- a/httpserver/server.go +++ b/httpserver/server.go @@ -5,6 +5,7 @@ import ( "net" "net/http" "time" + "crypto/tls" "github.com/gorilla/mux" "github.com/patrickhener/goshs/ca" @@ -108,6 +109,17 @@ func (fs *FileServer) Start(what string) { if err != nil { logger.Fatalf("Unable to start SSL enabled server: %+v\n", err) } + + cert, err := tls.LoadX509KeyPair(fs.MyCert, fs.MyKey) + if err != nil { + logger.Fatalf("Failed to load provided key or certificate: %+v\n", err) + } + + server.TLSConfig = &tls.Config{ + Certificates: []tls.Certificate{cert}, + MinVersion: tls.VersionTLS12, + } + fs.Fingerprint256 = fingerprint256 fs.Fingerprint1 = fingerprint1 fs.logStart(what)