Sentinel
CacheGenie Sentinel is four fields on a zone and one call: set how visitors sign in, who may, and for how long, and sign everyone out. What Sentinel is and what visitors see: CacheGenie Sentinel. The fields are read and written on the zone itself, through Zones.
The fields#
Every zone object carries these, and an update takes them:
- SENTINEL (String):
PASSWORD,EMAILorNOC, how visitors sign in, or an empty string while Sentinel is off. Any case is taken. A new zone starts with it off. - SENTINEL_HOURS (Integer): how long a sign-in lasts, in hours:
1,8,24,168(7 days) or720(30 days). Starts at 24. - SENTINEL_EMAILS (String): who may sign in with an emailed code: addresses and
@domains, at most 200. Read back one a line, in lower case; sent, separated by new lines, commas or spaces, and the whole list replaces the one before. An@domainis that domain alone, never its subdomains. - SENTINEL_PASSWORD (String, write only): the password for
PASSWORD, 8 to 128 characters. Only a hash of it is kept, so it is never read back. An empty string keeps the one set. - SENTINEL_PASSWORD_SET (Integer, read only): 1 when the zone has a password, else 0.
Each is optional in an update, and one left out keeps its value. Switching Sentinel off keeps the password and the list for later. The zone's own signing key for Sentinel is never part of any answer.
Turn it on#
POST https://api.cachegenie.com/v1/cdn/{ZONE_ID}With a password:
curl -X POST https://api.cachegenie.com/v1/cdn/AB12CD34E \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"SENTINEL": "PASSWORD", "SENTINEL_PASSWORD": "correct horse battery"}'With an emailed code, for one address and everyone at a domain, signed in for 8 hours:
curl -X POST https://api.cachegenie.com/v1/cdn/AB12CD34E \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"SENTINEL": "EMAIL", "SENTINEL_EMAILS": "jo@example.com\n@example.com", "SENTINEL_HOURS": 8}'With NOC sign-in, which needs nothing else: the users of your account sign in with the email they use for the NOC.
curl -X POST https://api.cachegenie.com/v1/cdn/AB12CD34E \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"SENTINEL": "NOC"}'The answer is the updated zone, as for any update. Send {"SENTINEL": ""} to switch it off. Every change reaches every location within about fifteen seconds.
Sign everyone out#
POST https://api.cachegenie.com/v1/cdn/{ZONE_ID}/sentinel/sign-outEveryone signed in to the zone must sign in again, on every hostname, and any code already emailed stops working. It answers Everyone was signed out. with an empty DATA; every location refuses the old sign-ins within about fifteen seconds, and closes any WebSocket or event stream still open with one. Any change to SENTINEL, SENTINEL_HOURS, SENTINEL_EMAILS or SENTINEL_PASSWORD does the same by itself, so nobody keeps access you have taken away.
curl -X POST https://api.cachegenie.com/v1/cdn/AB12CD34E/sentinel/sign-out \
-H "Authorization: Bearer YOUR_API_KEY"Errors#
An update that would leave Sentinel set up wrongly is refused whole, and nothing in it is saved:
- 400
SENTINEL must be PASSWORD, EMAIL, NOC, or empty to switch it off. - 400
SENTINEL_HOURS must be 1, 8, 24, 168 or 720. - 400
SENTINEL_PASSWORD: Use a password of 8 to 128 characters. - 400
SENTINEL_EMAILS: X is not an email address or an @domain.: an entry, named in place of X, is neither. - 400
SENTINEL_EMAILS: List at most 200 addresses and domains. - 400
Set SENTINEL_PASSWORD to turn on the Password method.:PASSWORDon a zone with no password, and none sent. - 400
List at least one address or @domain in SENTINEL_EMAILS to turn on the Email code method.:EMAILwith an empty list. - 404
Not found. POST /v1/cdn/{ID}/sentinel/sign-out signs everyone out.: any other method or path under/sentinel.
What your origin receives#
A signed-in request carries X-CDN-Sentinel-User, the email address the visitor signed in with by email code or NOC sign-in, and nothing for a password. Every location removes that header from what visitors send, so your origin can rely on it, together with the hostname each request asked for. See What your origin receives.