GSuite offers integration through oAuth-2 APIs. This guide will cover the steps needed to grant your LibraCyber Email Security Gateway permissions on your Gsuite Tenant. No changes are made to the GSuite Tenant itself by LibraCyber Email Security Gateway.
GSuite Tenant prepare
- Open Google Developer Console (https://console.developers.google.com/) and log in with your GSuite credentials
-
From the Drop, Down menu select your Organization and then CREATE a PROJECT
-
Create a New Project called LibraCyber ESG
S
- Select the project Just created
-
Enable the Admin SDK API
- Search for “Admin SDK API” using the top search bar
- Click on the first result “Admin SDK API“
- Enable it
-
Enable the Gmail API if you want to use the Threat Remediation
- Search for “Gmail API” using the top search bar
- Click on the first result “Gmail API“
- Enable it
-
Enable “OAuth consent screen”
- From the Navigation Menu, go to API and Services -> OAuth consent screen
- Select User Type “Internal” and click “Create”
- Enter the Application name, call it “LibraCyber ESG”
- Provide a “User support email” & the “Developer contact information”
- Click Save & Continue
- Do not provide any Scopes and click “Save & Continue” again
- Click BACK TO DASHBOARD
OAuth2 Client ID and Secret
- Go to the “APIs and Services -> Credentials” menu
- Choose “Create Credentials” -> “OAuth Client ID”
- Choose “Web application” as the type
- Call it “LibraCyber ESG Authentication”
- Add HTTPS://<esg public fqdn>/oauth-login as “Authorized redirect URI” and click Create
- Take note of the Client ID and Client Secret
Service Account
×The step 3 is also described on this official google documentation page: https://developers.google.com/admin-sdk/directory/v1/guides/delegation
-
Create a new service account
- From the Navigation Menu, go to IAM & Admin – Service Accounts
- Click Create Service Account
- Call it libraesvaesg
- Continue with the default settings and Save
- Take note of the Service Account Email
-
Obtain a key for the service account
- Click on the “Service Account” created above
- Take note of the Unique Id
- Select “ADD KEY” -> “Create new key”
- Select “JSON” type
- Generate it and download the JSON key
- Open the JSON file with a text editor and take note of the private_key inside the quotation marks
-
Allow the service account to access your directory
- Go to your GSuite Administration console (https://admin.google.com/)
- Click on “Security -> Access and data control->API Controls ->Manage Domain Wide Delegation”
- Add a record with “Add New”
- Fill the “Client ID” field with the Unique Id copied before
- Copy the following text and paste it into the “Oauth Scopes” field https://www.googleapis.com/auth/admin.directory.user,https://www.googleapis.com/auth/admin.directory.group
- Provide also the https://mail.google.com/ scope to give the necessary permissions for the Threat Remediation
- Click authorize
G Suite tenant ID
Find your Organization Id by going to this page https://play.google.com/work/adminsettings?pli=1 (you can also find it in the Admin console, check the following guide https://krypted.com/uncategorized/get-your-customerid-from-g-suite/ )
Settings for Threat Remediation
×NOTE: Follow this guide if you have already created a G Suite Connector and you want to only add the permission needed for the Threat Remediation
-
Enable the Gmail API
- Open Google Developer Console (https://console.developers.google.com/) and log in with your GSuite credentials
- From the Drop Down menu, select the Project created for the G Suite Connector
- Search for “Gmail API” using the top search bar
- Click on the first result “Gmail API“
- Enable it
-
Add the scope needed for the email recall
- Go to your GSuite Administration console (https://admin.google.com/)
- Click on “Security -> API Controls -> Manage Domain Wide Delegation”
- Find the Service account already create by “Client ID” and click Edit
- Add the https://mail.google.com/ scope
- Click authorize