Security fixes

1. Password reset tokens: use crypto/rand instead of math/rand
2. IP spoofing: only trust X-Forwarded-For from configured trusted proxies
3. Cleanup: purge failed login attempts older than 24 hours
4. JWT secret: validate minimum 32 character length on startup

Updated .env.example with TRUSTED_PROXIES setting
This commit is contained in:
Christoph Haas 2026-03-23 01:09:26 +01:00
parent ccaa1eca7e
commit 269fb6f53a
6 changed files with 82 additions and 46 deletions

View file

@ -8,7 +8,8 @@ DB_NAME=mailserver
# App
PORT=8080
USE_EMBEDDED=true
JWT_SECRET=change-this-to-a-random-secret
JWT_SECRET=your-random-secret-at-least-32-chars
TRUSTED_PROXIES=127.0.0.1
# Mail server paths
MAIL_DATA_DIR=/var/vmail