-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update current Alerting Email auth to prepare for Exchange Online deprecating Basic Authentication #93466
Comments
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
Adding to To-Do as a research only item. We need to understand the impact on our email connector and report back to the team. |
Investigation results:There are two options:
*single - means the most optimistic prognoses, where refresh tokens was never revoked. Details:Because our Email action type was built on top of the SMTP protocol https://nodemailer.com/smtp/, this changes will impact the functionality for MS Exchange Online connectors settings https://www.elastic.co/guide/en/kibana/7.x/email-action-type.html#exchange. What’s supported?
OAuth2 client credentials grant flow that enables access without a user account is not supported. If your application needs persistent access to all mailboxes in a Microsoft 365 organization, we recommend that you use the Microsoft Graph API’s which allow access without a user in addition to access on behalf of a user, enable granular permissions and let administrators scope such access to a specific set of mailboxes. Research about Gmail related to the OAuth 2.0 Code Flow:For Gmail OAuth 2.0 code flow docs https://developers.google.com/identity/protocols/oauth2/web-server#offline says that the refresh tokens should live till it will be revoked or we will get the limits on the number of refresh tokens that will be issued; one limit per client/user combination, and another per user across all clients. You should save refresh tokens in long-term storage and continue to use them as long as they remain valid. If your application requests too many refresh tokens, it may run into these limits, in which case older refresh tokens will stop working. |
The current issue is pending a product decision (cc @arisonl) to assess the impact. The scope of the OAuth flow may not be as big if the tokens never expire (can defer an experience about token expiry compared to OAuth tokens provided by other services providers). |
After considering two approaches to replace existing Basic Auth: OAuth 2.0 Authorization Code with current SMTP integration vs OAuth 2.0 Client Credentials with MS Exchange Graph API we identified next pros/cons for each. OAuth 2.0 Authorization Code with current SMTP:
Cons:
OAuth 2.0 Client Credentials with MS Exchange Graph API
Cons:
|
@YulNaumenko thank you for the writeup. The approach you are taking sounds very reasonable to me based on the pros and cons that you have listed. A couple of clarifications: On the security flow: Do I understand correctly that the Exchange-specific Client Credentials flow is related to the OAuth client credentials flow? https://oauth.net/2/grant-types/client-credentials/ (ref the end of your writeup). Is it a specific flavour of it or uses it as a part (or something along these lines)? On the migration: How will the users start using the new connector? Before MS Exchange sunsets basic, they will need to create the new connector and add it to their existing rules/actions, removing at the same time the existing basic one. Will this impact the existing rules/actions or they will be able to replace the connector in a rule and the rule will continue working normally? On the UX: Will this become an option in the Existing Email connector? What's the UX/design around how you will select an Exchange-specific email connector vs a generic/basic one? On the higher-level user flow: Users need to obtain non-personal (client-level in this case) credentials somehow, perhaps from an admin or by accessing their MS Exchange project. This requirement sounds similar to what they need to do to set up a Pagerduty connector for example, where they need an API key for the project. No real significant departure on that level, correct? |
MS Exchange Online using the general OAuth 2.0 Client Credentials flow (no specific flavors). I will implement OAuth token request logic as a generic lib function which could be reusable across the actions plugin.
All existing MS Exchange connectors will still be valid till the Microsoft drop the Basic Auth. After that it will start failing the action execution.
In the UI, user will get a dropdown from the supported service providers, one of which is MS Exchange Server: After the choosing Exchange Server, user will get the next UI (this is a version without Service select, imagine it is here :-) with selected MS Exchange Server): Old MS Exchange version with Basic Auth is supported under the Other service option:
Yes, this is a standard OAuth 2.0 Client Credentials flow, according to which application client can obtain access token by sending clientId, clientSecret and tenantId. No user consent is required here. Only Admin should consent the granted application client permissions on the MS Exchange Portal. |
With Microsoft deprecating basic auth for exchange ;
We'll want to update our roadmap for auth so it won't break Alerting and Watcher email alerts configured to use this.
https://www.elastic.co/guide/en/elasticsearch/reference/current/actions-email.html#exchange
https://www.elastic.co/guide/en/kibana/7.x/email-action-type.html#exchange
Elasticsearch issue: elastic/elasticsearch#69908
The text was updated successfully, but these errors were encountered: