SRS - Sender Rewriting Scheme unter CentOS 7.x

SPF Logo Im Kapitel SPF - Sender Policy Framework sind wir bereits darauf eingegangen, dass mit unter Probleme bei Mailumleitungen und/oder WebFormularen auftauchen können. Mit SRS1) kann ein Mailserver die eMail-Adresse im Envelope umschreiben und anpassen.

Das nachfolgende Schaubild verdeutlicht, warum bei zu strenger Wahl des SPF-Records der Versand bei einer Weiterleitung (alias) fehlschlägt. Der empfangende Mailserver überprüft die Angaben HELO und MAIL FROM im Envelop der eMail. Hierzu frägt der Mailserver den SPF-Record des sendenden Systems ab und vergleicht die IP-Adresse/Namen des einliefernden Empfängers mit den legitimen Sendern des SMF-Records. Ist der einliefernde Mailserver berechtigt, kann mit der weiteren Annahme und Prüfung fortgefahren werden. Ist der einliefernde Mailserver aber nicht berechtigt, quittiert das System den Zustellversuch mit einem Fehler-(code) 550.

Mailversand einer eMail bei Weiterleitung (alias)Mailversand einer eMail bei Weiterleitung (alias) <rect fill="#000000" fill-opacity="0.00000" height="1397.0313" width="8" x="407.0967" y="138.7813"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="411" x2="411" y1="138.7813" y2="1535.8125"/></g><g><title/><rect fill="#000000" fill-opacity="0.00000" height="1397.0313" width="8" x="766.3418" y="138.7813"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="769.9492" x2="769.9492" y1="138.7813" y2="1535.8125"/></g><g><title/><rect fill="#000000" fill-opacity="0.00000" height="1397.0313" width="8" x="1199.0674" y="138.7813"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="1202.4043" x2="1202.4043" y1="138.7813" y2="1535.8125"/></g><g><title/><rect fill="#000000" fill-opacity="0.00000" height="1397.0313" width="8" x="1645.6689" y="138.7813"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="1649.5811" x2="1649.5811" y1="138.7813" y2="1535.8125"/></g><g class="participant participant-head" data-participant="links"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="230.1934" x="296" y="58.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="408.8716" y="78.5889"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="207.293" x="307.4502" y="94.8857">Mail-Server mx1.example.org</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="102.4229" x="359.8853" y="111.1826">88.217.127.21</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="408.8716" y="127.4795"> </text></g><g class="participant participant-tail" data-participant="links"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="230.1934" x="296" y="1534.8125"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="408.8716" y="1554.8076"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="207.293" x="307.4502" y="1571.1045">Mail-Server mx1.example.org</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="102.4229" x="359.8853" y="1587.4014">88.217.127.21</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="408.8716" y="1603.6982"> </text></g><g class="participant participant-head" data-participant="mitte"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="228.7852" x="655.9492" y="58.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="768.1167" y="78.5889"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="205.8848" x="667.3994" y="94.8857">Mail-Server mx01.nausch.org</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="111.3301" x="714.6768" y="111.1826">217.91.103.190</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="768.1167" y="127.4795"> </text></g><g class="participant participant-tail" data-participant="mitte"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="228.7852" x="655.9492" y="1534.8125"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="768.1167" y="1554.8076"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="205.8848" x="667.3994" y="1571.1045">Mail-Server mx01.nausch.org</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="111.3301" x="714.6768" y="1587.4014">217.91.103.190</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="768.1167" y="1603.6982"> </text></g><g class="participant participant-head" data-participant="rechts"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="309.3262" x="1048.4043" y="58.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1200.8423" y="78.5889"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="286.4258" x="1059.8545" y="94.8857">Mail-Server mx1.piratenpartei-bayern.de</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="111.3301" x="1147.4023" y="111.1826">88.198.212.215</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1200.8423" y="127.4795"> </text></g><g class="participant participant-tail" data-participant="rechts"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="309.3262" x="1048.4043" y="1534.8125"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1200.8423" y="1554.8076"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="286.4258" x="1059.8545" y="1571.1045">Mail-Server mx1.piratenpartei-bayern.de</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="111.3301" x="1147.4023" y="1587.4014">88.198.212.215</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1200.8423" y="1603.6982"> </text></g><g class="participant participant-head" data-participant="DNS"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="134.1758" x="1582.5811" y="58.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1647.4438" y="78.5889"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="111.2754" x="1594.0313" y="94.8857">DNS-Server von</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="77.8477" x="1610.7451" y="111.1826">nausch.org</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1647.4438" y="127.4795"> </text></g><g class="participant participant-tail" data-participant="DNS"><rect fill="#E2E2F0" height="79.1875" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="134.1758" x="1582.5811" y="1534.8125"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1647.4438" y="1554.8076"> </text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="111.2754" x="1594.0313" y="1571.1045">DNS-Server von</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="77.8477" x="1610.7451" y="1587.4014">nausch.org</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthadjust="spacing" textlength="4.4502" x="1647.4438" y="1603.6982"> </text></g><g class="message" data-participant-1="links" data-participant-2="mitte"><polygon fill="#181818" points="758.3418,244.5781,768.3418,248.5781,758.3418,252.5781,762.3418,248.5781" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="411.0967" x2="764.3418" y1="248.5781" y2="248.5781"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="335.2451" x="418.0967" y="243.5122">connect von mx1.example.org zu mx01.nausch.org</text></g><path d="M5,153.7813 L5,329.7813 L406,329.7813 L406,163.7813 L396,153.7813 L5,153.7813" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M396,153.7813 L396,163.7813 L406,163.7813 L396,153.7813" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="11" y="170.8481"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="218.353" x="15.1323" y="185.981"><span class="search_hit">eMail</span>: \ From: n3rd@example.org</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="212.5703" x="15.1323" y="201.1138">To: pirat_django@piraten-it.guru</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="372.1123" x="15.1323" y="216.2466">Date: Tue, 18 Mar 2014 11:23:38 +0100 Subject: Termin</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="11" y="231.3794"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="32.8301" x="15.1323" y="246.5122">Ahoi,</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="175.7793" x="15.1323" y="261.645">kann leider nicht kommen!</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="11" y="276.7778"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="32.6143" x="15.1323" y="291.9106">cul8r</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="30.1069" x="15.1323" y="307.0435">n3rd</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="11" y="322.1763"> </text><g class="message" data-participant-1="mitte" data-participant-2="links"><polygon fill="#181818" points="422.0967,352.375,412.0967,356.375,422.0967,360.375,418.0967,356.375" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="416.0967" x2="769.3418" y1="356.375" y2="356.375"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="299.5205" x="428.0967" y="351.3091">. 220 mx01.nausch.org ESMTP Postfix</text></g><g class="message" data-participant-1="links" data-participant-2="mitte"><polygon fill="#181818" points="758.3418,381.5078,768.3418,385.5078,758.3418,389.5078,762.3418,385.5078" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="411.0967" x2="764.3418" y1="385.5078" y2="385.5078"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="154.2227" x="418.0967" y="380.4419">HELO mx1.example.org</text></g><g class="message" data-participant-1="mitte" data-participant-2="links"><polygon fill="#181818" points="422.0967,410.6406,412.0967,414.6406,422.0967,418.6406,418.0967,414.6406" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="416.0967" x2="769.3418" y1="414.6406" y2="414.6406"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="204.2485" x="428.0967" y="409.5747">. 250 mx01.nausch.org</text></g><g class="message" data-participant-1="links" data-participant-2="mitte"><polygon fill="#181818" points="758.3418,439.7734,768.3418,443.7734,758.3418,447.7734,762.3418,443.7734" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="411.0967" x2="764.3418" y1="443.7734" y2="443.7734"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="224.415" x="418.0967" y="438.7075">MAIL FROM:<n3rd@example.org></text></g><g class="message" data-participant-1="mitte" data-participant-2="DNS"><polygon fill="#181818" points="1637.6689,502.1719,1647.6689,506.1719,1637.6689,510.1719,1641.6689,506.1719" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="770.3418" x2="1643.6689" y1="506.1719" y2="506.1719"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="156.9014" x="777.3418" y="501.106">host -t TXT example.org</text></g><path d="M1654,456.7734 L1654,541.7734 L1793,541.7734 L1793,466.7734 L1783,456.7734 L1654,456.7734" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M1783,456.7734 L1783,466.7734 L1793,466.7734 L1783,456.7734" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="1660" y="473.8403"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="78.438" x="1664.1323" y="488.9731">Abfrage des</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="80.7612" x="1664.1323" y="504.106">SPF-Records</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="109.8843" x="1664.1323" y="519.2388">von example.org</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="1660" y="534.3716"> </text><g class="message" data-participant-1="DNS" data-participant-2="mitte"><polygon fill="#181818" points="781.3418,605.4023,771.3418,609.4023,781.3418,613.4023,777.3418,609.4023" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="775.3418" x2="1648.6689" y1="609.4023" y2="609.4023"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="422.6016" x="787.3418" y="604.3364">example.org descriptive text "v=spf1 ip4:88.217.127.21 mx -all"</text></g><path d="M534,552.4375 L534,652.4375 L764,652.4375 L764,562.4375 L754,552.4375 L534,552.4375" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M754,552.4375 L754,562.4375 L764,562.4375 L754,552.4375" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="540" y="569.5044"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="171.958" x="544.1323" y="584.6372">Nur der Mailserver mit der</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="201.6968" x="544.1323" y="599.77">IP 88.217.217.21 ist berechtigt</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="152.5786" x="544.1323" y="614.9028"><span class="search_hit">eMail</span>s der Mail-Domain</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="178.9404" x="544.1323" y="630.0356">example.org zu versenden!</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="540" y="645.1685"> </text><g class="message" data-participant-1="mitte" data-participant-2="links"><polygon fill="#181818" points="422.0967,675.3672,412.0967,679.3672,422.0967,683.3672,418.0967,679.3672" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="416.0967" x2="769.3418" y1="679.3672" y2="679.3672"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="174.8271" x="428.0967" y="674.3013">. 250 2.1.0 Ok</text></g><g class="message" data-participant-1="links" data-participant-2="mitte"><polygon fill="#181818" points="758.3418,704.5,768.3418,708.5,758.3418,712.5,762.3418,708.5" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="411.0967" x2="764.3418" y1="708.5" y2="708.5"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="270.5244" x="418.0967" y="703.4341">RCPT TO:<pirat_django@piraten-it.guru></text></g><g class="message" data-participant-1="mitte" data-participant-2="links"><polygon fill="#181818" points="422.0967,733.6328,412.0967,737.6328,422.0967,741.6328,418.0967,737.6328" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="416.0967" x2="769.3418" y1="737.6328" y2="737.6328"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="174.8271" x="428.0967" y="732.5669">. 250 2.1.0 Ok</text></g><g class="message" data-participant-1="links" data-participant-2="mitte"><polygon fill="#181818" points="758.3418,762.7656,768.3418,766.7656,758.3418,770.7656,762.3418,766.7656" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="411.0967" x2="764.3418" y1="766.7656" y2="766.7656"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="178.2993" x="418.0967" y="761.6997">Übermittlung der Nachricht</text></g><g class="message" data-participant-1="mitte" data-participant-2="links"><polygon fill="#181818" points="422.0967,810.0313,412.0967,814.0313,422.0967,818.0313,418.0967,814.0313" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="416.0967" x2="769.3418" y1="814.0313" y2="814.0313"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="222.3076" x="428.0967" y="808.9653">250 2.0.0 Ok: queued as 5957581</text></g><path d="M214,779.7656 L214,834.7656 L406,834.7656 L406,789.7656 L396,779.7656 L214,779.7656" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M396,779.7656 L396,789.7656 L406,789.7656 L396,779.7656" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="220" y="796.8325"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="162.8237" x="224.1323" y="811.9653">Beenden der Verbindung</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="220" y="827.0981"> </text><g class="message" data-participant-1="mitte" data-participant-2="rechts"><polygon fill="#181818" points="1191.0674,935.9609,1201.0674,939.9609,1191.0674,943.9609,1195.0674,939.9609" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="770.3418" x2="1197.0674" y1="939.9609" y2="939.9609"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="408.7256" x="777.3418" y="934.895">connect von mx01.nausch.org zu mx1.piratenpartei-bayern.de</text></g><path d="M363,845.1641 L363,1021.1641 L764,1021.1641 L764,855.1641 L754,845.1641 L363,845.1641" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M754,845.1641 L754,855.1641 L764,855.1641 L754,845.1641" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="369" y="862.231"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="218.353" x="373.1323" y="877.3638"><span class="search_hit">eMail</span>: \ From: n3rd@example.org</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="212.5703" x="373.1323" y="892.4966">To: pirat_django@piraten-it.guru</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="372.1123" x="373.1323" y="907.6294">Date: Tue, 18 Mar 2014 11:23:38 +0100 Subject: Termin</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="369" y="922.7622"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="32.8301" x="373.1323" y="937.895">Ahoi,</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="175.7793" x="373.1323" y="953.0278">kann leider nicht kommen!</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="369" y="968.1606"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="32.6143" x="373.1323" y="983.2935">cul8r</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="30.1069" x="373.1323" y="998.4263">n3rd</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="369" y="1013.5591"> </text><g class="message" data-participant-1="rechts" data-participant-2="mitte"><polygon fill="#181818" points="781.3418,1043.7578,771.3418,1047.7578,781.3418,1051.7578,777.3418,1047.7578" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="775.3418" x2="1202.0674" y1="1047.7578" y2="1047.7578"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="374.3086" x="787.3418" y="1042.6919">. 220 mx1.piratenpartei-bayern.de ESMTP Postfix</text></g><g class="message" data-participant-1="mitte" data-participant-2="rechts"><polygon fill="#181818" points="1191.0674,1072.8906,1201.0674,1076.8906,1191.0674,1080.8906,1195.0674,1076.8906" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="770.3418" x2="1197.0674" y1="1076.8906" y2="1076.8906"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="152.915" x="777.3418" y="1071.8247">HELO mx01.nausch.org</text></g><g class="message" data-participant-1="rechts" data-participant-2="mitte"><polygon fill="#181818" points="781.3418,1102.0234,771.3418,1106.0234,781.3418,1110.0234,777.3418,1106.0234" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="775.3418" x2="1202.0674" y1="1106.0234" y2="1106.0234"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="279.0366" x="787.3418" y="1100.9575">. 250 mx1.piratenpartei-bayern.de</text></g><g class="message" data-participant-1="mitte" data-participant-2="rechts"><polygon fill="#181818" points="1191.0674,1131.1563,1201.0674,1135.1563,1191.0674,1139.1563,1195.0674,1135.1563" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="770.3418" x2="1197.0674" y1="1135.1563" y2="1135.1563"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="224.415" x="777.3418" y="1130.0903">MAIL FROM:<n3rd@example.org></text></g><g class="message" data-participant-1="rechts" data-participant-2="DNS"><polygon fill="#181818" points="1637.6689,1193.5547,1647.6689,1197.5547,1637.6689,1201.5547,1641.6689,1197.5547" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;" x1="1203.0674" x2="1643.6689" y1="1197.5547" y2="1197.5547"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="156.9014" x="1210.0674" y="1192.4888">host -t TXT example.org</text></g><path d="M1654,1148.1563 L1654,1233.1563 L1793,1233.1563 L1793,1158.1563 L1783,1148.1563 L1654,1148.1563" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M1783,1148.1563 L1783,1158.1563 L1793,1158.1563 L1783,1148.1563" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="1660" y="1165.2231"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="78.438" x="1664.1323" y="1180.356">Abfrage des</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="80.7612" x="1664.1323" y="1195.4888">SPF-Records</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="109.8843" x="1664.1323" y="1210.6216">von example.org</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="1660" y="1225.7544"> </text><g class="message" data-participant-1="DNS" data-participant-2="rechts"><polygon fill="#181818" points="1214.0674,1304.3516,1204.0674,1308.3516,1214.0674,1312.3516,1210.0674,1308.3516" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="1208.0674" x2="1648.6689" y1="1308.3516" y2="1308.3516"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="422.6016" x="1220.0674" y="1303.2856">example.org descriptive text "v=spf1 ip4:88.217.127.21 mx -all"</text></g><path d="M741,1243.8203 L741,1358.8203 L1197,1358.8203 L1197,1253.8203 L1187,1243.8203 L741,1243.8203" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M1187,1243.8203 L1187,1253.8203 L1197,1253.8203 L1187,1243.8203" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="747" y="1260.8872"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="171.958" x="751.1323" y="1276.02">Nur der Mailserver mit der</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="201.6968" x="751.1323" y="1291.1528">IP 88.217.217.21 ist berechtigt</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="152.5786" x="751.1323" y="1306.2856"><span class="search_hit">eMail</span>s der Mail-Domain</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="178.9404" x="751.1323" y="1321.4185">example.org zu versenden!</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="427.5781" x="751.1323" y="1336.5513">Die IP-Adresse 217.91.103.190 ist als Versender nicht berechtigt!</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="747" y="1351.6841"> </text><g class="message" data-participant-1="rechts" data-participant-2="mitte"><polygon fill="#181818" points="781.3418,1400.0156,771.3418,1404.0156,781.3418,1408.0156,777.3418,1404.0156" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="775.3418" x2="1202.0674" y1="1404.0156" y2="1404.0156"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="321.3628" x="787.3418" y="1398.9497">. 550-5.7.1 SPF MAIL FROM check failed!</text></g><path d="M573,1369.75 L573,1424.75 L765,1424.75 L765,1379.75 L755,1369.75 L573,1369.75" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M755,1369.75 L755,1379.75 L765,1379.75 L755,1369.75" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="579" y="1386.8169"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="162.8237" x="583.1323" y="1401.9497">Beenden der Verbindung</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="579" y="1417.0825"> </text><g class="message" data-participant-1="mitte" data-participant-2="links"><polygon fill="#181818" points="422.0967,1472.9805,412.0967,1476.9805,422.0967,1480.9805,418.0967,1476.9805" style="stroke:#181818;stroke-width:1;"/><line style="stroke:#181818;stroke-width:1;stroke-dasharray:2.0,2.0;" x1="416.0967" x2="769.3418" y1="1476.9805" y2="1476.9805"/></g><path d="M775,1435.1484 L775,1520.1484 L972,1520.1484 L972,1445.1484 L962,1435.1484 L775,1435.1484" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><path d="M962,1435.1484 L962,1445.1484 L972,1445.1484 L962,1435.1484" fill="#FEFFDD" style="stroke:#181818;stroke-width:0.5;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="781" y="1452.2153"> </text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="140.8735" x="785.1323" y="1467.3481">Bounce der Nachricht</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="92.2822" x="785.1323" y="1482.481">zurück an den</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="168.6255" x="785.1323" y="1497.6138">ursprünglichen Absender!</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthadjust="spacing" textlength="4.1323" x="781" y="1512.7466"> </text><!--SRC=[tLRDRfj04BxxAIOvjMf0W8jYepIAKoTgf3YsOYlj8LArXZ7U61QwB9QRP-cZz9ONwonW9-3yLQfwY6KCxCv-C_FDp2ShhYA40UFH4cN6H0381Kf0lGHJvF0LkK8PqMykGdZ78iwozzUYrKgPLDpdAHCATgz50MACKH8Gn2lRn1MBqmZDH8P0svsEwTZxfktiqvqMTe5b476no5v0icnJi3ppvsia3TErJTjgctRNMaF5N2byCQYKIwPGQ3FanfJzH2dC0Ai0xQuEqg7BNSDAzETgEyJ-nNWDkqo4FbwBiJXADgrMaI4OXsLy01xuYH3eg-9SawVRl9bmIoHqBCAPegFafYWCFS6fJ68FH5i6Hmsc9ua7HPxVWnicmkIeIjhWoWnpcMkRFYruCCbn3-mEiIJ1iUoFODkUq_RQ7VXWsPO5utnwGw6I8SgO5sdIjpTF-9v-M30XA3GU40k24q-mIE8OnKvbwETHHnRSK9HqhyWuC8oA3GzCg7qSnzgg-CbuC1d1ACdKZA-QV7hmvUHysEJn5OxSBKVRq8FUsJcSNWu7ta6JvyDMQKJML6QodLDyO2YOV9l0mqYAyaaUpglwzQOpoKA403FGx-FHgN69VYA3JB_gfgYNitAaSoazFTmc55_oLF4bWi8LzURoKvRERE3fHwy-SV4A31P5kys6kiWbw0BgliggGU6gMDBRPwFrv9ONSCfpYiLOy51jMZBRW1Zz96PbipHQMqiCYg1ia9ThzA1KZccR5WmNspMw_3oQm6Je7JpNyOV_oDdThwaU1AKYhOKwuGlcpwLk_KSyb5XMWUN1Znnp3BGkk5rtt-tOpK8SOy5D0Nk5Sif5eBregTtqMgb6sofIdvX2HPxKkZUbAFV3KL7pXAGyhVnrUMaolT6NkbIymgtxhDj773shDfNLVv2RojERqnleSoHqenT8p39i_elGRXYXNbLdrlrtxthdTVq6hciPhaayQBBlgmh-7Fq5p2XY37R-OlWRmh9LukCa5pxMrKYlt-RoxZTvP1gre2UNMKfh8ep81dLpbAdgpFu0]--></g></svg></div> </p> <p> Da in dem fiktiven Beispiel der Mailserver mx01.nausch.org <em class="u"><strong>nicht berechtigt</strong></em> ist Nachrichten der Domain example.org zu verschicken, schlägt die Zustellung an das Zielsystemfehl und der Mailserver wird die zuvor angenommene <span class="search_hit">eMail</span> zurück an den Absender bouncen! </p> <p> Damit die Nachricht nun beim eigentlichen Zielsystem ankommt, müssen wir dafür Sorge tragen, dass das relayende System, also unser Mailserver, beim <strong>MAIL FROM</strong> im <strong>Envelope</strong> unsere Domain als Absender setzt. Dann kann das eigentliche Zielsystem, unsere <span class="search_hit">eMail</span> annehmen, da wir für unseren Mailserver einen entsprechend gültigen SPF-Record vorweisen können. Für den Fall, dass die Nachricht aber vom Zielsystem nicht zugestellt werden kann, oder eben von diesem später gebounced werden könnte, müssen wir uns nun die Absender-Adresse des ursprünglichen Mailservers merken. Nur so haben wir die Möglichkeit, den ursprünglichen Absender über den Zustellfehlversuch zu informieren. </p> <p> Und an dieser Stelle setzt nun Sender Rewriting Scheme (kurz <strong>SRS</strong>) an! Wird eine <span class="search_hit">eMail</span> weitergeleitet, so setzt der SRS-Deamon die Envelop-Adresse <strong>MAIL FROM</strong> nach folgendem Schema: <em><strong>SRS0+xxxx=yy=example.com=alice@yourdomain.org</strong></em>, den wird dann auch als <strong>Return-Path</strong> im Mailheader unserer <span class="search_hit">eMail</span> beim entsprechenden Zielsystem vorfinden. </p> <pre class="code">Return-Path: <SRS0+bCEv=YT=web.de=honeypot_for_spam@nausch.org></pre> <p> Sollte die <span class="search_hit">eMail</span> zu uns zurück-bouncen, so kann unser Mailserver mit den Angaben dann, den ursprünglichen Absender, in dem Beispiel also <em>honeypot_for_spam@web.de</em> rekonstruieren und den Bounce an den richtigen Absender zurück schicken. Damit nun der <em><strong>reverse-SRS</strong></em> nicht als open-relay-Adresse missbraucht werden kann, werden bei der Envelope-Adresse die beiden Feder <strong>xxx</strong> und <strong>yy</strong> eingesetzt, die zum einen eine kryptografische Signatur und einen Zeitstempel repräsentieren. Sollten bei einem Bounce diese Angaben nicht stimmen, wird die Annahme der Nachricht verweigert, also verworfen. </p> </div> <h2 class="sectionedit2 page-header pb-3 mb-4 mt-5" id="postfix_voraussetzungen">Postfix Voraussetzungen</h2> <div class="level2"> <p> Für <strong>SRS</strong> setzen wir den <strong><a href="https://github.com/roehling/postsrsd" class="urlextern" target="_tab" title="https://github.com/roehling/postsrsd" rel="ugc nofollow noopener">Postfix SRS Deamon</a></strong>, kurz <strong>PostSRSd</strong> von <a href="https://github.com/roehling" class="urlextern" target="_tab" title="https://github.com/roehling" rel="ugc nofollow noopener">Timo Röhling</a> ein. <strong>PostSRSd</strong> nutzt dabei zwei <em>TCP lookup tables</em>. Details zu diesen TCP lookup Tabellen, finden sich in der zugehörigen manpage. </p> <pre class="code"> # man 5 tcp_table</pre> <pre class="code bash">TCP_TABLE<span class="br0">(</span><span class="nu0">5</span><span class="br0">)</span> TCP_TABLE<span class="br0">(</span><span class="nu0">5</span><span class="br0">)</span>   NAME tcp_table - Postfix client<span class="sy0">/</span>server table lookup protocol   SYNOPSIS postmap <span class="re5">-q</span> <span class="st0">"string"</span> tcp:host:port   postmap <span class="re5">-q</span> - tcp:host:port <span class="sy0"><</span>inputfile   DESCRIPTION The Postfix mail system uses optional tables <span class="kw1">for</span> address rewriting or mail routing. These tables are usually <span class="kw1">in</span> dbm or db format. Alternatively, table lookups can be directed to a TCP server.   To <span class="kw2">find</span> out what types of lookup tables your Postfix system supports use the <span class="st0">"postconf -m"</span> command.   To <span class="kw3">test</span> lookup tables, use the <span class="st0">"postmap -q"</span> <span class="kw3">command</span> <span class="kw2">as</span> described <span class="kw1">in</span> the SYNOPSIS above.   PROTOCOL DESCRIPTION The TCP map class implements a very simple protocol: the client sends a request, and the server sends one reply. Requests and replies are sent <span class="kw2">as</span> one line of ASCII text, terminated by the ASCII newline character. Request and reply parameters <span class="br0">(</span>see below<span class="br0">)</span> are separated by whitespace.   Send and receive operations must <span class="kw3">complete</span> <span class="kw1">in</span> <span class="nu0">100</span> seconds.   REQUEST FORMAT Each request specifies a <span class="kw3">command</span>, a lookup key, and possibly a lookup result.   get SPACE key NEWLINE Look up data under the specified key. put SPACE key SPACE value NEWLINE This request is currently not implemented.   REPLY FORMAT Each reply specifies a status code and text. Replies must be no longer than <span class="nu0">4096</span> characters including the newline terminator.   <span class="nu0">500</span> SPACE text NEWLINE In <span class="kw1">case</span> of a lookup request, the requested data does not exist. In <span class="kw1">case</span> of an update request, the request was rejected. The text describes the nature of the problem.   <span class="nu0">400</span> SPACE text NEWLINE This indicates an error condition. The text describes the nature of the problem. The client should retry the request later.   <span class="nu0">200</span> SPACE text NEWLINE The request was successful. In the <span class="kw1">case</span> of a lookup request, the text contains an encoded version of the requested data.   ENCODING In request and reply parameters, the character <span class="sy0">%</span>, each non-printing character, and each whitespace character must be replaced by <span class="sy0">%</span>XX, where XX is the corresponding ASCII hexadecimal character value. The hexadecimal codes can be specified <span class="kw1">in</span> any <span class="kw1">case</span> <span class="br0">(</span>upper, lower, mixed<span class="br0">)</span>.   The Postfix client always encodes a request. The server may omit the encoding <span class="kw2">as</span> long <span class="kw2">as</span> the reply is guaranteed to not contain the <span class="sy0">%</span> or NEWLINE character.   SECURITY Do not use TCP lookup tables <span class="kw1">for</span> security critical purposes. The client-server connection is not protected and the server is not authenticated.   BUGS Only the lookup method is currently implemented.   The client does not hang up when the connection is idle <span class="kw1">for</span> a long time.   SEE ALSO postmap<span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span>, Postfix lookup table manager regexp_table<span class="br0">(</span><span class="nu0">5</span><span class="br0">)</span>, format of regular expression tables pcre_table<span class="br0">(</span><span class="nu0">5</span><span class="br0">)</span>, format of PCRE tables cidr_table<span class="br0">(</span><span class="nu0">5</span><span class="br0">)</span>, format of CIDR tables   README FILES Use <span class="st0">"postconf readme_directory"</span> or <span class="st0">"postconf html_directory"</span> to <span class="kw2">locate</span> this information. DATABASE_README, Postfix lookup table overview   LICENSE The Secure Mailer license must be distributed with this software.   AUTHOR<span class="br0">(</span>S<span class="br0">)</span> Wietse Venema IBM T.J. Watson Research P.O. Box <span class="nu0">704</span> Yorktown Heights, NY <span class="nu0">10598</span>, USA   TCP_TABLE<span class="br0">(</span><span class="nu0">5</span><span class="br0">)</span></pre> <p> Ob der im Einsatz befindliche Postfix diese <em><strong>TCP</strong></em>-Lookup-Tabellen unterstützt, können wir wie folgt abfragen. </p> <pre class="code"> # postconf -d | grep mail_version && postconf -m</pre> <pre class="code">mail_version = 2.11.3 milter_macro_v = $mail_name $mail_version btree cidr environ fail hash internal ldap memcache mysql nis pcre proxy regexp socketmap static tcp texthash unix</pre> <p> Wie wir sehen können, bringt unser Postfix die benötigte Unterstützung für <em><strong>TCP</strong></em>-Lookup-Tabellen mit, so dass wir uns gleich der Installation des SRS-Daemon widmen können. </p> </div> <h2 class="sectionedit3 page-header pb-3 mb-4 mt-5" id="installation">Installation</h2> <div class="level2"> </div> <h3 class="sectionedit4 page-header pb-3 mb-4 mt-5" id="repositorynauschorg">repository.nausch.org</h3> <div class="level3"> <p> Die einfachste und schnellste Variante bei der Installation ist die aus dem Repository <strong><a href="/doku.php/centos:nausch.org" class="wikilink2" title="centos:nausch.org" rel="nofollow" data-wiki-id="centos:nausch.org">nausch.org</a></strong>. Hier reicht ein einfacher Aufruf von <strong>yum</strong> und alles wird automatisch installiert. </p> <pre class="code"> yum install postsrsd -y</pre> </div> <h3 class="sectionedit5 page-header pb-3 mb-4 mt-5" id="localinstall">localinstall</h3> <div class="level3"> <p> Will man das <strong><a href="http://repo.nausch.org/" class="urlextern" target="_tab" title="http://repo.nausch.org/" rel="ugc nofollow noopener">Repository nausch.org</a></strong> <em class="u">nicht</em> einbinden kann man natürlich auch das betreffende Paket lokal installieren. </p> <pre class="code"> # yum localinstall http://repo7.nausch.org/7/x86_64/postsrsd-1.2-1.el7.centos.x86_64.rpm</pre> <p> Ein Update des Paketes geht entsprechend der Installation. </p> <pre class="code"> # yum localupdate http://repo7.nausch.org/7/x86_64/postsrsd-1.2-1.el7.centos.x86_64.rpm</pre> </div> <h2 class="sectionedit6 page-header pb-3 mb-4 mt-5" id="paketinhalt">Paketinhalt</h2> <div class="level2"> <p> Will man wissen, was das Paket alles mitbrachte, kann man dies mit dem Aufruf von <strong>rpm-qil</strong> <em><Paketname</em> erkunden. </p> <pre class="code"> # rpm -qil postsrsd</pre> <pre class="code">Name : postsrsd Version : 1.2 Release : 1.el7.centos Architecture: x86_64 Install Date: Wed 03 Dec 2014 01:20:43 PM CET Group : System Environment/Daemons Size : 46260 License : GPL Signature : RSA/SHA1, Wed 03 Dec 2014 01:04:43 PM CET, Key ID 60ecfb9e8195aea0 Source RPM : postsrsd-1.2-1.el7.centos.src.rpm Build Date : Wed 03 Dec 2014 01:04:33 PM CET Build Host : vml000200.dmz.nausch.org Relocations : (not relocatable) Packager : Django <django@nausch.org> URL : https://github.com/roehling/postsrsd/archive/1.2.tar.gz Summary : PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix. Description : PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix. SRS is needed if your mail server acts as forwarder. /etc/sysconfig/postsrsd /usr/lib/systemd/system/postsrsd.service /usr/sbin/postsrsd /usr/share/doc/postsrsd-1.2 /usr/share/doc/postsrsd-1.2/README.md /usr/share/doc/postsrsd-1.2/main.cf.ex /var/lib/postsrsd</pre> <p> Neben diesen Dateien wurde bei der Installation des RPMs auch ein individueller Schlüssel für <strong>postsrsd</strong> generiert. Wir finden diesen im Verzeichnis <em><strong>/etc/</strong></em>. </p> <pre class="code"> # ll /etc/postsrsd.secret</pre> <pre class="code">-rw-------. 1 root root 25 Dec 3 13:20 /etc/postsrsd.secret</pre> <p> Hinweise zur Installation und Konfiguration finden sich in der mitgelieferten Datei <em><strong>/usr/share/doc/postsrsd-1.2/README.md</strong></em>. </p> <pre class="code"> # less /usr/share/doc/postsrsd-1.2/README.md</pre> <pre class="code">PostSRSd ======== About ----- PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix. SRS is needed if your mail server acts as forwarder. Sender Rewriting Scheme Crash Course ------------------------------------ Imagine your server receives a mail from alice@example.com that is to be forwarded. If example.com uses the Sender Policy Framework to indicate that all legit mails originate from their server, your forwarded mail might be bounced, because you have no permission to send on behalf of example.com. The solution is that you map the address to your own domain, e.g. SRS0+xxxx=yy=example.com=alice@yourdomain.org (forward SRS). If the mail is bounced later and a notification arrives, you can extract the original address from the rewritten one (reverse SRS) and return the notification to the sender. You might notice that the reverse SRS can be abused to turn your server into an open relay. For this reason, xxxx and yy are a cryptographic signature and a time stamp. If the signature does not match, the address is forged and the mail can be discarded. Building -------- PostSRSd requires a POSIX compatible system and CMake to build. Optionally, help2man is used to create a manual page. For convenience, a Makefile fragment is provided which calls CMake with the recommended command line options. Just run `make`. Alternatively, you can control many aspects of the build manually: mkdir build cd build cmake .. <options> make make install The CMake script defines a number of options in addition to the standard CMake flags. Use `-D<option>=<value>` to override the defaults. * `GENERATE_SRS_SECRET` (default: `ON`). Generate a random secret on install. * `USE_APPARMOR` (default: `OFF`): Install an AppArmor profile for the daemon. * `INIT_FLAVOR` (default: auto-detect). Select the appriopriate startup script type. Must be one of (`upstart`,`sysv-lsb`,`sysv-redhat`) or `none`. * `CHROOT_DIR` (default: `${CMAKE_INSTALL_PREFIX}/lib/postsrsd`). Chroot jail for the daemon. * `SYSCONF_DIR` (default: `/etc`). Location of system configuration files. * `CONFIG_DIR` (default: `${SYSCONF_DIR}/default`). Install destination for the postsrsd settings. * `DOC_DIR` (default: `${CMAKE_INSTALL_PREFIX}/share/doc/postsrsd`). Install destination for documentation files. Installing ---------- Run `make install` as root to install the daemon and the configuration files. Configuration ------------- The configuration is located in `/etc/default/postsrsd` by default. You must store at least one secret key in `/etc/postsrsd.secret`. The installer tries to generate one from `/dev/urandom`. Be careful that no one can guess your secret, because anyone who knows it can use your mail server as open relay! Each line of `/etc/postsrsd.secret` is used as secret. The first secret is used for signing and verification, the others for verification only. PostSRSd exposes its functionality via two TCP lookup tables. The recommended Postfix configuration is to add the following fragment to your main.cf: sender_canonical_maps = tcp:127.0.0.1:10001 sender_canonical_classes = envelope_sender recipient_canonical_maps = tcp:127.0.0.1:10002 recipient_canonical_classes= envelope_recipient This will transparently rewrite incoming and outgoing envelope addresses. Run `service postsrsd start` and `postfix reload` as root, or reboot. </pre> </div> <h2 class="sectionedit7 page-header pb-3 mb-4 mt-5" id="konfiguration">Konfiguration</h2> <div class="level2"> </div> <h3 class="sectionedit8 page-header pb-3 mb-4 mt-5" id="srs-deamon">SRS-Deamon</h3> <div class="level3"> <p> Die Konfiguration des <strong>postsrsd</strong>-Daemons gestaltet sich vergleichsweise einfach und erfolgt lediglich mit Hilfe Der Datei <em><strong>/etc/sysconfig/postsrsd</strong></em>. Mit unserem Editor der Wahl, z.B. vim bearbeiten wir diese Konfigurationsdatei. </p> <pre class="code"> # vim /etc/sysconfig/postsrsd</pre> <dl class="file"> <dt><a href="/doku.php/centos:mail_c7:spam_11?do=export_code&codeblock=5" title="Schnipsel herunterladen" class="mediafile mf_">/etc/sysconfig/postsrsd</a></dt> <dd><pre class="code file bash"><span class="co0"># Default settings for postsrsd</span>   <span class="co0"># Local domain name.</span> <span class="co0"># Addresses are rewritten to originate from this domain. The default value</span> <span class="co0"># is taken from `postconf -h mydomain` and probably okay.</span> <span class="co0">#</span> <span class="co0"># Django : 2014-12-03</span> <span class="co0"># default. #SRS_DOMAIN=example.com</span> <span class="re2">SRS_DOMAIN</span>=nausch.org   <span class="co0"># Exclude additional domains.</span> <span class="co0"># You may list domains which shall not be subjected to address rewriting.</span> <span class="co0"># If a domain name starts with a dot, it matches all subdomains, but not</span> <span class="co0"># the domain itself. Separate multiple domains by space or comma.</span> <span class="co0">#</span> <span class="co0"># Django : 2014-12-03</span> <span class="co0"># default: #SRS_EXCLUDE_DOMAINS=.example.com,example.org</span> <span class="re2">SRS_EXCLUDE_DOMAINS</span>=pgp.guru   <span class="co0"># Secret key to sign rewritten addresses.</span> <span class="co0"># When postsrsd is installed for the first time, a random secret is generated</span> <span class="co0"># and stored in /etc/postsrsd.secret. For most installations, that's just fine.</span> <span class="co0">#</span> <span class="re2">SRS_SECRET</span>=<span class="sy0">/</span>etc<span class="sy0">/</span>postsrsd.secret   <span class="co0"># Local ports for TCP list.</span> <span class="co0"># These ports are used to bind the TCP list for postfix. If you change</span> <span class="co0"># these, you have to modify the postfix settings accordingly. The ports</span> <span class="co0"># are bound to the loopback interface, and should never be exposed on</span> <span class="co0"># the internet.</span> <span class="co0">#</span> <span class="re2">SRS_FORWARD_PORT</span>=<span class="nu0">10001</span> <span class="re2">SRS_REVERSE_PORT</span>=<span class="nu0">10002</span>   <span class="co0"># Drop root privileges and run as another user after initialization.</span> <span class="co0"># This is highly recommended as postsrsd handles untrusted input.</span> <span class="co0">#</span> <span class="re2">RUN_AS</span>=nobody   <span class="co0"># Jail daemon in chroot environment</span> <span class="re2">CHROOT</span>=<span class="sy0">/</span>var<span class="sy0">/</span>lib<span class="sy0">/</span>postsrsd</pre> </dd></dl> </div> <h3 class="sectionedit9 page-header pb-3 mb-4 mt-5" id="postfix">Postfix</h3> <div class="level3"> <p> In der Postfix-Konfigurationsdatei <strong></strong>/etc/postfix/main.cf<strong></strong> aktivieren wir nun noch die Erweiterungen für die TCP Lookup Tabellen in der Sektion <strong>LOOKUP-TABELLEN</strong> bzw. tragen diese nach. </p> <pre class="code"> # vim /etc/postfix/main.cf</pre> <pre class="code bash"><span class="co0">################################################################################</span> <span class="co0">## LOOKUP-TABELLEN</span> <span class="co0">#</span> ...   ... <span class="co0"># Django : 2014-10-16 - Lookup-Tabelle zum Umschreibungen von Absender-<span class="search_hit">eMail</span>-</span> <span class="co0"># -Adressen im SMTP-Envelop und/oder im Header der <span class="search_hit">eMail</span>.</span> <span class="co0"># default: sender_canonical_maps =</span> sender_canonical_maps = btree:<span class="sy0">/</span>etc<span class="sy0">/</span>postfix<span class="sy0">/</span>sender_canonical_maps <span class="co0"># SRS - Sender Rewriting Scheme mit postsrsd</span> tcp:127.0.0.1:<span class="nu0">10001</span> <span class="co0"># Definition welche Adressen umgeschrieben werden sollen</span> <span class="co0"># default: sender_canonical_classes = envelope_sender, header_sender</span> sender_canonical_classes = envelope_sender   <span class="co0"># Django : 2014-10-16 - Lookup-Tabelle zum Umschreibungen von Empfänger-<span class="search_hit">eMail</span>-</span> <span class="co0"># -Adressen im SMTP-Envelop und/oder im Header der <span class="search_hit">eMail</span>.</span> <span class="co0"># default: recipient_canonical_maps =</span> recipient_canonical_maps = btree:<span class="sy0">/</span>etc<span class="sy0">/</span>postfix<span class="sy0">/</span>recipient_canonical_maps <span class="co0"># SRS - Sender Rewriting Scheme mit postsrsd</span> tcp:127.0.0.1:<span class="nu0">10002</span> <span class="co0"># Definition welche Adressen umgeschrieben werden sollen</span> <span class="co0"># default: recipient_canonical_classes = envelope_recipient, header_recipient</span> recipient_canonical_classes = envelope_recipient</pre> </div> <h2 class="sectionedit10 page-header pb-3 mb-4 mt-5" id="programmstart_des_srs-daemon">Programmstart des SRS-Daemon</h2> <div class="level2"> </div> <h3 class="sectionedit11 page-header pb-3 mb-4 mt-5" id="erster_manueller_start">erster manueller Start</h3> <div class="level3"> <p> Das Starten des Daemon erfolgt über folgenden Aufruf. </p> <pre class="code"> # systemctl start postsrsd</pre> <p> Den erfolgreichen Start bzw. den Status des <strong>postsrsd</strong>-Daemon können wir bei Bedarf mit folgendem Aufruf abfragen. </p> <pre class="code"> # systemctl status postsrsd</pre> <p> <pre class="code"> <font style="color: rgb(0, 255, 0)"><b>● </b></font>postsrsd.service - PostSRSd Daemon Loaded: loaded (/usr/lib/systemd/system/postsrsd.service; enabled) Active: <font style="color: rgb(0, 255, 0)"><b>active (running)</b></font>since Wed 2014-12-03 14:39:49 CET; 2s ago Main PID: 29588 (postsrsd) CGroup: /system.slice/postsrsd.service └─29588 /usr/sbin/postsrsd -f10001 -r10002 -dnausch.org -s/etc/postsrsd.secret -unobody -c/var/lib/postsrsd -Xpgp.guru Dec 03 14:39:49 vml000087.dmz.nausch.org systemd[1]: Starting PostSRSd Daemon... Dec 03 14:39:49 vml000087.dmz.nausch.org systemd[1]: Started PostSRSd Daemon.</font> </pre> </p> <p> In der Prozessliste finden wir mindestens einen neuen Prozess, der gestartet wurde. </p> <pre class="code"> # ps aux | grep postsrsd</pre> <pre class="code"> nobody 29588 0.0 0.0 6420 740 ? Ss 14:39 0:00 /usr/sbin/postsrsd -f10001 -r10002 -dnausch.org -s/etc/postsrsd.secret -unobody -c/var/lib/postsrsd -Xpgp.guru</pre> <p> Mittels <strong>netstat</strong> können wir überprüfen, ob die beiden Ports 10001 und 10002 geöffnet wurden. </p> <pre class="code"> # netstat -tulpen | grep 1000</pre> <pre class="code"> tcp 0 0 127.0.0.1:10001 0.0.0.0:* LISTEN 0 290001 29588/postsrsd tcp 0 0 127.0.0.1:10002 0.0.0.0:* LISTEN 0 290003 29588/postsrsd</pre> <p> Läuft unser Daemon kann mit Hilfe von <strong>lsof</strong> sehen wir nicht nur den geöffneten Port, sondern auch die Verbindungen die dort anliegen. </p> <pre class="code"> # lsof -i :10001</pre> <pre class="code">COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME postsrsd 6170 nobody 5u IPv4 574244 0t0 TCP localhost:scp-config (LISTEN) postsrsd 7151 nobody 5u IPv4 574244 0t0 TCP localhost:scp-config (LISTEN) cleanup 7299 postfix 22u IPv4 583245 0t0 TCP localhost:43341->localhost:scp-config (ESTABLISHED) postsrsd 7300 nobody 0u IPv4 583246 0t0 TCP localhost:scp-config->localhost:43341 (ESTABLISHED) postsrsd 7300 nobody 5u IPv4 574244 0t0 TCP localhost:scp-config (LISTEN) postsrsd 7301 nobody 5u IPv4 574244 0t0 TCP localhost:scp-config (LISTEN)</pre> <pre class="code"> # lsof -i :10002</pre> <pre class="code">postsrsd 6170 nobody 6u IPv4 574246 0t0 TCP localhost:documentum (LISTEN) smtpd 7146 postfix 40u IPv4 582010 0t0 TCP localhost:57592->localhost:documentum (ESTABLISHED) postsrsd 7151 nobody 0u IPv4 582011 0t0 TCP localhost:documentum->localhost:57592 (ESTABLISHED) postsrsd 7151 nobody 6u IPv4 574246 0t0 TCP localhost:documentum (LISTEN) cleanup 7299 postfix 23u IPv4 583248 0t0 TCP localhost:57652->localhost:documentum (ESTABLISHED) postsrsd 7300 nobody 6u IPv4 574246 0t0 TCP localhost:documentum (LISTEN) postsrsd 7301 nobody 0u IPv4 583249 0t0 TCP localhost:documentum->localhost:57652 (ESTABLISHED) postsrsd 7301 nobody 6u IPv4 574246 0t0 TCP localhost:documentum (LISTEN)</pre> </div> <h3 class="sectionedit12 page-header pb-3 mb-4 mt-5" id="automatisches_starten_des_dienste_beim_systemstart">automatisches Starten des Dienste beim Systemstart</h3> <div class="level3"> <p> Damit der Daemon automatisch beim Hochfahren des Servers gestartet wird, nutzen wir folgenden Aufruf. </p> <pre class="code"> # systemctl enable postsrsd.service</pre> <pre class="code"> ln -s '/usr/lib/systemd/system/postsrsd.service' '/etc/systemd/system/multi-user.target.wants/postsrsd.service'</pre> <p> Wollen wir überprüfen ob der Dienst automatisch startet, verwenden wir folgenden Aufruf. </p> <pre class="code"> # systemctl is-enabled postsrsd.service</pre> <pre class="code"> enabled</pre> <p> Die Rückmeldung <strong>enabled</strong> zeigt an, dass der Dienst automatisch startet; ein <strong>disabled</strong> zeigt entsprechend an, dass der Dienst <em class="u">nicht</em> automatisch startet. </p> </div> <h2 class="sectionedit13 page-header pb-3 mb-4 mt-5" id="umschreibungen_logging">Umschreibungen / Logging</h2> <div class="level2"> <p> Im Maillog unseres Mailservers werden die Umschreibungen entsprechend dokumentiert. </p> <pre class="code"> # less /var/log/maillog</pre> <pre class="code">Dec 3 19:01:59 vml000080 postsrsd[5806]: srs_forward: <honeypot_for_spam@web.de> rewritten as <SRS0+BaCI=YT=web.de=honeypot_for_spam@nausch.org></pre> <p> Im Header zugestellten <span class="search_hit">eMail</span> beim Empfänger wird dies auch im <strong>Return-Path</strong>hinterlegt. </p> <pre class="code">Return-Path: <SRS0+BaCI=YT=web.de=honeypot_for_spam@nausch.org></pre> <p> Bounced das Zielsystem die Nachricht, weil dieses z.B. die Nachricht wegen einer vollen Mailbox nicht zustellen kann, kann das relayende System nun problemlos den eigentlichen Absender informieren, da der <strong>PostSRSd</strong> die Zieladresse wieder ermitteln und umschreiben (<strong>srs_reverse</strong>) kann. </p> <pre class="code">Dec 3 23:23:23 vml000080 postsrsd[6883]: srs_reverse: <SRS0+bCev=YT=web.de=honeypot_for_spam@nausch.org> rewritten as <honeypot_for_spam@web.de> ... ... Dec 8 12:42:23 vml000080 postfix/smtp[6884]: 8413383: to=<honeypot_for_spam@web.de>, orig_to=<SRS0+bCev=YT=web.de=honeypot_for_spam@nausch.org>, relay=mx-ha03.web.de[213.165.67.104]:25, delay=0.75, delays=0.06/0/0.41/0.29, dsn=2.0.0, status=sent (250 Requested mail action okay, completed: id=0LtrOf-1X9H7q3CS5-011BDN)</pre> </div> <h1 class="sectionedit14 page-header pb-3 mb-4 mt-5" id="links">Links</h1> <div class="level1"> <ul class=" fix-media-list-overlap"> <li class="level1"><div class="li"> <strong>⇐ <a href="/doku.php/centos:mail_c7:spam_10" class="wikilink1" title="centos:mail_c7:spam_10" data-wiki-id="centos:mail_c7:spam_10">Zurück zum Kapitel "SPF - Sender Policy Framework unter CentOS 7.x"</a></strong></div> </li> <li class="level1"><div class="li"> <strong>⇒ <a href="/doku.php/centos:mail_c7:spam_12" class="wikilink1" title="centos:mail_c7:spam_12" data-wiki-id="centos:mail_c7:spam_12">Weiter zum Kapitel "DMARC - Domain-based Message Authentication, Reporting & Conformance unter CentOS 7.x"</a></strong></div> </li> <li class="level1"><div class="li"> <strong><a href="/doku.php/centos:mail_c7:start" class="wikilink1" title="centos:mail_c7:start" data-wiki-id="centos:mail_c7:start">Zurück zum Kapitel >>Mailserverinstallation unter CentOS 7<<</a></strong></div> </li> <li class="level1"><div class="li"> <strong><a href="/doku.php/wiki:start" class="wikilink1" title="wiki:start" data-wiki-id="wiki:start">Zurück zu >>Projekte und Themenkapitel<<</a></strong></div> </li> <li class="level1"><div class="li"> <strong><a href="http://dokuwiki.nausch.org/doku.php/" class="urlextern" target="_tab" title="http://dokuwiki.nausch.org/doku.php/" rel="ugc nofollow noopener">Zurück zur Startseite</a></strong></div> </li> </ul> </div> <hr/><div class="footnotes"> <div class="fn"><sup><a href="#fnt__1" id="fn__1" class="fn_bot">1)</a></sup> <div class="content"><strong>S</strong>ender <strong>R</strong>ewriting <strong>S</strong>cheme</div></div> </div> <div class="cookielaw-banner cookielaw-bottom">Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.<button>OK</button><a href="https://de.wikipedia.org/wiki/Cookie" target="_blank">Weitere Information</a></div></div><!-- /content --></div> </div> </div> <div class="small text-right"> <span class="docInfo"> <ul class="list-inline"><li><span class="iconify text-muted" data-icon="mdi:file-document-outline"></span> <span title="centos/mail_c7/spam_11.txt">centos/mail_c7/spam_11.txt</span></li><li><span class="iconify text-muted" data-icon="mdi:calendar"></span> Zuletzt geändert: <span title="18.11.2024 19:11. ">18.11.2024 19:11. </span></li><li class="text-muted">von <bdi><img src="/lib/tpl/bootstrap3/images/avatar.png" alt="" width="16" height="16" class="img-rounded" /> <bdi>127.0.0.1<bdi></bdi></li></ul> </span> </div> </article> </div> </main> <footer id="dw__footer" class="dw-container py-5 dokuwiki container-fluid"> <!-- footer --> <div class="dw-container small container-fluid mx-5"> <div class="footer-dw-title"> <div class="media"> <div class="media-left"> <img src="/lib/exe/fetch.php/logo.png" alt="Linux - Wissensdatenbank" class="media-object" style="height:32px" /> </div> <div class="media-body"> <div class="row"> <div class="col-sm-2"> <h4 class="media-heading">Linux - Wissensdatenbank</h4> <p> </p> </div> <div class="col-sm-10"> </div> </div> </div> </div> </div> <div class="footer-license row"> <hr/> <div id="dw__license" class="col-sm-6"> <p> <a href="https://creativecommons.org/licenses/by-sa/4.0/deed.de" title="CC Attribution-Share Alike 4.0 International" target="_tab" itemscope itemtype="http://schema.org/CreativeWork" itemprop="license" rel="license" class="license"><img src="/lib/tpl/bootstrap3/images/license/cc.png" width="24" height="24" alt="cc" /> <img src="/lib/tpl/bootstrap3/images/license/by.png" width="24" height="24" alt="by" /> <img src="/lib/tpl/bootstrap3/images/license/sa.png" width="24" height="24" alt="sa" /> </a> </p> <p class="small"> Falls nicht anders bezeichnet, ist der Inhalt dieses Wikis unter der folgenden Lizenz veröffentlicht:<br/><a href="https://creativecommons.org/licenses/by-sa/4.0/deed.de" title="CC Attribution-Share Alike 4.0 International" target="_tab" itemscope itemtype="http://schema.org/CreativeWork" itemprop="license" rel="license" class="license">CC Attribution-Share Alike 4.0 International</a> </p> </div> <div class="col-sm-6"> <!-- badges --> <div class="text-right"> <ul id="dw__badges" class="list-inline hidden-print"> <li> <a href="https://www.dokuwiki.org/template:bootstrap3" title="Bootstrap template for DokuWiki" target="_tab"> <img src="/lib/tpl/bootstrap3/images/bootstrap.png" width="20" alt="Bootstrap template for DokuWiki" /> </a> </li> <li> <a href="https://www.php.net" title="Powered by PHP" target="_tab"> <img src="/lib/tpl/bootstrap3/images/php.png" width="20" alt="Powered by PHP" /> </a> </li> <li> <a href="http://validator.w3.org/check/referer" title="Valid HTML5" target="_tab"> <img src="/lib/tpl/bootstrap3/images/html5.png" width="20" alt="Valid HTML5" /> </a> </li> <li> <a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS" target="_tab"> <img src="/lib/tpl/bootstrap3/images/css3.png" width="20" alt="Valid CSS" /> </a> </li> <li> <a href="https://www.dokuwiki.org/" title="Driven by DokuWiki" target="_tab"> <img src="/lib/tpl/bootstrap3/images/logo.png" width="20" alt="Driven by DokuWiki" /> </a> </li> </ul> </div> <!-- /badges --> </div> </div> </div> <!-- /footer --> </footer> <a href="#dokuwiki__top" class="back-to-top hidden-print btn btn-default" title="zum Inhalt springen" accesskey="t"> <span class="iconify" data-icon="mdi:chevron-up"></span> </a> <div id="screen__mode"> <span class="visible-xs-block"></span> <span class="visible-sm-block"></span> <span class="visible-md-block"></span> <span class="visible-lg-block"></span> </div> <img src="/lib/exe/taskrunner.php?id=centos%3Amail_c7%3Aspam_11&1743706598" width="2" height="1" alt="" /> </div> </body> </html>