Sophos XG 18 Webserver Protection and Exchange 2019

The last article on Sophos XG in conjunction with Exchange is a bit outdated, so here is an updated version. At the moment SFOS 18 is the latest version, I have tested version 18.0.4 MR-4. My small test environment is set up as follows:

Sophos XG 18 Webserver Protection and Exchange 2019

Exchange is configured to the hostnames outlook.frankyswebweblab.de for the web services and autodisocver.frankysweblab.de for Autodiscover. The same host names are configured internally and externally. Everything else follows in the article.

Configuration Sophos XG Webserver Protection

An SSL certificate must first be installed so that the web server protection of Sophos XG can be configured later. Unfortunately, XG version 18 still does not support automated Let's Encrypt certificates. The Let's Encrypt feature (as it has long been available on the Sophos UTM) has long been on the wish list of users, perhaps the feature will make it into one of the next versions. At the moment, a corresponding certificate still needs to be obtained. As most connections via web server protection to Exchange come from external clients, this should be a certificate from a public CA so that the certificate is recognized as trustworthy by all clients. The certificate must contain the DNS name for the Exchange web services and for Autodiscover (further information can be found in the Exchange Certificates Whitepaper). In my case, the certificate contains the name outlook.frankysweblab.de and autodiscover.frankysweblab.de.

The certificate can be added under "Certificates":

Certificates

The certificate can be uploaded in PFX or PEM format:

Certificates

After the certificate has been uploaded, it is displayed in the overview. Even if it is not displayed in this overview, the certificate contains the DNS names outlook.frankysweblab.de and autodiscover.frankysweblab.de. Both names are important so that no certificate warnings or errors occur later when setting up the Outlook clients:

Certificates

The Exchange server can now be added as a web server under "Web servers". If there are several Exchange servers in the organization, the virtual server of the load balancer must be specified here. Not all Exchange servers can simply be specified here (this is also the case with Sophos UTM). Either one Exchange server must be created here, or a load balancer must be implemented between XG and Exchange:

Sophos XG Web Servers

The Exchange Server is created here as an IP or FQDN host:

Web Servers

In my case, I have specified the Exchange Server as the IP host:

Web Servers

Finally, the value in the "Type" field must now be changed to "Encrypted (HTTPS)" and the "Time-out" to "1850":

Web Servers

Two new protection policies can now be created for Exchange 2019. The Sophos templates are not suitable for Exchange 2019/2016 as they are completely outdated. A new policy should therefore be created for Exchange 2019 (also works with Exchange 2016):

Sophos XG Protection Policy

The policy for Exchange 2019 services such as OWA and EWS, for example, can be called "Exchange Webservices" and initially has the following settings:

Sophos XG Protection Policy

Note: The "Pass Outlook Anywhere" setting is no longer required, all clients from Outlook 2010 onwards speak MAPIoverHTTP. On Exchange 2019 Server this is also the preferred protocol, on Exchange 2016/2013 servers, it may still need to be activated. become.

Here is the complete list of entry URLs:

  • /ecp
  • /ECP
  • /ews
  • /EWS
  • /Microsoft-Server-ActiveSync
  • /oab
  • /OAB
  • /owa
  • /OWA
  • /
  • /mapi
  • /MAPI

Sophos XG Protection Policy

The following 4 filter rules must be excluded:

  • 960010
  • 960015
  • 981204
  • 981176

A further policy is required for Autodiscover, which is configured as follows:

Sophos XG Protection Policy

Here are the entry URLs:

  • /autodiscover
  • /Autodiscover

Protection Policy

The following two filter rules must be excluded:

  • 960015
  • 960911

After the two rules have been created, the overview now looks like this:

Protection Policy

Two new firewall rules can now be created for Exchange:

Sophos XG Firewall Rule

The first rule is for the Exchange web services, the settings can be seen in the screenshots. It is important that the WAN port of the Sophos XG is selected as the "Hosted address":

Firewall Rule

The Exchange 2019 Server is of course selected as the "Protected Server":

Firewall Rule

The previously created protection policy is now selected in the "Advanced" area and "Pass host header" is activated ("Pass host header" is particularly important for downstream load balancers):

Firewall Rule

The second firewall rule is for Autodiscover, the rule is configured almost identically to the first rule. It is important here that the entry "outlook.frankysweblab.de" in the "Domains" field is replaced by "autodiscover.frankysweblab.de":

Firewall Rule

Note: The previously configured certificate must contain both names, two individual certificates with one host name each do not work here.

The Exchange 2019 server is again selected as the protected server:

Firewall Rule

The Protection Policy for Autodiscover can now be selected in the Exceptions area and the "Pass host header" setting can be activated:

Firewall Rule

When saving the firewall rule, a warning is displayed that the certificate would not cover the host name "autodisocver.frankysweblab.de". However, this message is nonsense. The XG only seems to evaluate the CN (Common Name) of the certificate, but not the SAN entries ("Subject Alternate Name"). However, the rule can still be saved and works:

Certificate warning

After the two rules have been created, the overview now looks as follows:

Firewall overview

Finally, the two DNS entries "outlook.frankysweblab.de" and "autodiscover.frankysweblab.de" must point to the WAN IP of the Sophos XG (in the public DNS).

36 thoughts on “Sophos XG 18 Webserver Protection und Exchange 2019”

  1. Hallo,

    kann es sein, dass hier in den Richtlinien ein dicker Fehler sich eingeschlichen hat? Sollte es nicht heißen „überwachen“ und nicht wie auf den Bildern zu sehen „ablehnen“???

    Mit freundlichen Grüßen.

    Oliver Spenn

    Reply
  2. Damit die Empfänger-Verfizierung (Empfänger verifizieren „Mit Serveranfrage“ oder Recipient Verification) korrekt funktioniert (Bounce bei nicht existenten E-Mailadressen beispielsweise), muss etwas bei dem Exchange-Server nachjustiert werden:
    falls bei
    Get-TransportAgent
    der
    „Recipient Filter Agent“ gelistet ist, dann:
    Enable-TransportAgent „Recipient Filter Agent“

    Falls nicht, dann:
    & „D:\Exchange Server\Scripts\install-AntispamAgents.ps1“
    Disable-TransportAgent „Content Filter Agent“
    Disable-TransportAgent „Sender Id Agent“
    Disable-TransportAgent „Sender Filter Agent“
    Disable-TransportAgent „Protocol Analysis Agent“
    Restart-Service MSExchangeTransport
    Get-TransportAgent

    nachzulesen mit Bildern hier:
    https://support.mxguardian.net/hc/en-us/articles/360048500492-Enable-Recipient-Filtering-for-Exchange-2013-2016-2019

    Reply
  3. Hallo,
    danke für die super Anleitung und überhaupt für diese super Seite! Zum Glück bin ich drübergestolpert – Wahnsinns Arbeit!

    Bei mir gehen die Mails zwar raus aber es kommen keine Mails rein. Und scheinbar wird intern die Domain falsch aufgelöst mydomain.com wird zu mydomain.com/owa umgeleitet (nur hinter der Firewall).

    Das ist meine erste Sophos Firewall und der Support hat mich gleich mal enttäuscht. Vielleicht kann mich ja hier jemand in die richtige Richtung schupsen?

    Danke schonmal und LG aus Wien,
    NR

    Reply
    • OWA Zugriff hat nichts mit deinem Mailfluss zu tun. Den konfigurierst du unter EMAIL – nicht unter Web Server protection.

      Das ändern der URL findet durch den Exchange server statt. da im ECP mal unter virtuelle Verzeichnisse gucken was konfiguriert ist unter Server

      Reply
  4. Hallo, gehört hier nicht ganz hin aber gibt es so etwas auch für die Einrichtung des RemoteDesktopGateways; also /rpc usw.
    Ich versuche das gerade auf einer XG hinzubekommen aber im Internet hab ich bis jetzt für eine XG noch nichts richtiges gefunden.
    mfg.
    hartmut

    Reply
  5. Hallo,

    ich habe das ganze jetzt mal mit Windows 2019 und Exchange 2019 ausprobiert.
    Mein Setup läuft in 3 VM´s (DC, Mail und Sophos XG 18.5.1 mit 2 Interfaces).

    Als Client nehme ich ein iPhone, das über einen AP15 sich über die WiFi Zone (Public WAN IP) verbindet.

    Aber, es fehlen die „Protected server Exceptions“ und Filter Rule Nummern bei den FW Regeln.

    Sophos hat das hier beschrieben
    https://support.sophos.com/support/s/article/KB-000040209?language=en_US

    Ein Webmail über OWA funktioniert soweit.
    ActiveSync läuft mit dem Sophos Artikel dann auch.

    Sophos gibt ja weitere Filternummern und einen anderen Filter Level an.
    Die fehlenden Filter Nummern lassen sich ganz gut über die Shell ermitteln.

    Einfach mit dem CMD anzeigen lassen… Die Nummern stehen dann im Log.

    tail -n 5000 -f /log/reverseproxy.log | grep security2:error

    Gruß

    Jürgen

    Reply
    • Hi, vielen Dank für den Link. Das Ganze hat mich EXTREM voran gebracht.

      Ich bin Frankysweb echt dankbar, da hier viel Content auf hohem Level ist, aber über diesen Beitrag von Franky zur XG bin ich sehr enttäuscht.

      Du hast mit deinem Post für mich den Beitrag allerdings gerettet :-)

      Danke nochmal :-)

      Reply
  6. Hi Zusammen,
    um Let´s Encrypt Zertifikate auf der Sophos zu updaten habe ich mir aus vielen Foren eine PS7 Script gebaut, welches das Zertifikat auf der Sophos updatet.

    1. Powershell7 installieren
    2. PS-Module KEMP-ADC instalieren ( Install-Module -Name Kemp.LoadBalancer.Powershell -RequiredVersion 7.2.54.0 )
    3. ein PS Script mit folgendem Inhalt erstellen

    # replace Certificate on Sophos XG
    # Username, Password, Name, CertificateFile muss dem Wert aus Zeile $PFXfileProd entsprechen, Zertifikate Password müssen angepasst werden
    # $uri = bitte die IP der Sophos eintragen

    $request = „***Username******Password***UploadCertificate***CertName***pkcs12***cert.pfx******CertPassword***“
    $uri = „https://x.x.x.x:4444/webconsole/APIController?reqxml=“
    $PFXfileProd = „C:\temp\cert.pfx“
    $Form = @{
    reqxml = $request
    $((Get-Item $PFXfileProd).Basename) = Get-Item -Path $PFXfileProd
    }
    $Result = Invoke-RestMethod -Uri $Uri -Method Post -Form $Form -SkipCertificateCheck

    Viel Spaß damit
    Gruß Daniel

    Reply
    • leider hat er die Formatierung geändert so kann es leider nicht funktionieren.
      Vielleicht kann ich das Script Franky schicken und er fügt es ein.

      Gruß Daniel

      Reply
      • Hi, vielen Dank für das Script. Ich würde mal anhand dessen behaupten, du nutzt hinter deiner Sophos noch einen Kemp?
        Ich habe versucht anhand dieser Anleitung es so aufzubauen: Sophos XGS mit Webserver Protection -> Kemp (für Pre-Auth) -> Exchange 2016
        Leider werden bei mir die Active Sync Verbindung abgewiesen. Inbound Anomaly Score Exceeded (Total Score: 10). Hast du es auch nach dieser Anleitung eingerichtet und evtl. noch Anpassungen gemacht? Ich habe schon versucht div. weitere Filterregeln auszuklammern.
        Gruß, Christian

        Reply
  7. Hallo, ich hatte auch das Problem mit „no signature found“.
    Anhand der Anleitung für Exchange 2016 von Sophos direkt konnte ich es zum Laufen bringen. (Noch nicht groß getestet, aber man kann sich einloggen.)
    https://support.sophos.com/support/s/article/KB-000038003?language=en_US

    Womit es bei mir geklappt hat:
    – Bei der Protection Policy „Exchange Webservices“ noch die IDs 960018, 960032, 981203 hinzufügen
    – Bei den Firewallregeln des Exchange Webservice müssen noch 3 Ausnahmen angelegt werden:
    1. /ecp/* /ECP/* /ews/* /EWS/* /Microsoft-Server-ActiveSync* /oab/* /OAB/* /owa/* /OWA/*
    Operation: egal, alle Checkboxen aus, außer Static URL Hardening, Never change HTML during static URL hardening or form hardening (wurde oben im Forum verlinkt)
    2. /owa/ev.owa* /OWA/ev.owa*
    Operation: egal, Alle Checkboxen aus, außer Antivirus
    3. /mapi/* /MAPI/*
    Operation: egal, Alle Checkboxen an (!)
    – Bei den Firewallregeln für Autodiscover braucht man eine Ausnahme: /autodiscover/* /Autodiscover/*
    Operation: egal, Alle Checkboxen aus, außer Static URL Hardening und Never change HTML during static URL hardening or form hardening

    In der Anleitung wird auch noch /RPC/* behandelt, aber das ist ja rpc-over-http, was wir eh nicht mehr verwenden.
    Wenn das hier nicht gut formatiert wird, schaut am besten direkt auf den Sophos-Link

    Reply
  8. Hallo,

    ich habe die Verbindung zum Exchange nur hinbekommen nachdem ich die Ausnahmen in der Firewallregel genau wie früher in der SG hinzugefügt habe. Aber den Hinweis dazu habe ich in der Anleitung nicht gefunden.
    Ist das eine Besonderheit bei mir?

    ActiveSync geht auch mit Ausnahme noch nicht. OWA und MAPI und so sind aber jetzt okay.

    *kopfkratz*
    Ralph

    Reply
    • Hallo Ich habe das gleiche Problem mit „no signature found“ trotz der oben beschrieben Ausnahmen

      Reply
      • Guten Morgen Michi,

        hast du das Problem gelöst bekommen? Ich stehe vor dem selben Problem. Wenn ja, was hast du geändert?
        Danke,
        Alireza

        Reply
  9. Mit einem Powershell-Script kann man auch unter der Sophos XG LetsEncrypt-Zertifikate über die API relativ bequem wechseln, die über Posh-ACME angefordert wurden. Wünschenswert wäre aber, wenn Sophos endlich den Zertifikatstausch nativ anbieten würde.

    Reply
  10. Autodiscover funktioniert bei mir mit Filter Strengh 3 und den genannten Ausnahmeregeln ebenfalls nicht -> Forbidden. Mit Filter Strengh 1 und 2 klappt es wieder problemlos.

    Reply
  11. Erfolgreiche Logins im OWA werden mir mit „Forbidden“ quittiert. Anhand des Reverseproxy Logs kam raus dass die Rule mit ID 949110 den Zugriff blockiert. Mit Filter Strength 1 und 2 passiert das nicht. Wahrscheinlich wird die entsprechende Regel dort einfach nicht angewendet. Die ID zu den Exchange Webservices als Ausnahme hinzugefügt und schon klappte der Login auch mit Filter Strengh 3.

    Reply
  12. Bei mir kommt ebenfalls die Meldung

    Request blocked
    The web application firewall has blocked access to /owa/auth/logon.aspx for the following reason:

    No signature found

    Wurde das überhaupt mal getestet bevor man es postet? Scheinbar nicht.

    Reply
    • Hatte mich auch gewundert und bin bei 300 geblieben. Bei großen Bestandspostfächern wurde dann aber per ActiveSync nichts geladen. Mit den 1850 war kamm dann alles.

      Reply
  13. Hallo Franky,
    ein weiteres Problem tritt bei mir nach der Einrichtung anhand dieser Anleitung auf. Bei aufrufen per Browser erscheint folgende Meldung:

    Request blocked
    The web application firewall has blocked access to /owa/auth/logon.aspx for the following reason:

    No signature found

    Auch funktioniert die Verbindung mit den iPhones nicht mehr. Hättest du eine Idee woran es liegen kann?
    Vielen Dank.

    Reply
  14. Hallo Franky,
    nach der Konfiguration haben wir das Problem, dass keine Anhänge versendet werden können außerhalb des Netzwerkes. Wenn man im lokalen Netz drin ist, es also nicht über die Sophos läuft funktioniert es tadellos. Jedoch wenn man sich von Extern mit dem Exchange verbindet, egal ob per OWA, Outlook oder Smartphone, ist der Versand von Mails mit Anhang nicht möglich. Bei Google Recherche findet man das Problem, jedoch keine richtige Lösung. Hast du hier schon Erfahrung?
    Vielen Dank & einen schönen Sonntag :)
    Grüße Chris

    Reply
    • Zusätzlich ist mir noch folgendes aufgefallen, eine Verbindung mit Outlook bei Windows 10 ist von außerhalb auch nicht möglich. Im Outlook Verbindungsstatus wird unter „Authn“ angezeigt: „Fehler*“…

      Reply
  15. Die Frage ist viel mehr, wie geht es mit der Entwicklung von Sophos UTM (FW 9.8, 9.9, 9.10) überhaupt weiter und wie entwickelt sich die XG Serie. Von vielen Seiten merkt man Stillstand oder 0 Kommunikation des Herstellers, wie ist euer Bauchgefühl?

    Reply
    • Sophos hat mir persönlich leider zu oft Fehler gemacht in der Entwicklung der XG. Viele Updates haben das System verschlimmbessert.
      Ich bin nun auf Fortigate Firewalls umgestiegen und seither 0 Probleme.

      Reply
    • Bin mit der utm sehr zufrieden, doch fehlen or einige features. Auch ist ds update Intervall der UTM zu lange, hier würde ich whr updates erwarten, nicht nur neue features.
      Der xg fehlen mor noch zu viele features.

      Schade, ist ein tolles Produkt.

      Reply
    • Die Sophos Politik sieht so aus, dass UTM (SG) Kunden mit großem Aufwand (z.B. kostenloser Migration der Lizenzen) der Umstieg schmackhaft gemacht werden soll.
      Das lässt wiederum vermuten, dass die UTM Schiene über kurz oder lang eingestellt wird; schon jetzt hat die Betreuung deutlich nachgelassen
      Wer sich, wie ich, eine XG Migration unterjubeln lassen hat, wird leider auch nicht wirklich glücklich.
      Im Unternehmensumfeld mit komplexeren Firewallanforderungen ist die Konfiguration sehr hakelig; die GUI ist wesentlich unübersichtlicher, als die der UTM.
      Außerdem hat sie sehr lange Ladezeiten.
      Wer Probleme hat, muss sich mit dem dürftigen Support rumschlagen.
      Das gesamte Produkt wirkt unausgereift; von der UTM bekannte Features fehlen z.T.
      Meine persönliche Meinung:
      Sophos hat die UTM, die unter Astaro einmal Spitzenklasse war, zugunsten der XG auf’s Abstellgleis geschoben.
      Dumm nur, dass die XG der UTM immer noch nicht das Wasser reichen kann.
      Darum kann ich Sophos leider nicht mehr empfehlen und schaue mich mittelfristig für einen Ersatz für unser Firmenumfeld um.

      Reply
    • Updates für SG sind dürftig und die verwendete Software teilw. steinalt (bspw. Strongswan für IPSEC). XG wird besser, allerdings in sehr kleinen Schritten. Letsencrypt Feature wurde vor sieben Jahren das erste mal angefragt, bisher nicht umgesetzt. Beim letzten Update hat man sich damit gerühmt jetzt DHCP Optionen zu können (Ernsthaft??). Die Bedienung ist unübersichtlich und sehr träge. Das können andere besser.

      Reply

Leave a Comment