How to Secure Remote Access to an Exchange Mailbox with UserLock (using HTTP Modules)
Unauthorized access to users’ Exchange mailbox is a key security concern for many organizations.
In a previous article (that we advise you to read first), we explained how UserLock can control remote access to Exchange mailbox through either Outlook Web Access (OWA) or ActiveSync using ISAPI Filters.
This procedure also applies to Exchange 2010 and Exchange 2016. For Exchange 2016, you will find a specificity at the end of this article.
Deploy the IIS Agent to monitor & audit mailbox access
As before, we will perform our demonstration on a small Active Directory environment: The server VES1 is the domain controller where UserLock is installed. The server VES2 has Exchange 2013 installed with the Client Access role. We will also use a workstation VEW1 to access a mailbox with Outlook 2013 and OWA.
From the ‘Agent distribution’ view we can install the IIS agent on the server VES2.
The first difference you will notice is that we need to finish the installation either by registering the ISAPI filter (as we did in our previous article) or by registering the HttpModule.
The UserLock HttpModule is a new agent to control IIS sessions. The main goal of this new agent is to improve the overall compatibility with most web applications. With Exchange 2013 we get a better result with the HttpModule so we will continue our demonstration with this.
Next, switch to the IIS management console on the server VES2. At the root of the server we open the Modules.
Click on Configure Native Modules.
Next click on Register.
Specify the path to the UserLock HttpModule located at the following path: c:\Windows\System32\UlHttpModule.dll.
Once we click OK the module is selected in the native module list. If we leave the module selected it will be active server wide for all IIS applications. We recommend unselecting it and enabling it only on selected applications.
To illustrate this, if we had left it selected for the whole server, the result after opening a single instance of Outlook 2013 on the workstation VEW1 (10.2.2.11) would be as follows. Looking at the sessions in the UserLock console you can see a lot of different sessions for just one instance of Outlook.
Now remove the UserLock agent from the modules list at the root of IIS. The module will remain registered and available for selection in child applications.
Next enable it only in the OWA and Microsoft-Server-ActiveSync applications.
We can now see the result after all application pools have been recycled. The user Bob has an interactive session open on the workstation VEW1 (10.2.2.11) with Outlook and OWA open but we no longer see the IIS sessions generated by Outlook.
Detect when a user signs out from OWA
Next, let’s make Bob sign out from OWA.
If we look at the session view in the UserLock console we can see that the session is gone and Bob has only its workstation session on VEW1 still open. UserLock can detect when a user signs out from OWA.
Detect unauthorized mailbox access & close IIS sessions
Now, if we let Bob open a session on OWA with Alice’s credentials you can see clearly in the UserLock console that the OWA session from Alice is generated from the IP address of the workstation VEW1 where Bob is logged on.
If we are the UserLock administrator, we would now be legitimately suspicious by seeing Bob accessing Alice’s mailbox. In this scenario the administrator can simply select the identified suspicious session and click logoff to close the suspicious access.
Restricting mailbox access by IP address
As a precautionary measure the administrator could create a protected account rule for Alice to deny IIS sessions from the address 10.2.2.11.
What’s the result? When Bob tries to do something in OWA he will be automatically redirected to the logon page:
And if Bob tries to logon again with Alice credentials on OWA, he will receive the following deny message.
As you can see, with UserLock an administrator can quickly react and sign out a user from a mailbox thanks to the new IIS session logoff feature.
About Exchange 2016
The same procedure will work on Exchange 2016 too. There is only one point that you should care about Exchange 2016.
If you do this procedure till the end, the IIS Agent will be configured only for “OWA” and “Microsoft-Server-ActiveSync” applications.
With Exchange 2016, the problem is that, after any update, all HTTP modules (including the IIS Agent) configured in applications only (not at the root level of IIS) will be automatically disabled.
Configure the HTTP Module IIS UserLock Agent at the root level of IIS (as documented at the beginning of the article).
Specify IIS Application Pools to monitor:
By default, when you configure the IIS agent on an IIS website, all applications from this site are monitored independently of the application pool they run on.
If needed, you can choose to monitor only Web applications running on specific application pools by creating the following registry value (REG_MULTI_SZ type) on the IIS server:
Then enter the list of all application pools you want to supervise (one per line).
On an Exchange server for example, many Web applications are created on the 'IIS Default' website. If you configure the UserLock 'IIS agent' for this site, UserLock will display a lot of IIS sessions.
In most cases, you only want to control sessions from 'Outlook Web Access' and ignore the other Web applications. You can do this by specifying only “MSExchangeOWAAppPool” as application pool to monitor.
If you are interested in Active Sync, add “MSExchangeSyncAppPool”.
Example with both “MSExchangeOWAAppPool” and “MSExchangeSyncAppPool” application pools:
About ISAPI Filters
Lastly, What about ISAPI Filters? The answer is yes, with UserLock it is also possible to control sessions to OWA and ActiveSync using ISAPI Filters in place of HTTP Modules.
Please see this article.