

Externally Sourced Configuration File Values in MongoDB
source link: https://www.percona.com/blog/externally-sourced-configuration-file-values-in-mongodb/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Since version 4.2, MongoDB provides a new interesting feature called Externally Sourced Configuration File Values. It allows administrators to specify that particular variables will have their values loaded from an external resource.
The external resources that are supported, at this time, are:
- REST APIs, which will cause MongoDB to perform HTTP GET requests to a given URL
- Processes, which will cause MongoDB to run a specified binary and use the returned value
This feature has a lot of use cases, and providing the x509 certificate password without having it stored in the file is one of them. It can easily achieve it with the following configuration:
or by using REST API:
Within the scope of Externally Sourced Configuration File Values, MongoDB also introduces a unique feature, allowing users to use only the expected value. For instance, if someone wants to protect from the external resource mistakenly returning a wrong value, the user can provide a SHA256-HMAC digest of the expected value. By using that, the value is known to an administrator, can be used by MongoDB, and it’s still not stored in the configuration file.
Let’s consider the trivial example of:
The /usr/local/bin/getPort
is a simple script that returns a single integer:
The digest key was chosen randomly, and the digest itself is sha256-hmac of literal 21010
:
After starting it, MongoDB works fine, and it uses 21010/tcp
As defined in the provider script:
After changing the returned value to 201011
, but leaving the expected digest unchanged, MongoDB refuses to start and returns an error:
As the expected and received value digest changed, MongoDB decided not to trust the received value. This could be used for passwords and tokens in real-life scenarios as the data won’t be stored in the config file, but MongoDB will still accept only a single expected value. This provides integrity of the critical configuration data but still allows MongoDB to be more flexible in fetching data from remote endpoints.
Complete the 2021 Percona Open Source Data Management Software Survey
Recommend
-
58
README.md Hardened malloc This is a security-focused general purpose memory allocator providing the malloc API along with various extensions. It provid...
-
16
Debugging configuration values in ASP.NET Core Recently I saw this tweet from Cecil Philip: IConfigurationRoot.GetDebugView is really useful for insp...
-
8
Srajan Gupta Posted on Nov 10...
-
27
Carsten Heuer December 10, 2021 8 minute read ...
-
4
Spring: Make an Externally Created Object Available to Beans in applicationContext.xml October 11, 2011 If your Spring beans...
-
2
Vue 3.3 to support externally imported types Front-end JavaScript framework project will be working on an alternative compilation strategy called Vapor M...
-
3
Internally And Externally Facing Honeypots Honeypots are great security tools – you install a “decoy”, which attracts malicious traffic. They have certain ports open and they work with certain protocols...
-
5
-
8
How to solve "error: externally-managed-environment" when installing via pip3 ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK