mirror of
https://github.com/bitwarden/server.git
synced 2024-12-26 17:37:36 +01:00
update decision tree for non-ssl use cases
This commit is contained in:
parent
f21a25f917
commit
7de9b18aa6
@ -20,7 +20,7 @@ namespace Bit.Setup
|
||||
}
|
||||
|
||||
public bool MssqlDataDockerVolume { get; private set; }
|
||||
public int HttpPort { get; private set; } = 80;
|
||||
public int HttpPort { get; private set; }
|
||||
public int HttpsPort { get; private set; }
|
||||
public string CoreVersion { get; private set; } = "latest";
|
||||
public string WebVersion { get; private set; } = "latest";
|
||||
@ -42,9 +42,10 @@ namespace Bit.Setup
|
||||
|
||||
public void BuildForUpdater()
|
||||
{
|
||||
if(File.Exists("/bitwarden/docker/docker-compose.yml"))
|
||||
var composeFile = "/bitwarden/docker/docker-compose.yml";
|
||||
if(File.Exists(composeFile))
|
||||
{
|
||||
var fileLines = File.ReadAllLines("/bitwarden/docker/docker-compose.yml");
|
||||
var fileLines = File.ReadAllLines(composeFile);
|
||||
foreach(var line in fileLines)
|
||||
{
|
||||
if(!line.StartsWith("# Parameter:"))
|
||||
@ -189,8 +190,13 @@ services:
|
||||
image: bitwarden/nginx:{CoreVersion}
|
||||
container_name: bitwarden-nginx
|
||||
restart: always
|
||||
ports:
|
||||
ports:");
|
||||
|
||||
if(HttpPort != default(int))
|
||||
{
|
||||
sw.Write($@"
|
||||
- '{HttpPort}:8080'");
|
||||
}
|
||||
|
||||
if(HttpsPort != default(int))
|
||||
{
|
||||
|
@ -73,7 +73,6 @@ namespace Bit.Setup
|
||||
{
|
||||
Console.Write("(!) Do you have a SSL certificate to use? (y/n): ");
|
||||
ssl = Console.ReadLine().ToLowerInvariant() == "y";
|
||||
|
||||
if(ssl)
|
||||
{
|
||||
Directory.CreateDirectory($"/bitwarden/ssl/{domain}/");
|
||||
@ -87,7 +86,7 @@ namespace Bit.Setup
|
||||
var selfSignedSsl = certBuilder.BuildForInstall();
|
||||
ssl = certBuilder.Ssl; // Ssl prop can get flipped during the build
|
||||
|
||||
var url = ssl ? $"https://{domain}" : $"http://{domain}";
|
||||
var url = $"https://{domain}";
|
||||
Console.Write("(!) Do you want to use the default ports for HTTP (80) and HTTPS (443)? (y/n): ");
|
||||
var defaultPorts = Console.ReadLine().ToLowerInvariant() == "y";
|
||||
int httpPort = default(int), httpsPort = default(int);
|
||||
@ -96,37 +95,26 @@ namespace Bit.Setup
|
||||
httpPort = 80;
|
||||
httpsPort = 443;
|
||||
}
|
||||
else
|
||||
else if(ssl)
|
||||
{
|
||||
Console.Write("(!) HTTP port: ");
|
||||
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpPort))
|
||||
httpsPort = 443;
|
||||
Console.Write("(!) HTTPS port: ");
|
||||
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpsPort) && httpsPort != 443)
|
||||
{
|
||||
if(ssl)
|
||||
{
|
||||
Console.Write("(!) HTTPS port: ");
|
||||
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpsPort))
|
||||
{
|
||||
if(httpsPort != 443)
|
||||
{
|
||||
url += (":" + httpsPort);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid HTTPS port. Using defaults.");
|
||||
httpPort = 80;
|
||||
httpsPort = 443;
|
||||
}
|
||||
}
|
||||
else if(httpPort != 80)
|
||||
{
|
||||
url += (":" + httpPort);
|
||||
}
|
||||
url += (":" + httpsPort);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid HTTP port. Using default.");
|
||||
httpPort = 80;
|
||||
Console.WriteLine("Using default port.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
httpPort = 80;
|
||||
Console.Write("(!) HTTP port: ");
|
||||
if(!int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpPort) && httpPort != 80)
|
||||
{
|
||||
Console.WriteLine("Using default port.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,46 +122,32 @@ namespace Bit.Setup
|
||||
var reverseProxy = Console.ReadLine().ToLowerInvariant() == "y";
|
||||
if(reverseProxy)
|
||||
{
|
||||
Console.Write("(!) Do you use the default ports on your reverse proxy (80/443)? (y/n): ");
|
||||
var proxyDefaultPorts = Console.ReadLine().ToLowerInvariant() == "y";
|
||||
|
||||
if(proxyDefaultPorts)
|
||||
Console.Write("(!) Do you use the default HTTPS port (443) on your reverse proxy? (y/n): ");
|
||||
var proxyDefaultPort = Console.ReadLine().ToLowerInvariant() == "y";
|
||||
if(proxyDefaultPort)
|
||||
{
|
||||
url = ssl ? $"https://{domain}" : $"http://{domain}";
|
||||
url = $"https://{domain}";
|
||||
}
|
||||
else
|
||||
else if(ssl)
|
||||
{
|
||||
int httpReversePort = default(int), httpsReversePort = default(int);
|
||||
Console.Write("(!) Proxy HTTP port: ");
|
||||
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpReversePort))
|
||||
Console.Write("(!) Proxy HTTPS port: ");
|
||||
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out var httpsReversePort)
|
||||
&& httpsReversePort != 443)
|
||||
{
|
||||
if(ssl)
|
||||
{
|
||||
Console.Write("(!) Proxy HTTPS port: ");
|
||||
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpsReversePort))
|
||||
{
|
||||
if(httpsReversePort != 443)
|
||||
{
|
||||
url += (":" + httpsReversePort);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid proxy HTTPS port.");
|
||||
httpReversePort = httpsReversePort = default(int);
|
||||
}
|
||||
}
|
||||
else if(httpReversePort != 80)
|
||||
{
|
||||
url += (":" + httpReversePort);
|
||||
}
|
||||
url += (":" + httpsReversePort);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid proxy HTTP port.");
|
||||
Console.WriteLine("Using default port.");
|
||||
url = $"https://{domain}";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!ssl)
|
||||
{
|
||||
Console.WriteLine("ERROR: You must use a reverse proxy if not using SSL.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.Write("(!) Do you want to use push notifications? (y/n): ");
|
||||
var push = Console.ReadLine().ToLowerInvariant() == "y";
|
||||
|
Loading…
Reference in New Issue
Block a user