Securing Office 365 With Okta
Securing Office 365 With Okta
with Okta
Index
Background 3
Terms & Definitions 4
Introduction 6
Office 365 Authentication Methods 8
Securing Federated Office 365 Using Okta 9
Known Email Clients that Support Modern Authentication 23
Conclusion 25
References 25
Disclaimer 25
A. Basic Authentication
Basic Authentication, in the Office 365 suite, is a legacy authentication mechanism that relies
solely on username and password. It has proven ineffective and is not recommended for the
modern IT environments especially when authentication flows are exposed to the internet as
is the case for Office 365.
B. Modern Authentication
To address the common security concerns and end-user experience requirements associated
with Office 365 deployments, Microsoft introduced the Active Directory Authentication Library
(ADAL) for Office 365 client applications, referred to as Modern Authentication. Modern
Authentication helps secure Office 365 resources using multi-factor authentication,
certificate-based authentication, and SAML-based logins (such as federation with Okta), for a
true single sign-on experience.
Access Protocols
Office 365 supports multiple protocols that are used by clients to access Office 365. In the context of
this document, the term “Access Protocol” indicates the protocols such as POP, IMAP, Exchange
ActiveSync, Exchange Web Services (EWS), MAPI and PowerShell. In the context of authentication,
these protocols fall into two categories:
POP
IMAP
Active Sync
EWS
MAPI
PowerShell
Note that ‘PowerShell’ is not an actual protocol used by email clients but required to interact with
Exchange. Figure 1 below shows the Office 365 access matrix based on access protocols and
authentication methods listed in Table 1:
A. Not all access protocols used by Office 365 mail clients support Modern Authentication.
Protocols like POP and IMAP only support basic authentication and hence cannot enforce MFA
in their authentication flow.
B. Regardless of the access protocol, email clients supporting Basic Authentication can sign-in
and access Office 365 with only username and password despite the fact that federation
enforces MFA.
C. Modern authentication protocols like Exchange ActiveSync, EWS and MAPI can also be used
with basic authentication. For example, Outlook clients can default to Basic Authentication
when by modifying registry on Windows machines.
D. Office 365 currently does not offer the capability to disable Basic Authentication. Therefore,
even if Modern Authentication is enabled on an Office 365 tenant, mail clients can still access it
using Basic Authentication.
E. In environments where Okta is used for federation, using legacy authentication protocols (POP
and IMAP), that rely on Basic Authentication does not trigger the New Device Access email
notification.
This complexity presents a major challenge in balancing support for email applications preferred by
end-users and enforcing MFA across the entire Office 365 environment. The “Expected
Behavior/Changes” section below addresses the trade-offs that must be made to enforce MFA for
Office 365.
B. Federation
Later sections of this paper focus on changes required to enforce MFA on Office 365 using
federated authentication with Okta as IDP. However, there are few things to note about the
cloud authentication methods listed above.
Password Hash Synchronization relies on synchronizing password hash from an on-premise Active
Directory (AD) to a cloud Azure AD instance. This allows users to authenticate to cloud-based services
such as Office 365 using the same password as the on-premises AD. In this scenario, MFA can only be
enforced via Azure MFA, third-party MFA solutions are not supported.
Pass-through Authentication allows users to use the password to access cloud services like Office
365, as the one stored in on-premise AD. Pass-through authentication removes the need to synchronize
the password hash to a cloud Azure AD by using intermediate systems called pass-through
authentication agents that act as liaison between on-premises AD and Azure AD. It is important to note
that MFA can be enforced only via Azure MFA when Pass-through Authentication is used, Third party
MFA and on-premises MFA methods are not supported.
Having addressed relevant MFA requirements for the Cloud Authentication method, we can focus on
how to secure federated authentication to Office 365 with Okta as Identity Provider in the next sections.
The order of the steps is important because the final step involves invalidating the current Office 365
tokens issued to users, which should be done after the Office 365 client access policies are set in Okta.
This will ensure existing user sessions (both non-modern and modern authentication) are terminated
and the new session are on Modern Authentication.
Note that the minimum privileges required on Office 365 and the Okta platform to implement these
changes are listed in Table 2:
Platform Privilege
B. Clients that rely on legacy authentication protocols (including, not limited to, legacy Outlook
and Skype clients and a few native clients) will be prevented from accessing Office 365. More
details on clients that are supported to follow.
C. Clients that support modern authentication protocols, will not be allowed to access Office 365
over basic authentication.
D. Office 365 Administrators will need the Modern Authentication supported PowerShell module
to connect to online Exchange.
Figure 2 shows the Office 365 access matrix once configurations are implemented:
Modern authentication can be enabled for an Office 365 tenant using PowerShell by executing the
following commands:
1. To connect to Office 365 exchange, open Exchange Online PowerShell Module and enter the
following command (Replace ‘adminuser@domain’ with the administrator credentials in
Exchange):
3. If the value of OAuth2ClientProfileEnabled is true, then modern auth is enabled for the domain. If
not, use the following command to enable it:
The Office 365 Exchange online console does not provide an option to disable the legacy authentication
protocols for all users at once. This can be done using the Exchange Online PowerShell Module.
The following commands show how to check users that have legacy authentication protocols enabled
and disable the legacy protocols for those users. The commands listed below use POP protocol as an
example. You will need to replace ‘Pop’ in the commands with ‘Imap’ and ‘ActiveSync’ to disable those
protocols as well.
1. Get a list of all users with POP, IMAP and ActiveSync enabled.
To ensure these legacy authentication protocols are disabled for new users added to exchange,
administrators can use SET-CSAMailboxPlan commandlet in PowerShell. Note that this method will
only set the configuration for the newly created mailboxes and not the existing ones.
In this step, you configure an Authentication Policy in Office 365 to block Basic Authentication. Note that
this policy blocks access to legacy protocols at the pre-authentication level, meaning logins coming
through legacy endpoints will not be evaluated at all. The Office 365 Exchange online console does not
provide an option to disable basic authentication for all users at once. This can be done using the
Exchange Online PowerShell Module. The following commands show how to create a policy that denying
basic authentication, and how to assign users to the policy.
1. For running Exchange Powershell commands in your windows machine (or server), install the
Windows Management Framework 5.1.
Set-ExecutionPolicy RemoteSigned
$UserCredential - Get-Credential
Note: If your administrator account has MFA enabled, follow the instructions in Microsoft’s
documentation.
Get-Mailbox
You should see a list of users from your Office 365 tenant:
4. To create an authentication policy denying Basic Authentication, enter the command (this blocks
all legacy protocols as mentioned in Microsoft documentation):
6. To confirm that the policy exists – or review the policy, enter the command:
8. Optionally, apply the policy in 30 minutes (instead of 24 hours) by revoking the user tokens:
list.txt contents:
john.doe@mydomain.com
jane.doe@mydomain.com
PowerShell:
Example 3: To set the new authentication policy as default for all users:
These policies are required to ensure coverage when users are not protected by the Office 365
Authentication Policies.
1. In the Okta Admin Console, go to Applications > Office 365 > Sign-on > Sign-on policy
The goal of creating a “block” policy is to deny access to clients that rely on legacy
authentication protocols which only support Basic Authentication irrespective of location
and device platform.
People: In this section, select all the users/groups that have access to this application.
Client: In this section, choose “Exchange ActiveSync client” and all user platforms.
This will effectively restrict access based on basic authentication over any access
protocol (MAPI, EWS, ActiveSync, POP and IMAP).
The goal of this policy is to enforce MFA on every sign-in to Office 365 application irrespective
of location and device platform. The policy configuration consists of the following:
People: In this section, select all the users/groups that have access to this application.
Device Trust: Choose “Any” i.e. both trusted and non-trusted devices in this section.
Actions: Select “Allowed” and enable “Prompt for factor”. The periodicity of the factor prompt
can be set based on the sensitivity of users/groups. For example, if this policy is being applied
to high profile users or executives i.e. prompt can be set to every sign-on or every session.
F. Revoke Refresh-Tokens
To reduce the number of times a user is required to sign-in to Office 365 application, Azure AD issues
two types of tokens i.e. Access and Refresh Tokens. Both tokens are issued when a user logs in for
the first time. An access Token is granted for the combination of user, client, and resource that is used
when the user first logs in. By default, the Access Token is valid for a period of 1 hour (configurable to
a minimum of 10 minutes). Refresh tokens are valid for a period of 90 days and are used to obtain new
sets of access/refresh tokens.
Once the user has a valid refresh token, they will not be prompted for login and will continue to have
access until the refresh token expires. To ensure that all the configurations listed in previous sections
in this document take effect immediately**, refresh tokens need to be revoked.
** Even after revoking a 'refresh-token', the user might still be able to access Office 365 as long as
access token is valid. Reducing lifetime of access token carries a trade-off between performance and
amount of time clients maintain access under the current configuration.
1. Open a new PowerShell window as administrator and Install Azure AD PowerShell Module:
2. To revoke Refresh Token for a single user, log in to exchange using Exchange Online
PowerShell Module:
Connect-AzureAD
Revoke-AzureADUserAllRefreshToken -ObjectId
(Get-AzureADUser).ObjectId | Revoke-AzureADUserAllRefreshToken
*nix N/A (*nix platform does not has officially supported Outlook client)
For a full list of applications (apart from Outlook clients) that support Modern Authentication, see the
Microsoft documentation referenced here. To access Exchange Online over Modern Authentication
using PowerShell, install the Microsoft Exchange Online Remote PowerShell Module.
Microsoft Outlook clients that do not support Modern authentication are listed below.
Outlook 2016
Windows 10 MailVersion: 17.9126.21785.0
Version: 16.0 and above
Outlook 2016
OSX 10.13.4 Native Mail client does not support modern authentication
Version: 16.12 and above
Outlook
iOS 10.3.3 Native Mail client does not support modern authentication Version: 2.75.0 and above
Outlook
iOS 11.3.1 Native Mail Client (Exchange Discover)
Version: 2.75.0 and above
Outlook
Android 8.1.0 Native Mail client does not support modern authentication
Version: 2.2143 and above
*nix Native Mail client does not support modern authentication N/A
References
Okta Adaptive MFA
Disclaimer
Okta makes this document available to its customers as a best-practices recommendation. This
document does not modify or otherwise change Okta’s assurances to its customers regarding the
security practices Okta employs to secure its Okta, as set forth in Okta’s Security & Privacy
Documentation, which is online at https://www.okta.com/trustandcompliance/.