2022-06-30 01:46:41 +02:00
|
|
|
|
using System.ComponentModel;
|
2018-09-04 03:12:24 +02:00
|
|
|
|
using YamlDotNet.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Setup;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
public class Configuration
|
|
|
|
|
{
|
|
|
|
|
[Description("Note: After making changes to this file you need to run the `rebuild` or `update`\n" +
|
|
|
|
|
"command for them to be applied.\n\n" +
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
"Full URL for accessing the installation from a browser. (Required)")]
|
|
|
|
|
public string Url { get; set; } = "https://localhost";
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Auto-generate the `./docker/docker-compose.yml` config file.\n" +
|
|
|
|
|
"WARNING: Disabling generated config files can break future updates. You will be\n" +
|
|
|
|
|
"responsible for maintaining this config file.\n" +
|
|
|
|
|
"Template: https://github.com/bitwarden/server/blob/master/util/Setup/Templates/DockerCompose.hbs")]
|
|
|
|
|
public bool GenerateComposeConfig { get; set; } = true;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Auto-generate the `./nginx/default.conf` file.\n" +
|
|
|
|
|
"WARNING: Disabling generated config files can break future updates. You will be\n" +
|
|
|
|
|
"responsible for maintaining this config file.\n" +
|
2019-01-19 04:20:05 +01:00
|
|
|
|
"Template: https://github.com/bitwarden/server/blob/master/util/Setup/Templates/NginxConfig.hbs")]
|
2018-09-04 03:12:24 +02:00
|
|
|
|
public bool GenerateNginxConfig { get; set; } = true;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Docker compose file port mapping for HTTP. Leave empty to remove the port mapping.\n" +
|
|
|
|
|
"Learn more: https://docs.docker.com/compose/compose-file/#ports")]
|
|
|
|
|
public string HttpPort { get; set; } = "80";
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Docker compose file port mapping for HTTPS. Leave empty to remove the port mapping.\n" +
|
|
|
|
|
"Learn more: https://docs.docker.com/compose/compose-file/#ports")]
|
|
|
|
|
public string HttpsPort { get; set; } = "443";
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Docker compose file version. Leave empty for default.\n" +
|
|
|
|
|
"Learn more: https://docs.docker.com/compose/compose-file/compose-versioning/")]
|
|
|
|
|
public string ComposeVersion { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Configure Nginx for Captcha.")]
|
2021-08-13 15:52:26 +02:00
|
|
|
|
public bool Captcha { get; set; } = false;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Configure Nginx for SSL.")]
|
|
|
|
|
public bool Ssl { get; set; } = true;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("SSL versions used by Nginx (ssl_protocols). Leave empty for recommended default.\n" +
|
|
|
|
|
"Learn more: https://wiki.mozilla.org/Security/Server_Side_TLS")]
|
|
|
|
|
public string SslVersions { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("SSL ciphersuites used by Nginx (ssl_ciphers). Leave empty for recommended default.\n" +
|
|
|
|
|
"Learn more: https://wiki.mozilla.org/Security/Server_Side_TLS")]
|
|
|
|
|
public string SslCiphersuites { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Installation uses a managed Let's Encrypt certificate.")]
|
|
|
|
|
public bool SslManagedLetsEncrypt { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("The actual certificate. (Required if using SSL without managed Let's Encrypt)\n" +
|
|
|
|
|
"Note: Path uses the container's ssl directory. The `./ssl` host directory is mapped to\n" +
|
|
|
|
|
"`/etc/ssl` within the container.")]
|
|
|
|
|
public string SslCertificatePath { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("The certificate's private key. (Required if using SSL without managed Let's Encrypt)\n" +
|
|
|
|
|
"Note: Path uses the container's ssl directory. The `./ssl` host directory is mapped to\n" +
|
|
|
|
|
"`/etc/ssl` within the container.")]
|
|
|
|
|
public string SslKeyPath { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("If the certificate is trusted by a CA, you should provide the CA's certificate.\n" +
|
|
|
|
|
"Note: Path uses the container's ssl directory. The `./ssl` host directory is mapped to\n" +
|
|
|
|
|
"`/etc/ssl` within the container.")]
|
|
|
|
|
public string SslCaPath { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Diffie Hellman ephemeral parameters\n" +
|
|
|
|
|
"Learn more: https://security.stackexchange.com/q/94390/79072\n" +
|
|
|
|
|
"Note: Path uses the container's ssl directory. The `./ssl` host directory is mapped to\n" +
|
|
|
|
|
"`/etc/ssl` within the container.")]
|
|
|
|
|
public string SslDiffieHellmanPath { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2020-12-18 16:58:35 +01:00
|
|
|
|
[Description("Nginx Header Content-Security-Policy parameter\n" +
|
|
|
|
|
"WARNING: Reconfiguring this parameter may break features. By changing this parameter\n" +
|
|
|
|
|
"you become responsible for maintaining this value.")]
|
2023-01-31 22:21:06 +01:00
|
|
|
|
public string NginxHeaderContentSecurityPolicy { get; set; } = "default-src 'self'; " +
|
|
|
|
|
"script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; " +
|
|
|
|
|
"img-src 'self' data: https://haveibeenpwned.com; " +
|
2021-01-15 22:59:51 +01:00
|
|
|
|
"child-src 'self' https://*.duosecurity.com https://*.duofederal.com; " +
|
|
|
|
|
"frame-src 'self' https://*.duosecurity.com https://*.duofederal.com; " +
|
2020-12-18 16:58:35 +01:00
|
|
|
|
"connect-src 'self' wss://{0} https://api.pwnedpasswords.com " +
|
2023-01-03 19:57:53 +01:00
|
|
|
|
"https://api.2fa.directory; object-src 'self' blob:;";
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Communicate with the Bitwarden push relay service (push.bitwarden.com) for mobile\n" +
|
|
|
|
|
"app live sync.")]
|
|
|
|
|
public bool PushNotifications { get; set; } = true;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[Description("Use a docker volume (`mssql_data`) instead of a host-mapped volume for the persisted " +
|
|
|
|
|
"database.\n" +
|
2018-09-04 14:21:49 +02:00
|
|
|
|
"WARNING: Changing this value will cause you to lose access to the existing persisted database.\n" +
|
|
|
|
|
"Learn more: https://docs.docker.com/storage/volumes/")]
|
2018-09-04 03:12:24 +02:00
|
|
|
|
public bool DatabaseDockerVolume { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2019-04-26 18:26:54 +02:00
|
|
|
|
[Description("Defines \"real\" IPs in nginx.conf. Useful for defining proxy servers that forward the \n" +
|
2018-09-04 03:12:24 +02:00
|
|
|
|
"client IP address.\n" +
|
2022-05-06 16:34:04 +02:00
|
|
|
|
"Learn more: https://nginx.org/en/docs/http/ngx_http_realip_module.html\n\n" +
|
|
|
|
|
"Defined as a dictionary, e.g.:\n" +
|
|
|
|
|
"real_ips: ['10.10.0.0/24', '172.16.0.0/16']")]
|
2019-04-26 18:26:54 +02:00
|
|
|
|
public List<string> RealIps { get; set; }
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2021-11-16 18:52:02 +01:00
|
|
|
|
[Description("Enable Key Connector (https://bitwarden.com/help/article/deploy-key-connector)")]
|
|
|
|
|
public bool EnableKeyConnector { get; set; } = false;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2022-07-14 21:58:48 +02:00
|
|
|
|
[Description("Enable SCIM")]
|
|
|
|
|
public bool EnableScim { get; set; } = false;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2018-09-04 03:12:24 +02:00
|
|
|
|
[YamlIgnore]
|
|
|
|
|
public string Domain
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (Uri.TryCreate(Url, UriKind.Absolute, out var uri))
|
|
|
|
|
{
|
|
|
|
|
return uri.Host;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|