Add per-domain DKIM signing, admin console TLS, log rotation, and resolver timeout scoping

- DKIM signing was hardcoded to one domain; now keyed per-domain off
  the sending address, fixing mail for every domain but the original.
- Admin console (port 1027) is now TLS-wrapped instead of plaintext.
- barantmail.log now rotates by size (config-driven) instead of
  growing unbounded (previously hit 23GB).
- ResolverThreadScope.h: a <setenv> scoping fix for name resolution
  inside a <try> block that previously did not survive its own
  container.
- IMAPArgs.cpp: fixed "UID STORE 1:*" wrongly requiring UID 1 to
  exist, which silently made empty-folder operations delete nothing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Brad ArantandClaude Sonnet 5 committed 2026-10-06 17:39:06 +00:00
1 parent 5f3e6ed2e6
commit 407cc2e915
11 files changed
+284 -81

No files matched your search

+11 -6
View File
@@ -4,6 +4,7 @@
#include "DKIMSigner.h"
#include "File.h"
#include "MString.h"
#include <map>
#include <string>
#include <vector>
@@ -41,13 +42,17 @@ namespace mail {
class SendMail {
public:
// dkimSigner is optional (nullptr = don't sign) and not owned -
// the caller keeps it alive for as long as any SendMail built
// from it might still be sending (a shared signer is fine to
// reuse across many messages; it holds no per-message state).
// dkimSigners is optional (nullptr = don't sign anything) and not
// owned - the caller keeps both it and every DKIMSigner it points
// to alive for as long as any SendMail built from it might still
// be sending (shared, reusable across many messages; a signer
// holds no per-message state). Keyed by domain (matching a
// sender address's own domain, case-sensitive exact match, via
// domainOf() on `from`) - a domain with no entry just goes out
// unsigned, same as dkimSigners being nullptr entirely.
SendMail(std::string hostName, std::string sendLogPath, std::string messageId,
coreutils::MString from, coreutils::MString recipient, coreutils::MString mailData,
DKIMSigner *dkimSigner = nullptr);
std::map<std::string, DKIMSigner*> *dkimSigners = nullptr);
/// Blocking. Returns true if some MX host for the recipient's
/// domain accepted the message, false if DNS resolution or every
@@ -68,7 +73,7 @@ namespace mail {
coreutils::MString from;
coreutils::MString recipient;
coreutils::MString mailData;
DKIMSigner *dkimSigner;
std::map<std::string, DKIMSigner*> *dkimSigners;
};