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

+27 -8
View File
@@ -82,20 +82,39 @@ namespace mail {
return hasTls ? &tlsInfo : NULL;
}
bool BARANTMailConfig::hasDkim() {
return file->exists("dkim.domain") && file->exists("dkim.selector") && file->exists("dkim.privateKey");
std::vector<BARANTMailConfig::DkimEntry> BARANTMailConfig::getDkimEntries() {
std::vector<DkimEntry> entries;
// No length-prefixed array accessor on JFile/JString - probe
// ascending indices via exists() (the same technique the JSON
// path syntax's own "a[2]" bracket form is meant for) until one
// is missing, matching a plain JSON array's natural "no trailing
// comma/count field" shape.
for (int i = 0; ; i++) {
std::string indexPrefix = "dkim[" + std::to_string(i) + "]";
std::string domainPath = indexPrefix + ".domain";
if (!file->exists(domainPath))
break;
std::string selectorPath = indexPrefix + ".selector";
std::string keyPath = indexPrefix + ".privateKey";
DkimEntry entry;
entry.domain = file->getString(domainPath);
entry.selector = file->getString(selectorPath);
entry.privateKeyPath = file->getString(keyPath);
entries.push_back(entry);
}
return entries;
}
std::string BARANTMailConfig::getDkimDomain() {
return file->getString("dkim.domain");
bool BARANTMailConfig::hasLog() {
return file->exists("log");
}
std::string BARANTMailConfig::getDkimSelector() {
return file->getString("dkim.selector");
size_t BARANTMailConfig::getLogMaxSizeBytes() {
return file->exists("log.maxSizeBytes") ? (size_t)file->getInt("log.maxSizeBytes") : 104857600;
}
std::string BARANTMailConfig::getDkimPrivateKeyPath() {
return file->getString("dkim.privateKey");
int BARANTMailConfig::getLogMaxBackups() {
return file->exists("log.maxBackups") ? (int)file->getInt("log.maxBackups") : 5;
}
bool BARANTMailConfig::hasAdmin() {