This document describes the security measures implemented in this project and recommendations for maintaining a secure environment when using msmtp on Ubuntu Server.
- Defense in Depth
- Use AppArmor in
enforcemode to confinemsmtp. - Strict TLS certificate validation (
tls_certcheck on).
- Credential Protection
- Use
passwordevalto read passwords from files with600permissions androot:root. - Store secrets in a
/etc/msmtp/directory with700permissions. - Recommended: Use App Passwords instead of master passwords.
- Secure Logs
- Logging to
/var/log/msmtp/msmtp.logwith restrictive permissions (640) and a controlled owner. - A
/var/log/msmtp/folder with750permissions, compatible with AppArmor. - Alternative: Use of
syslog LOG_MAILto centralize in/var/log/mail.log.
- TLS and Encryption
- Use of secure ports:
587(STARTTLS) or465(SMTPS). tls_trust_filepointing to the/etc/ssl/certs/ca-certificates.crtsystem bundle.- Ability to harden ciphers with
tls_priorities.
- Permissions and Isolation
- Avoid sensitive logs or files in
$HOMEin multi-user environments. - One password file per SMTP account, with minimal permissions.
- Separate system accounts for services that send email.
- Saving passwords in plain text in
msmtprc. - Disabling
tls_certcheckin production. - Using lax permissions (
777) on directories or configuration files. - Disabling AppArmor without a solid technical justification.