Using real_ips throws Yaml errors
Hi there,
I updated to the current version and trying to get the real_ips setting in config.yml working.
I couldn't find anything about the expected parameters, so i tried true and the ip of the docker host. But both throws the following error when rebuilding the configs:
<Bitwarden ascii>
Open source password management solutions
Copyright 2015-2019, 8bit Solutions LLC
https://bitwarden.com, https://github.com/bitwarden
===================================================
Docker version 17.05.0-ce, build 89658be
docker-compose version 1.24.0, build 0aa59064
Removing network docker_default
WARNING: Network docker_default not found.
Unhandled Exception: YamlDotNet.Core.YamlException: (Line: 79, Col: 11, Idx: 3492) - (Line: 79, Col: 26, Idx: 3507): Exception during deserialization ---> System.InvalidCastException: Invalid cast from 'System.String' to 'System.Collections.Generic.List`1[[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.
at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
at YamlDotNet.Serialization.Utilities.TypeConverter.ChangeType(Object value, Type destinationType, CultureInfo culture)
at YamlDotNet.Serialization.NodeDeserializers.ScalarNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer
nestedObjectDeserializer)
--- End of inner exception stack trace ---
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer
nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer
nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
at YamlDotNet.Serialization.Deserializer.Deserialize[T](String input)
at Bit.Setup.Context.LoadConfiguration() in /home/appveyor/projects/server/util/Setup/Context.cs:line 121
at Bit.Setup.Program.RebuildConfigs() in /home/appveyor/projects/server/util/Setup/Program.cs:line 246
at Bit.Setup.Program.Main(String[] args) in /home/appveyor/projects/server/util/Setup/Program.cs:line 62```
real_ips should be an array of ip addresses for ngx_http_realip_module. See more at https://nginx.org/en/docs/http/ngx_http_realip_module.html
Example:
real_ips:
- 1.1.1.1
- 2.2.2.2
Thanks for the quick reply.
With
real_ips:
- 172.18.0.1
- 172.18.0.0/24
The rebuild runs successful and the services are starting. (Tried with just 172.18.0.1 on my first try, same result)
But somehow the configuration seems to be wrong. The rebuild makes the following entries in the nginx config:
set_real_ip_from ;
set_real_ip_from ;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
Resulting in 503 errors... Something wrong with my syntax?
Try indenting with 2 spaces under real-ips:
real_ips:
- 172.18.0.1
- 172.18.0.0/24
Tried multiple variations of spaces and tabs as indentation, but after every run of ./bitwarden.sh rebuild the spaces are gone and the entry is formatted as my last paste, without the spaces...
I found the bug. Upgrade to 1.30.4 to get the fix. Thanks.
I've still problems with this bug.
./bitwarden.sh rebuild works fine with two spaces as indention (or inline with [ a.b.c.d ]). But after running the rebuild the file is reformatted w/o indention and breaks at the next run.
I can confirm that the file is reformatted and the spaces are lost again.
I can confirm that the file is reformatted and the spaces are lost again.
Spaces are lost, but rebuild succeeds
bitwarden.sh version 1.39.4