On this page本页内容
mongokerberos
Validation Tool¶Introduced alongside MongoDB 4.4, the mongokerberos
program provides a convenient method to verify your platform’s Kerberos configuration for use with MongoDB, and to test that Kerberos authentication from a MongoDB client works as expected.
The mongokerberos
tool can help diagnose common configuration issues, and is the recommended place to start when troubleshooting your Kerberos configuration. See the mongokerberos
documentation for more information.
mongokerberos
is available in MongoDB Enterprise only.
If you have difficulty starting or authenticating against mongod
or mongos
with Kerberos:
To verify that you are using MongoDB Enterprise, pass the --version
command line option to the mongod
or mongos
:
In the output from this command, look for the string modules:
subscription
or modules: enterprise
to confirm you are using the MongoDB Enterprise binaries.
mongod
or mongos
instance is a resolvable, fully qualified domain name.
On Linux, you can verify the system hostname resolution with the hostname -f
command at the system prompt.
mongodb
. If the primary component of the SPN is not mongodb
, you must specify the primary component using --setParameter saslServiceName
.mongod
or mongos
instance. If the mongod
or mongos
instance’s system hostname is not in the keytab file, authentication will fail with a GSSAPI error acquiring credentials.
error message.
If the hostname of your mongod
or mongos
instance as returned by hostname -f
is not fully qualified, use --setParameter saslHostName
to set the instance’s fully qualified domain name when starting your mongod
or mongos
.
mongod
or mongos
instance has A
and PTR
DNS records to provide both forward and reverse DNS lookup. The A
record should map to the mongod
or mongos
’s FQDN.MIT Kerberos provides the KRB5_TRACE
environment variable for trace logging output. If you are having persistent problems with MIT Kerberos on Linux, you can set KRB5_TRACE
when starting your mongod
, mongos
, or mongo
instances to produce verbose logging.
For example, the following command starts a standalone mongod
whose keytab file is at the default /etc/krb5.keytab
path and sets KRB5_TRACE
to write to /logs/mongodb-kerberos.log
:
In some situations, MongoDB will return error messages from the GSSAPI interface if there is a problem with the Kerberos service. Some common error messages are:
GSSAPI error in client while negotiating security context.
This error occurs on the client and reflects insufficient credentials or a malicious attempt to authenticate.
If you receive this error, ensure that you are using the correct credentials and the correct fully qualified domain name when connecting to the host.
GSSAPI error acquiring credentials.
mongod
or mongos
and reflects improper configuration of the system hostname or a missing or incorrectly configured keytab file.