Add optional inbound relay (backup-MX) behind INBOUND_RELAY_ENABLE.
test / test (push) Waiting to run
test / test (push) Waiting to run
Port 25 accepts only configured domains and listed recipients, then forwards to an upstream; the outbound path is unchanged when the flag is off. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,6 +47,7 @@ services:
|
||||
ports: !override
|
||||
- "20465:465"
|
||||
- "20587:587"
|
||||
- "20025:25"
|
||||
- "127.0.0.1:20080:8080"
|
||||
dns:
|
||||
- 10.77.0.10
|
||||
|
||||
@@ -105,6 +105,9 @@ func TestE2E(t *testing.T) {
|
||||
if err := checkSupervisorProcesses(h); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := checkInboundRelayOff(h); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := checkLogrotateConfigMode(h); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -134,6 +137,26 @@ func TestE2E(t *testing.T) {
|
||||
sc.panel = p
|
||||
})
|
||||
|
||||
run("inbound_ui_absent_when_disabled", func(t *testing.T) {
|
||||
resp, body, err := sc.panel.get("/status")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
t.Fatalf("status = %d", resp.StatusCode)
|
||||
}
|
||||
if strings.Contains(body, `href="/inbound"`) {
|
||||
t.Fatal("status page shows Inbound nav while INBOUND_RELAY_ENABLE is off")
|
||||
}
|
||||
resp, _, err = sc.panel.get("/inbound")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if resp.StatusCode != 404 {
|
||||
t.Fatalf("GET /inbound = %d, want 404 with inbound relay off", resp.StatusCode)
|
||||
}
|
||||
})
|
||||
|
||||
run("add_domain_and_publish_dkim", func(t *testing.T) {
|
||||
id, err := sc.panel.addDomain(senderDomain)
|
||||
if err != nil {
|
||||
|
||||
@@ -62,3 +62,18 @@ func parseSupervisorStatus(out string) map[string]string {
|
||||
}
|
||||
return states
|
||||
}
|
||||
|
||||
// checkInboundRelayOff asserts the default image does not accept mail on
|
||||
// port 25: smtp/inet is absent from master.cf (Debian's stock listener is
|
||||
// removed when INBOUND_RELAY_ENABLE is not true).
|
||||
func checkInboundRelayOff(s *stack) error {
|
||||
out, err := s.execIn("selfpost", "postconf", "-M", "smtp/inet")
|
||||
combined := out
|
||||
if err != nil {
|
||||
combined += err.Error()
|
||||
}
|
||||
if strings.Contains(combined, "smtpd") && !strings.Contains(combined, "warning:") && !strings.Contains(combined, "fatal:") {
|
||||
return fmt.Errorf("inbound smtp/inet is present while INBOUND_RELAY_ENABLE is off:\n%s", out)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user