1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-04 02:00:32 -05:00

generate a self signed cert if not using ssl

This commit is contained in:
Kyle Spearrin 2017-09-18 13:26:17 -04:00
parent 448e536ba4
commit a10d0f24ee

View File

@ -222,17 +222,13 @@ namespace Bit.Setup
{ {
if(!_ssl) if(!_ssl)
{ {
Console.Write("(!) Do you want to generate a self-signed SSL certificate? (y/n): "); Directory.CreateDirectory($"/bitwarden/ssl/self/{_domain}/");
if(Console.ReadLine().ToLowerInvariant() == "y") Console.WriteLine("Generating self signed SSL certificate.");
{ _ssl = _selfSignedSsl = true;
Directory.CreateDirectory($"/bitwarden/ssl/self/{_domain}/"); Exec("openssl req -x509 -newkey rsa:4096 -sha256 -nodes -days 365 " +
Console.WriteLine("Generating self signed SSL certificate."); $"-keyout /bitwarden/ssl/self/{_domain}/private.key " +
_ssl = _selfSignedSsl = true; $"-out /bitwarden/ssl/self/{_domain}/certificate.crt " +
Exec("openssl req -x509 -newkey rsa:4096 -sha256 -nodes -days 365 " + $"-subj \"/C=US/ST=New York/L=New York/O=8bit Solutions LLC/OU=bitwarden/CN={_domain}\"");
$"-keyout /bitwarden/ssl/self/{_domain}/private.key " +
$"-out /bitwarden/ssl/self/{_domain}/certificate.crt " +
$"-subj \"/C=US/ST=New York/L=New York/O=8bit Solutions LLC/OU=bitwarden/CN={_domain}\"");
}
} }
if(_letsEncrypt) if(_letsEncrypt)