Edge Connector

Edge Connector install

Build the Edge Connector on a Linux device, run the local smoke test, then connect the device to a DefenseClaw Fleet gateway.

Preview. This page builds the Edge Connector on a Linux device. Start with the local smoke test, which needs no network, then connect the device to Fleet.

Choose a path

You wantPath
To try the engine on one Linux device, with no networkLocal-only Linux smoke (MINIMAL profile)
A device that asks a Fleet gateway when local rules cannot decideConnect a device to Fleet (STANDARD or EDGE profile)
To guard a coding agent on macOS, Linux or WindowsThe core install. It leaves Fleet off and does not install the C engine.

Before you start

  • A Linux device with Git, a C compiler, CMake 3.22 or newer, Make, Python 3 and PyYAML.
  • For Fleet, also:
    • the core gateway and a trusted TLS proxy on the same host, with a valid certificate for the Fleet hostname;
    • an MQTT broker with TLS and per-device topic ACLs (MQTT broker setup);
    • Python 3 and PyYAML on the gateway host for the policy compiler (policy compiler requirements).

Local-only Linux smoke

The MINIMAL profile has no MQTT. It needs no broker, certificates or Fleet token.

Build and test

git clone https://github.com/cisco-ai-defense/defenseclaw.git
cd defenseclaw
cmake -S edge-connector -B edge-connector/build-local \
  -DDCLAW_PROFILE=MINIMAL -DDCLAW_DEV_MODE=ON
cmake --build edge-connector/build-local -j2
ctest --test-dir edge-connector/build-local --output-on-failure

Run the binary

./edge-connector/build-local/edge-connector --help

All tests passing means the local engine works. Nothing is installed as a service.

Connect a device to Fleet

Set up Fleet on the gateway host

Extract the matching defenseclaw-fleet-assets.tar.gz release asset, then run:

defenseclaw setup edge-connector --source-dir /path/to/extracted-assets \
  --endpoint https://fleet.example.com/api/v1/fleet
defenseclaw config set fleet.trust_proxy_headers true
defenseclaw-gateway restart

Replace the example hostname with your TLS proxy's hostname. The proxy must run on the gateway host, connect to the gateway at 127.0.0.1:18970, and set X-Forwarded-Proto: https. Keep the gateway API reachable only through loopback and that proxy.

What the three commands do:

  • Setup saves the Fleet API token, the signing keys and the HTTPS registration endpoint, then enables Fleet.
  • fleet.trust_proxy_headers true lets the same-host proxy attest to HTTPS (Fleet credential delivery).
  • The restart applies the Fleet setup and fleet.trust_proxy_headers before the device registers. The gateway reads both Fleet settings below only when it starts.

On a terminal, when no Fleet API token is saved yet, setup first asks Generate a new fleet API bearer token? [Y/n]. Enter generates one; n asks you to paste your own. --token TOKEN or --non-interactive skips the question.

On Linux, setup then writes the audit, OTA and emergency keys to /etc/defenseclaw/edge-connector.env through sudo, so sudo can ask for your password. An account without sudo rights stops with Could not provision DCLAW_AUDIT_KEY in /etc/defenseclaw/edge-connector.env; Edge setup is incomplete, and Fleet stays off. Run setup again from an account that can use sudo. On macOS and Windows setup configures the gateway only; the C engine runs on Linux.

Build and install the engine on the device

Use the STANDARD profile for most devices, or EDGE for edge gateways (build profiles).

defenseclaw setup edge-connector install --source-dir /path/to/extracted-assets \
  --target DEVICE --user USER \
  --profile standard --broker-url mqtts://broker.example.com:8883

Replace DEVICE and USER with the SSH host and account. The account needs sudo rights. --user defaults to root, and without --target the command installs on the local host. --tenant-id and --fleet-id (both 1 by default) and --device-id (generated when omitted) set the device's Fleet identity. The remote install copies the source, builds it, and automatically registers the device. In order, it:

  1. Copies the source to the device and builds it.
  2. Registers the device through the configured HTTPS Fleet API.
  3. Writes the returned key to /etc/defenseclaw/edge-connector.env.
  4. Creates the defenseclaw system service account if needed.
  5. Installs the edge-connector systemd unit and starts it.

Do not register the same device again: re-registration replaces its key.

Push a policy

Write the policy as in Edge Connector policies, then push it:

defenseclaw edge-connector policy push policy.yaml --tenant-id 1 --fleet-id 2

Fleet credential delivery

Fleet refuses to return device keys over plain HTTP. Two settings control this, and both default to false. The gateway reads them only when it starts, so a change takes effect after defenseclaw-gateway restart.

SettingSet it to true whenProduction
fleet.trust_proxy_headersThe gateway sits behind a TLS proxy on the same host. The gateway then accepts the forwarded HTTPS claim, but only from a loopback peer.Yes, with the same-host proxy above
fleet.allow_key_over_httpYou run a dedicated loopback-only test gateway and want a test key over HTTP.Never. When the test ends, set it back to false and restart the gateway. Until that restart, keys still go over plain HTTP.
defenseclaw config set fleet.trust_proxy_headers true
defenseclaw-gateway restart
# test gateway only:
defenseclaw config set fleet.allow_key_over_http true
defenseclaw-gateway restart
# when the test ends:
defenseclaw config set fleet.allow_key_over_http false
defenseclaw-gateway restart

A remote proxy, or a missing X-Forwarded-Proto header, still gets key_delivery_requires_tls.

To register a device by hand, run defenseclaw edge-connector register DEVICE_ID. It uses the Fleet endpoint that setup saved, so set that endpoint to your HTTPS URL. You can also call the Fleet API over HTTPS and put the returned key on the device. More on keys is in Device keys and registration.

For an internal certificate authority, set REQUESTS_CA_BUNDLE (or CURL_CA_BUNDLE) to its PEM bundle when you run the defenseclaw edge-connector CLI. The CLI honors HTTPS_PROXY and the usual bypass variables, and keeps certificate verification. It does not use a .netrc entry in place of the saved Fleet token.

These defenseclaw setup edge-connector and defenseclaw edge-connector steps are per-user commands. A managed computer refuses them; there Fleet is set in the managed config.

Check it worked

defenseclaw edge-connector devices
defenseclaw edge-connector health

The device shows as online once its signed heartbeat arrives. On the device, systemctl is-active edge-connector prints active, and journalctl -u edge-connector -n 20 shows the log.

Undo

  1. On the device, stop and disable the unit: sudo systemctl disable --now edge-connector.
  2. On the gateway host, remove the device from Fleet: defenseclaw edge-connector decommission DEVICE_ID. For several devices, use defenseclaw edge-connector decommission-batch --ids ID1,ID2.

Next steps