1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

quiet output for setup scripts

This commit is contained in:
Kyle Spearrin
2019-03-12 10:26:14 -04:00
parent 14fd7e2801
commit b6f54324a5
8 changed files with 70 additions and 22 deletions

View File

@ -24,12 +24,12 @@ namespace Bit.Setup
Directory.CreateDirectory($"/bitwarden/ssl/{_context.Install.Domain}/");
var message = "Make sure 'certificate.crt' and 'private.key' are provided in the \n" +
"appropriate directory before running 'start' (see docs for info).";
Helpers.ShowBanner("NOTE", message);
Helpers.ShowBanner(_context, "NOTE", message);
}
else if(Helpers.ReadQuestion("Do you want to generate a self-signed SSL certificate?"))
{
Directory.CreateDirectory($"/bitwarden/ssl/self/{_context.Install.Domain}/");
Console.WriteLine("Generating self signed SSL certificate.");
Helpers.WriteLine(_context, "Generating self signed SSL certificate.");
_context.Config.Ssl = true;
_context.Install.Trusted = false;
_context.Install.SelfSignedCert = true;
@ -55,7 +55,7 @@ namespace Bit.Setup
"(requires ca.crt, see docs)?");
}
Console.WriteLine("Generating key for IdentityServer.");
Helpers.WriteLine(_context, "Generating key for IdentityServer.");
_context.Install.IdentityCertPassword = Helpers.SecureRandomString(32, alpha: true, numeric: true);
Directory.CreateDirectory("/bitwarden/identity/");
Helpers.Exec("openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout identity.key " +
@ -63,14 +63,14 @@ namespace Bit.Setup
Helpers.Exec("openssl pkcs12 -export -out /bitwarden/identity/identity.pfx -inkey identity.key " +
$"-in identity.crt -certfile identity.crt -passout pass:{_context.Install.IdentityCertPassword}");
Console.WriteLine();
Helpers.WriteLine(_context);
if(!_context.Config.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 or the web vault (and \n" +
"other Bitwarden apps) will not work properly.";
Helpers.ShowBanner("WARNING", message, ConsoleColor.Yellow);
Helpers.ShowBanner(_context, "WARNING", message, ConsoleColor.Yellow);
}
else if(_context.Config.Ssl && !_context.Install.Trusted)
{
@ -78,7 +78,7 @@ namespace Bit.Setup
"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);
Helpers.ShowBanner(_context, "WARNING", message, ConsoleColor.Yellow);
}
}
}