feat(dns): implement DKIM record serving and proactive key generation

- Add loadDkimRecords() method to read DKIM records from JSON files
- Integrate DKIM records into DNS server during startup
- Add initializeDkimForEmailDomains() for proactive DKIM key generation
- Ensure DKIM records are available immediately after server startup
- Update documentation with DKIM implementation status

DKIM records are now automatically loaded from .nogit/data/dns/*.dkimrecord.json
and served via DNS. Keys are generated for all configured email domains at startup.
This commit is contained in:
2025-05-31 12:53:29 +00:00
parent c776dab2c0
commit 272973702e
2 changed files with 123 additions and 3 deletions

View File

@ -1,5 +1,29 @@
# Implementation Hints and Learnings
## DKIM Implementation Status (2025-05-30)
### Current Implementation
1. **DKIM Key Generation**: Working - keys are generated when emails are sent
2. **DKIM Email Signing**: Working - emails are signed with DKIM
3. **DKIM DNS Record Serving**: Implemented - records are loaded from JSON files and served
4. **Proactive DKIM Generation**: Implemented - keys are generated for all email domains at startup
### Key Points
- DKIM selector is hardcoded as `mta` in DKIMCreator
- DKIM records are stored in `.nogit/data/dns/*.dkimrecord.json`
- DKIM keys are stored in `.nogit/data/keys/{domain}-private.pem` and `{domain}-public.pem`
- The server needs to be restarted for DKIM records to be loaded and served
- Proactive generation ensures DKIM records are available immediately after startup
### Testing
After server restart, DKIM records can be queried:
```bash
dig @192.168.190.3 mta._domainkey.central.eu TXT +short
```
### Note
The existing dcrouter instance has test domain DKIM records but not for production domains like central.eu. A restart is required to trigger the proactive DKIM generation for configured email domains.
## SmartProxy Usage
### New Route-Based Architecture (v18+)