Skip to content

feat: module no longer ouputs admin: creds to console - #799

Open
Ph0B1uS wants to merge 1 commit into
voxpupuli:masterfrom
Ph0B1uS:admin-creds-in-console
Open

Ph0B1uS wants to merge 1 commit into
voxpupuli:masterfrom
Ph0B1uS:admin-creds-in-console

Conversation

@Ph0B1uS

@Ph0B1uS Ph0B1uS commented Aug 27, 2026

Copy link
Copy Markdown

Pull Request (PR) description

This removes diffs for /root/.mongoshrc.js from the console which would leak admin_username and admin_password.

This Pull Request (PR) fixes the following issues

Fixes #798

@TheMeier

Copy link
Copy Markdown
Contributor

Wouldn't sensitve be a better way to go?

@Ph0B1uS

Ph0B1uS commented Aug 28, 2026

Copy link
Copy Markdown
Author

Wouldn't sensitve be a better way to go?

That would make sense, looking at the template there isn't a lot more than the aforementioned parameters that should be marked as sensitive.

@Ph0B1uS
Ph0B1uS force-pushed the admin-creds-in-console branch from 88ff7b0 to 79be37b Compare August 28, 2026 09:20
@Ph0B1uS
Ph0B1uS force-pushed the admin-creds-in-console branch 3 times, most recently from 20af2a3 to bc64238 Compare September 7, 2026 14:04
@Ph0B1uS

Ph0B1uS commented Sep 22, 2026 •

Copy link
Copy Markdown
Author

seems like the module does not create the admin user itself and this is why the tests fails.

not quite sure how to deal with this but something like this needs to be done with mongosh if the user is not already setup:

use admin
db.createUser (
    {
        user: "$mongodb::server::config::admin_username",
        pwd: "$mongodb::server::config::admin_password",
        roles : [
            { role: "clusterAdmin", db : "admin" }, 
            { role: "userAdminAnyDatabase", db: "admin" },
            { role: "readWriteAnyDatabase", db: "admin" },
            { role: "userAdminAnyDatabase", db: "admin" }
        ]
    }
)

@Ph0B1uS
Ph0B1uS force-pushed the admin-creds-in-console branch from 61c305a to 6fdcf0e Compare November 6, 2026 07:26
@Ph0B1uS
Ph0B1uS force-pushed the admin-creds-in-console branch from 6fdcf0e to 82eb921 Compare November 6, 2026 07:32
@Ph0B1uS

Ph0B1uS commented Nov 6, 2026 •

Copy link
Copy Markdown
Author

Seems like quite a few tests fail because of the lack of the mongosh binary:

61) mongodb_user with the new multidb role syntax compiles with no errors
      Failure/Error: apply_manifest(pp, catch_failures: true)
      Beaker::Host::CommandFailure:
        Host 'host1-openvox9.example.com' exited with 6 running:
         puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_084809096.Chf9dq.pp
        Last 10 lines of output were:
        	Warning: /Stage[main]/Mongodb::Client/Package[mongodb_client]: Skipping because of failed dependencies
        	Error: Could not prefetch mongodb_user provider 'mongodb': Could not evaluate MongoDB shell command: load('/root/.mongoshrc.js'); EJSON.stringify(db.system.users.find().toArray()), with: Command mongosh is missing
        	Warning: /Stage[main]/Main/Mongodb_user[testuser]: Skipping because of failed dependencies
        	Error: Could not prefetch mongodb_database provider 'mongodb': Command mongosh is missing
        	Notice: /Stage[main]/Main/Mongodb_database[testdb]: Dependency Mongodb_user[testuser] has failures: true
        	Notice: /Stage[main]/Main/Mongodb_database[testdb2]: Dependency Mongodb_user[testuser2] has failures: true
        	Warning: /Stage[main]/Main/Mongodb_database[testdb]: Skipping because of failed dependencies
        	Warning: /Stage[main]/Main/Mongodb_user[testuser2]: Skipping because of failed dependencies
        	Warning: /Stage[main]/Main/Mongodb_database[testdb2]: Skipping because of failed dependencies
        	Notice: Applied catalog in 241.51 seconds```

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

Successfully merging this pull request may close these issues.

admin_username and admin_password is output to console on puppet run

2 participants