Sophos Firewall: Using Azure MFA for SSL VPN and User portal

Inspiration for this post, was taken from: https://rieskaniemi.com/azure-mfa-with-sophos-xg-firewall/

Some of the things that I’ve seen at work, is that Sophos Firewall VPN users are using one token for Sophos SSLVPN and another for ex. Office 365 services. Both tokens can be in Microsoft Authenticator, but only the one that Office 365 is using, can do the “pop-up”, letting the user easy sign-in, like this:

Nonetheless it’s easier for the IT dept. (and the user!) to maintain only one token solution Slight smile

Here is the auth flow for Azure MFA with NPS Extension:

Nice isn’t it Wink

So how to fix?

We setup Sophos XG for RADIUS validation for SSLVPN and UserPortal access, and if you use the built-in OTP solution, disable that Slight smile

To get started:

  • If you do not have MFA enabled for your Office 365/Azure AD account’s you can enable it through following link: https://aka.ms/mfasetup
  • And of course you need to have set Azure AD Connect to get your on-premise talking with Azure, I will not go into the details with this here, as I assume this is already setup and working Slight smile

Let’s go:

  1. Install the Network Policy Server (NPS) role on your member server or domain controller. Refering to the Network Policy Server Best Practices, then you will find this “To optimize NPS authentication and authorization response times and minimize network traffic, install NPS on a domain controller.” So we will go ahead and place this on the domain controller, but remember it’s also possible to do it on a domain joined member server!
  2. Press “Next” and the installation begins:

  3. After installation has ended, go and join the NPS to the Active Directory, right-click NPS (Local):

  4. Download and install the NPS Extension for Azure MFA here:
    https://www.microsoft.com/en-us/download/details.aspx?id=54688
    Note: As i did try this on a server with already setup NPS, it failed with the other mechanisms, because of this:
    https://docs.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-nps-extension#control-radius-clients-that-require-mfa

    Control RADIUS clients that require MFA

    Once you enable MFA for a RADIUS client using the NPS extension, all authentications for this client are required to perform MFA. If you want to enable MFA for some RADIUS clients but not others, you can configure two NPS servers and install the extension on only one of them.

    Configure RADIUS clients that you want to require MFA to send requests to the NPS server configured with the extension, and other RADIUS clients to the NPS server not configured with the extension.”

    So the “workround” is to run the MFA for the Sophos on a seprate NPS instance Slight smile

  5. After it’s installed, go and follow the configure is like it’s stated here (Find TenantID and run Powershell script):
    https://docs.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-nps-extension#azure-active-directory
  6. Go and configure your radius Client, here it’s the XG:

    Remember the secret, we need it later on Slight smile

  7. Create a “Connection request policy”:


    Type here the IP of the XG

    Just set like above, and the rest of the settings, just leave them to their defaults Slight smile

  8. Now create a “Network Policy”

    Add a domain group, that shall have this access, to simplify, here I have choose domain\Domain Users
    Now the EAP types, XG does only support PAP, as far as I have tested:


    You will get a warning telling you that you have choosen unencrypted auth (locally – not on the Internet!), just press OK.
    Just left the rest to their default’s and save the policy.

  9. Now to create a firewall rule:

  10. Now to setup the XG for this:

    Press ADD:

    Remember to choose RADIUS:

    Fill in as your environment matches:

    Type in the secret you wrote down earlier and create a host object for your NPS, also remember to change the timeout from 3 to 15 secs!

    You can now test is the authentication through NPS and Azure MFA is working, change Group name attribute to “SF_AUTH”

    Press the TEST CONNECTION butoon:

    type in a users username (e.mail adress) and password, and your phone should pop-up with Microsoft Authenticator Slight smile

    You should see this soon after you accept the token:

  11. Now head over to the Authentication –> Services section:

    Add the new RADIUS server to:
    – User portal authentication methods
    – SSL VPN authentication methods

    Also make sure that the group your AD / RADIUS users are in, is added to the SSLVPN profile:

  12. Now login to the User Portal and download a VPN client (You cannot use the old ones, if you already had thoose installed)
  13. Now connect through VPN, type in your full email in username and your password, then wait for MS Authenticator to pop-up, accept the token and you are logged into VPN Slight smile

UPDATE: 20/11-2023

Due to recent changes in the module and Entra, you will need to add this in the registry of the NPS server:

  1. On the NPS Server, open the Registry Editor.
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AzureMfa.
  3. Create the following String/Value pair:
    • Name: OVERRIDE_NUMBER_MATCHING_WITH_OTP
    • Value = FALSE
  4. Restart the NPS Service.

WHY: How number matching works in multifactor authentication push notifications for Microsoft Authenticator | Microsoft Learn

 

References

https://docs.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-nps-extension-vpn

https://docs.microsoft.com/en-us/windows-server/networking/technologies/nps/nps-best-practices

https://community.sophos.com/kb/en-us/127328

Sourcehttps://martinsblog.dk/sophos-xg-use-azure-mfa-for-sslvpn-and-userportal/




Re-posted after the pictures where removed due to edtor issues.
[edited by: twister5800 at 12:28 PM (GMT -8) on 23 Nov 2023]
  • thanks for your quick reply.

    I set up the same settings on the how to, but it failed again
    On your event viewer, can you tell me if the "SubjectUserSid is S-1-0-0 or a more classical one please ?

  • ok I just tested it and I'm able to configure Radius running without mfa but it's not working on my Sophos 18.0.3 & W2019 Disappointed

  • have you look though the guid eand your setup, step by step?

    Try to setup NPS on a seperate server, so it des not conflict with your setup :-)

    I run 18.0.4. MR-4 and Win2019 with no issues :-)

    -----

    Best regards
    Martin

    Sophos XGS 2100 @ Home | Sophos v20 Architect

  • Hello I configured this NPS extension on a separate Radius server and it worked well with the push from Microsoft APP. With the SMS I receive the SMS after entering my credentials but then I don't kwow what to or where I should enter the SMS. Did you make it work with SMS? thanks for your feedback.

    Best Regards,
    Maxime

  • Hello I configured this NPS extension on a separate Radius server and it worked well with the push from Microsoft APP. With the SMS I receive the SMS after entering my credentials but then I don't kwow what to or where I should enter the SMS. Did you make it work with SMS? thanks for your feedback.

    Best Regards,
    Maxime

  • Hey - As far as i know, the Sophos Connect app does not Support SMS tokens, it's just true or false from the fw authentication :-)

    -----

    Best regards
    Martin

    Sophos XGS 2100 @ Home | Sophos v20 Architect

  • hello !

    I just reconfigure my radius and guess what .... it's working like a charm now !

    thanks for your help

  • Hi guys,

    just to clarify something. With this setup all users will fall into Open Group, which is wrong for fully configured XG.

    You need to set RADIUS Attribute "Filter-Id" on your NPAS server Network policy as XG group name which the user should go to.

    Then in service server settings on XG "Group name attribute" needs to be "Filter-Id" not "SF_AUTH" or anything else.

    This way you pass value of Filter-Id from RADIUS to Sophos XG and user is added to desired group.

    Hope this helps ...

  • Good day to all,

    thank you twister5800 for the tutorial. I have already implemented and tested this in my LAB environment a long time ago. Currently we are still using this solution with the Sophos SG series and have to adjust the config file on the clients to set the "route-delay" to 2, otherwise the authentication will fail. Since we are now planning to go to the Sophos XGS, I am now testing this variant with the new Sophos Connect client, since in the meantime the old VPN client is phased out anyway. The new client also has advantages with the distribution etc..

    My current problem is that the Sophos Connect client does not connect with Radius and MFA. The authentication arrives, I can confirm it via MS Auth. and the client then runs on Auth. Failure. I have already tested through the timings on the Sophos XGS from 5-30 seconds. Always the same problem. It looks to me that the VPN client gives up way too fast and tries to authenticate a second time and then runs to failure as the Sophos is then already through with the process. With the old client you can also see this very well in the status. There, however, as mentioned, the value helps. With the Sophos Connect the entry is ignored or brings the nothing.

    Has anyone had a similar problem with the implementation and has it perhaps solved. Or does anyone have an idea what else can be done.

    Thanks in advance and a nice rest of the week

    Many greetings
    Alex

  • Hello all,
    I have just been able to solve my problem with renewed help from a post by LuCar Toni.
    community.sophos.com/.../radius-timeout-with-mfa-authentication-is-not-working
    The problem is from version 18.5.2 MR-2 there is a new item with MFA. There you must not enable OPT when using MS Azure MFA, but you must set there that it requires MFA on user portal and SSL VPN. Also you have to set the value "2fa": 1, in the .pro file. For me it works now with the Config.
    Many greetings
    Alex