Skip to content
Merged
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
2 changes: 1 addition & 1 deletion scripts/check-dns-plan.jq
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# the bot management configuration and the zone settings listed below. They
# always exist, so they are imported, never created, and may be updated by the
# reviewed change that imports them.
def zone_settings: ["email_obfuscation"];
def zone_settings: ["email_obfuscation", "nel"];
def setting: .type=="cloudflare_bot_management" or
(.type=="cloudflare_zone_setting" and (((.change.after // .change.before // {}).setting_id // "")|IN(zone_settings[])));
def fqdn: ascii_downcase | rtrimstr(".") |
Expand Down
2 changes: 1 addition & 1 deletion scripts/dns-imports.jq
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# create of one of them is always an import of the live setting: the bot
# management configuration by zone, and an allowed zone setting by zone and
# setting name. Any other setting is left to fail at the plan check.
def zone_settings: ["email_obfuscation"];
def zone_settings: ["email_obfuscation", "nel"];
def fqdn: ascii_downcase | rtrimstr(".") |
if .=="@" then "devantler.tech"
elif .=="devantler.tech" or endswith(".devantler.tech") then .
Expand Down
4 changes: 3 additions & 1 deletion scripts/tests/test-dns-apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ printf '%s\n' 'PASS: DNS plans admit unchanged imports, creates, updates and for
setting() { jq -n --arg address "$1" --arg type "$2" --arg setting "$3" '{address:$address,mode:"managed",type:$type,change:{actions:["create"],after:({zone_id:null} + (if $setting=="" then {} else {setting_id:$setting,value:"off"} end))}}'; }
result=$( { setting cloudflare_bot_management.primary cloudflare_bot_management ""
setting cloudflare_zone_setting.email_obfuscation cloudflare_zone_setting email_obfuscation
setting cloudflare_zone_setting.nel cloudflare_zone_setting nel
setting cloudflare_zone_setting.rocket_loader cloudflare_zone_setting rocket_loader; } | resolve)
jq -e --arg zone "$zone" '.refused==[] and .imports==[
{address:"cloudflare_bot_management.primary",id:$zone},
{address:"cloudflare_zone_setting.email_obfuscation",id:($zone+"/email_obfuscation")}]' <<<"$result" >/dev/null
{address:"cloudflare_zone_setting.email_obfuscation",id:($zone+"/email_obfuscation")},
{address:"cloudflare_zone_setting.nel",id:($zone+"/nel")}]' <<<"$result" >/dev/null
printf '%s\n' "[{\"address\":\"cloudflare_bot_management.primary\",\"id\":\"$zone\"},{\"address\":\"cloudflare_zone_setting.email_obfuscation\",\"id\":\"$zone/email_obfuscation\"}]" > "$scratch/imports.json"
bot_import=$(change cloudflare_bot_management.primary cloudflare_bot_management '["update"]' '{"fight_mode":true,"enable_js":true}' '{"fight_mode":false,"enable_js":false}' "{\"id\":\"$zone\"}")
obfuscation_import=$(change cloudflare_zone_setting.email_obfuscation cloudflare_zone_setting '["update"]' '{"setting_id":"email_obfuscation","value":"on"}' '{"setting_id":"email_obfuscation","value":"off"}' "{\"id\":\"$zone/email_obfuscation\"}")
Expand Down
12 changes: 12 additions & 0 deletions zone.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ resource "cloudflare_zone_setting" "email_obfuscation" {
value = "off"
}

# Network Error Logging makes visitors' browsers store a reporting policy for
# seven days and send failed-connection reports to Cloudflare. Off, responses
# stop setting that policy, which removes it as a consent question under the
# Danish cookie order (BEK 1148/2011). A browser that already stored it keeps it
# until it expires, at most seven days later. The platform's own monitoring is
# unaffected (#84).
resource "cloudflare_zone_setting" "nel" {
zone_id = cloudflare_zone.primary.id
setting_id = "nel"
value = { enabled = false }
}

resource "cloudflare_bot_management" "primary" {
zone_id = cloudflare_zone.primary.id
fight_mode = false
Expand Down
Loading