Name no node: mailu's and mesh-mail's test domain becomes example.org (issue 1838)
This commit is contained in:
@@ -17,10 +17,10 @@ import (
|
||||
// The environment mailu gives automx on node-c when the fixtures were captured (files/mailu.env): the mail domain,
|
||||
// the route name for both servers, the ports.
|
||||
var capturedEnvironment = map[string]string{
|
||||
"AMX_MAIL_DOMAINS": "node-c.be",
|
||||
"AMX_IMAP_ADDRESS": "mail.node-c.be",
|
||||
"AMX_MAIL_DOMAINS": "example.org",
|
||||
"AMX_IMAP_ADDRESS": "mail.example.org",
|
||||
"AMX_IMAP_PORT": "143",
|
||||
"AMX_SMTP_ADDRESS": "mail.node-c.be",
|
||||
"AMX_SMTP_ADDRESS": "mail.example.org",
|
||||
"AMX_SMTP_PORT": "587",
|
||||
"AUTOMX_PORT": "4243",
|
||||
}
|
||||
@@ -176,7 +176,7 @@ func TestTheOnlyCorrectedAnswerIsTheImapServersName(t *testing.T) {
|
||||
}
|
||||
for _, c := range corrected {
|
||||
orig := readFile(t, strings.TrimSuffix(c, ".corrected.body")+".body")
|
||||
want := strings.Replace(orig, "<hostname />", "<hostname>mail.node-c.be</hostname>", 1)
|
||||
want := strings.Replace(orig, "<hostname />", "<hostname>mail.example.org</hostname>", 1)
|
||||
if strings.Contains(want, "<hostname />") || want == orig {
|
||||
t.Fatalf("%s: the capture has no single empty hostname to correct", c)
|
||||
}
|
||||
@@ -198,12 +198,12 @@ func TestTheImapServerIsNamedFromTheImapAddress(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rec := httptest.NewRecorder()
|
||||
newHandler(cfg).ServeHTTP(rec, httptest.NewRequest("GET", "/mail/config-v1.1.xml?emailaddress=a@node-c.be", nil))
|
||||
newHandler(cfg).ServeHTTP(rec, httptest.NewRequest("GET", "/mail/config-v1.1.xml?emailaddress=a@example.org", nil))
|
||||
body := rec.Body.String()
|
||||
if !strings.Contains(body, `<incomingServer type="imap"><hostname>imap.example.test</hostname><port>993</port>`) {
|
||||
t.Errorf("incoming server not named from AMX_IMAP_ADDRESS and AMX_IMAP_PORT: %s", body)
|
||||
}
|
||||
if !strings.Contains(body, `<outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port>`) {
|
||||
if !strings.Contains(body, `<outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port>`) {
|
||||
t.Errorf("outgoing server changed: %s", body)
|
||||
}
|
||||
}
|
||||
@@ -213,13 +213,13 @@ func TestEveryDomainOfTheEnvironmentIsServed(t *testing.T) {
|
||||
for k, v := range capturedEnvironment {
|
||||
env[k] = v
|
||||
}
|
||||
env["AMX_MAIL_DOMAINS"] = "node-c.be, example.test"
|
||||
env["AMX_MAIL_DOMAINS"] = "example.org, example.test"
|
||||
cfg, err := configFrom(getenvOf(env))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h := newHandler(cfg)
|
||||
for _, d := range []string{"node-c.be", "example.test"} {
|
||||
for _, d := range []string{"example.org", "example.test"} {
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, httptest.NewRequest("GET", "/mail/config-v1.1.xml?emailaddress=a@"+d, nil))
|
||||
if rec.Code != 200 || !strings.Contains(rec.Body.String(), "<domain>"+d+"</domain>") {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>node-c.be</domain><displayName>node-c.be</displayName><displayShortName>node-c.be</displayShortName><incomingServer type="imap"><hostname /><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>example.org</domain><displayName>example.org</displayName><displayShortName>example.org</displayShortName><incomingServer type="imap"><hostname /><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>node-c.be</domain><displayName>node-c.be</displayName><displayShortName>node-c.be</displayShortName><incomingServer type="imap"><hostname>mail.node-c.be</hostname><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>example.org</domain><displayName>example.org</displayName><displayShortName>example.org</displayShortName><incomingServer type="imap"><hostname>mail.example.org</hostname><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
Content-Length: 612
|
||||
Content-Length: 624
|
||||
Content-Type: application/xml
|
||||
Server: Werkzeug/3.1.9 Python/3.9.5
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
GET https://autoconfig.node-c.be/mail/config-v1.1.xml?emailaddress=jochen@node-c.be
|
||||
GET https://autoconfig.example.org/mail/config-v1.1.xml?emailaddress=jochen@example.org
|
||||
User-Agent: Thunderbird
|
||||
Accept: */*
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>node-c.be</domain><displayName>node-c.be</displayName><displayShortName>node-c.be</displayShortName><incomingServer type="imap"><hostname /><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>example.org</domain><displayName>example.org</displayName><displayShortName>example.org</displayShortName><incomingServer type="imap"><hostname /><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>node-c.be</domain><displayName>node-c.be</displayName><displayShortName>node-c.be</displayShortName><incomingServer type="imap"><hostname>mail.node-c.be</hostname><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>example.org</domain><displayName>example.org</displayName><displayShortName>example.org</displayShortName><incomingServer type="imap"><hostname>mail.example.org</hostname><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
Content-Length: 612
|
||||
Content-Length: 624
|
||||
Content-Type: application/xml
|
||||
Server: Werkzeug/3.1.9 Python/3.9.5
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://automx.node-c.be/mail/config-v1.1.xml?emailaddress=jochen@node-c.be
|
||||
GET https://automx.example.org/mail/config-v1.1.xml?emailaddress=jochen@example.org
|
||||
User-Agent: Thunderbird
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>node-c.be</domain><displayName>node-c.be</displayName><displayShortName>node-c.be</displayShortName><incomingServer type="imap"><hostname /><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>example.org</domain><displayName>example.org</displayName><displayShortName>example.org</displayShortName><incomingServer type="imap"><hostname /><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>node-c.be</domain><displayName>node-c.be</displayName><displayShortName>node-c.be</displayShortName><incomingServer type="imap"><hostname>mail.node-c.be</hostname><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.node-c.be</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
<clientConfig version="1.1"><emailProvider id="automx2-1"><identity /><domain>example.org</domain><displayName>example.org</displayName><displayShortName>example.org</displayShortName><incomingServer type="imap"><hostname>mail.example.org</hostname><port>143</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></incomingServer><outgoingServer type="smtp"><hostname>mail.example.org</hostname><port>587</port><socketType>STARTTLS</socketType><username>%EMAILADDRESS%</username><authentication>password-cleartext</authentication></outgoingServer></emailProvider></clientConfig>
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
Content-Length: 612
|
||||
Content-Length: 624
|
||||
Content-Type: application/xml
|
||||
Server: Werkzeug/3.1.9 Python/3.9.5
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://autodiscover.node-c.be/mail/config-v1.1.xml?emailaddress=jochen@node-c.be
|
||||
GET https://autodiscover.example.org/mail/config-v1.1.xml?emailaddress=jochen@example.org
|
||||
User-Agent: Thunderbird
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://autoconfig.node-c.be/mail/config-v1.1.xml?emailaddress=nobody@unknown.example
|
||||
GET https://autoconfig.example.org/mail/config-v1.1.xml?emailaddress=nobody@unknown.example
|
||||
User-Agent: Thunderbird
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://autoconfig.node-c.be/mail/config-v1.1.xml
|
||||
GET https://autoconfig.example.org/mail/config-v1.1.xml
|
||||
User-Agent: Thunderbird
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
GET https://autoconfig.node-c.be/
|
||||
GET https://autoconfig.example.org/
|
||||
User-Agent: Mozilla/5.0
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
GET https://autoconfig.node-c.be/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=jochen@node-c.be
|
||||
GET https://autoconfig.example.org/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=jochen@example.org
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
POST https://autodiscover.node-c.be/autodiscover/autodiscover.xml
|
||||
POST https://autodiscover.example.org/autodiscover/autodiscover.xml
|
||||
User-Agent: Microsoft Office/16.0 (Windows NT 10.0; Microsoft Outlook 16.0.14326; Pro)
|
||||
Content-Type: text/xml
|
||||
Accept: */*
|
||||
@@ -6,7 +6,7 @@ Accept: */*
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
|
||||
<Request>
|
||||
<EMailAddress>jochen@node-c.be</EMailAddress>
|
||||
<EMailAddress>jochen@example.org</EMailAddress>
|
||||
<AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
|
||||
</Request>
|
||||
</Autodiscover>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
POST https://autodiscover.node-c.be/autodiscover/autodiscover.xml
|
||||
POST https://autodiscover.example.org/autodiscover/autodiscover.xml
|
||||
User-Agent: Microsoft Office/16.0
|
||||
Content-Type: text/xml
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
POST https://autodiscover.node-c.be/autodiscover/autodiscover.xml
|
||||
POST https://autodiscover.example.org/autodiscover/autodiscover.xml
|
||||
User-Agent: Microsoft Office/16.0
|
||||
Content-Type: text/xml
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
POST https://autodiscover.node-c.be/autodiscover/autodiscover.xml
|
||||
POST https://autodiscover.example.org/autodiscover/autodiscover.xml
|
||||
User-Agent: Microsoft Office/16.0
|
||||
Content-Type: text/xml
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://autodiscover.node-c.be/autodiscover/autodiscover.xml
|
||||
GET https://autodiscover.example.org/autodiscover/autodiscover.xml
|
||||
User-Agent: Microsoft Office/16.0
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
POST https://autodiscover.node-c.be/Autodiscover/Autodiscover.xml
|
||||
POST https://autodiscover.example.org/Autodiscover/Autodiscover.xml
|
||||
User-Agent: Microsoft Office/16.0
|
||||
Content-Type: text/xml
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>jochen@node-c.be</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>
|
||||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>jochen@example.org</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
<html lang=en>
|
||||
<title>Redirecting...</title>
|
||||
<h1>Redirecting...</h1>
|
||||
<p>You should be redirected automatically to the target URL: <a href="https://automx.node-c.be/mobileconfig/?emailaddress=jochen@node-c.be">https://automx.node-c.be/mobileconfig/?emailaddress=jochen@node-c.be</a>. If not, click the link.
|
||||
<p>You should be redirected automatically to the target URL: <a href="https://automx.example.org/mobileconfig/?emailaddress=jochen@example.org">https://automx.example.org/mobileconfig/?emailaddress=jochen@example.org</a>. If not, click the link.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
Content-Length: 323
|
||||
Content-Length: 331
|
||||
Content-Type: text/html; charset=utf-8
|
||||
Location: https://automx.node-c.be/mobileconfig/?emailaddress=jochen@node-c.be
|
||||
Location: https://automx.example.org/mobileconfig/?emailaddress=jochen@example.org
|
||||
Server: Werkzeug/3.1.9 Python/3.9.5
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
GET https://automx.node-c.be/mobileconfig?emailaddress=jochen@node-c.be
|
||||
GET https://automx.example.org/mobileconfig?emailaddress=jochen@example.org
|
||||
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) Safari
|
||||
Accept: */*
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
GET https://automx.node-c.be/mobileconfig/?emailaddress=jochen@node-c.be
|
||||
GET https://automx.example.org/mobileconfig/?emailaddress=jochen@example.org
|
||||
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) Safari
|
||||
Accept: */*
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://automx.node-c.be/mobileconfig/?emailaddress=nobody@unknown.example
|
||||
GET https://automx.example.org/mobileconfig/?emailaddress=nobody@unknown.example
|
||||
User-Agent: Mozilla/5.0 (iPhone)
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
GET https://automx.node-c.be/mobileconfig/
|
||||
GET https://automx.example.org/mobileconfig/
|
||||
User-Agent: Mozilla/5.0 (iPhone)
|
||||
|
||||
+4
-4
@@ -2,9 +2,9 @@ What mailu's autoconfiguration module (automx2 2021.6, container mailu-automx on
|
||||
answers to the requests mail clients make (R4d step AMX-1, issue 1630, ADR 0480).
|
||||
|
||||
Captured 2026-10-21 between 13:58:25 and 13:58:52 (CEST; the Date headers said 11:58 GMT) with the mesh tool
|
||||
node-d/netcheck.netcheck_request, called from node-d, through the names clients use (autoconfig.node-c.be,
|
||||
autodiscover.node-c.be, automx.node-c.be: HTTPS, the mesh's route), no ssh. A redirect is reported, never followed.
|
||||
Mail domain served: node-c.be. Mailbox used: jochen@node-c.be; unknown domain: nobody@unknown.example.
|
||||
node-d/netcheck.netcheck_request, called from node-d, through the names clients use (autoconfig.example.org,
|
||||
autodiscover.example.org, automx.example.org: HTTPS, the mesh's route), no ssh. A redirect is reported, never followed.
|
||||
Mail domain served: example.org. Mailbox used: jochen@example.org; unknown domain: nobody@unknown.example.
|
||||
|
||||
Each capture is four files with the same stem:
|
||||
<stem>.request method and URL, then the request headers sent, then (after a blank line) the body sent
|
||||
@@ -24,7 +24,7 @@ A fixture is not the bytes on the wire in four ways (issue 1701):
|
||||
What the answers show (read, not guessed):
|
||||
- GET /mail/config-v1.1.xml?emailaddress=... answers 200 application/xml on all three names; same body on each.
|
||||
- The incoming (IMAP) server has an EMPTY hostname (<hostname />), port 143, STARTTLS. The outgoing server is
|
||||
mail.node-c.be:587 STARTTLS. Cause (from reading the module, not from the database): automx/files/add-domains:35
|
||||
mail.example.org:587 STARTTLS. Cause (from reading the module, not from the database): automx/files/add-domains:35
|
||||
reads AMX_IMAP_SERVER, files/mailu.env:58 sets AMX_IMAP_ADDRESS, so the IMAP name was never written.
|
||||
A client given this answer cannot find its IMAP server.
|
||||
- POST /autodiscover/autodiscover.xml with a valid request for the served domain answers 500 (the Outlook
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ whole list of where the two differ.
|
||||
server because its setup script read AMX_IMAP_SERVER, which mailu's environment does not set (it sets
|
||||
AMX_IMAP_ADDRESS). The program names it from AMX_IMAP_ADDRESS (and the port from AMX_IMAP_PORT).
|
||||
Fixtures 01, 02 and 03 each have a <stem>.corrected.body: the capture with <hostname /> replaced by
|
||||
<hostname>mail.node-c.be</hostname> and nothing else (a test checks that). Their Content-Length is that file's
|
||||
size, 634, not the captured 612.
|
||||
<hostname>mail.example.org</hostname> and nothing else (a test checks that). Their Content-Length is that file's
|
||||
size, 649, not the captured 624.
|
||||
|
||||
2. The Server header. The capture has "Server: Werkzeug/3.1.9 Python/3.9.5". The program sends no Server header, and
|
||||
Date, which the captured .headers leave out, is sent as net/http sends it.
|
||||
|
||||
Reference in New Issue
Block a user