Skip to content

Auth in mongod 3.6 #437

@m13t

Description

@m13t

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.1.9
  • Ruby: 2.1.9
  • Distribution: CentOS/7
  • Module version: 2.0.0

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

class { '::mongodb::globals':
    bind_ip => [ '0.0.0.0' ],
    version => '3.6.1',
    manage_package_repo => true,
    repo_location => 'https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.6/x86_64/',
  }

  -> class { '::mongodb::client': }

  -> class { '::mongodb::server':
    verbose => true,
    directoryperdb => true,
    manage_pidfile => false,

    auth => true,
    store_creds => true,
    create_admin => true,
    admin_username => "$admin_username",
    admin_password => "$admin_password",
  }

What are you seeing

Debug: Prefetching mongodb resources for mongodb_database
Debug: Executing: '/bin/mongo admin --quiet --host 127.0.0.1:27017 --eval load('/root/.mongorc.js'); printjson(db.getMongo().getDBs())'
Debug: Request failed: 'Execution of '/bin/mongo admin --quiet --host 127.0.0.1:27017 --eval load('/root/.mongorc.js'); printjson(db.getMongo().getDBs())' returned 252: Error: Authentication failed.
2018-01-10T13:35:14.082+0000 E QUERY    [thread1] Error: listDatabases failed:{
	"ok" : 0,
	"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: \"admin\" }",
	"code" : 13,
	"codeName" : "Unauthorized"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:65:1

What behaviour did you expect instead

I would have expected the module to configure Mongo 3.6, enable authentication and create the admin account. It appears the account must be created with mongo running without auth enabled, once an admin account is created, it should be then started with auth enabled.

Output log

As per 'What are you seeing'

Any additional information you'd like to impart

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions