fix: Resolve Exchange email server self-signed certificate error
- Add TLS configuration to accept self-signed certificates - Disable TLS/STARTTLS for port 25 when SMTP_SECURE=false - Add ignoreTLS option for Exchange servers on port 25 - Update .env.example with Exchange-specific configuration - Create comprehensive EMAIL_CONFIGURATION.md guide - Support both Exchange internal servers and modern SMTP servers This fixes the "self-signed certificate" error when connecting to Microsoft Exchange servers on port 25 without TLS. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+11
-4
@@ -23,11 +23,18 @@ MINIO_ACCESS_KEY=minioadmin
|
|||||||
MINIO_SECRET_KEY=minioadmin
|
MINIO_SECRET_KEY=minioadmin
|
||||||
|
|
||||||
# Email Configuration (for reports)
|
# Email Configuration (for reports)
|
||||||
SMTP_HOST=smtp.gmail.com
|
# For Microsoft Exchange on port 25 without TLS:
|
||||||
SMTP_PORT=587
|
SMTP_HOST=exchange.yourcompany.com
|
||||||
|
SMTP_PORT=25
|
||||||
SMTP_SECURE=false
|
SMTP_SECURE=false
|
||||||
SMTP_USER=your-email@gmail.com
|
SMTP_USER=username
|
||||||
SMTP_PASS=your-app-password
|
SMTP_PASS=password
|
||||||
|
# For Gmail/Office365 with STARTTLS:
|
||||||
|
# SMTP_HOST=smtp.gmail.com
|
||||||
|
# SMTP_PORT=587
|
||||||
|
# SMTP_SECURE=false
|
||||||
|
# SMTP_USER=your-email@gmail.com
|
||||||
|
# SMTP_PASS=your-app-password
|
||||||
REPORT_RECIPIENT=info@example.com
|
REPORT_RECIPIENT=info@example.com
|
||||||
REPORT_SENDER=kopiabackup@example.com
|
REPORT_SENDER=kopiabackup@example.com
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
# Email Configuration Guide for MinIO WebUI
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
MinIO WebUI supports email notifications for storage reports. This guide explains how to configure email settings, especially for Microsoft Exchange servers.
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
Configure these variables in your `.env` file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# SMTP Server Configuration
|
||||||
|
SMTP_HOST=your-exchange-server.com
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=false
|
||||||
|
SMTP_USER=your-username
|
||||||
|
SMTP_PASS=your-password
|
||||||
|
|
||||||
|
# Email Settings
|
||||||
|
REPORT_SENDER=minio-reports@yourdomain.com
|
||||||
|
REPORT_RECIPIENT=admin@yourdomain.com
|
||||||
|
|
||||||
|
# Report Schedule (cron format)
|
||||||
|
REPORT_SCHEDULE=0 0 * * 1 # Every Monday at midnight
|
||||||
|
```
|
||||||
|
|
||||||
|
## Port and Security Settings
|
||||||
|
|
||||||
|
### Port 25 (No TLS/SSL)
|
||||||
|
Most common for internal Exchange servers:
|
||||||
|
```bash
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=false
|
||||||
|
```
|
||||||
|
|
||||||
|
### Port 587 (STARTTLS)
|
||||||
|
For servers that support encryption:
|
||||||
|
```bash
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_SECURE=false # STARTTLS will upgrade the connection
|
||||||
|
```
|
||||||
|
|
||||||
|
### Port 465 (SSL/TLS)
|
||||||
|
For servers requiring SSL from the start:
|
||||||
|
```bash
|
||||||
|
SMTP_PORT=465
|
||||||
|
SMTP_SECURE=true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Issues and Solutions
|
||||||
|
|
||||||
|
### Self-Signed Certificate Error
|
||||||
|
|
||||||
|
**Error**: `self-signed certificate`
|
||||||
|
|
||||||
|
**Solution**: The application is configured to accept self-signed certificates. If you still see this error:
|
||||||
|
|
||||||
|
1. Ensure `SMTP_SECURE=false` for port 25
|
||||||
|
2. Restart the backend service
|
||||||
|
3. Check that your Exchange server allows SMTP connections on port 25
|
||||||
|
|
||||||
|
### Connection Refused
|
||||||
|
|
||||||
|
**Error**: `connect ECONNREFUSED`
|
||||||
|
|
||||||
|
**Solution**:
|
||||||
|
1. Verify the SMTP_HOST is correct
|
||||||
|
2. Check if port 25 is open on the Exchange server
|
||||||
|
3. Ensure no firewall is blocking the connection
|
||||||
|
|
||||||
|
### Authentication Failed
|
||||||
|
|
||||||
|
**Error**: `Invalid login`
|
||||||
|
|
||||||
|
**Solution**:
|
||||||
|
1. Verify SMTP_USER and SMTP_PASS are correct
|
||||||
|
2. For Exchange, use either:
|
||||||
|
- Username only: `username`
|
||||||
|
- Domain\Username: `DOMAIN\\username`
|
||||||
|
- Email format: `username@domain.com`
|
||||||
|
|
||||||
|
## Exchange Server Specific Settings
|
||||||
|
|
||||||
|
For Microsoft Exchange servers, the configuration automatically:
|
||||||
|
- Accepts self-signed certificates when `SMTP_SECURE=false`
|
||||||
|
- Disables TLS for port 25 when `SMTP_SECURE=false`
|
||||||
|
- Handles STARTTLS negotiation for port 587
|
||||||
|
|
||||||
|
## Testing Email Configuration
|
||||||
|
|
||||||
|
1. Set up your environment variables
|
||||||
|
2. Restart the backend:
|
||||||
|
```bash
|
||||||
|
docker-compose restart backend
|
||||||
|
```
|
||||||
|
3. Check the logs:
|
||||||
|
```bash
|
||||||
|
docker logs minio-webui-backend -f
|
||||||
|
```
|
||||||
|
4. Look for either:
|
||||||
|
- ✅ `Email transporter ready`
|
||||||
|
- ❌ `Email transporter verification failed`
|
||||||
|
|
||||||
|
## Manual Test
|
||||||
|
|
||||||
|
To manually trigger a test email:
|
||||||
|
1. Log into the MinIO WebUI
|
||||||
|
2. Navigate to Reports
|
||||||
|
3. Click "E-Mail senden" (Send Email)
|
||||||
|
|
||||||
|
## Report Schedule Format
|
||||||
|
|
||||||
|
The `REPORT_SCHEDULE` uses cron format:
|
||||||
|
|
||||||
|
```
|
||||||
|
┌────────────── second (optional)
|
||||||
|
│ ┌──────────── minute
|
||||||
|
│ │ ┌────────── hour
|
||||||
|
│ │ │ ┌──────── day of month
|
||||||
|
│ │ │ │ ┌────── month
|
||||||
|
│ │ │ │ │ ┌──── day of week
|
||||||
|
│ │ │ │ │ │
|
||||||
|
* * * * * *
|
||||||
|
```
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
- `0 0 * * 1` - Every Monday at midnight
|
||||||
|
- `0 8 * * *` - Every day at 8 AM
|
||||||
|
- `0 0 1 * *` - First day of every month at midnight
|
||||||
|
- `0 */6 * * *` - Every 6 hours
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Enable Debug Logging
|
||||||
|
|
||||||
|
Add to your `.env`:
|
||||||
|
```bash
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
```
|
||||||
|
|
||||||
|
### Check Email Service Status
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# View recent logs
|
||||||
|
docker logs minio-webui-backend --tail 50
|
||||||
|
|
||||||
|
# Watch logs in real-time
|
||||||
|
docker logs minio-webui-backend -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Common Exchange Configurations
|
||||||
|
|
||||||
|
**Internal Exchange (No Auth)**:
|
||||||
|
```bash
|
||||||
|
SMTP_HOST=exchange.internal.company.com
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=false
|
||||||
|
SMTP_USER=
|
||||||
|
SMTP_PASS=
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exchange with Auth**:
|
||||||
|
```bash
|
||||||
|
SMTP_HOST=mail.company.com
|
||||||
|
SMTP_PORT=25
|
||||||
|
SMTP_SECURE=false
|
||||||
|
SMTP_USER=DOMAIN\\username
|
||||||
|
SMTP_PASS=yourpassword
|
||||||
|
```
|
||||||
|
|
||||||
|
**Office 365**:
|
||||||
|
```bash
|
||||||
|
SMTP_HOST=smtp.office365.com
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_SECURE=false
|
||||||
|
SMTP_USER=user@company.com
|
||||||
|
SMTP_PASS=yourpassword
|
||||||
|
```
|
||||||
|
|
||||||
|
## Security Considerations
|
||||||
|
|
||||||
|
1. Store credentials securely in `.env` file
|
||||||
|
2. Never commit `.env` to version control
|
||||||
|
3. Use application-specific passwords when available
|
||||||
|
4. Consider using OAuth2 for modern email services
|
||||||
|
5. Restrict SMTP relay access on Exchange server
|
||||||
|
|
||||||
|
## Need Help?
|
||||||
|
|
||||||
|
If email configuration continues to fail:
|
||||||
|
1. Verify with your IT team that SMTP is enabled on the Exchange server
|
||||||
|
2. Check if any additional authentication (like NTLM) is required
|
||||||
|
3. Test connectivity: `telnet your-exchange-server 25`
|
||||||
|
4. Review Exchange server logs for connection attempts
|
||||||
@@ -27,6 +27,15 @@ class ReportService {
|
|||||||
user: config.email.auth.user,
|
user: config.email.auth.user,
|
||||||
pass: config.email.auth.pass,
|
pass: config.email.auth.pass,
|
||||||
},
|
},
|
||||||
|
// For Exchange Server on port 25 without TLS
|
||||||
|
tls: {
|
||||||
|
rejectUnauthorized: false, // Accept self-signed certificates
|
||||||
|
// If you want to disable TLS completely when secure is false:
|
||||||
|
...(config.email.port === 25 && !config.email.secure ? { enabled: false } : {})
|
||||||
|
},
|
||||||
|
// Disable STARTTLS for port 25 if not using secure
|
||||||
|
requireTLS: config.email.secure,
|
||||||
|
ignoreTLS: config.email.port === 25 && !config.email.secure,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verify connection
|
// Verify connection
|
||||||
|
|||||||
Reference in New Issue
Block a user