Relays: how many port 25 connections at once #232
No files matched your search
@@ -661,6 +661,11 @@ function SettingsDialog({
|
||||
</span>
|
||||
</div>
|
||||
</Field>
|
||||
{relay.settings.maxSmtpSessions !== undefined && (
|
||||
<Field field="maxSmtpSessions" label={t('relays.f.maxSmtpSessions', 'Connections at once, all senders')}>
|
||||
{input('maxSmtpSessions', { inputMode: 'numeric' })}
|
||||
</Field>
|
||||
)}
|
||||
<Field field="dnsbl" label={t('relays.f.dnsbl', 'Blocklists while this server is unreachable')}>
|
||||
{input('dnsbl', { placeholder: 'zen.example.org' })}
|
||||
</Field>
|
||||
|
||||
@@ -294,6 +294,23 @@ describe('plain forms', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('reads and sends the relay-wide session cap, and leaves it alone on an older relay', () => {
|
||||
const withCap = { ...SETTINGS, maxSmtpSessions: 1000 };
|
||||
const before = toForm(withCap);
|
||||
expect(before.maxSmtpSessions).toBe('1000');
|
||||
expect(settingsPatch(before, before, withCap)).toEqual({ patch: {} });
|
||||
expect(settingsPatch(before, { ...before, maxSmtpSessions: ' 250 ' }, withCap)).toEqual({
|
||||
patch: { 'settings/maxSmtpSessions': 250 },
|
||||
});
|
||||
expect(settingsPatch(before, { ...before, maxSmtpSessions: '0' }, withCap)).toEqual({ invalid: 'maxSmtpSessions' });
|
||||
expect(settingsPatch(before, { ...before, maxSmtpSessions: 'lots' }, withCap)).toEqual({ invalid: 'maxSmtpSessions' });
|
||||
const old = toForm(SETTINGS);
|
||||
expect(old.maxSmtpSessions).toBe('');
|
||||
expect(settingsPatch(old, { ...old, hostname: 'mx2.example.com' }, SETTINGS)).toEqual({
|
||||
patch: { 'settings/hostname': 'mx2.example.com' },
|
||||
});
|
||||
});
|
||||
|
||||
it('names the field that doesn’t read', () => {
|
||||
const before = toForm(SETTINGS);
|
||||
expect(settingsPatch(before, { ...before, maxRecipients: 'many' }, SETTINGS)).toEqual({
|
||||
|
||||
@@ -58,6 +58,8 @@ export interface RelaySettings {
|
||||
outboundTls: 'opportunistic' | 'required';
|
||||
/** Absent from servers before RL-33: who may dial the link; empty is anyone. */
|
||||
linkAllowFrom?: string[];
|
||||
/** Absent from servers before 27.1-rc.28: port 25 sessions at once, relay-wide. */
|
||||
maxSmtpSessions?: number;
|
||||
}
|
||||
|
||||
export interface Relay {
|
||||
@@ -317,6 +319,7 @@ export interface SettingsForm {
|
||||
connectionsPerMinute: string;
|
||||
messagesPerMinute: string;
|
||||
concurrentSessions: string;
|
||||
maxSmtpSessions: string;
|
||||
dnsbl: string;
|
||||
liveVerdictTimeout: string;
|
||||
heldMaxAge: string;
|
||||
@@ -340,6 +343,7 @@ export function toForm(s: RelaySettings): SettingsForm {
|
||||
connectionsPerMinute: String(s.rateLimits.connectionsPerMinute),
|
||||
messagesPerMinute: String(s.rateLimits.messagesPerMinute),
|
||||
concurrentSessions: String(s.rateLimits.concurrentSessions),
|
||||
maxSmtpSessions: s.maxSmtpSessions === undefined ? '' : String(s.maxSmtpSessions),
|
||||
dnsbl: s.dnsbl.join(', '),
|
||||
liveVerdictTimeout: formatDuration(s.liveVerdictTimeout),
|
||||
heldMaxAge: String(s.heldMaxAge),
|
||||
@@ -390,6 +394,11 @@ export function settingsPatch(
|
||||
concurrentSessions: read('concurrentSessions', whole(after.concurrentSessions)),
|
||||
};
|
||||
}
|
||||
if (changed('maxSmtpSessions')) {
|
||||
const cap = read('maxSmtpSessions', whole(after.maxSmtpSessions));
|
||||
if (!cap) throw 'maxSmtpSessions';
|
||||
patch['settings/maxSmtpSessions'] = cap;
|
||||
}
|
||||
if (changed('dnsbl')) patch['settings/dnsbl'] = parseList(after.dnsbl);
|
||||
if (changed('liveVerdictTimeout'))
|
||||
patch['settings/liveVerdictTimeout'] = read('liveVerdictTimeout', parseDuration(after.liveVerdictTimeout));
|
||||
|
||||
@@ -70,6 +70,8 @@ export const FIELD_HELP: Record<string, string> = {
|
||||
'inbuxa:Relay.maxRecipients': 'How many recipients one message may have at the relay.',
|
||||
'inbuxa:Relay.rateLimits':
|
||||
'How fast one sending address may connect and send to the relay, so a flood stops at the edge.',
|
||||
'inbuxa:Relay.maxSmtpSessions':
|
||||
'How many servers may be connected to the relay on port 25 at once, from all addresses together. Past it, the next one is asked to try again later. 1000 unless you change it.',
|
||||
'inbuxa:Relay.dnsbl':
|
||||
'Blocklists the relay checks connecting servers against while this server is unreachable. Empty checks none.',
|
||||
'inbuxa:Relay.liveVerdictTimeout':
|
||||
|
||||
+2
-1
@@ -2423,7 +2423,8 @@
|
||||
"smtpCertificate": "Certificate chain (PEM)",
|
||||
"smtpPrivateKey": "Private key (PEM)",
|
||||
"linkAllowFrom": "Who may link",
|
||||
"certificateId": "Use"
|
||||
"certificateId": "Use",
|
||||
"maxSmtpSessions": "Connections at once, all senders"
|
||||
},
|
||||
"cancel": "Cancel",
|
||||
"addGo": "Add",
|
||||
|
||||
Reference in new issue
Block a user