[SERVER-30361] mongod.conf bindIp option accept bogus parameters Created: 27/Jul/17  Updated: 30/Oct/23  Resolved: 02/Aug/17

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: None
Fix Version/s: 3.2.18, 3.4.10, 3.5.11

Type: Bug Priority: Minor - P4
Reporter: Gilberto Velazquez Assignee: Sara Golemon
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

3.4.6 community


Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2, v3.0
Steps To Reproduce:

Using 3.4.6.
1. Get a fresh copy of mongod.conf
2. Change values as needed.
3. set the bindIp option value to something like " bindIp: [somestuff] "
4. start mongod using that file (mongod.conf)
5. use " netstat -tanp | grep LISTEN " to verify THAT mongod is listening on 0.0.0.0:portnumber

Sprint: Platforms 2017-08-21
Participants:

 Description   

bindIp accepts ANY bogus string as a parameter if it is enclosed in square brackets.

I found out a mongo.conf that had a list of values (IP's) enclosed in square brackets []. However mongod was listening on 0.0.0.0:portnumber.



 Comments   
Comment by Benno Geisselmann [ 10/Nov/17 ]

Hi, Is it possible that this fix broke the actual feature to add a list of bind ips? in 3.4.10 we cannot set a list of bind ips anymore (doesn't matter which syntax).

Can you tell me the syntax to add a list of bind ips in 3.4.10 ?

Comment by Githook User [ 22/Sep/17 ]

Author:

{'email': 'sara.golemon@mongodb.com', 'name': 'Sara Golemon', 'username': 'sgolemon'}

Message: SERVER-30361 Do not accept map/sequence for scalar config value

(cherry picked from commit 782672ef01d5903076b13e765cecedaea4981ecf)
Branch: v3.4
https://github.com/mongodb/mongo/commit/92d0529680c6481f1651f01374f93703ffd1c3f7

Comment by Githook User [ 22/Sep/17 ]

Author:

{'email': 'sara.golemon@mongodb.com', 'name': 'Sara Golemon', 'username': 'sgolemon'}

Message: SERVER-30361 Do not accept map/sequence for scalar config value

(cherry picked from commit 782672ef01d5903076b13e765cecedaea4981ecf)
Branch: v3.2
https://github.com/mongodb/mongo/commit/3a0e61122509ddd74df23f669df811a46ccddeb8

Comment by Githook User [ 10/Aug/17 ]

Author:

{'email': 'sara.golemon@mongodb.com', 'name': 'Sara Golemon'}

Message: SERVER-30361 Do not accept map/sequence for scalar config value
Branch: master
https://github.com/mongodb/mongo/commit/782672ef01d5903076b13e765cecedaea4981ecf

Comment by Sara Golemon [ 02/Aug/17 ]

Note that certain types of invalid configuration (passing a list or map where a scalar value is expected) previously silently passed validation and resulted in an empty value. With this change those misconfigurations will result in an error.

Comment by Sara Golemon [ 31/Jul/17 ]

Root cause: This actually has nothing to do with IPv6, but is rather a YAML parsing issue since `bindIp: [something]` is taken as a single element array containing the value `something`. The options parser treats an array value in the YAML as quietly invalid and throws it out yielding no provided value to bindIp.

I plan to address this by having an array value for bindIp be treated as an configuration error.

Generated at Thu Feb 08 04:23:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.