From 72cfd79b77256209ea1419abac75191b4474d574 Mon Sep 17 00:00:00 2001 From: Daniel Del Rio Figueira Date: Mon, 2 Dec 2024 09:26:25 +0100 Subject: [PATCH 1/2] Removed hardcoded paths and fixed typo --- util/http.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/http.go b/util/http.go index b244a0c..9ab238f 100644 --- a/util/http.go +++ b/util/http.go @@ -17,12 +17,12 @@ func GetClientCertificate() (tls.Certificate, error) { return tls.Certificate{}, nil } if certExists && !keyExists { - return tls.Certificate{}, fmt.Errorf("Client TLS private key is empty, but client TLS cert was sent.") + return tls.Certificate{}, fmt.Errorf("Client TLS private key is empty, but client TLS cert was set.") } if !certExists && keyExists { - return tls.Certificate{}, fmt.Errorf("Client TLS cert is empty, but client TLS private key was sent.") + return tls.Certificate{}, fmt.Errorf("Client TLS cert is empty, but client TLS private key was set.") } - return tls.LoadX509KeyPair("client.cert", "client-key.pem") + return tls.LoadX509KeyPair(cert, key) } func GetHttpClient() (*http.Client, error) { From 0273cee2ba34c23584c05275bc202232178dd393 Mon Sep 17 00:00:00 2001 From: Daniel Del Rio Figueira Date: Mon, 2 Dec 2024 09:27:02 +0100 Subject: [PATCH 2/2] Added File suffix on tlsClient command flags --- cmd/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 74048df..d84cbb6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -61,8 +61,8 @@ func init() { rootCmd.PersistentFlags().Duration("mfaDelay", time.Second*10, "Delay between MFA Attempts, only used in noninteractive modes") rootCmd.PersistentFlags().Bool("tlsSkipVerify", false, "Allow servers with self-signed certificates") - rootCmd.PersistentFlags().String("tlsClientPrivateKey", "", "Client private key for mtls") - rootCmd.PersistentFlags().String("tlsClientCert", "", "Client certificate for mtls") + rootCmd.PersistentFlags().String("tlsClientPrivateKeyFile", "", "Client private key for mtls") + rootCmd.PersistentFlags().String("tlsClientCertFile", "", "Client certificate for mtls") viper.BindPFlag("debug", rootCmd.PersistentFlags().Lookup("debug")) viper.BindPFlag("timeout", rootCmd.PersistentFlags().Lookup("timeout"))