Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation

authsec-cli (AuthSec Agent Kit)

Finds the AI agents on a machine, what each one may do without asking, and what it actually does: the programs it runs, the files it opens and where it connects.

curl -fsSL https://github.com/authsec-ai/authsec-cli/releases/latest/download/install.sh | sudo sh
authsec-cli agents                    # AI agents running now (and installed)
authsec-cli agents --watch 5s         # print agents as they start and stop
authsec-cli scan                      # agent settings, MCP servers, risks (offline)
sudo authsec-cli daemon               # follow agents, log what they do
sudo authsec-cli daemon install       # the same as a systemd service
sudo authsec-cli access claude-code   # files, network, services, programs (the daemon's log is root's)
sudo authsec-cli policy generate      # one YAML policy per installed agent in ./policies, left yours
authsec-cli policy edit claude-code   # opens vi, checks the file on save
sudo authsec-cli policy check         # validate, and replay recent activity
sudo authsec-cli daemon --policies ./policies   # enforce mode: enforce policies
sudo authsec-cli quarantine codex     # freeze an agent and cut its network
sudo authsec-cli release codex
sudo authsec-cli enforce claude install         # Claude Code hook (managed settings)
authsec-cli run --enforce -- claude   # re-run an agent confined by its policy
authsec-cli detect                    # ARTEX and agents running attack tools, now
sudo authsec-cli daemon --quarantine-threats --siem syslog+tls://siem:6514
authsec-cli logs --since 1h --format cef        # or --siem splunk+https://...:8088
authsec-cli cloud agents --env .env   # Bedrock, AgentCore, Azure OpenAI, AI Foundry
authsec-cli cloud quarantine my-agent --apply   # AWS: deny-all on the agent's role
authsec-cli catalogue                 # every config file a scan may read
sudo authsec-cli connect --url https://api.authsec.ai --workspace <id> --token-stdin

Enforcement (policies with mode: enforce):

What Running agents (daemon, root) run --enforce
Network nftables per agent cgroup: only the policy's hosts and ports Landlock: only the policy's TCP ports; hosts too when the daemon runs
Commands a denied program the agent starts is stopped at once same
Programs programs list: an unlisted binary is refused at exec (BPF LSM) same, with the daemon
Files logged Landlock: only the policy's paths
Claude Code PreToolUse hook decides every tool call; fails closed same
Quarantine frozen, no network; new instances too, until released —

Limits (details in docs/notes/enforcement-formats.md):

  • files of an already-running agent are only logged;
  • work handed to processes outside the agent's tree (systemd-run --user, docker run, an existing tmux) is not enforced, so generated policies ask before those commands;
  • IP rules cannot tell apart host names that share an address.

Programs (exec allowlist): a policy's programs section lists the binaries the agent may start (absolute paths, {home}, * within a folder, ** at any depth). The kernel checks every exec in the agent's cgroup with a BPF LSM program, by the file itself (device, inode, generation), so a link, a copy or a rename of an allowed binary gets nothing. It ships disarmed and is armed in steps: observe (log only; what policy generate writes, listing what each agent ran), rehearse (log what would be refused), enforce (refuse with EPERM). The daemon arms enforce only after the same list has rehearsed for --min-rehearsal (default 24h) without a would-be refusal; authsec-cli enforce status shows when. policy test AGENT --program PATH asks the list about one file. Needs root, the BPF LSM active (bpf in /sys/kernel/security/lsm; Ubuntu 24.04 and later have it) and BTF. Limits: an allowed interpreter runs any script given as an argument (sh x.sh, python -c), the dynamic loader runs any file (policy check warns), and a listed file the agent can write keeps its permission when rewritten in place.

OpenShell sandbox: authsec-cli run --enforce --sandbox openshell --image IMAGE [--provider NAME] -- AGENT runs the agent in an NVIDIA OpenShell sandbox built from its policy (checked with OpenShell 0.1.9 and its Docker driver). OpenShell lets out only what is listed, so the sandbox gets the policy's allow rules plus the agent's own model API; "allow everything except" rules and command rules have no OpenShell equivalent and are reported. The agent works on an uploaded copy of the project (files your .gitignore excludes, such as .env, stay out); when it exits, its copy is downloaded to ~/.local/state/authsec/sandboxes/<sandbox> for you to compare, and OpenShell's denials go to the daemon (and the console), or to your own log. The run uses the console's policy for the agent when the machine is connected (as the daemon does; --dir names a folder instead), and follows it: a changed policy replaces the running sandbox's network rules within about 40 seconds of being saved in the console; file rules apply when the agent is started again. Credentials come from OpenShell providers, never the command line. build/openshell/agents.Dockerfile builds an image with Codex and Claude Code.

Detections (daemon, and authsec-cli detect): artex_present (ARTEX, an autonomous AI pentest agent, by its binary, ARTEX_* variables, ports, files or containers; a renamed binary is still found), offensive_tool (an agent starts nmap, sqlmap, nuclei, ffuf, hydra, ...), connection_fanout (an agent connects to many destinations in a minute). With --quarantine-threats, a high-severity detection quarantines the agent.

SIEM: records go out as CEF over syslog (UDP, TCP, TLS), as JSON to a webhook, or to Splunk HEC, each with compliance tags (OWASP Top 10 for LLM and agentic applications). The token is read from an environment variable named with --siem-token-env.

Console: connect saves the API URL, workspace and ingest token shown in the console under Add > Machine (/etc/authsec/connect.json, 0600; the token never goes on the command line). The daemon then registers the machine, reports its agents, sends decisions, detections and access summaries (at start, 2 minutes later, then every 10 minutes, each covering the last hour) to the console's logs (with the same tags), and applies the policies saved in the console (kept in /var/lib/authsec/console-policies; they win over a local policy for the same agent; one that fails policy check is not applied). When enforcement is turned on for the machine in the console, the daemon hands over its own credential and carries out quarantine and release from the console. --no-connect runs without it; disconnect forgets it.

Agents recognised: Claude Code, Claude Desktop, Codex, Gemini CLI, GitHub Copilot, Cursor, Windsurf, VS Code AI features, Aider, OpenCode, Goose, OpenClaw, Amp, Qwen Code, Kiro, model servers (Ollama, LM Studio), ARTEX (flagged as a threat), and any process that talks to an LLM API ("unknown agent").

Sensor: on Linux as root, eBPF (kernel 5.8+ with BTF): process start and exit, outgoing TCP connections, DNS answers, and file opens of agent processes only. Elsewhere, or without root, it polls the process table. The service is capped at 128 MB and 20% CPU; measured use is about 22 MB and under 2% of one core.

Platforms: Linux is the full product (sensor, daemon, enforcement, quarantine, console). On macOS, discovery, scanning, policies and the Claude Code hook work; the daemon polls the process table and does not enforce. The Windows binary is a preview: only parts of discovery are tested there, and scanning has known gaps.

Secrets: never read or printed. Environment variables and headers are kept by name; command lines, URLs and arguments are scrubbed. The event log is 0600.

Develop

make build      # bin/authsec-cli
make release    # dist/: binaries, install.sh, SHA256SUMS (VERSION=v0.7.0)
make test
make lint
make golden     # after an intended change to the report; review the diff
make bpf        # rebuild internal/sensor/bpf/sensor.o (clang in Docker)
make ebpf-test  # load the sensor as root in a privileged container and check it
bash scripts/enforce-smoke.sh   # enforcement end to end as root (own network namespace)

See docs/PLAN.md.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages