Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Create New Tag
on:
push:
branches:
- 'main'
- '*'

jobs:
create-tag:
Expand All @@ -15,7 +15,14 @@ jobs:

- name: Set tag version
id: set_version
run: echo "::set-output name=tag::v$(date +'%Y%m%d%H%M%S')"
run: |
if [ "${GITHUB_REF##*/}" == "main" ]; then
#echo "::set-output name=tag::$(date +'%Y%m%d%H%M%S')"
echo "::set-output name=tag::$(cat VERSION.txt')"
else
# echo "::set-output name=tag::rc$(date +'%Y%m%d%H%M%S')"
echo "::set-output name=tag::rc$(cat VERSION.txt${SHORT_SHA})'"
fi

- name: Create Git Tag
run: git tag ${{ steps.set_version.outputs.tag }}
Expand Down
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
68 changes: 68 additions & 0 deletions cloudflare/firewall/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
## Email
#
resource "cloudflare_email_routing_catch_all" "forward" {
zone_id = var.zone_id
name = "email catch all"
enabled = true

matcher {
type = "all"
}

action {
type = "forward"
value = ["bwp.pearson@gmail.com"]
}
}

#
## Block non US CA AU countries
#

resource "cloudflare_filter" "countries" {
zone_id = var.zone_id
description = "Expression to block all countries except US, CA and AU"
expression = "(ip.geoip.country ne \"US\" and ip.geoip.country ne \"CA\" and ip.geoip.country ne \"AU\")"
}

resource "cloudflare_firewall_rule" "countries" {
zone_id = var.zone_id
description = "Firewall rule to block all countries except US, CA and AU"
filter_id = cloudflare_filter.countries.id
action = "block"
}

#
## Bots
#

resource "cloudflare_filter" "bots" {
zone_id = var.zone_id
description = "Expression to block bots determined by CF"
expression = "(cf.client.bot)"
}

resource "cloudflare_firewall_rule" "bots" {
zone_id = var.zone_id
description = "Firewall rule to block bots determined by CF"
filter_id = cloudflare_filter.bots.id
action = "block"
}

#
## Block threats greater than Medium
#

resource "cloudflare_filter" "threats" {
zone_id = var.zone_id
description = "Expression to block medium threats"
expression = "(cf.threat_score gt 14)"
}

resource "cloudflare_firewall_rule" "threats" {
zone_id = var.zone_id
description = "Firewall rule to block medium threats"
filter_id = cloudflare_filter.threats.id
action = "block"
}
14 changes: 14 additions & 0 deletions cloudflare/firewall/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Configure the Cloudflare provider.
# You may optionally use version directive to prevent breaking changes occurring unannounced.
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "4.11.0"
}
namecheap = {
source = "namecheap/namecheap"
version = ">= 2.0.0"
}
}
}
20 changes: 20 additions & 0 deletions cloudflare/firewall/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "zone_id" {
type = string
default = null
}

variable "account_id" {
type = string
default = null
}

variable "name" {
type = string
default = null

}

variable "tld" {
type = string
default = ".com"
}
67 changes: 3 additions & 64 deletions cloudflare/mail_server/main.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
#
## Email
#
resource "cloudflare_email_routing_catch_all" "example" {
zone_id = var.zone_id
name = "email catch all"
enabled = true

matcher {
type = "all"
}

action {
type = "forward"
value = ["bwp.pearson@gmail.com"]
}
}

resource "cloudflare_record" "mx0" {
allow_overwrite = true
zone_id = var.zone_id
Expand Down Expand Up @@ -51,53 +36,7 @@ resource "cloudflare_record" "txt" {
value = "v=spf1 include:_spf.mx.cloudflare.net ~all"
}

#
## Block non US CA AU countries
#

resource "cloudflare_filter" "countries" {
zone_id = var.zone_id
description = "Expression to block all countries except US, CA and AU"
expression = "(ip.geoip.country ne \"US\" and ip.geoip.country ne \"CA\" and ip.geoip.country ne \"AU\")"
}

resource "cloudflare_firewall_rule" "countries" {
zone_id = var.zone_id
description = "Firewall rule to block all countries except US, CA and AU"
filter_id = cloudflare_filter.countries.id
action = "block"
}

#
## Bots
#

resource "cloudflare_filter" "bots" {
zone_id = var.zone_id
description = "Expression to block bots determined by CF"
expression = "(cf.client.bot)"
}

resource "cloudflare_firewall_rule" "bots" {
zone_id = var.zone_id
description = "Firewall rule to block bots determined by CF"
filter_id = cloudflare_filter.bots.id
action = "block"
}

#
## Block threats greater than Medium
#

resource "cloudflare_filter" "threats" {
zone_id = var.zone_id
description = "Expression to block medium threats"
expression = "(cf.threat_score gt 14)"
}

resource "cloudflare_firewall_rule" "threats" {
zone_id = var.zone_id
description = "Firewall rule to block medium threats"
filter_id = cloudflare_filter.threats.id
action = "block"
module "firewall" {
source = "../firewall"
zone_id = var.zone_id
}
76 changes: 3 additions & 73 deletions cloudflare/mail_server_secondary/main.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
#
## Email
#
resource "cloudflare_email_routing_catch_all" "catch_all" {
zone_id = var.zone_id
name = "email catch all"
enabled = true

matcher {
type = "all"
}

action {
type = "forward"
value = ["bwp.pearson@gmail.com"]
}
}

resource "cloudflare_record" "mx77" {
allow_overwrite = true
zone_id = var.zone_id
Expand All @@ -42,62 +27,7 @@ resource "cloudflare_record" "mx85" {
value = "route3.mx.cloudflare.net"
priority = "85"
}

resource "cloudflare_record" "txt" {
allow_overwrite = true
zone_id = var.zone_id
name = "@"
type = "TXT"
value = "v=spf1 include:_spf.mx.cloudflare.net ~all"
}

#
## Block non US CA AU countries
#

resource "cloudflare_filter" "countries" {
zone_id = var.zone_id
description = "Expression to block all countries except US, CA and AU"
expression = "(ip.geoip.country ne \"US\" and ip.geoip.country ne \"CA\" and ip.geoip.country ne \"AU\")"
}

resource "cloudflare_firewall_rule" "countries" {
zone_id = var.zone_id
description = "Firewall rule to block all countries except US, CA and AU"
filter_id = cloudflare_filter.countries.id
action = "block"
}

#
## Bots
#

resource "cloudflare_filter" "bots" {
zone_id = var.zone_id
description = "Expression to block bots determined by CF"
expression = "(cf.client.bot)"
}

resource "cloudflare_firewall_rule" "bots" {
zone_id = var.zone_id
description = "Firewall rule to block bots determined by CF"
filter_id = cloudflare_filter.bots.id
action = "block"
}

#
## Block threats greater than Medium
#

resource "cloudflare_filter" "threats" {
zone_id = var.zone_id
description = "Expression to block medium threats"
expression = "(cf.threat_score gt 14)"
}

resource "cloudflare_firewall_rule" "threats" {
zone_id = var.zone_id
description = "Firewall rule to block medium threats"
filter_id = cloudflare_filter.threats.id
action = "block"
module "firewall" {
source = "../firewall"
zone_id = var.zone_id
}
8 changes: 6 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": [
"config:base"
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true
}
]
}