linagora / james-project

Mirror of Apache James Project
Apache License 2.0
70 stars 63 forks source link

Audit trail pour Apache JAMES #4866

Closed chibenwa closed 9 months ago

chibenwa commented 10 months ago

Step 1: Audit trail implementation

In james-core add a AuditTrail class allowing to log critical user actions accross the application.

Usage:

AuditTrail.entry()
    .username(() -> ...)
    .remoteIp(() -> ...)
    .userAgent(() -> ...)
    .protocol(() -> ...)
    .action(() -> ...)
    .parameters(() -> aMap)
    .log();

Use SLF4J logger to back this.

Step 2: Use the audit trail where needed

Arsnael commented 10 months ago

Log level: INFO

vttranlina commented 10 months ago

the list below is optional?

remoteIp
userAgent
protocol

we can't get this info in some classes

chibenwa commented 10 months ago

protocol can alsways be specified even if it's slightly distorded -> eg protocol=mailetcontainer

userAgent yes we can't always. Let's keep it best effort.

remoteIp -> best effet.

vttranlina commented 10 months ago

Quan concern: user action privacy issue (via logs)? -> Should we have a configuration to enable/disable this log?

chibenwa commented 10 months ago

user action privacy issue (via logs)?

Audit trail is easy to turn off if unwanted via logback.xml...

quantranhong1999 commented 9 months ago

WIP: https://github.com/apache/james-project/pull/1738

quantranhong1999 commented 9 months ago

LMTP email sent including mimeMessageId, MailId, sender, recipients

If I do not understand wrongly, LMTP email sending shares the SendMailHandler hook with SMTP. => Handled within SMTP message spooled including mailId and mimeMessageId, sender, recipients.

chibenwa commented 9 months ago

Maybe need the protocol to be configurable?

quantranhong1999 commented 9 months ago

If I do not understand wrongly, LMTP email sending shares the SendMailHandler hook with SMTP.

Hmm, likely I was wrong. LMTP seems not to use a mail queue to send mail and LMTPServer actually does not include SendMailHandler but uses MailboxDeliverToRecipientHandler to directly deliver messages to local recipients.

quantranhong1999 commented 9 months ago

JMAP forward/set including username and forward list

TODO on the TMail side: https://github.com/linagora/tmail-backend/issues/833