[SERVER-5265] Store last auth time for each user Created: 09/Mar/12  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Logging, Security
Affects Version/s: 2.0.3
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Jared D. Cottrell Assignee: Backlog - Security Team
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-15573 Print date and time of last user logi... Closed
Assigned Teams:
Server Security
Participants:
Case:

 Description   

It would be nice to be able to see the last time each user authed to the database. Though not at the expense of creating extra lock contention. So this may need to wait for finer-grained locking.



 Comments   
Comment by Wernfried Domscheit [ 11/Feb/21 ]

You can get this information from mongodb logfile, for example:

jq -r 'select(.c == "ACCESS") | select(.msg == "Successful authentication")' /var/log/mongodb/mongod.log 

 

{
  "t": {
    "$date": "2021-02-11T11:18:16.295+01:00"
  },
  "s": "I",
  "c": "ACCESS",
  "id": 20250,
  "ctx": "conn231",
  "msg": "Successful authentication",
  "attr": {
    "mechanism": "SCRAM-SHA-256",
    "principalName": "admin",
    "authenticationDatabase": "admin",
    "client": "127.0.0.1:49994"
  }
}

 

Generated at Thu Feb 08 03:08:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.