Skip to content

Commit bc8b2ef

Browse files
committed
only allow internal user with --keyFile option SERVER-3666
1 parent 55087b1 commit bc8b2ef

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

db/cmdline.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,12 @@ namespace mongo {
272272
dbexit(EXIT_BADOPTIONS);
273273
}
274274

275+
cmdLine.keyFile = true;
275276
noauth = false;
276277
}
278+
else {
279+
cmdLine.keyFile = false;
280+
}
277281

278282

279283
{

db/cmdline.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ namespace mongo {
100100

101101
string socket; // UNIX domain socket directory
102102

103+
bool keyFile;
104+
103105
static void addGlobalOptions( boost::program_options::options_description& general ,
104106
boost::program_options::options_description& hidden );
105107

db/security_commands.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ namespace mongo {
139139
string pwd;
140140

141141
if (user == internalSecurity.user) {
142+
uassert(15889, "key file must be used to log in with internal user", cmdLine.keyFile);
142143
pwd = internalSecurity.pwd;
143144
}
144145
else {

0 commit comments

Comments
 (0)