INTEGRITY Cloudflare Docs

Google Workspace as MX Record

A schematic showing where Email security is in the life cycle of an email received

In this tutorial, you will learn how to configure Google Workspace with Email security as MX record.

Prerequisites

To ensure changes made in this tutorial take effect quickly, update the Time to Live (TTL) value of the existing MX records on your domains to five minutes. Do this on all the domains you will be deploying.

Changing the TTL value instructs DNS servers on how long to cache this value before requesting an update from the responsible nameserver. You need to change the TTL value before changing your MX records to Email security. This will ensure that changes take effect quickly and can also be reverted quickly if needed. If your DNS manager does not allow for a TTL of five minutes, set it to the lowest possible setting.

To check your existing TTL, open a terminal window and run the following command against your domain:

dig mx <YOUR_DOMAIN>
; <<>> DiG 9.10.6 <<>> mx <YOUR_DOMAIN>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39938
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;<YOUR_DOMAIN>.		IN	MX

;; ANSWER SECTION:
<YOUR_DOMAIN>.    300    IN    MX    10 mxa.global.inbound.cf-emailsecurity.net.
<YOUR_DOMAIN>.    300    IN    MX    10 mxb.global.inbound.cf-emailsecurity.net.

In the above example, TTL is shown in seconds as 300 (or five minutes).

If you are using Cloudflare for DNS, you can leave the TTL setting as Auto.

Below is a list with instructions on how to edit MX records for some popular services:

Requirements

1. Set up Inbound Email Configuration

Set up Inbound Email Configuration with the following details:

2. (Optional) Set up an email quarantine

Set up an email quarantine with the following details:

To access the newly created quarantine, select GO TO ADMIN QUARANTINE or access the quarantine directly by pointing your browser to https://email-quarantine.google.com/adminreview.

3. (Optional) Create a content compliance filter

Go to Compliance, and create a content compliance filter to send malicious messages to quarantine. Enter the following details:

If you would like to quarantine the other dispositions, repeat the above steps and use the following strings for the other dispositions:

If desired, you can create a separate quarantine for each of the dispositions.

4. Set up MX/Inline

Now that you have completed the prerequisite steps, set up MX/Inline on the Cloudflare dashboard. Refer to Set up MX/Inline deployment for the next steps.

One method of a DNS attack is to search for old MX records and send phishing emails directly to the mail server. To secure the email flow, you should enforce an email flow where inbound messages are accepted by Google Workspace only when they originate from Email security. This can be done by adding a connector to only allow email from Email security with TLS encryption. This step is optional but recommended.

After 72 hours, the MX record DNS update will have sufficiently propagated across the Internet. It is now safe to secure your email flow. This will ensure that Google Workspace only accepts messages that are first received by Email security. This step is highly recommended to prevent threat actors from using cached MX entries to bypass Email security by injecting messages directly into Google Workspace.

  1. Access the Google Administrative Console, then select Apps > Google Workspace > Gmail.

  2. Select Spam, Phishing and Malware.

  3. Go to Inbound gateway and select Edit Inbound gateway.

  4. Enable Reject all mail not from gateway IPs and select Save.

  5. Select Save once more to commit and activate the configuration change in the Gmail advanced configuration console.