https://github.com/vojtechmares/terraform-cloudflare-no-mail
Terraform module for a Cloudflare DNS, to configure to prevent spammers sending mail from your domain
https://github.com/vojtechmares/terraform-cloudflare-no-mail
cloudflare dkim dns-records mail null-mx spf
Last synced: 8 months ago
JSON representation
Terraform module for a Cloudflare DNS, to configure to prevent spammers sending mail from your domain
- Host: GitHub
- URL: https://github.com/vojtechmares/terraform-cloudflare-no-mail
- Owner: vojtechmares
- License: mit
- Created: 2021-03-21T18:48:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T20:32:45.000Z (about 1 year ago)
- Last Synced: 2024-08-27T23:16:42.661Z (about 1 year ago)
- Topics: cloudflare, dkim, dns-records, mail, null-mx, spf
- Language: HCL
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform Cloudflare No Mail Module
This module is created to help you keep your domains safe off spam lists, block lists etc.
For Every domain, you do not use emails, configure these DNS records, to deny any mail going from your domains (if you did not set it up yourself) to keep your domain spam free, off spam list and non blocked.
No spammers can send valid mail from your domain.
Technically, spammers still can send mails from your domain, but every good behaving mail server will reject these mails with this DNS configuration.
## Usage
You only need to provide singe variable `zone_id` of the domain you wish to add these DNS records to.
This module requires Cloudflare provider **2.19.2** or newer.
### Example
```hcl
module "example_com_no_mail" {
source = "vojtechmares/no-mail/cloudflare"
version = "1.0.0"
zone_id = cloudflare_zone.example_com.id // or variable
}
```## Null MX record
According to [RFC 7505](https://tools.ietf.org/html/rfc7505), Null MX record has a priority of `0` and content `.`.
**NOTE**: TTL of this record is 1 second.
## No Cloudflare
If you are not using Cloudflare for your DNS, add these DNS records to your DNS manually:
- MX: name `@`, content `.`, priority `0` (if you add MX record in the future, cache won't be an issue)
- TXT: name `@`, content `v=spf1 -all`
- TXT: name `_dmarc`, content `v=DMARC1; p=reject;`