Docs
Type to search every article.
  1. Docs
  2. Zones

CacheGenie Sentinel

6 min read Updated

On this page
  1. Turn it on
  2. What visitors see
  3. One sign-in for the whole zone
  4. How long a sign-in lasts
  5. Sign everyone out
  6. What your origin receives
  7. HTTPS, and requests that cannot sign in
  8. What still works
  9. Cookies on your hostnames
  10. Limits
  11. From the API

CacheGenie Sentinel lets only the people you allow open a zone. A visitor signs in once, with a password, a code sent to their email or their CacheGenie NOC sign-in, and is then let in on every hostname of the zone.

It is a lock on the zone, not on your server: no software to install and nothing to change on your origin, and it works the same in front of a full site, a tunnel or a bucket. Use it to keep an admin panel, a staging site or a private tool to your own people.

Turn it on#

Open the zone in the NOC and its Sentinel tab. Choose how visitors sign in, set how long they stay signed in, and press Save. The zone list then marks the zone Sentinel, and every location applies the change within about fifteen seconds. Choose Everyone and save to switch it off again.

A zone has one method at a time:

  • Password: anyone who knows the password you set for the zone. It is 8 to 128 characters, and we keep only a hash of it, so it cannot be shown again: to change it, type the new one and save. Leave the field empty to keep the one set.
  • Email code: the people you list. Add an address, such as jo@example.com, or @example.com for everyone at that domain (up to 200 entries). A domain is that domain alone, never its subdomains: @example.com lets in pat@example.com but not pat@mail.example.com.
  • NOC sign-in: the users of your account, signed in to the CacheGenie NOC with the email they use there, whatever their permission level. Nobody else can use it, our team included. Manage them on the Users page.

What visitors see#

A visitor who is not signed in is sent to a sign-in page on noc.cachegenie.com that names the hostname they asked for, and once signed in comes straight back to the page they wanted.

  • With a password, they type it.
  • With an email code, they give their address, and if it is one you allow we email them an eight-digit code, which works once, for 10 minutes. Anyone else is told the same thing and sent nothing, and a wrong code and an expired one get the same answer, so the page never reveals who is on your list. Five wrong tries use a code up.
  • With NOC sign-in, a user already signed in to the NOC presses Continue as and is let in; anyone else is offered Sign in to the CacheGenie NOC first, and comes back here afterwards.

The page is the NOC's own sign-in page, with no link away from it but back to your site.

One sign-in for the whole zone#

Signing in opens every hostname of the zone. A visitor signed in on app.example.com who then opens files.example.com in the same zone passes through the sign-in page and back without being asked anything. With NOC sign-in that holds only while they stay signed in to the NOC as a user of your account, and with an email code only while their address stays on your list. A hostname of another zone is another sign-in.

How long a sign-in lasts#

Stay signed in for is 1 hour, 8 hours, 24 hours (a new zone's), 7 days or 30 days, counted from the moment the visitor signed in. It ends at the same moment on every hostname of the zone, however many they have opened since.

To end it early, a visitor opens /.cg-sentinel/sign-out on any hostname of the zone, for example https://app.example.com/.cg-sentinel/sign-out, which you can link from your site. That signs them out of the zone on the NOC and on that hostname; a hostname they already opened lets them in until Sign everyone out or the end of their sign-in.

Sign everyone out#

Sign everyone out, at the foot of the Sentinel tab, makes everyone signed in to the zone sign in again, on every hostname, within about fifteen seconds. A page they already have open loses its live connections too: a WebSocket or an event stream opened with the old sign-in is closed, so an app that runs over one, such as an editor in the browser, stops working until they sign in again. The same goes for the end of a sign-in: a connection lasts no longer than the sign-in it opened with. The same happens by itself whenever you change the method, the password, the list of addresses or how long a sign-in lasts, so nobody keeps access you have taken away, and any code already emailed stops working.

What your origin receives#

A signed-in request reaches your origin as any other does, with one header added: X-CDN-Sentinel-User, the email address the visitor signed in with (by email code or NOC sign-in). A password names nobody, so it adds no header. Every location removes the header from what visitors send, on every zone, so your origin can rely on it. It says who signed in to a zone of ours, not to which: if your origin can be reached through another zone, or directly, check the hostname each request asked for as well.

Sentinel's own cookies never reach your origin either, your origin cannot set them, and they do not stop a request being served from the cache. A cached file is served only to signed-in visitors, and signed-in visitors share the cache as anyone does: a page that differs from person to person needs Cache-Control: private, as on any zone (see How caching works).

HTTPS, and requests that cannot sign in#

Sentinel works over HTTPS alone. A request over plain HTTP is sent to the same address over HTTPS first, so each hostname of the zone needs SSL on and its certificate (see Hostnames and certificates). The sign-in page sends a visitor back only to a hostname that has both, so a name whose DNS points somewhere else never receives a sign-in; until one does, the Sentinel tab says nobody can sign in yet.

Only a page a browser opens is sent to sign in. A request that cannot follow a sign-in, such as a script's fetch, a form posted after the sign-in ended, a WebSocket or an API client, is answered 401 until the browser has signed in again, so put a service that programs call on a zone of its own, protected with allowed addresses or signed links instead.

What still works#

  • A certificate challenge, under /.well-known/acme-challenge/, still reaches your origin, so a certificate you renew there keeps renewing. Only a path that stays in that folder counts: one that climbs out of it with .. is a sign-in like any other.
  • Every other setting applies after the sign-in: blocking, signed links, maintenance mode, caching and statistics. A visitor you block cannot get in by signing in.
  • The paths under /.cg-sentinel/ are Sentinel's own while it is on, and reach your origin again when it is off.

Cookies on your hostnames#

Sentinel sets two cookies on each hostname a visitor opens, both kept to that one hostname, sent only over HTTPS and never readable by your pages' scripts. List them in your own cookie policy if you keep one:

CookieWhat it does
__Host-cg_sentinelKeeps the visitor signed in to the hostname until their sign-in ends
__Host-cg_sentinel_stateWhile the visitor signs in, ties the sign-in to their browser, for 10 minutes

Limits#

Each limit counts one visitor's tries, or only wrong ones, so nobody can lock your zone or one of your people out by trying on their behalf. Past a limit the sign-in page asks the visitor to wait.

  • Ten passwords or codes tried a minute, and 60 an hour, from one IP address for a zone.
  • Five wrong codes an hour for one email address from one IP address, and 30 from everywhere.
  • A thousand wrong passwords an hour for a zone from everywhere.
  • Three codes an hour to one email address from one IP address, ten to it from everywhere, and ten an hour from one IP address.

From the API#

Sentinel is four fields on the zone, and one call signs everyone out. See Sentinel in the API reference.

Shell
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}'