From 818a668e3c46a00761488abbae197e143f7c0242 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 30 Mar 2018 13:48:26 -0400 Subject: [PATCH] move cert warnings to main --- util/Setup/CertBuilder.cs | 13 ------------- util/Setup/Program.cs | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/util/Setup/CertBuilder.cs b/util/Setup/CertBuilder.cs index a3647ca53..c80d6a0cd 100644 --- a/util/Setup/CertBuilder.cs +++ b/util/Setup/CertBuilder.cs @@ -25,12 +25,6 @@ namespace Bit.Setup { if(Helpers.ReadQuestion("Do you want to generate a self-signed SSL certificate?")) { - var message = "You are using a self-signed SSL certificate. This certificate will not be \n" + - "trusted by Bitwarden client applications. You must add this certificate to \n" + - "the trusted store on each device or else you will receive errors when trying \n" + - "to connect to your installation."; - Helpers.ShowBanner("WARNING", message, ConsoleColor.Yellow); - Directory.CreateDirectory($"/bitwarden/ssl/self/{Domain}/"); Console.WriteLine("Generating self signed SSL certificate."); Ssl = selfSignedSsl = true; @@ -39,13 +33,6 @@ namespace Bit.Setup $"-out /bitwarden/ssl/self/{Domain}/certificate.crt " + $"-subj \"/C=US/ST=New York/L=New York/O=8bit Solutions LLC/OU=Bitwarden/CN={Domain}\""); } - else - { - var message = "You are not using an SSL certificate. Bitwarden requires HTTPS to operate. \n" + - "You must front your installation with a HTTPS proxy. The web vault (and \n" + - "other Bitwarden apps) will not work properly without HTTPS."; - Helpers.ShowBanner("WARNING", message, ConsoleColor.Yellow); - } } if(LetsEncrypt) diff --git a/util/Setup/Program.cs b/util/Setup/Program.cs index 366fe320b..516e1daba 100644 --- a/util/Setup/Program.cs +++ b/util/Setup/Program.cs @@ -96,6 +96,22 @@ namespace Bit.Setup sslTrusted = Helpers.ReadQuestion("Is this a trusted SSL certificate (requires ca.crt, see docs)?"); } + if(!ssl) + { + var message = "You are not using a SSL certificate. Bitwarden requires HTTPS to operate. \n" + + "You must front your installation with a HTTPS proxy. The web vault (and \n" + + "other Bitwarden apps) will not work properly without HTTPS."; + Helpers.ShowBanner("WARNING", message, ConsoleColor.Yellow); + } + else if(ssl && !sslTrusted) + { + var message = "You are using an untrusted SSL certificate. This certificate will not be \n" + + "trusted by Bitwarden client applications. You must add this certificate to \n" + + "the trusted store on each device or else you will receive errors when trying \n" + + "to connect to your installation."; + Helpers.ShowBanner("WARNING", message, ConsoleColor.Yellow); + } + var url = $"https://{domain}"; int httpPort = default(int), httpsPort = default(int); if(Helpers.ReadQuestion("Do you want to use the default ports for HTTP (80) and HTTPS (443)?"))