The sensor-local policy is a read-only file that the owner of the scanned network writes when the sensor is installed. The sensor refuses every job outside it, even one the platform sent, and even once jobs are signed. A compromised platform, API or database therefore cannot point the sensor at networks, ports or tools the owner did not allow. This is the "the host owner has the last word" principle of api RFC-040 §5.7.
The platform cannot change the policy. The sensor reports only its state,
digest and a summary (counts, tools, switches; never the ranges) on the
heartbeat and the manifest, and only to a platform that announces the
local_policy feature.
Template: sensor-policy.example.yaml.
targets.allow: ["*"] (sensor v0.35.0 or newer) allows every target the
platform signs; the built-in deny list and the private-range rules still apply.
* may not be mixed with other entries. For several sensors on one host, ./sensors.sh set-policy NAME --allow-all in deploy/multi writes this file and
sets SENSOR_LOCAL_POLICY; a sensor older than that gets a v1 file with
0.0.0.0/0 and ::/0, which covers IP addresses but not domain names.
| Setting | Effect |
|---|---|
-local-policy <file> or SENSOR_LOCAL_POLICY=<file> |
the policy; the file must exist |
| neither | /etc/openctem/sensor-policy.yaml when it exists |
no file, SENSOR_ALLOWED_RANGES / SENSOR_ALLOWED_PORTS |
a shorthand policy: targets.allow and ports.allow only, everything else at its policy default (templates and callbacks off). Setting a shorthand together with a file is an error |
| no file, no shorthand | no policy: see below |
SENSOR_KILL_SWITCH_FILE=<absolute path> |
a kill switch file, with or without a policy |
The sensor reads the policy at start and again on SIGHUP
(kill -HUP <pid>, docker kill -s HUP <container>). A reloaded file that
loads replaces the policy for new jobs; a running job keeps the policy it was
admitted under. A reloaded file that does not load stops every job (the
kill switch engages, the log and the platform show local policy reload failed (…)) until a later SIGHUP loads a valid file: the sensor never keeps
running on the previous policy, which may be the looser one you just tried to
tighten. At start it logs Local policy: enforced from file … (sha256:…): targets allow N, deny N, private …, ports …, tools …, custom templates …, interactsh ….
It fails closed. The sensor does not start (exit code 2) when the file:
- has an unknown key or a key in the wrong place;
- has a malformed CIDR, IP, host name, port or tool name, or a CIDR with host
bits set (
198.51.100.0/16); - holds more than one YAML document, or is empty;
- is writable by every user;
- lists a private range in
targets.allowwithoutallow_private: true, or an always-blocked range (loopback, cloud metadata); - was configured with
-local-policyorSENSOR_LOCAL_POLICYbut does not exist.
apiVersion is required and is always openctem.io/sensor-policy/v1: there is one
schema with every key. Any other apiVersion (an older release wrote v2 and v3) is
refused; change that line, or write a new file with ./sensors.sh set-policy. An
absent section restricts nothing; an absent switch is off; an empty list ([])
allows nothing.
One schema. Until 1.0 the schema may gain additive, optional keys. A file is
checked strictly: an unknown key or a typo refuses the file, so a sensor that
predates a key refuses a file that uses it (fail closed): upgrade the sensor first.
openctemio-sensor policy validate tells you before you install.
| Key | Meaning |
|---|---|
managed.accept |
false: this sensor ignores any policy the platform manages for it (narrowing documents the platform will send; they can never widen this file). The platform shows the sensor as locked by its owner. Default true. |
| Key | Meaning |
|---|---|
targets.allow |
CIDRs, IPs, host names, *.domain (the domain itself and every name below it, at any depth, as the platform reads a scope pattern; deny the domain exactly to keep it out). Names compare case-insensitively, without a trailing dot, in IDNA ASCII form. A host name passes when it matches a domain entry, or when every address it resolves to lies in a range entry. A range target must lie inside one range entry. |
targets.deny |
the same forms (*.domain denies the domain too); never scanned, even when allow matches. Every address a name resolves to is checked, so a name that resolves into a denied range is refused (DNS rebinding). |
targets.allow_private |
RFC 1918 / IPv6 ULA ranges may be scanned. SENSOR_ALLOW_PRIVATE_TARGETS=1 is needed as well. Every heartbeat reports whether private targets are admitted (allow_private, also without a policy file), so the platform refuses a scan of a private range at plan time instead of dispatching a job this sensor would refuse. The built-in deny list (loopback, link-local and metadata, CGNAT, multicast, reserved) always applies. |
ports.allow |
"80,443,8000-8999": ports a job names (host:port, or a URL's port: http 80, https 443, and the default port of other known schemes such as ssh 22, redis 6379, postgres 5432), and every port setting the tool will run with, wherever it comes from (the job's config and scanner_config, the organization's and the sensor's settings layers, the tool's own defaults) and under whatever name a port list has (ports, port_range, tcpPorts, in a group or a list of objects). While it is set, these are refused with rule ports.allow: a port scan (scan.ports) that names no ports, a top-N setting (top_ports) unless the job names a port list, a port written with a sign or a leading zero (+22, 0022), and a URL of a scheme with no known default port and no explicit port. At connect time the egress forwarder refuses any other port for a tool whose network is targets or resolver. |
tools.allow |
tools that may run; the others are neither run nor reported, so the platform does not route jobs for them here. This is the way to narrow the tools: the sensor otherwise enables every installed tool (SENSOR_TOOLS is deprecated). It applies to the built-ins too (rdap, asn, reach-probe). |
checks.allow |
job types: scan, validate, retest, collect, refresh_content. health_check is always allowed. |
allow_custom_templates |
platform-supplied custom templates. They must also be trusted: listed in the verified signed job, or, on a sensor without signed jobs, signed with a key in SENSOR_TEMPLATE_SIGNING_KEYS. |
allow_interactsh |
out-of-band callbacks (nuclei interactsh). Absent: the platform's job decides. false: never on this sensor; a job that asks for them runs without them, it is not refused. The server is always the one this sensor's operator configured (SENSOR_OOB_SERVER), never a public one; see REFERENCE.md. |
rate.max_rps |
requests per second; no scan runs above it, whatever the job asks for: a higher rate the job asks for is lowered to it, and a tool whose job sets no rate runs at it. |
rate.max_host_rps |
requests per second toward one target host (1 to 200). One of the limits of every job's per-host budget, of which the lowest wins: a sensor level or a job's budget above it is lowered to it, and no job raises it. Absent: the built-in ceiling of 200. See REFERENCE.md. |
rate.max_host_inflight |
requests in flight toward one target host (1 to 50), the same way. Absent: the built-in ceiling of 50. |
rate.max_job_seconds |
longest run of a job. Every job is capped at 24h anyway. |
kill_switch |
true stops every job until the policy changes. |
kill_switch_file |
while this file exists the sensor stops every job. |
http.user_agent |
a User-Agent for every tool, which wins over the organization's unless the platform enforces one. |
http.user_agents |
instead of http.user_agent (set one, not both): up to 200 User-Agents to rotate. Each target host of a scan run gets one of them, the same for every request of that run, so a session keeps one fingerprint. The whole list wins over the job's User-Agent or list unless the platform or a program locks it. The identification headers are sent with every value. |
http.allow_insecure_tls |
false refuses tools that skip TLS verification. true is the default: it never lets a tool skip verification where the organization's policy forbids it. |
http.headers |
up to 4 {name, value} headers that mark this sensor's scan traffic; see below. |
Schema v4 lets the host owner add identification headers so the network's WAF, SIEM and logs can tell this sensor's scans apart.
A ready file is sensor-policy-headers.example.yaml; the file is read from the same place as any
policy (/etc/openctem/sensor-policy.yaml, -local-policy, or SENSOR_LOCAL_POLICY).
apiVersion: openctem.io/sensor-policy/v1 http: headers: - {name: X-Netops, value: dc1}
- A sensor older than v0.35.0 refuses a file with
http.headers(unknown key, fail closed): upgrade it first. - The sensor sends them on every request of every task that sends HTTP to its targets, for every organization it serves. On a shared sensor they are the host's network identity: never put an organization's data or a secret in a value.
- Rules: a name of 1 to 64 letters, digits or
!#$%&'*+-.^_|~; a printable ASCII value of at most 200 characters; names unique ignoring case; neverAuthorization,Cookie,Host,Content-Length,Transfer-Encoding,Connection,Keep-Alive,TE,Trailer,UpgradeorProxy-*. A file that breaks a rule stops the sensor from starting (it names the header). - Merged with what the platform sends, by name, ignoring case: a header the platform enforces, or a bug-bounty program sets, keeps the platform's value (the job's
locked_headers); any other header of the same name is replaced by yours; every other name is kept. Yourhttp.user_agentwins over the organization's unless the platform enforces one. Together at most 16 headers; a job over that is refused with a message naming the cap. - A tool that cannot carry headers is refused while headers are set (nothing probes unmarked). nuclei, httpx and katana carry them.
- Each run's result reports what was sent (names, source, values), so the console can show it. Values of secret-looking names are masked.
- A header on an allow-list is not a secret; anyone who sees the traffic can copy it. Use it with the sensor's published address, and tag rather than bypass.
- The sensor advertises
http.identity@1for all of this. The console shows only the header names of the policy.
The multi-sensor kit manages the headers for you: ./sensors.sh set-header acme X-Netops dc1 and ./sensors.sh unset-header acme X-Netops (deploy/multi).
The sensor binary checks and installs policies. They read local files only and never contact the platform.
openctemio-sensor policy validate [file] # parse it as the sensor does (exit 1 if invalid) openctemio-sensor policy digest [file] # the sha256 the sensor reports openctemio-sensor policy explain [file] -target app.example.com:8443 -tool nuclei # admitted, or the rule that refuses it sudo openctemio-sensor policy install sensor-policy.yaml --expect-sha256 <hash shown with the file> \ [-dest /etc/openctem/sensor-policy.yaml] [-dry-run] [-pid <sensor pid>]
install refuses a file whose sha256 is not the one given (install only the
bytes you reviewed), a policy this sensor cannot read, a destination that is a
symlink or not a regular file, and a destination directory anyone can write.
It prints the change (before / after), writes the file atomically (0644,
temporary file, fsync, rename) and, with -pid, sends the sensor SIGHUP. The
hash is yours to check, not a key the platform holds: the platform never
writes this file.
The sensor checks a job after claiming it and before any tool sees it.
Per target. A scan job's target that the policy refuses, or that the sensor cannot check, is removed from the job before any tool sees it. The job runs on the other targets. Each removed target gets a reason:
| Reason | When |
|---|---|
unresolvable |
a host name that does not resolve (NXDOMAIN, a resolver failure): an address the policy cannot check is never scanned |
wildcard_pattern |
a pattern such as *.example.com, not a host |
denied_by_policy |
outside targets.allow, in targets.deny, a private address without the switch, the built-in deny list, or a port outside ports.allow |
invalid_target |
not a URL, host, address, range or path, or unsafe to hand to a tool |
The job then completes as partial. Its result lists every skipped target
(refused_targets: target, reason, rule, detail; at most 100, with
refused_targets_total), and the platform shows "Completed with N targets
skipped". The task's log has the policy check and one line per skipped
target. For example, example.com runs and api.example.com (NXDOMAIN) is
skipped:
Local policy check targets=2 refused=1
Target refused by the local policy: api.example.com reason=unresolvable rule=targets
Running on 1 of 2 target(s); 1 skipped
Completed with 1 target(s) refused: "api.example.com" (unresolvable)
The whole job. The job is refused, and nothing runs, in these cases:
- a job-wide rule refuses it (the kill switch,
checks.allow,tools.allow,allow_custom_templates, aportssetting); - every target is refused;
- the single target of a single-target tool is refused;
- one target of a retest or a validation is refused.
The job is then reported failed with a reason the platform shows. The task's log has the same lines, so "no logs" never hides a refusal. Examples:
refused by local policy: targets.deny: 203.0.113.9 (resolved from db.example.com) is in 203.0.113.0/24
refused by local policy: targets.allow: 192.0.2.1 is not in an allowed range
refused by local policy: ports.allow: port 22 is not in 80,443,8000-8999
refused by local policy: tools.allow: naabu is not allowed on this sensor
refused by local policy: kill_switch: kill switch file /etc/openctem/STOP is present
refused by local policy: targets: 2 target(s) refused: "api.example.com" (unresolvable), "*.example.com" (wildcard_pattern)
allow_interactsh: false is not on this list: it narrows the job instead.
The scan runs without callbacks and its result carries
oob: {"state": "unavailable", "reason": "local_policy"}.
sensor policy explain -target T prints the rule and the per-target reason,
for example rule targets (unresolvable).
The rule names the key to change if the job should run. The platform's own
settings (its tool policy, a scan's allow_interactsh, rate_limit,
timeout_seconds) can narrow what the policy allows, never widen it.
touch /etc/openctem/STOP # stop: nothing is claimed, running jobs are stopped rm /etc/openctem/STOP # resume
The sensor checks the file every 2 seconds. While the file exists, the sensor
keeps sending heartbeats with the message paused by local policy, so the
platform shows the sensor as paused rather than offline. Jobs that were
running are reported failed with kill_switch. If the file cannot be checked
(for example, permission denied), the sensor treats the switch as on.
The file's directory must be visible inside the container. Mount the directory, not the file: a file mount cannot appear later.
A local policy is optional and narrow-only. With no policy the sensor
follows the platform's signed scope: it runs any job whose scope statement
the platform signed (the sensor still verifies the signature), the built-in
deny list and SENSOR_ALLOW_PRIVATE_TARGETS still limit targets, and the kill
switch still applies. You do not have to write an allow list to start. A policy
you install narrows that scope (the intersection of the two), never widens it,
and the platform never writes the file. A policy with an explicit
targets.allow: [] allows nothing; a policy without targets.allow does not
narrow targets.
- A job may enable out-of-band callbacks (interactsh, only with this
sensor's own
SENSOR_OOB_SERVER), and custom templates run whenSENSOR_TEMPLATE_SIGNING_KEYSis set. - The sensor reports
local_policy: {"state": "absent", "required": false}.
To fail closed without a file, set SENSOR_REQUIRE_LOCAL_POLICY=true: the
sensor then refuses every job with network targets or custom templates
(and runs jobs without out-of-band callbacks), with the refusal
no_local_policy and a message that
says how to fix it (install a policy file, or set SENSOR_ALLOWED_RANGES).
Jobs without network targets (repository and file scans, health checks) still
run. The sensor reports local_policy.required so the platform can tell the
modes apart.
Trade-off: without a local policy a compromised platform could sign a wide
scope. If you do not trust the platform that far, install a narrowing policy or
set SENSOR_REQUIRE_LOCAL_POLICY=true.
In a policy, custom templates are off unless the policy turns them on;
out-of-band callbacks follow the platform unless the policy sets
allow_interactsh: false.
How to install a policy by hand. (Planned: the platform's sensor install dialog offers the policy as a step of the install command, prefilled from what the platform knows, such as a zone's ranges and the organization's verified domains; the network owner edits and approves it, and the platform never installs or changes it afterwards.)
-
Write the policy from
sensor-policy.example.yaml. -
Defaults for a new install:
allow_custom_templates: false,kill_switch_file: /etc/openctem/STOP, andallow_privateonly for an on-prem zone (withSENSOR_ALLOW_PRIVATE_TARGETS=1). -
Render the mount read-only for each target:
Docker:
install -o root -g root -m 0644 sensor-policy.yaml /etc/openctem/sensor-policy.yaml docker run -d --name openctem-sensor \ -v /etc/openctem:/etc/openctem:ro \ -e SENSOR_API_URL=https://openctem.example.com \ ghcr.io/openctemio/sensor:<tag>
Compose:
services: sensor: image: ghcr.io/openctemio/sensor:<tag> volumes: - /etc/openctem:/etc/openctem:ro
Kubernetes (the platform has no write access to this ConfigMap's namespace or RBAC):
apiVersion: v1 kind: ConfigMap metadata: { name: openctem-sensor-policy } data: sensor-policy.yaml: | apiVersion: openctem.io/sensor-policy/v1 … --- # in the sensor Deployment's pod spec volumes: - name: policy configMap: { name: openctem-sensor-policy, defaultMode: 0444 } containers: - name: sensor volumeMounts: - { name: policy, mountPath: /etc/openctem, readOnly: true }
To stop jobs on Kubernetes, set
kill_switch: truein the ConfigMap and send the sensor SIGHUP (or restart the pod), or name akill_switch_fileon a writable volume that the host owner controls. -
After installation, the sensor page shows the policy state (
enforced,absent, or paused by the kill switch), the digest and the summary.
- The policy checks the targets a job names, every connection made through
the sensor's guarded dialer and the task's egress forwarder, and every port
setting the tool runs with (see
ports.allowabove). Not covered byports.allow: raw-socket scans (a SYN port scan does not pass the forwarder; the sandbox must denyCAP_NET_RAW), a legacy scanner whose traffic does not go through the forwarder (checked at admission only), and a tool setting naming ports under a name the sensor does not recognise and the tool's manifest does not map toports(the forwarder still refuses other ports at connect time for a confined tool). Pair the policy with a host firewall rendered from it (RFC-040 §5.10). - A scanner resolves a host name again when it runs (DNS rebinding window).
The sensor checks a name twice: at admission, and again right before the
scanner starts. A name that resolves into a denied range by then is
skipped (
denied_by_policy). External scanners (nuclei, httpx, ...) then look the name up once more themselves. A name that changes its answer between that last check and the scanner's own lookup is caught only by the guarded dialer and the host firewall. To close the window, list addresses intargets.allowinstead of names. - An unresolvable dotless name (an image reference such as
alpine) reaches no target network and is not checked againsttargets.allow.