1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

real ips config

This commit is contained in:
Kyle Spearrin 2019-04-26 12:26:54 -04:00
parent acfacf69a2
commit 6dc2e1b328
3 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using YamlDotNet.Serialization;
@ -81,6 +82,11 @@ namespace Bit.Setup
"Learn more: https://docs.docker.com/storage/volumes/")]
public bool DatabaseDockerVolume { get; set; }
[Description("Defines \"real\" IPs in nginx.conf. Useful for defining proxy servers that forward the \n" +
"client IP address.\n" +
"Learn more: https://nginx.org/en/docs/http/ngx_http_realip_module.html")]
public List<string> RealIps { get; set; }
[YamlIgnore]
public string Domain
{

View File

@ -1,4 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Bit.Setup
@ -78,6 +78,7 @@ namespace Bit.Setup
Ssl = context.Config.Ssl;
Domain = context.Config.Domain;
Url = context.Config.Url;
RealIps = context.Config.RealIps;
if(Ssl)
{
@ -129,6 +130,7 @@ namespace Bit.Setup
public string SslCiphers { get; set; }
public string SslProtocols { get; set; }
public string ContentSecurityPolicy => string.Format(NginxConfigBuilder.ContentSecurityPolicy, Domain);
public List<string> RealIps { get; set; }
}
}
}

View File

@ -49,6 +49,12 @@ server {
include /etc/nginx/security-headers-ssl.conf;
{{/if}}
include /etc/nginx/security-headers.conf;
{{#if RealIps}}
{{#each RealIps}}
set_real_ip_from {{{Value}}}
{{/each}}
{{/if}}
location / {
proxy_pass http://web:5000/;