GoAdmio

securitylevel

Set the Cloudflare security level (medium, high, or Under Attack) for one hosted domain or for all of them

On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also


Overview

/go/securitylevel changes a domain's Security Level setting on Cloudflare through the Cloudflare API. The security level controls how aggressively Cloudflare challenges visitors it considers suspicious. Use it to:

It can target:

The command only changes the setting on Cloudflare. It does not change anything on this server. Domains must already be in Cloudflare (see dns).


Quick start

# Challenge more visitors on one domain
/go/securitylevel example.com high

# Turn on Under Attack Mode for every hosted domain
/go/securitylevel all under_attack

# Return every hosted domain to normal
/go/securitylevel all medium

Syntax

/go/securitylevel <domain|all> <level>

The command re-runs itself with sudo when it is not started as root, and writes the call to /var/log/go/securitylevel.log.


Arguments

Position Argument Required Notes
1 <domain> or all Yes A hosted domain exactly as it appears in /home, or all for every hosted domain.
2 <level> Yes One of the values in Levels. Any other value, or no value, sets medium.

Levels

Matching is case-sensitive.

You type Applied to Cloudflare What it does
medium medium Normal protection. Challenges visitors Cloudflare rates as a moderate threat.
high high Stronger protection. Challenges more visitors.
under_attack under_attack Under Attack Mode. Every visitor sees a Cloudflare challenge page before reaching the site.
underattack under_attack Same as above.
under attack under_attack Same as above. Quote it: "under attack".
Anything else (low, High, a typo, nothing) medium No error is shown.

[!WARNING] A typo or a missing level does not fail. It sets medium, which can silently lower a site that is currently on high or under_attack. Always check the level printed after the domain name, for example example.com (high)....

The Cloudflare levels essentially_off and low cannot be set with this command.


Output

For each domain, the command prints one progress line, then the raw JSON that Cloudflare returned. It does not read the JSON, so the command always ends normally, even when Cloudflare rejects the change. Check the JSON for "success": true.

Single domain

example.com (high)...
{"result":{"id":"security_level","value":"high","editable":true,"modified_on":"2026-11-21T01:23:00.000000Z"},"success":true,"errors":[],"messages":[]}

All domains

Each line starts with a counter, [position/total].

[1/2] example.com (under_attack)...
{"result":{"id":"security_level","value":"under_attack",...},"success":true,"errors":[],"messages":[]}
[2/2] example.org (under_attack)...
{"result":{"id":"security_level","value":"under_attack",...},"success":true,"errors":[],"messages":[]}

Nothing printed

For a single domain, the command prints nothing if /home/<domain>/www doesn't exist. This is not an error message; the domain was simply skipped.


Examples

# One domain, strong protection
/go/securitylevel example.com high
# Spaces in the level need quotes
/go/securitylevel example.com "under attack"
# Under Attack Mode on every site during an attack, then back to normal
/go/securitylevel all under_attack
/go/securitylevel all medium
# Confirm the change was accepted
/go/securitylevel example.com high | grep -c '"success":true'
# Review recent calls
tail /var/log/go/securitylevel.log

Troubleshooting

Symptom Likely cause Fix
Nothing is printed for a domain /home/<domain>/www doesn't exist, so the domain was skipped. Check the spelling against the folders in /home.
Level shown is medium but you asked for something else The level was misspelled, mistyped in another case, or missing. Use medium, high, or under_attack, in lowercase.
"success":false with an authentication error The Cloudflare API token is missing, wrong, or expired. Update the token in GoAdmio's Cloudflare settings (see cloudflare).
"success":false with a permission error The token can't edit zone settings. Give the token the Zone Settings: Edit permission for the zones.
"success":false with an invalid zone error The domain has no zone ID, or it is not on Cloudflare. Add the domain with dns, then run again.
The [n/total] counter doesn't match The total counts folders with a dot in the name, but the loop processes every folder that has a www directory. Cosmetic only. Every domain with a www folder is still processed.
Visitors see a challenge page on every site Under Attack Mode is on. Run /go/securitylevel all medium.

Details

What it does

  1. Re-runs itself with sudo if it was not started as root.
  2. Appends the call and a timestamp to /var/log/go/securitylevel.log.
  3. Turns the level argument into medium, high, or under_attack (see Levels).
  4. Reads the Cloudflare API token from /var/lib/sqlite/config.db.
  5. For each target domain that has a /home/<domain>/www folder:
    1. Reads its zone ID from the Site table in /var/lib/sqlite/site.db.
    2. Sends a PATCH request to Cloudflare's zones/<zone-id>/settings/security_level endpoint.
    3. Prints the response.
flowchart TD
    A["securitylevel domain level"] --> B["Log the call"]
    B --> C["Normalize level: medium, high, or under_attack"]
    C --> D{"domain = all?"}
    D -- "Yes" --> E["Loop over every folder in /home"]
    D -- "No" --> F["Use the one domain"]
    E --> G{"/home/domain/www exists?"}
    F --> G
    G -- "No" --> H["Skip silently"]
    G -- "Yes" --> I["Read zone ID, PATCH Cloudflare, print JSON"]

Things to know


See also

Command Description
underattack Enable Cloudflare Under Attack Mode for a domain
fightmode Enable or disable Bot Fight Mode on Cloudflare
waf Block IPs via Cloudflare WAF
block Block an IP address in the server firewall and in Cloudflare
white Whitelist an IP address on this server and in Cloudflare
purge Delete the Cloudflare edge cache (purge everything)
proxy Change Cloudflare's proxy setting
dns Add hosted domains to Cloudflare and set up their DNS zone
cloudflare Configure Cloudflare DNS records, SSL, caching, and security settings