MongoDB Agent (Automation Module): don't attempt to auth with `__system` (SCRAM) user when `security.clusterAuthMode` is set to `x509`
Problem Statement,
What is the problem? MongoDB Agent (Automation Module) attempts to auth with __system
(SCRAM) user when security.clusterAuthMode
is set to x509
.
Why is this a problem? MongoDB Server process logs are flooded by unnecessary noise from such MongoDB Agent (Automation Module) failed auth attempts.
Example,
{"t":{"$date":"2021-05-10T11:08:02.115+0000"},"s":"I", "c":"ACCESS", "id":20249, "ctx":"conn115","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","principalName":"__system","authenticationDatabase":"local","client":"10.10.10.10:46765","result":"AuthenticationFailed: ###"}}
Proposal,
* Don't attempt to auth with __system
(SCRAM) user when security.clusterAuthMode
is set to x509
in MongoDB Server

This has been corrected in OM versions 5.0.5 and 4.4.19. Thank you!
-
Andrew commented
The issue of unnecessary log events also appears in the audit log when --auditAuthorizationSuccess is set to True.
{ "atype" : "authenticate", "ts" : { "$date" : "2021-09-14T15:44:30.892-04:00" }, "local" : { "ip" : "10.10.10.10", "port" : 27017 }, "remote" : { "ip" : "10.10.10.10", "port" : 35250 }, "users" : [], "roles" : [], "param" : { "user" : "__system", "db" : "local", "mechanism" : "SCRAM-SHA-1" }, "result" : 18 }