From 1d2574acd9df46aa0f3899f1bb47d5b6bcc3b320 Mon Sep 17 00:00:00 2001 From: Nguyen Manh <18032641+0xmanhnv@users.noreply.github.com> Date: Wed, 2 Dec 2026 04:48:19 +0000 Subject: [PATCH 1/3] docs(developers): write an attack-surface source adapter Signed-off-by: Nguyen Manh <18032641+0xmanhnv@users.noreply.github.com> --- developers/attack-surface-source-adapter.md | 138 ++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 developers/attack-surface-source-adapter.md diff --git a/developers/attack-surface-source-adapter.md b/developers/attack-surface-source-adapter.md new file mode 100644 index 0000000..9bccb1d --- /dev/null +++ b/developers/attack-surface-source-adapter.md @@ -0,0 +1,138 @@ +--- +title: Write an attack-surface source adapter +parent: Developers +nav_order: 11 +--- +{% raw %} + +# Write an attack-surface source adapter + +An edge sensor watches your internet-facing assets from outside your network and brings the +results in. What it observes comes from a **source adapter**. The sensor's own discovery tools +are one adapter. You can write another, for example one that reads an attack-surface product +you already pay for, and the platform treats its results exactly like the built-in ones. + +The platform never knows which adapter produced a record. It receives sealed pages of +[CTIS](https://github.com/openctemio/ctis) reports, each page labelled with the adapter's id. +You write no platform code and no console code. + +## What an adapter is + +An adapter is a Go type that implements `edgesync.Source` from +[sdk-go](https://github.com/openctemio/sdk-go) (`pkg/edgesync`): + +```go +type Source interface { + // Describe returns the manifest. + Describe() Manifest + // Pull returns observations after cursor (nil: from the start) and the + // cursor to continue from. + Pull(ctx context.Context, run Run, cursor []byte) (Batch, []byte, error) +} +``` + +- `Describe` returns a **manifest**: + - `ID`: a lower-case id such as `acme.asm`; + - `Name`, `Version`; + - `Emits`: the asset types you report (`domain_name`, `ip_address`, `service`, `web_origin`, + `certificate`) and `finding`; + - `Capabilities`: what your adapter does, one kind of act each, at major version 1 (for example + `discover.subdomains@1`); + - `ConfigSchema`: a JSON Schema of your settings. The console renders it as a form. Mark + secrets `"writeOnly": true`; their values are read on the host that runs the adapter, never + sent to the platform; + - `RateLimit`: how fast you call the systems you read; + - `Label`: the provenance label shown on every record ("Acme ASM"). +- `Pull` gets a `Run` and your last cursor: + - `Run.Scope` is the public scope the organization signed: roots, ranges, exclusions and the + entries allowed active checks; + - `Run.Active` is false when active checks are not allowed now; + - `Run.Snapshot` asks for the full picture instead of changes. + + It returns a `Batch` of CTIS reports, items you stopped seeing (`Gone`, which the platform + reads as "not seen", never as "fixed"), and your next cursor (at most 64 KiB). + +## The rules your adapter must follow + +1. **Work only inside the scope.** Ask only about names under `Scope.Roots` and addresses in + `Scope.Ranges`, never anything in `Scope.Exclusions`. Run an active check only where + `Scope.ActiveAllowed` says yes. +2. **Report nothing internal.** The edge filters every report anyway (`edgesync.FilterReport`): + internal addresses (RFC 1918, loopback, link-local, unique local and the rest), internal names + (`.local`, `.internal`, `.corp`, single labels…), names outside the scope and asset types that + are not visible from the internet are dropped and counted. The conformance kit fails an + adapter that emits any of them. +3. **Use the mapping helpers for identity.** `edgesync.DomainAsset`, `AddressAsset`, + `ServiceAsset`, `OriginAsset` and `CertificateAsset` give every asset its canonical value and + reference, so the same host seen by your adapter, the built-in tools and an internal scan + becomes one asset and one finding. `edgesync.Severity`, `CVE` and `CWE` normalize the rest. +4. **Keep credentials on the host.** Your adapter runs on the edge host, or on the relay host + inside your network when the product you read is itself a service on the internet. Read API + keys from files there. Nothing you hold is sent to the platform. +5. **Your data is evidence.** The platform never widens scope, authorizes a scan, overrides a + person's decision or closes another source's finding because of an adapter's record. + +## A minimal adapter + +The SDK ships a skeleton in +[`pkg/edgesync/example`](https://github.com/openctemio/sdk-go/tree/main/pkg/edgesync/example). +Its core: + +```go +func (s *Source) Pull(_ context.Context, run edgesync.Run, _ []byte) (edgesync.Batch, []byte, error) { + r := ctis.NewReport() + r.Metadata.Channel = ctis.ChannelCollector + r.Tool = &ctis.Tool{Name: "acme-asm", Version: "1.0.0"} + for _, rec := range s.records() { // your API call + if !run.Scope.InScope(rec.Host) { + continue + } + host, err := edgesync.DomainAsset(rec.Host) + if err != nil { + continue + } + r.Assets = append(r.Assets, host) + if rec.Issue != "" { + r.Findings = append(r.Findings, ctis.Finding{ + Type: ctis.FindingTypeMisconfiguration, Title: rec.Issue, + Severity: edgesync.Severity(rec.Severity), AssetRef: host.ID, + }) + } + } + return edgesync.Batch{Reports: []*ctis.Report{r}, Complete: true}, s.nextCursor(), nil +} +``` + +## Prove it with the conformance kit + +Every adapter must pass `pkg/edgesync/conformance`: + +```go +func TestConformance(t *testing.T) { + conformance.Run(t, acme.New(testConfig), conformance.Options{}) +} +``` + +It checks: + +- the manifest; +- valid CTIS; +- only the declared types; +- nothing internal and nothing outside the scope; +- references from the mapping helpers; +- the same assets on two pulls from the start; +- `Gone` entries; +- the cursor resumes; +- a passive run works. + +The default scope uses the documentation names and ranges (`example.com`, `example.net`, +`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`, `2001:db8::/32`). Feed your adapter +recorded answers from those, never real customer data. + +## Ship it + +Ship an adapter as its own container image or binary, signed with cosign, the same way the +[Tenable.sc connector](../sensors/connector-tenable.md) ships. The kit verifies the signature +before it runs anything. An organization enables an adapter per link in the console. + +{% endraw %} From e2baf1c9f3ef94f347539aa5e9e23f49eb1c4271 Mon Sep 17 00:00:00 2001 From: Nguyen Manh <18032641+0xmanhnv@users.noreply.github.com> Date: Wed, 2 Dec 2026 06:04:40 +0000 Subject: [PATCH 2/3] docs(sensors): run attack-surface scanning outside your network and bring the results in A how-to section under Sensors, External scanning: an index (how it works, pick a mailbox, the console steps, security, troubleshooting) and one page per mailbox (storage bucket, private tunnel with WireGuard, public address with its warning, folder for air-gapped sites), each with the kit command and the one-line docker run. The pages say the feature ships with the sensor and OpenCTEM release that adds edge mode. The architecture overview, the sensors index and the network page now say that an edge sensor never connects to the platform, that the outbox is the only listener and only on the edge host, and that the platform makes no new outbound connection. Signed-off-by: Nguyen Manh <18032641+0xmanhnv@users.noreply.github.com> --- overview/architecture.md | 6 +- sensors/external-scanning/bucket.md | 181 ++++++++++++++++++++ sensors/external-scanning/folder.md | 68 ++++++++ sensors/external-scanning/index.md | 154 +++++++++++++++++ sensors/external-scanning/public-address.md | 91 ++++++++++ sensors/external-scanning/wireguard.md | 132 ++++++++++++++ sensors/index.md | 6 +- sensors/network.md | 18 ++ 8 files changed, 654 insertions(+), 2 deletions(-) create mode 100644 sensors/external-scanning/bucket.md create mode 100644 sensors/external-scanning/folder.md create mode 100644 sensors/external-scanning/index.md create mode 100644 sensors/external-scanning/public-address.md create mode 100644 sensors/external-scanning/wireguard.md diff --git a/overview/architecture.md b/overview/architecture.md index cfefc4f..e4a29af 100644 --- a/overview/architecture.md +++ b/overview/architecture.md @@ -77,7 +77,9 @@ The subgraphs are the trust boundaries. The platform runs in the operator's network and accepts connections only through the gateway. The platform console has its own site on the gateway (a port, by default 8443, or its own host name), open only to the networks the operator allows. Sensors run in the -networks they scan and only connect out. CI jobs run at the CI provider and +networks they scan and only connect out. An edge sensor, on an internet host +outside your network, never connects to the platform at all: it leaves sealed +results in a mailbox, and a sensor inside your network brings them in. CI jobs run at the CI provider and prove who they are with the provider's OIDC token. The platform never opens a connection to a sensor or a CI job, and never sends probes to targets itself. @@ -147,6 +149,7 @@ Details: [scan-lifecycle.md](https://github.com/openctemio/openctem/blob/develop | Imports | Files from other scanners (Nessus, Qualys, SARIF, trivy, nuclei, ZAP and others) uploaded in the console or the API. | | Connectors and integrations | SCM repositories (GitHub, GitLab), Tenable.sc, DefectDojo, Entra ID identity exposures, SIEM. | | Discovery jobs | Certificate Transparency logs and DNS checks of each organization's own domains, and the automatic coverage loop that plans the checks each asset type needs, run by the API. | +| Edge sensors | An [edge sensor](../sensors/external-scanning/index.md) checks the public scope from outside your network and writes signed, encrypted pages to a mailbox (a bucket, an outbox on the edge host, or a carried folder). A sensor of the organization inside the network carries them to the platform in signed jobs; the platform checks the edge's signature, opens the pages and ingests them as evidence that never widens scope or closes another source's finding. Only the public scope goes the other way. | | Threat intelligence | Vulnerability bundles, EPSS scores and the CISA KEV catalog, refreshed on a schedule (bundles every 20 minutes, KEV hourly, EPSS daily) and used in prioritization. The platform fetches them directly, through an HTTPS proxy, from a bundle directory, or, in relay mode, receives them from one to three platform sensors, so that it makes no outbound request for feeds ([Feeds](../operations/feeds.md)). In every mode it verifies each file against a pinned root key before it imports it. | ### Outputs @@ -267,6 +270,7 @@ flowchart LR | Automation to API | `oct_` API keys are bound to one organization and are read-only on the REST API; SCIM and CI use their own credentials. AI assistants connect to the MCP server with OAuth, as the person who approved them, within the organization's AI policy. | | Sensor to platform | Each sensor has its own key, bound to one organization (a shared sensor to the instance); results are treated as hostile input (validated, size-capped, bound to the key's organization, quarantined when they do not match the task). | | Platform to sensor | A sensor runs only the tools it has, can enforce a local policy set by the network owner (allowed targets, ports, tools, kill switch) whatever the platform sends, and accepts custom scanner templates only when signed. | +| Edge host to platform | No connection: the edge sensor's pages go through a mailbox that sees only ciphertext, signed with the edge key pinned at pairing (a person compares a 12-digit check) and encrypted to the platform. The relay sensor holds no key that opens them. A compromised edge exposes only the public scope and public results it already had. | | Platform to outside services | Outbound URLs and SMTP hosts are checked against private, loopback and metadata addresses before connecting. | Security model and hardening: [Security](../security/index.md). Engineering diff --git a/sensors/external-scanning/bucket.md b/sensors/external-scanning/bucket.md new file mode 100644 index 0000000..49cdc00 --- /dev/null +++ b/sensors/external-scanning/bucket.md @@ -0,0 +1,181 @@ +--- +title: Storage bucket +parent: External scanning +grand_parent: Sensors +nav_order: 1 +description: Bring edge sensor results in through an S3-compatible bucket you own. No port opens anywhere. +--- + +# Storage bucket (recommended) +{: .no_toc } + +{: .note } +> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> [External scanning](index.md). + +The edge sensor writes sealed results into a bucket you own and reads the +sealed scope from it. The relay sensor inside your network reads the results +and writes the scope. Both only make outbound HTTPS requests: **no port opens +on the edge host or in your network.** Any storage with the S3 API works. + +1. TOC +{:toc} + +--- + +## 1. Make the bucket and two sets of keys + +Give each side its own keys and only what it needs; nobody may delete. Replace +`openctem-edge` and `site1` with your bucket and prefix, and the two +principals with yours: + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "EdgeWritesItsOwnObjects", + "Effect": "Allow", + "Principal": { "AWS": "arn:aws:iam::111122223333:user/openctem-edge" }, + "Action": "s3:PutObject", + "Resource": [ + "arn:aws:s3:::openctem-edge/site1/l/*/r/*", + "arn:aws:s3:::openctem-edge/site1/l/*/h/*", + "arn:aws:s3:::openctem-edge/site1/l/*/i/*" + ] + }, + { + "Sid": "EdgeReadsScopeOffersAndItsPages", + "Effect": "Allow", + "Principal": { "AWS": "arn:aws:iam::111122223333:user/openctem-edge" }, + "Action": "s3:GetObject", + "Resource": [ + "arn:aws:s3:::openctem-edge/site1/l/*/s/*", + "arn:aws:s3:::openctem-edge/site1/p/*", + "arn:aws:s3:::openctem-edge/site1/l/*/r/*" + ] + }, + { + "Sid": "RelayReadsEdgeObjects", + "Effect": "Allow", + "Principal": { "AWS": "arn:aws:iam::111122223333:user/openctem-relay" }, + "Action": "s3:GetObject", + "Resource": [ + "arn:aws:s3:::openctem-edge/site1/l/*/r/*", + "arn:aws:s3:::openctem-edge/site1/l/*/h/*", + "arn:aws:s3:::openctem-edge/site1/l/*/i/*" + ] + }, + { + "Sid": "RelayWritesScopeAndOffers", + "Effect": "Allow", + "Principal": { "AWS": "arn:aws:iam::111122223333:user/openctem-relay" }, + "Action": "s3:PutObject", + "Resource": [ + "arn:aws:s3:::openctem-edge/site1/l/*/s/*", + "arn:aws:s3:::openctem-edge/site1/p/*" + ] + }, + { + "Sid": "RelayListsThePrefix", + "Effect": "Allow", + "Principal": { "AWS": "arn:aws:iam::111122223333:user/openctem-relay" }, + "Action": "s3:ListBucket", + "Resource": "arn:aws:s3:::openctem-edge", + "Condition": { "StringLike": { "s3:prefix": ["site1/*"] } } + } + ] +} +``` + +A lifecycle rule clears old objects (the platform applies results within +minutes, so 30 days only clears what nobody needs): + +```json +{ "Rules": [ { "ID": "openctem-edge-30d", "Status": "Enabled", "Filter": { "Prefix": "site1/" }, "Expiration": { "Days": 30 } } ] } +``` + +Turn on versioning or object lock where your storage has it, so even a +stolen key cannot overwrite an object unnoticed. + +## 2. The relay host + +With the kit (keys from your vault: `edge_relay_s3_access_key`, +`edge_relay_s3_secret_key`; bucket settings `edge_relay_s3_endpoint`, +`edge_relay_s3_region`, `edge_relay_s3_bucket`, `edge_relay_s3_prefix`): + +```bash +ansible-playbook -i $INV playbooks/72-edge-relay.yml -K --ask-vault-pass -e apply_edge_relay=true +``` + +By hand: a folder only the sensor's user (999) can read, with the relay's two +key files (one line each, mode 0600) and `mailboxes.json` (0600): + +```json +{ + "mailboxes": { + "edge": { + "type": "s3", + "endpoint": "https://s3.example.com", + "region": "region-1", + "bucket": "openctem-edge", + "prefix": "site1", + "access_key_file": "/etc/openctem/edge/access_key", + "secret_key_file": "/etc/openctem/edge/secret_key" + } + } +} +``` + +Start (or restart) the relay sensor with these added: + +```bash +-e SENSOR_EDGE_MAILBOXES=/etc/openctem/edge/mailboxes.json -v /etc/openctem/edge:/etc/openctem/edge:ro +``` + +The relay refuses to start when the file or a key file can be read by others. + +## 3. Add the edge in the console + +Settings > Integrations > External scanning > **Add an edge sensor**, mailbox +**Storage bucket**, mailbox name `edge`. Copy the command. + +## 4. The edge host + +With the kit (the edge's own keys in your vault: `edge_sensor_s3_access_key`, +`edge_sensor_s3_secret_key`; the same bucket settings as `edge_sensor_s3_*`): + +```bash +ansible-playbook -i $INV playbooks/70-edge-sensor.yml -K --ask-vault-pass -e apply_edge_sensor=true -e edge_pair_code=XXXX-XXXX-XXXX-XXXX +``` + +The play verifies the signed images, sets the host firewall to SSH from your +administrators only, pairs, prints the check, and starts the edge. + +By hand: write the sensor's seccomp profile, and the edge's bucket settings +in `/etc/openctem-edge` (folder 0700 and files 0600, owner 999; the same JSON +as the relay's, with the edge's key files): + +```bash +docker run --rm ghcr.io/openctemio/sensor: seccomp-profile > /etc/openctem-edge/sensor-seccomp.json +docker run -d --name openctem-edge --restart unless-stopped --read-only --tmpfs /tmp --cap-drop ALL --security-opt no-new-privileges --security-opt seccomp=/etc/openctem-edge/sensor-seccomp.json -v openctem-edge:/var/lib/openctem -v /etc/openctem-edge:/etc/openctem-edge:ro -e SENSOR_EDGE_MAILBOX=/etc/openctem-edge/mailbox.json -e SENSOR_EDGE_PAIR_CODE=XXXX-XXXX-XXXX-XXXX ghcr.io/openctemio/sensor: edge run +``` + +`docker logs openctem-edge` shows the check. Pin ``; never run +`latest` in production. Block every inbound port on the edge host except SSH +from your administrators. + +## 5. Compare and approve + +Compare the 12-digit check printed on the edge host with the one in the +console. Only when they match, choose **The check matches. Approve**. + +## Troubleshooting + +| What you see | What to do | +|---|---| +| The relay logs `HTTP 403` from the bucket | The relay's keys lack an action of the policy above. A missing object also answers 403 without the list permission, which is fine. | +| `no pairing offer for this code in the mailbox yet` | The edge and the relay use different buckets or prefixes, or the relay sensor was not restarted with its mailbox file. | +| `must not be readable by others (chmod 600)` | A key file or the mailbox file is too open: `chmod 600` it and keep its folder 0700. | + +More: [External scanning troubleshooting](index.md#troubleshooting). diff --git a/sensors/external-scanning/folder.md b/sensors/external-scanning/folder.md new file mode 100644 index 0000000..8bcaf2f --- /dev/null +++ b/sensors/external-scanning/folder.md @@ -0,0 +1,68 @@ +--- +title: Folder (air-gapped) +parent: External scanning +grand_parent: Sensors +nav_order: 4 +description: Carry edge sensor results into an air-gapped site on a disk. +--- + +# Folder for air-gapped sites +{: .no_toc } + +{: .note } +> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> [External scanning](index.md). + +For a site with no network path at all: the edge sensor writes its sealed +results into a folder, a person carries the folder to the relay host inside +the site, and carries it back with the scope. The objects are signed and +encrypted, so the disk holds ciphertext only. No port opens anywhere. + +1. TOC +{:toc} + +--- + +## With the kit + +On the **edge host** set `edge_sensor_mode: dir`; the folder is +`/srv/openctem-edge/dir`. On the **relay host** set `edge_relay_mode: dir` +and `edge_relay_dir_path` to the folder as the relay sensor sees it, and +mount that folder into the relay sensor. + +```bash +ansible-playbook -i $INV playbooks/72-edge-relay.yml -K -e apply_edge_relay=true -e edge_relay_mode=dir -e edge_relay_dir_path=/srv/openctem-edge-carry +ansible-playbook -i $INV playbooks/70-edge-sensor.yml -K -e apply_edge_sensor=true -e edge_sensor_mode=dir -e edge_pair_code=XXXX-XXXX-XXXX-XXXX +``` + +## By hand + +Edge host: + +```bash +docker run -d --name openctem-edge --restart unless-stopped --read-only --tmpfs /tmp --cap-drop ALL --security-opt no-new-privileges --security-opt seccomp=/etc/openctem-edge/sensor-seccomp.json -v openctem-edge:/var/lib/openctem -v /srv/openctem-edge/dir:/srv/mailbox -e SENSOR_EDGE_MAILBOX=dir:/srv/mailbox -e SENSOR_EDGE_PAIR_CODE=XXXX-XXXX-XXXX-XXXX ghcr.io/openctemio/sensor: edge run +``` + +Relay host: a mailbox file (0600) with `"type": "dir"` and the folder's path, +and the relay sensor started with +`-e SENSOR_EDGE_MAILBOXES=/etc/openctem/edge/mailboxes.json -v /etc/openctem/edge:/etc/openctem/edge:ro` +and the folder mounted: + +```json +{ "mailboxes": { "edge": { "type": "dir", "path": "/srv/openctem-edge-carry" } } } +``` + +## Pairing across the gap + +Pairing needs one round trip: add the edge in the console (mailbox +**Folder**), carry the folder with the relay's offer to the edge host, run +the command, carry the folder back. The console then shows the check to +compare with the one the edge printed. The code expires 30 minutes after you +add the edge, so the edge must read the offer within that time: plan the +first crossing for it. If it takes longer, add the edge again for a new +code and carry the folder with the new offer. + +The edge deletes the results the platform confirmed it applied, so the +folder does not grow without end. + +More: [External scanning troubleshooting](index.md#troubleshooting). diff --git a/sensors/external-scanning/index.md b/sensors/external-scanning/index.md new file mode 100644 index 0000000..127148e --- /dev/null +++ b/sensors/external-scanning/index.md @@ -0,0 +1,154 @@ +--- +title: External scanning +parent: Sensors +nav_order: 7.8 +has_children: true +description: Run attack-surface scanning on a host outside your network and bring the results in, with nothing internal leaving. +--- + +# Run attack-surface scanning outside your network and bring the results in +{: .no_toc } + +{: .note } +> This section describes edge mode, which ships with the sensor and OpenCTEM +> release that adds it. Check the release notes of your version: an older +> console has no **External scanning** card, and the kit's edge plays refuse +> to run without that sensor release. + +An **edge sensor** runs on a host outside your network, for example a small +cloud server. It checks your internet-facing names and addresses the way +anyone on the internet can see them, and its results come back into the +platform inside your network. Nothing internal goes to that host, and the +platform still never connects out. + +1. TOC +{:toc} + +--- + +## How it works + +```mermaid +flowchart LR + subgraph inet["Internet"] + E["Edge sensor
(keys stay here)"] + M[("Mailbox:
bucket, outbox
or folder")] + T["Your public
names and addresses"] + end + subgraph net["Your network"] + R["Relay sensor
(no key of the link)"] + P["Platform"] + end + E -->|"checks inside the scope"| T + E -->|"sealed results"| M + M -->|"sealed scope"| E + R -->|"dials out, fetches results,
puts the scope"| M + R -->|"sealed bytes, in jobs
the platform signed"| P +``` + +- The **platform** decides the scope it sends: your public names and ranges, + the names you allow active checks on, and the pace. Internal names and + private ranges are left out before anything is sealed. +- The **edge sensor** works only inside that scope. It signs each batch of + results with its own key and encrypts it to the platform. +- The **mailbox** carries the sealed objects. It sees only ciphertext: it can + delay or lose objects, but it cannot read, change, replay or reorder them + without the platform noticing. +- The **relay sensor** is an ordinary sensor of your organization inside your + network. It moves the sealed objects between the mailbox and the platform, + and holds no key that opens them. It dials out; nothing dials in. + +## Pick a mailbox + +| Mailbox | Use when | Open on the edge host | Page | +|---|---|---|---| +| Storage bucket (recommended) | you have object storage with the S3 API | nothing | [Storage bucket](bucket.md) | +| Private tunnel with WireGuard | there is no bucket | the WireGuard UDP port only | [Private tunnel](wireguard.md) | +| Public address | no bucket and no WireGuard | **TCP 443, to the addresses you list** | [Public address](public-address.md) | +| Folder | an air-gapped site | nothing | [Folder](folder.md) | + +Nothing is opened on any host inside your network in any mode. + +## What you need + +- A host on the internet for the edge sensor: Linux 5.13 or later with + Docker, a public address, and SSH from your administrators only. +- A sensor of your organization inside your network to act as the relay + ([Run the sensor](../run-the-sensor.md)). It needs outbound access to the + mailbox (the bucket, or the edge host over the tunnel or port 443). +- For the kit commands, the + [openctem-ansible](https://github.com/openctemio/openctem-ansible) kit + (`playbooks/70-edge-sensor.yml` on the edge host, + `playbooks/72-edge-relay.yml` on the relay host; its + `docs/EDGE-SENSOR.md` has every variable). + +## In the console + +1. Go to **Settings > Integrations > External scanning** and choose + **Add an edge sensor**. +2. Pick how the results travel (the mailbox), the relay sensor, and the + mailbox name (the same name as in the relay sensor's mailbox file, `edge` + by default). +3. Copy the command the console shows and run it on the edge host (the + pages of each mailbox have the kit command and the one-line + `docker run`). The code in it works once and expires after 30 minutes. +4. The edge host prints a **12-digit check**. The console shows a check for + the edge that answered. Compare the two digit by digit. +5. Only when they match, choose **The check matches. Approve** and confirm + your identity again. The first scope document goes out and the edge + starts. + +The card then shows the edge's status (Connected, Waiting for the edge, +Behind by some hours, or Stopped with the reason), when results last +arrived, what was left out of the scope sent to the edge, and names the edge +saw outside your scope for you to review. **Disconnect this edge** stops it +at once: the platform stops using the link and drops its keys, and the edge +deletes its keys and state when it reads that. + +## Security + +**What leaves your network.** Only the scope document: public root names, +public ranges, exclusions, the names you allow active checks on, and the +pace. No internal name, no private range, no finding, no identifier of yours. +The console lists what it left out. The edge refuses a scope document that +holds an internal entry. + +**What the edge sends.** Sealed results to the mailbox, and the requests its +tools make inside the scope. No telemetry and no error reports. + +**If the edge host is compromised,** an attacker learns what it already had: +your public scope and the results about it, which anyone on the internet +could gather. They cannot read anything from your network, reach the +platform or widen the scope, and the platform refuses results that the paired +edge key did not sign. + +**Evidence, never authority.** Edge results enter like any other source, +labelled with the edge sensor. They never widen your scope (a new name +becomes a suggestion you review), never authorize a scan, never confirm that +an asset is yours on their own, never override a person's decision, and +never close another source's finding. "No longer seen" by the edge marks its +own record stale; it never means fixed. + +**If the mailbox is compromised** (a stolen bucket key, the outbox host), it +holds ciphertext only. It can delay or drop objects; the platform notices a +gap and the card shows the delay. + +**Pairing.** Each side makes its own keys. There is no shared secret and no +bearer token. The 12-digit check you compare protects against someone +answering the code in place of your edge. + +## Troubleshooting + +| What you see | What to do | +|---|---| +| The edge prints `no pairing offer for this code in the mailbox yet` | The relay sensor puts the offer in the mailbox within a few minutes of adding the edge. Check that the relay sensor runs with its mailbox file and the same mailbox name, bucket and prefix as the edge. If 30 minutes passed, add the edge again for a new code. | +| The edge waits with `waiting for the first scope document` | Approve it in the console after comparing the check. | +| The two checks differ | Do not approve. Disconnect the pending edge, and check who else could have run the code. | +| The card shows **Waiting for the edge** for long | The edge has not written its first answer: see its log (`docker logs openctem-edge`) and the relay sensor's log. | +| The card shows **Behind** | Results are late: the mailbox, the tunnel or the edge host is down, or the relay sensor is offline. | +| The card shows **Stopped: signature not valid** | Something in the mailbox was not signed by the paired edge. Disconnect the edge, check the edge host, and pair again. | +| The edge log says `a tool sandbox control is missing on this host` | Run the edge with the sensor's seccomp profile on Linux 5.13 or later; until then only passive discovery runs. | +| The edge log says `an edge checks public addresses only` | Unset `SENSOR_ALLOW_PRIVATE_TARGETS` on the edge host. | +| `this edge is already paired` | Disconnect it in the console first; the edge then deletes its state, and a new code pairs it again. | + +Mailbox-specific problems are on each mailbox's page. diff --git a/sensors/external-scanning/public-address.md b/sensors/external-scanning/public-address.md new file mode 100644 index 0000000..f0423cb --- /dev/null +++ b/sensors/external-scanning/public-address.md @@ -0,0 +1,91 @@ +--- +title: Public address +parent: External scanning +grand_parent: Sensors +nav_order: 3 +description: Bring edge sensor results in through the outbox on TCP 443 of the edge host, open only to the addresses you list. +--- + +# Public address (opens a port) +{: .no_toc } + +{: .note } +> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> [External scanning](index.md). + +{: .warning } +> **This opens port 443 on the edge host.** Use it only when there is no +> bucket and WireGuard is not possible. Only the relay's pinned key can +> connect, every request is signed, and only the addresses you list get past +> the firewall and the outbox; still, the port is visible to those addresses. + +The outbox (a separate container with no scanning tool and no key of the +link) answers on TCP 443 of the edge host. Unknown clients are refused +during the TLS handshake. The certificate is self-signed and pinned by the +relay, so the edge host's name appears in no public certificate log. Nothing +opens in your network: the relay sensor connects out. + +1. TOC +{:toc} + +--- + +## With the kit + +Set `edge_outbox_allow_from` to the public address range your relay host +connects from (the play refuses to open the port without it, and refuses +`0.0.0.0/0`). `$INV` is your inventory. + +1. **Relay host**: makes the relay's outbox key and prints its pin: + + ```bash + ansible-playbook -i $INV playbooks/72-edge-relay.yml -K -e apply_edge_relay=true -e edge_relay_mode=public + ``` + +2. **Edge host**: installs the edge and the outbox from signed images, sets + the firewall (SSH from your administrators; TCP 443 from the listed + addresses only, to the outbox), prints the warning and the outbox + certificate: + + ```bash + ansible-playbook -i $INV playbooks/70-edge-sensor.yml -K -e apply_edge_sensor=true -e edge_sensor_mode=public \ + -e '{"edge_outbox_allow_from": ["203.0.113.0/28"], "edge_sensor_outbox_client_pins": ["sha256:"]}' + ``` + +3. **Relay host** again with the edge's address and certificate; then restart + the relay sensor with its mailbox file (as on [Storage bucket](bucket.md#2-the-relay-host)): + + ```bash + ansible-playbook -i $INV playbooks/72-edge-relay.yml -K -e apply_edge_relay=true -e edge_relay_mode=public \ + -e edge_relay_outbox_host=198.51.100.20 -e edge_relay_outbox_server_cert= + ``` + +4. **Console**: Settings > Integrations > External scanning > **Add an edge + sensor**, mailbox **Public address**, mailbox name `edge`. The console + shows the same warning. Copy the code. +5. **Edge host** once more with `-e edge_pair_code=XXXX-XXXX-XXXX-XXXX`; + compare the 12-digit check; choose **The check matches. Approve**. + +## By hand + +The steps are those of [the private tunnel](wireguard.md#by-hand) without +WireGuard. Start the outbox on all interfaces with `--public` and your relay's +range (it prints the warning again when it starts): + +```bash +docker run -d --name openctem-outbox --restart unless-stopped -p 443:8443 --read-only --cap-drop ALL --security-opt no-new-privileges -v /srv/openctem-outbox:/etc/openctem-outbox:ro -v /srv/openctem-edge/outbox:/srv/outbox:ro -v /srv/openctem-edge/inbox:/srv/inbox ghcr.io/openctemio/sensor:-outbox --listen 0.0.0.0:8443 --public --allow-from 203.0.113.0/28 --outbox-dir /srv/outbox --inbox-dir /srv/inbox --tls-key-file /etc/openctem-outbox/tls.key --client-pin +``` + +Allow the same range in the edge host's firewall and nothing else but SSH +from your administrators. The relay's mailbox file names +`https://` as the `url`. + +## Troubleshooting + +| What you see | What to do | +|---|---| +| The relay cannot connect | Its public address is not inside the allowed range (both the firewall and the outbox check it), or the edge host's provider blocks TCP 443. | +| The outbox exits with `reachable from outside a private network` | `--public` and at least one `--allow-from` are needed for an all-interfaces address. | +| The kit refuses with `needs edge_outbox_allow_from` | List your relay's public range; the whole internet is refused. | + +More: [External scanning troubleshooting](index.md#troubleshooting). diff --git a/sensors/external-scanning/wireguard.md b/sensors/external-scanning/wireguard.md new file mode 100644 index 0000000..fe43bca --- /dev/null +++ b/sensors/external-scanning/wireguard.md @@ -0,0 +1,132 @@ +--- +title: Private tunnel (WireGuard) +parent: External scanning +grand_parent: Sensors +nav_order: 2 +description: Bring edge sensor results in through a small outbox on the edge host, reachable only inside a WireGuard tunnel your network dials. +--- + +# Private tunnel with WireGuard (no bucket) +{: .no_toc } + +{: .note } +> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> [External scanning](index.md). + +Use this when you have no bucket. A second, separate container on the edge +host, the **outbox**, serves the edge's sealed results and accepts sealed +scope documents. It runs no scanning tool, holds no key of the link, and +listens only on the tunnel address (`10.77.0.1:8443` by default). The edge +host opens only the WireGuard UDP port (51820), which answers nothing to a +packet without a valid key. The relay host brings the tunnel up from inside +your network; **nothing opens in your network.** + +1. TOC +{:toc} + +--- + +## With the kit (three runs, one value copied each way) + +Each side makes its own keys and prints only public values, like an SSH host +key you confirm once. `$INV` is your inventory. + +1. **Relay host**: makes the relay's WireGuard key and outbox key, prints + the WireGuard public key and the outbox key's pin (`sha256:...`): + + ```bash + ansible-playbook -i $INV playbooks/72-edge-relay.yml -K -e apply_edge_relay=true -e edge_relay_mode=wireguard + ``` + +2. **Edge host**, with those two values: installs the edge and the outbox + from signed images, brings up the tunnel interface, sets the firewall + (SSH from your administrators, UDP 51820, the outbox only from the relay's + tunnel address), prints the edge's WireGuard public key and the outbox + certificate: + + ```bash + ansible-playbook -i $INV playbooks/70-edge-sensor.yml -K -e apply_edge_sensor=true -e edge_sensor_mode=wireguard \ + -e edge_sensor_wg_relay_public_key= -e '{"edge_sensor_outbox_client_pins": ["sha256:"]}' + ``` + +3. **Relay host** again, with the edge's values: brings the tunnel up (it + dials out, with a keepalive) and writes the relay sensor's mailbox file: + + ```bash + ansible-playbook -i $INV playbooks/72-edge-relay.yml -K -e apply_edge_relay=true -e edge_relay_mode=wireguard \ + -e edge_relay_wg_edge_public_key= -e edge_relay_wg_endpoint=198.51.100.20:51820 \ + -e edge_relay_outbox_server_cert= + ``` + + Restart the relay sensor with + `-e SENSOR_EDGE_MAILBOXES=/etc/openctem/edge/mailboxes.json -v /etc/openctem/edge:/etc/openctem/edge:ro` + (or set `edge_relay_sensor_container` and `edge_relay_restart_sensor: true`). + +4. **Console**: Settings > Integrations > External scanning > **Add an edge + sensor**, mailbox **Private tunnel**, mailbox name `edge`. Copy the code. +5. **Edge host** once more with `-e edge_pair_code=XXXX-XXXX-XXXX-XXXX`. It + pairs, prints the 12-digit check, and starts the edge. +6. Compare the check with the console's and choose **The check matches. + Approve**. + +Keep the copied values in each host's inventory variables so later runs need +no `-e`. + +## By hand + +Bring up WireGuard yourself (the edge host listens on UDP 51820 with address +`10.77.0.1`; the relay host dials it with address `10.77.0.2`, `AllowedIPs` +of the other side's address only). Then, on the **edge host**: + +```bash +install -d -o 999 -g 999 -m 0700 /srv/openctem-edge/outbox /srv/openctem-edge/inbox /srv/openctem-outbox +docker run --rm --read-only --cap-drop ALL --security-opt no-new-privileges -v /srv/openctem-outbox:/etc/openctem-outbox ghcr.io/openctemio/sensor:-outbox init --tls-key-file /etc/openctem-outbox/tls.key +``` + +`init` prints the certificate the relay pins. On the **relay host**, make the +relay's outbox key (it prints the pin): + +```bash +docker run --rm -v openctem-sensor-data:/var/lib/openctem ghcr.io/openctemio/sensor: edge relay-key +``` + +Back on the **edge host**, start the outbox with that pin, then the edge +(the console's code in the edge command): + +```bash +docker run -d --name openctem-outbox --restart unless-stopped --network host --read-only --cap-drop ALL --security-opt no-new-privileges -v /srv/openctem-outbox:/etc/openctem-outbox:ro -v /srv/openctem-edge/outbox:/srv/outbox:ro -v /srv/openctem-edge/inbox:/srv/inbox ghcr.io/openctemio/sensor:-outbox --outbox-dir /srv/outbox --inbox-dir /srv/inbox --tls-key-file /etc/openctem-outbox/tls.key --client-pin +docker run -d --name openctem-edge --restart unless-stopped --read-only --tmpfs /tmp --cap-drop ALL --security-opt no-new-privileges --security-opt seccomp=/etc/openctem-edge/sensor-seccomp.json -v openctem-edge:/var/lib/openctem -v /srv/openctem-edge/outbox:/srv/outbox -v /srv/openctem-edge/inbox:/srv/inbox:ro -e SENSOR_EDGE_MAILBOX=outbox:/srv/outbox -e SENSOR_EDGE_INBOX=/srv/inbox -e SENSOR_EDGE_PAIR_CODE=XXXX-XXXX-XXXX-XXXX ghcr.io/openctemio/sensor: edge run +``` + +(`sensor-seccomp.json` comes from `docker run --rm ghcr.io/openctemio/sensor: seccomp-profile`.) +The relay's mailbox file (0600) names the outbox by its tunnel address: + +```json +{ + "mailboxes": { + "edge": { + "type": "outbox", + "url": "https://10.77.0.1:8443", + "key_file": "/var/lib/openctem/state/edge-outbox.key", + "server_cert": "" + } + } +} +``` + +Both sides are pinned: the outbox refuses any client whose key it was not +given during the TLS handshake, and the relay accepts only the certificate it +was given. No public certificate authority is involved, so the edge host's +name appears in no public certificate log. + +## Troubleshooting + +| What you see | What to do | +|---|---| +| The outbox exits with `reachable from outside a private network` | Its listen address is all interfaces or public. Keep the default tunnel address, or use [Public address](public-address.md). | +| The outbox exits with `holds a key file` | A `*.key` file is in the outbox or inbox folder. Keys belong only in the edge's state volume and the outbox's own key folder. | +| The relay cannot connect to `10.77.0.1:8443` | The tunnel is down: `wg show` on both hosts should show a recent handshake. Check the edge's public address and UDP 51820 in the relay's config, and that both public keys were copied the right way round. | +| The relay's TLS handshake fails | The certificate in the relay's mailbox file is not the one `init` printed, or the outbox was started without the relay's pin. | +| The kit says `Waiting for the relay` or `Waiting for the edge` | Run the other host's play with the values printed, as in the steps above. | + +More: [External scanning troubleshooting](index.md#troubleshooting). diff --git a/sensors/index.md b/sensors/index.md index 055dbc1..88596be 100644 --- a/sensors/index.md +++ b/sensors/index.md @@ -22,6 +22,7 @@ inside is described in [How sensors work](how-it-works.md). | You want to | Use | Runs where | Start here | |---|---|---|---| | Scan hosts, web applications and networks the platform cannot reach (ports, HTTP, nuclei templates, subdomains) | **Sensor** (`openctemio/sensor`) | A host or cluster inside the network to scan | [Quickstart](#quickstart-a-working-sensor-in-five-minutes) | +| Check your internet-facing names and addresses from outside, with the results brought in and nothing internal leaving | **Edge sensor** (the sensor in edge mode) and a sensor inside your network as the relay | A host on the internet | [External scanning](external-scanning/index.md) | | Bring in the inventory of systems you run (VMware vCenter, Active Directory, Google Cloud DNS, Splunk, PRTG) | **Asset collector** (`ghcr.io/openctemio/asset-collector`, private image) | A host that can reach those systems | [Asset collector](asset-collector.md) | | Bring in a Tenable Security Center you run (its findings, and scans launched from OpenCTEM) | **Tenable.sc connector** (`openctemio/connector-tenable`) | A host or cluster that can reach your Tenable.sc | [Tenable.sc connector](connector-tenable.md) | | Scan code and dependencies in a pipeline | **CI integration** (no sensor) | GitHub Actions or GitLab CI | [CI integration](../scanning/ci-integration.md) | @@ -29,7 +30,10 @@ inside is described in [How sensors work](how-it-works.md). | Follow public bug-bounty and disclosure programs | **Program feed** (`openctemio/programfeed`) | Nothing to install: the platform imports signed bundles | [Vulnerability and program feeds](../operations/feeds.md) | A sensor connects out to the platform, needs no inbound port and appears -under **Discovery > Sensors**. The feeds are not installed on your hosts at +under **Discovery > Sensors**. To check your public attack surface from +outside your network, an [edge sensor](external-scanning/index.md) on an +internet host hands sealed results to a mailbox, and a sensor inside your +network brings them in; the platform still makes no outbound connection. The feeds are not installed on your hosts at all. 1. TOC diff --git a/sensors/network.md b/sensors/network.md index 13ef126..99723a1 100644 --- a/sensors/network.md +++ b/sensors/network.md @@ -18,6 +18,24 @@ and no route from the platform into your network. | DNS | The resolvers in `/etc/resolv.conf` (the platform host name and targets), or `SENSOR_DNS_RESOLVERS` (dnsx, naabu and subfinder) | Resolving the platform and targets. dnsx, naabu and subfinder never use their built-in public resolver lists. To make the platform connection independent of DNS, pin the platform host ([Platform name resolution](host-requirements.md#platform-name-resolution)) | | Scan | Your targets | The scans themselves | +## Edge sensors and the relay + +An [edge sensor](external-scanning/index.md) runs outside your network and +never connects to the platform. It still only makes outbound connections: + +| Traffic | From | To | Needed for | +|---|---|---|---| +| Mailbox | the edge sensor | the bucket over HTTPS, or a folder on its own host (outbox and folder modes) | Sealed results out, sealed scope in | +| Scan, DNS, content | the edge sensor | your public names and addresses inside the scope; the public sources its discovery tools read; its resolvers | The checks themselves | +| Mailbox | the relay sensor (inside your network) | the bucket over HTTPS, or the edge host's outbox over WireGuard or TCP 443 | Carrying the sealed objects, in jobs the platform signed | + +The edge sensor itself listens on no port. In the private tunnel and public +address modes a separate outbox container on the edge host listens: on the +tunnel address only (the host opens just the WireGuard UDP port), or on TCP +443 open only to the addresses you list. Nothing listens inside your +network, and the platform makes no new outbound connection: the relay sensor +does the mailbox work. + ## The platform URL `SENSOR_API_URL` is the platform's API base URL. With the built-in gateway this is From 18e6f044a24f6f479450406e1842d7b2c0f486a7 Mon Sep 17 00:00:00 2001 From: Nguyen Manh <18032641+0xmanhnv@users.noreply.github.com> Date: Sat, 5 Dec 2026 22:35:12 +0000 Subject: [PATCH 3/3] docs: v0.31.0 and edge mode released with sensor v0.43.0 Edge mode notes now name the releases (sensor v0.43.0, platform v0.31.0). Upgrade rows for v0.30.2 and v0.31.0, sensor v0.43.0 notes, GitLab all-projects connection and New repositories tab, runs per hour limit, refused-token codes, scan export masking, merge request feedback, default branch from GitLab, degraded pipeline reasons, kev_past_due. Signed-off-by: Nguyen Manh <18032641+0xmanhnv@users.noreply.github.com> --- operations/upgrade.md | 2 + scanning/ci-blocked-pr.md | 12 ++++ scanning/ci-integration.md | 63 ++++++++++++++++++++- scanning/ci-troubleshooting.md | 15 ++++- scanning/scans-and-runs.md | 5 +- sensors/external-scanning/bucket.md | 2 +- sensors/external-scanning/folder.md | 2 +- sensors/external-scanning/index.md | 10 ++-- sensors/external-scanning/public-address.md | 2 +- sensors/external-scanning/wireguard.md | 2 +- sensors/operate.md | 3 +- sensors/tool-settings.md | 2 +- user-guide/06-prioritization.md | 4 +- 13 files changed, 110 insertions(+), 14 deletions(-) diff --git a/operations/upgrade.md b/operations/upgrade.md index 2bb1f46..3a358af 100644 --- a/operations/upgrade.md +++ b/operations/upgrade.md @@ -36,6 +36,8 @@ Which sensor, SDK, CI runner and chart releases go with the current platform rel | From | To | Guide | |---|---|---| | CTIS 1.x | CTIS 2.0 | [Migrating to CTIS 2.0](ctis-2-migration.md): platform, sensors, `openctem-ci`, the Tenable connector and the asset collector are upgraded together; data migrates on start; rollback restores the pre-upgrade backup. | +| v0.30.2 | v0.31.0 | Eight additive migrations, which the `migrate` service applies before the API starts: `20261202045211_ci_runs_coverage_gaps` (a column with a constant default, no rewrite), `20261202075851_finding_link_dast_same_check` and `20261202075852_finding_link_dast_same_check_validate` (a widened check, then validated), `20261202083454_asset_technologies_software_links` and `20261202083455_asset_technologies_software_backfill` (marks gone the software whose technology a scan already removed and links stored technologies to their software), `20261204105130_repository_branch_default_source` (a nullable column, no backfill), and `20261205040207_edge_links` and `20261205040208_edge_links_validate` (the tables of [external scanning](/sensors/external-scanning/) and two columns on source records). No configuration change: update the images and nothing else. Before you upgrade, read the behaviour changes. A CI run closes what it proved fixed, so a run that is not a verified push of the default or a protected branch, or whose reports were not all full scans, closes nothing, and an unbound (warn mode) sensor report marks no branch fixed. A GitLab merge request pipeline is never a run of the default branch: if merge request pipelines from a branch named like the default branch ran before the upgrade, review the repository's findings closed by CI and its baseline under CI/CD. A scan export masks credential-looking `scanner_config` values. Two templates that test the same thing show as one issue: findings stored before link on their next scan, or at once with `refingerprint -links` (dry run first, then `-apply`). Edge mode needs sensor v0.43.0 or later; the sensor installed with v0.31.0 is v0.42.1. Every change: [v0.31.0](/operations/releases/v0-31-0/). | +| v0.30.1 | v0.30.2 | A patch release for the dashboard: its change queue no longer sticks on one batch (the log repeated `canceling statement due to user request` and the dashboard numbers stopped updating). One additive migration, `20261204065828_dashboard_dirty_queue_unstick` (one new empty table and function replacements, no data change). No configuration change: update the images and nothing else. A queue that was stuck drains on the first ticks after the upgrade. Every change: [v0.30.2](/operations/releases/v0-30-2/). | | v0.30.0 | v0.30.1 | A security hotfix: no migration and no configuration change; update the images and nothing else, and you can roll back to v0.30.0. Behaviour changes: the threat intel API (`/api/v1/threat-intel/*`, except `/freshness`) needs an active membership and the Threat Intel module (with the module off it answers that the module is not enabled); views that list findings next to another object (IOC matches, an asset's risk explanation, affected assets, asset groups, attack paths, detections) show only the findings the member may see in the findings list; a sensor request started with an enrollment token is approved only while the token is still valid. Every change: [v0.30.1](/operations/releases/v0-30-1/). | | v0.29.0 | v0.30.0 | Three additive migrations, which the `migrate` service applies before the API starts: `20261130095346` (the asset merge log records the private programs involved), `20261202024619_decision_review_proof_reasons` and `20261202024620_decision_review_proof_reasons_validate` (the review reason check is widened, then validated: no data change) and `20261202033604_finding_decision_seen_counter` (two counter columns on findings, filled from the next scan, and a trigger that resets the count when a decision changes). No configuration change: update the images and nothing else. Before you upgrade, read the three behaviour changes: a CI job started by a comment needs **Admit fork pull requests** on its trust configuration, proof reopens a finding marked not a real issue even when two people approved it, and `POST /api/v1/commands` with type `scan` answers 409 while scan approval is On or Strict. A restore with `backup.sh` needs free disk space for a second copy of the database ([Backup and restore](/operations/backup-restore/)). Every change: [v0.30.0](/operations/releases/v0-30-0/). | | v0.28.0 | v0.29.0 | Five additive migrations, which the `migrate` service applies before the API starts: `20261130015036_approval_signoffs_keep_after_erasure` (the sign-off key clears the person instead of deleting the sign-off: no row is rewritten), `20261130015636_suppression_rules_soft_delete` (nullable `deleted_at` and `deleted_by` and the `deleted` status), `20261130025903_organization_purging_status` (the `purging` organization status), `20261130070726_finding_flow_location_context` (the code around a data flow step) and `20261130092933_trust_request_answers` (`tenant_trusts.home_domain` and a request log). Update the images and nothing else. Rolling back the suppression migration removes the rules marked deleted. Run `openctem-ci` v0.5.1 only against v0.29.0 or later ([CI upgrade](/scanning/ci-reference/#upgrade-from-v040-to-v050)). Every change: [v0.29.0](/operations/releases/v0-29-0/). | diff --git a/scanning/ci-blocked-pr.md b/scanning/ci-blocked-pr.md index 6aac64d..132466e 100644 --- a/scanning/ci-blocked-pr.md +++ b/scanning/ci-blocked-pr.md @@ -28,6 +28,18 @@ failed, and what to do next. blocking. - **Details** on the check opens the run in the console. +The comment never notifies anybody: scanner text is escaped, so a finding +title with an at sign (`@all`) mentions nobody, and `%`, `$` and `:` cannot +start a milestone, snippet, math or emoji reference or a scheme link +(platform v0.31.0 and later). A pull request that is closed, merged or locked +gets no comment (the check or commit status is still set, and the run says why +the comment was skipped). When the code host refuses the status, check or +note, the run's feedback state says what to change: an expired or revoked +GitLab token, the `api` scope and Developer role a GitLab group access token +needs, a project outside the connected group, or the GitHub App permissions +(Checks and Pull requests: write). Rate limits and server errors are retried +with backoff. + ## Read the run The run sheet shows the verdict, the policy that applied, how many findings diff --git a/scanning/ci-integration.md b/scanning/ci-integration.md index 3eb069a..ad4225e 100644 --- a/scanning/ci-integration.md +++ b/scanning/ci-integration.md @@ -262,6 +262,14 @@ entry is split at `/` into parts: - A GitHub pull request is matched as `pull/`, never as its head branch: `feature/*` does not admit a pull request from `feature/login`. Add `pull/*` to admit pull requests. +- A GitLab merge request pipeline never counts as a run of the default + branch, even when its source branch is named like it (a fork's `main`): + such a run is recorded under `merge-requests/source/`, and its + results never become default-branch exposure, close findings or set the + first baseline (platform v0.31.0 and later). When one of your GitLab + connections holds the project, the platform reads the pipeline the token + signs from GitLab, so the merge request gets its note and its target + branch is the baseline. - A GitLab merge request pipeline is matched on its source branch. When the job's token names the merge request instead (`refs/merge-requests//head`), it is matched as @@ -408,11 +416,53 @@ requests and metadata. **Connect GitLab group** takes a **group access token** (Developer role, `api` scope). A project access token also works. A personal access token is refused, so the status is never posted as a person and does not depend on -anyone's membership. A connection made earlier with a personal token keeps +anyone's membership. The GitLab address may carry a port and a path +(`example.com:8443/gitlab`) for an instance under a relative URL root; it is +still https only. A connection made earlier with a personal token keeps working until it is removed; reconnect it with a group access token. ![The Connect GitLab group dialog: host, group path and group access token]({{ site.baseurl }}/assets/images/scanning/ci/ci-gitlab-connect.png) +### Accept every project of a self-managed GitLab + +A GitLab connection can accept every project of its instance instead of a +list. It is for a self-managed GitLab only: the API refuses it on gitlab.com +and other shared issuers. In the connection's form, turn on **Accept every +project on this GitLab**. The console asks first, because any user of the +instance can create a project; new projects then wait for your approval. +**Accept jobs of new projects before approval** and **Tell administrators when +a project of a new group appears** sit under **More rules**. A connection set +to this mode, in the console or through the API, starts with protected +branches and tags only and a notice for every new group; an administrator may +turn them off by editing it. + +The connection then has a **New repositories** tab (platform v0.31.0 and +later): the projects seen for the first time, grouped by top-level group, with +their job count and when they were last seen, then the blocked projects and +groups and the approved names. **Approve** or **Block** a project or a whole +group. Every decision asks first: approving a project shows its full path and +how many of its jobs were refused, and approving a group warns that a GitLab +token carries no group id, so a renamed group's name can be taken over. +Decisions need a recent sign-in and are audited. Turning the mode off keeps +the approved projects and groups as the connection's list. + +### Runs per hour + +A pipeline may start at most 300 runs an hour; every job is a run, so a busy +repository with many scan jobs per merge request can reach it. Raise it per +connection under **More rules**, **Runs per hour limit** (10 to 5,000; empty +keeps 300; API `rules.max_runs_per_hour`). A refused job is told the limit in +force and how to raise it. + +### Two administrators editing one connection + +A save names the version it was made from. When someone else saved the +connection in between, the console says **Someone else changed this +connection** and offers **Reload**; the API answers 409 with the current +configuration (`expected_updated_at` on the update). Approvals and **Allow** +fixes made from an older version are refused the same way, so one change never +silently undoes another. + ## Where pipelines show up **Discovery › CI/CD › Pipelines** lists each workflow file of each repository @@ -421,6 +471,11 @@ inactive (Archived, Revoked, Never). It is never "offline". **Runs** lists every run with its verdict. **Coverage** shows, per repository, which capabilities ran recently. +A Degraded pipeline names the reason on +its row and on the run, one line per problem: `Scanner sast (semgrep) failed:` +why and what to do, or that the runner is older than the minimum and which +image to update to (platform v0.31.0 and later). + ![The CI/CD integration page on the Pipelines tab]({{ site.baseurl }}/assets/images/scanning/ci/ci-pipelines.png) *Figure: Pipelines.* @@ -465,4 +520,10 @@ organization's exposure when the code reaches a branch that counts: the default branch or a protected branch (a name such as `release/x` alone does not count). In a repository whose default branch is not known yet, nothing is hidden. + +For a GitLab project that one of your connections holds, the platform reads +the project's `default_branch` from GitLab when the job exchanges its token +(a project whose default is `master` or `trunk` is judged on that branch, not +on the connection's single value) and records it on the repository. A default +branch an administrator set is never replaced. Nothing a job sends sets it. Branch-only findings that no branch reports any longer expire. diff --git a/scanning/ci-troubleshooting.md b/scanning/ci-troubleshooting.md index 5192245..1b2afbb 100644 --- a/scanning/ci-troubleshooting.md +++ b/scanning/ci-troubleshooting.md @@ -50,8 +50,21 @@ What the job is told depends on how far the token got: `repository_binding`, `owner_id_mismatch`, `pipeline_identity`, `legacy_audience`, `aggregate_no_run_id`, `pipeline_rate`, `pipeline_cap`, `replay`, `replay_limit`, `replay_run_closed` and `run_mismatch`. +- **When the provider really signed the token but it was refused** + (platform v0.31.0 and later), the answer names the cause, with your own + token's values and never the audience you configured: + `CI_TOKEN_AUDIENCE_MISMATCH` (set the job's audience to the one in the + connection), `CI_TOKEN_EXPIRED`, `CI_TOKEN_CLOCK_SKEW` (the runner's clock + differs from the provider's), `CI_TOKEN_LIFETIME_TOO_LONG` and + `CI_TOKEN_CLAIMS_MISSING`. Tokens of hosted providers and tokens with a bad + signature still get the generic answer. - When the provider's signing keys cannot be fetched right now, the answer is `503 CI_ISSUER_UNAVAILABLE` with `Retry-After: 30`; retry the same token. + When the issuer answers but its discovery document is unusable (a + `jwks_uri` that is not https or is on another host or port, unreadable + JSON, no usable key), the reason is `discovery_invalid` instead: for a + self-managed GitLab behind a reverse proxy, set its `external_url` to the + address the proxy serves. ![Recent refused pipelines: a project outside the trust, a pipeline event the trust does not allow and a branch it does not accept, each with its fix]({{ site.baseurl }}/assets/images/scanning/ci/ci-refusals.png) @@ -77,7 +90,7 @@ What the job is told depends on how far the token got: | `replay_run_closed` | The token was exchanged again after its run stopped accepting results (it was evaluated, ended or is too old). | Re-run the job for a new token. | | `runner_outdated` | The CI scanner is older than the minimum version. | Pin openctemio/ci {{ site.data.versions.min_ci }} or later. The job log names the exact line to change (see below). | | `pipeline_cap` | The organization reached its number of pipelines. | Retire unused pipelines. | -| `pipeline_rate` | This pipeline started too many runs in a short time. | Wait and retry; check for a loop in the pipeline. | +| `pipeline_rate` | This pipeline started more runs in an hour than its limit (300 by default; every job is a run). The message states the limit in force. | Wait and retry, check for a loop in the pipeline, or raise **Runs per hour limit** under **More rules** of the connection (10 to 5,000; platform v0.31.0 and later). | | `run_mismatch` | The job named a run of another pipeline. | Let each pipeline run use its own run. | | `aggregate_no_run_id` | A combined run needs the pipeline's run id, which the token does not carry. | Run one job per capability without combining, or use a provider that names the run. | | `legacy_audience` | The pipeline used the trust configuration's old audience, which it may no longer use (it is new, or already used the new audience once). | Update the pipeline to the current snippet: its audience names the organization (`openctem:tenant:`). See [audience](ci-integration.md#trust-issuers-audience-and-keys). | diff --git a/scanning/scans-and-runs.md b/scanning/scans-and-runs.md index 588556f..2a88821 100644 --- a/scanning/scans-and-runs.md +++ b/scanning/scans-and-runs.md @@ -93,7 +93,10 @@ Other actions: **Clone as my scan** makes a copy you own. - Pause, activate and disable; export and import (`GET /api/v1/scans/{id}/export`, `POST /api/v1/scans/import`); bulk - activate, pause, disable and delete. + activate, pause, disable and delete. An export masks every value of + `scanner_config` that looks like a credential (`********`) for every caller, so + an imported scan needs its secrets entered again (platform v0.31.0 and + later; scans cannot be saved with credentials, so only older scans are affected). ## Starting a run diff --git a/sensors/external-scanning/bucket.md b/sensors/external-scanning/bucket.md index 49cdc00..2dbba9c 100644 --- a/sensors/external-scanning/bucket.md +++ b/sensors/external-scanning/bucket.md @@ -10,7 +10,7 @@ description: Bring edge sensor results in through an S3-compatible bucket you ow {: .no_toc } {: .note } -> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> Edge mode needs sensor v0.43.0 or later and OpenCTEM v0.31.0 or later. See > [External scanning](index.md). The edge sensor writes sealed results into a bucket you own and reads the diff --git a/sensors/external-scanning/folder.md b/sensors/external-scanning/folder.md index 8bcaf2f..8c19830 100644 --- a/sensors/external-scanning/folder.md +++ b/sensors/external-scanning/folder.md @@ -10,7 +10,7 @@ description: Carry edge sensor results into an air-gapped site on a disk. {: .no_toc } {: .note } -> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> Edge mode needs sensor v0.43.0 or later and OpenCTEM v0.31.0 or later. See > [External scanning](index.md). For a site with no network path at all: the edge sensor writes its sealed diff --git a/sensors/external-scanning/index.md b/sensors/external-scanning/index.md index 127148e..1377942 100644 --- a/sensors/external-scanning/index.md +++ b/sensors/external-scanning/index.md @@ -10,10 +10,12 @@ description: Run attack-surface scanning on a host outside your network and brin {: .no_toc } {: .note } -> This section describes edge mode, which ships with the sensor and OpenCTEM -> release that adds it. Check the release notes of your version: an older -> console has no **External scanning** card, and the kit's edge plays refuse -> to run without that sensor release. +> Edge mode needs sensor v0.43.0 or later (on the edge host and on the relay +> sensor) and OpenCTEM v0.31.0 or later. An older console has no **External +> scanning** card, and the kit's edge plays refuse to run with an older +> sensor. The sensor that OpenCTEM v0.31.0 installs with itself is v0.42.1, so +> set `SENSOR_VERSION` to v0.43.0 or later on the relay sensor +> ([Run a newer sensor than the platform pins](../operate.md#the-bundled-sensor-of-the-compose-install)). An **edge sensor** runs on a host outside your network, for example a small cloud server. It checks your internet-facing names and addresses the way diff --git a/sensors/external-scanning/public-address.md b/sensors/external-scanning/public-address.md index f0423cb..c837aa1 100644 --- a/sensors/external-scanning/public-address.md +++ b/sensors/external-scanning/public-address.md @@ -10,7 +10,7 @@ description: Bring edge sensor results in through the outbox on TCP 443 of the e {: .no_toc } {: .note } -> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> Edge mode needs sensor v0.43.0 or later and OpenCTEM v0.31.0 or later. See > [External scanning](index.md). {: .warning } diff --git a/sensors/external-scanning/wireguard.md b/sensors/external-scanning/wireguard.md index fe43bca..fbb1aef 100644 --- a/sensors/external-scanning/wireguard.md +++ b/sensors/external-scanning/wireguard.md @@ -10,7 +10,7 @@ description: Bring edge sensor results in through a small outbox on the edge hos {: .no_toc } {: .note } -> Edge mode ships with the sensor and OpenCTEM release that adds it. See +> Edge mode needs sensor v0.43.0 or later and OpenCTEM v0.31.0 or later. See > [External scanning](index.md). Use this when you have no bucket. A second, separate container on the edge diff --git a/sensors/operate.md b/sensors/operate.md index 0f49342..d520460 100644 --- a/sensors/operate.md +++ b/sensors/operate.md @@ -56,6 +56,7 @@ Notes that change what a sensor does: | To | What to know | |---|---| +| v0.43.0 | Adds **edge mode**: `openctemio-sensor edge pair`, `edge run`, `edge status` and `edge relay-key`, and the `-outbox` image. A sensor you run inside your network as a relay needs v0.43.0 or later and `SENSOR_EDGE_MAILBOXES` to carry an edge's results; without that setting nothing changes. Nothing to do if you do not use edge mode. See [External scanning](external-scanning/index.md). | | v0.42.1 | Semgrep, opengrep and trivy findings carry their code again: the flagged lines and five lines around them, read from the checked-out code (credentials masked, secret findings never read). Data flow steps keep their file. No configuration changes. | | v0.42.0 or later | Every scan works each target host under a per-host budget, **Standard** by default: 20 requests per second and 8 in flight per host, instead of the tools' own 150 per second per job. Scans of many sites on one host take longer. The lowest limit wins: the sensor's level ([`SENSOR_PACING_LEVEL`](settings.md#SENSOR_PACING_LEVEL): `gentle`, `standard`, `fast`), the job's signed budget, the local policy's `rate.max_host_rps` and `rate.max_host_inflight`, and a built-in ceiling. A rate a person set above the budget is lowered to it. A target that answers only 429 or 503 is paused and reported as a coverage gap `throttled`; a connection the budget had no slot for is the gap `slots_full`. nuclei marks a match found on a throttling or block answer with a verification hold instead of dropping it; platform v0.28.0 and earlier ignore the hold and file the finding as before. New image `:-relay` for a feed relay sensor with no tools ([Pick an image](deploy-docker.md#1-pick-an-image)). To run faster on hosts you own, set `SENSOR_PACING_LEVEL=fast` ([How hard a scan works one host](tool-settings.md#how-hard-a-scan-works-one-host)). The seccomp profile is unchanged since v0.40.0. | | v0.41.1 or later (sdk-go v0.51.0) | A job's own files (rewritten rules, target lists, reports) are readable only by that job's tool runs. `ports.allow` is also checked when a tool connects. A large volume no longer stops claiming work while plenty of disk is free (the high watermark needs less than 15 % and less than 16 GiB free). New setting `SENSOR_COMMAND_TYPES` (the only command types the sensor accepts; unset: all it handles). | @@ -170,7 +171,7 @@ v0.40.0 must use `--self-update`. ### The bundled sensor of the Compose install The overlay runs the sensor release the platform release pins (platform -v0.28.0 pins v0.42.0, v0.29.0 pins v0.42.1). To run a newer sensor release before the next platform +v0.28.0 pins v0.42.0, v0.29.0 to v0.31.0 pin v0.42.1). To run a newer sensor release before the next platform release, set it in the install directory's `.env` and recreate the sensor: ```bash diff --git a/sensors/tool-settings.md b/sensors/tool-settings.md index 3c83413..e391eee 100644 --- a/sensors/tool-settings.md +++ b/sensors/tool-settings.md @@ -161,7 +161,7 @@ Related: [Tools and capabilities](../scanning/tools.md), Every tool that connects to a scan's targets runs under a **per-host budget**: 20 requests per second and 8 requests in flight toward one host by default (the Standard level). The budget is counted per host, -whatever the scheme, port, path or spelling of the scan's targets. This ships with the next sensor release. +whatever the scheme, port, path or spelling of the scan's targets. This is in sensor v0.42.0 and later. | Level | Requests per second per host | In flight per host | |---|---|---| diff --git a/user-guide/06-prioritization.md b/user-guide/06-prioritization.md index b57ec38..85df9f2 100644 --- a/user-guide/06-prioritization.md +++ b/user-guide/06-prioritization.md @@ -174,7 +174,9 @@ Tabs: link to that list: **Exploit likelihood 50% or more**, **Exploit likelihood 10% or more** (chance of exploitation in the next 30 days), **Known exploited (KEV)** (with how many have ransomware use and how many were added in the last - 30 days) and **Known exploited, past due** (the CISA due date has passed). + 30 days) and **Known exploited, past due** (the CISA due date has passed; the number opens the + findings list with the `kev_past_due` filter, so the number and the list are the + same findings). **Catalogs** shows how many CVEs have an EPSS score and how many KEV entries there are. Two cards explain EPSS and KEV and link to their sources. - **Threat actors**: the adversary groups your organization tracks. **Add actor**