We need to have a user with minimal privileges that is only able to lock a mongo instance, using db.fsyncLock() and db.unlock(), to ensure we can take consistent snapshots of the disk images. I currently have the following role created:
{
"role" : "local_lock",
"db" : "admin",
"isBuiltin" : false,
"roles" : [ ],
"inheritedRoles" : [ ],
"privileges" : [
{
"resource" : {
"cluster" : true
},
"actions" : [
"logRotate",
"resync",
"unlock"
]
}
],
"inheritedPrivileges" : [
{
"resource" : {
"cluster" : true
},
"actions" : [
"logRotate",
"resync",
"unlock"
]
}
]
}
But when I use this user to attempt a lock I receive the following:
> db.fsyncLock()
{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { fsync: 1.0, lock: true }",
"code" : 13,
"codeName" : "Unauthorized"
}
>
What other permissions are required? Mongo versions as follows:
MongoDB shell version v3.4.7
MongoDB server version: 3.4.7