From 6e35f78338d86fae70e807eb83a8db7400d8ee5b Mon Sep 17 00:00:00 2001 From: Mathias Kaufmann Date: Wed, 14 Mar 2018 02:06:18 +0100 Subject: [PATCH] Allow to specify tlsKEY as seperate file. Signed-off-by: Mathias Kaufmann --- goircd.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/goircd.go b/goircd.go index 128dcf3..79f8a13 100644 --- a/goircd.go +++ b/goircd.go @@ -50,6 +50,7 @@ var ( passwords = flag.String("passwords", "", "Optional path to passwords file") tlsBind = flag.String("tlsbind", "", "TLS address to bind to") tlsPEM = flag.String("tlspem", "", "Path to TLS certificat+key PEM file") + tlsKEY = flag.String("tlskey", "", "Path to TLS key PEM as seperate file") tlsonly = flag.Bool("tlsonly", false, "Disable listening on non tls-port") proxyTimeout = flag.Uint("proxytimeout", PROXY_TIMEOUT, "Timeout when using proxy protocol") metrics = flag.Bool("metrics", false, "Enable metrics export") @@ -165,9 +166,14 @@ func Run() { } if *tlsBind != "" { - cert, err := tls.LoadX509KeyPair(*tlsPEM, *tlsPEM) + if *tlsKEY == "" { + tlsKEY = tlsPEM + } + + cert, err := tls.LoadX509KeyPair(*tlsPEM, *tlsKEY) + if err != nil { - log.Fatalf("Could not load TLS keys from %s: %s", *tlsPEM, err) + log.Fatalf("Could not load Certificate and TLS keys from %s: %s", *tlsPEM, *tlsKEY, err) } config := tls.Config{Certificates: []tls.Certificate{cert}}