Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider mongodb.rb has confusion between client and server configurations/arguments #689

Open
dabelenda opened this issue Jan 15, 2024 · 0 comments

Comments

@dabelenda
Copy link

  • Module version: all (?)

How to reproduce (e.g Puppet code you use)

When trying to set mTLS authentication in mongod there will be issues. I Did not hit it directly but when configuring SSL/TLS for mongod I was misled by a CA validation issue and reading the code I found a big confusion between mongod (server) and mongo (client) in provider command setup.

What are you seeing

At lines: 30-31 the mongo_conf (client configuration) function loads the mongod_conf_file (server configuration file):

def self.mongo_conf
config = YAML.load_file(mongod_conf_file) || {}

Then at line 85

args += ['--sslPEMKeyFile', config['sslcert']]
the argument to mongo (client) for mTLS authentication (--sslPEMKeyFile) is setup using the sslcert value from the hash. This entry in the hash is the sslPEMKeyFile parameter from the Server configuration file. This means that the client will perform mTLS authentication using the Server certificate. In a general case, mTLS will be disabled on the server side, but if enabled this will most likely make the client fail to connect every single time.

What behaviour did you expect instead

The client configuration should be set separately from the server configuration in the puppet module. For the following reasons:

  • the sslCAFile (or tlsCAFile) parameter of the server (used to validate client certificates during mTLS) is not expected to be the same as the sslCAFile (or tlsCAFile) parameter of the client (used to validate the server certificate)
  • the sslPEMKeyFile (or tlsPEMKeyFile) of the server (used to allow ssl/tls connections to the server) is not the same as the sslPEMKeyFile (or tlsPEMKeyFile) of the client (used to enable mTLS authentication)

Output log

Any additional information you'd like to impart

@dabelenda dabelenda changed the title provider mongo.rb has confusion between client and server configurations/arguments provider mongodb.rb has confusion between client and server configurations/arguments Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant