conning 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. conning-0.2.0/.github/workflows/ci.yml +32 -0
  2. conning-0.2.0/.github/workflows/release.yml +40 -0
  3. conning-0.2.0/.gitignore +9 -0
  4. conning-0.2.0/CHANGELOG.md +48 -0
  5. conning-0.2.0/CLAUDE.md +29 -0
  6. conning-0.2.0/LICENSE +202 -0
  7. conning-0.2.0/PKG-INFO +200 -0
  8. conning-0.2.0/README.md +178 -0
  9. conning-0.2.0/docs/build-log.html +359 -0
  10. conning-0.2.0/docs/design.md +166 -0
  11. conning-0.2.0/docs/manual-test.md +218 -0
  12. conning-0.2.0/pyproject.toml +55 -0
  13. conning-0.2.0/src/conning/__init__.py +3 -0
  14. conning-0.2.0/src/conning/__main__.py +3 -0
  15. conning-0.2.0/src/conning/admin.py +489 -0
  16. conning-0.2.0/src/conning/askpass.py +9 -0
  17. conning-0.2.0/src/conning/audit.py +126 -0
  18. conning-0.2.0/src/conning/cli.py +263 -0
  19. conning-0.2.0/src/conning/core.py +458 -0
  20. conning-0.2.0/src/conning/doctor.py +105 -0
  21. conning-0.2.0/src/conning/install.py +214 -0
  22. conning-0.2.0/src/conning/notify.py +46 -0
  23. conning-0.2.0/src/conning/output.py +77 -0
  24. conning-0.2.0/src/conning/paths.py +29 -0
  25. conning-0.2.0/src/conning/policy.py +143 -0
  26. conning-0.2.0/src/conning/remote.py +267 -0
  27. conning-0.2.0/src/conning/secrets.py +75 -0
  28. conning-0.2.0/src/conning/server.py +153 -0
  29. conning-0.2.0/src/conning/ssh.py +232 -0
  30. conning-0.2.0/src/conning/state.py +150 -0
  31. conning-0.2.0/src/conning/targets.py +169 -0
  32. conning-0.2.0/src/conning/transport.py +74 -0
  33. conning-0.2.0/src/conning/watch.py +70 -0
  34. conning-0.2.0/tests/conftest.py +110 -0
  35. conning-0.2.0/tests/test_admin.py +367 -0
  36. conning-0.2.0/tests/test_cli_and_server.py +29 -0
  37. conning-0.2.0/tests/test_cli_wiring.py +169 -0
  38. conning-0.2.0/tests/test_core.py +434 -0
  39. conning-0.2.0/tests/test_edges.py +96 -0
  40. conning-0.2.0/tests/test_install.py +197 -0
  41. conning-0.2.0/tests/test_m2.py +576 -0
  42. conning-0.2.0/tests/test_output.py +33 -0
  43. conning-0.2.0/tests/test_policy.py +36 -0
  44. conning-0.2.0/tests/test_run_prompt.py +86 -0
  45. conning-0.2.0/tests/test_safe_list.py +127 -0
  46. conning-0.2.0/tests/test_ssh.py +221 -0
  47. conning-0.2.0/tests/test_targets.py +62 -0
  48. conning-0.2.0/tests/test_transport_and_secrets.py +178 -0
  49. conning-0.2.0/tests/test_users_and_path.py +76 -0
  50. conning-0.2.0/tests/test_windows_jobs.py +108 -0
  51. conning-0.2.0/uv.lock +1213 -0
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest, macos-latest]
17
+ python: ["3.11", "3.13"]
18
+ runs-on: ${{ matrix.os }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: astral-sh/setup-uv@v6
22
+ with:
23
+ python-version: ${{ matrix.python }}
24
+ - run: uv sync
25
+ - run: uv run ruff check
26
+ - run: uv run ruff format --check
27
+ - name: pytest (coverage gate on Linux, where the sh-based job tests run)
28
+ if: matrix.os == 'ubuntu-latest'
29
+ run: uv run pytest -q --cov=conning --cov-report=term-missing --cov-fail-under=95
30
+ - name: pytest
31
+ if: matrix.os != 'ubuntu-latest'
32
+ run: uv run pytest -q
@@ -0,0 +1,40 @@
1
+ name: Release
2
+
3
+ # Push a tag like v0.0.1 to publish. PyPI must trust this workflow first (Trusted Publishing):
4
+ # pypi.org > Your projects > Publishing > add a pending publisher for project "conning",
5
+ # owner EranYonai, repository Conning, workflow release.yml, environment pypi.
6
+
7
+ on:
8
+ push:
9
+ tags: ["v*"]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: read
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v6
19
+ - name: Check the tag matches the package version
20
+ run: |
21
+ version=$(uv version --short)
22
+ test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME != version $version"; exit 1; }
23
+ - run: uv build
24
+ - uses: actions/upload-artifact@v4
25
+ with:
26
+ name: dist
27
+ path: dist/
28
+
29
+ publish:
30
+ needs: build
31
+ runs-on: ubuntu-latest
32
+ environment: pypi
33
+ permissions:
34
+ id-token: write
35
+ steps:
36
+ - uses: actions/download-artifact@v4
37
+ with:
38
+ name: dist
39
+ path: dist/
40
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .coverage
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 (2026-10-15)
4
+
5
+ - Approve commands where you are: in the agent client (MCP elicitation, both protocol versions; on by
6
+ default, `conn mcp --no-approve-in-client` turns it off), in `conn watch`, or with `conn approve`. A desktop notification
7
+ says when a command is waiting (`CONNING_NOTIFY=0` turns it off).
8
+ - `conn run` at a terminal asks right there when a command needs approval, and prints the result; a
9
+ target name typed where the command starts is caught with a hint to use `a,b`.
10
+ - `conn targets` shows the user each target logs in as; `conn add <name> --like <target> --user <u>` adds the
11
+ same machine as another user.
12
+ - Jobs on Linux and macOS targets get the PATH of a login shell, so tools in `~/.local/bin` or `/opt` are found.
13
+ - Windows jobs run detached (created through WMI, outside the ssh session), so they survive a dropped
14
+ connection and support `read --signal` and timeouts like POSIX jobs. Scripts reach PowerShell over stdin.
15
+ - `conn mcp install claude|codex|cursor|opencode|pi` adds the server and denies raw `ssh`/`scp`/`sftp`, the human-only
16
+ `conn` commands and reads of Conning's config dir (pi has no rules, so only the server); merges with
17
+ existing files and keeps a backup.
18
+ - `conn watch`: every command, decision and job exit as it happens, new job output, and approval prompts.
19
+ - Audit log in the state dir (`audit.jsonl`), hash-chained; `conn doctor` reports edits.
20
+ - Built-in read-only list: `uname`, `hostname`, `df`, `ps`, `ls`, `ip addr`, `systemctl status`, `journalctl`,
21
+ `Get-Process` and more run without asking, checked so changing forms still ask (`safe = false` opts out).
22
+ - `conn allow <target> [words]` lists or adds allow rules; `conn deny <target> <words>` removes one.
23
+ - `conn doctor` checks the config and state dirs, ssh tools, keychain, secret sources, pinned keys and leases.
24
+
25
+ ## 0.1.0 (unreleased)
26
+
27
+ - M1: commands run over OpenSSH with a generated per-target config (pinned host key, no forwarding,
28
+ connection reuse) and key, ssh-agent or password auth (keychain, `op://` or `env:` references).
29
+ - `run` starts detached jobs on POSIX targets; `read j:<id>` streams new lines, long-polls and sends
30
+ signals; `read o:<id>` pages saved output; `read <target>:<path>` reads remote files.
31
+ - `transfer` copies files and directories with scp and checks files by sha256.
32
+ - Approvals: commands outside the allowlist wait for `conn approve a:<id>`; leases with `conn lease`.
33
+ - `conn add`, `approve`, `import`, `test`, `rm` and `lease` work. Agent-added targets stay pending.
34
+ - Secrets and their base64, URL and hex forms are redacted from all output.
35
+ - Windows targets run synchronously through PowerShell for now.
36
+ - Unit tests with a fake transport; CI gates coverage at 95%.
37
+ - `conn run <target> uname -a` passes flags through without `--`; `conn approve a:<id>` prints the result.
38
+ - The `max_bytes` ceiling is now 16 KB (was 64 KB).
39
+ - Running commands never writes the config dir: job output, approvals and generated ssh configs go to a
40
+ state dir (`XDG_STATE_HOME/conning`, or `CONNING_STATE`). Works with a read-only config, as in agent sandboxes.
41
+ - `conn targets` says where it looked when there are none, and why a pending target is pending.
42
+ - File and secret problems print one `error:` line (CLI and MCP) instead of a traceback.
43
+
44
+ ## 0.0.1 (unreleased)
45
+
46
+ - Scaffold: `conn` CLI surface, MCP server with the four agent tools (`targets` works; `run`, `read`,
47
+ `transfer` are stubs for M1), fail-closed target file, output cap with handles, two-word allowlist
48
+ rules, CI, and a PyPI release workflow using Trusted Publishing.
@@ -0,0 +1,29 @@
1
+ # Working on Conning
2
+
3
+ Conning is an MCP server and CLI that let a developer's own agent run commands on remote test
4
+ machines ("targets") without seeing their secrets. Read [docs/design.md](docs/design.md) before
5
+ changing behavior; every decision there has a number (D1...) and a status.
6
+
7
+ ## Principles
8
+
9
+ - Prompt text is advice; the toolset is a wall. Guardrails live in code, and default to deny.
10
+ - Fewer tools beat more tools. The agent gets exactly four: targets, run, read, transfer. Adding a
11
+ tool or growing a docstring costs context on every turn; `tests/test_cli_and_server.py` caps it.
12
+ - No tool ever returns a secret, adds a live target or changes policy.
13
+ - Lead every result with the fact the agent branches on (exit code or status). Never exceed `max_bytes`.
14
+ - The target file is fail-closed: unknown keys and bad values are errors.
15
+ - Never put real hostnames, IPs or credentials in code, tests or docs. Placeholders only.
16
+
17
+ ## Commands
18
+
19
+ ```sh
20
+ uv sync
21
+ uv run pytest --cov=conning # keep coverage at 95%+; mock SSH with the fake transport in tests/conftest.py
22
+ uv run ruff check && uv run ruff format --check
23
+ uv run conn help --markdown # paste into README.md between the conn-help markers after CLI changes
24
+ ```
25
+
26
+ ## Docs
27
+
28
+ When a decision changes, update the table in `docs/design.md` (supersede rows rather than deleting
29
+ them) and add a dated entry to `docs/build-log.html`.
conning-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
conning-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.5
2
+ Name: conning
3
+ Version: 0.2.0
4
+ Summary: A control room for your agent's test machines: an MCP server and CLI that run commands on remote targets without the agent ever seeing a secret.
5
+ Project-URL: Homepage, https://github.com/EranYonai/Conning
6
+ Project-URL: Issues, https://github.com/EranYonai/Conning/issues
7
+ Author: Eran Yonai
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: agents,mcp,remote-execution,ssh,testing,vault
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: Testing
17
+ Classifier: Topic :: System :: Systems Administration
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: keyring>=25.7.0
20
+ Requires-Dist: mcp<3,>=2.3
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Conning
24
+
25
+ **A control room for your agent's test machines.** Your agent (Claude Code, Codex, Cursor...) stays on
26
+ your own laptop. Conning holds the keys to your lab VMs and gives the agent four lean tools to run
27
+ commands and move files there. The agent never sees a password, and you approve anything risky.
28
+
29
+ > **Status: pre-alpha (M2 done).** Running commands, long jobs, remote file reads and transfers
30
+ > work over OpenSSH, with pinned host keys, password or key auth, approvals and leases. You can approve
31
+ > in the agent client, in `conn watch` or with `conn approve`; `conn doctor` checks your setup. Long
32
+ > jobs run detached on Linux, macOS and Windows targets, and `conn mcp install` sets up claude, codex,
33
+ > cursor, opencode or pi. See
34
+ > [docs/design.md](docs/design.md) for every decision so far.
35
+
36
+ ## Why
37
+
38
+ Putting an agent harness inside every CLI on every remote machine is redundant. Developers already
39
+ have a capable agent on their own machine. What's missing is a safe, token-lean way for that agent to
40
+ reach the machines it tests on:
41
+
42
+ - **No secrets in context.** Targets hold *references* to the OS keychain, `op://` or ssh-agent.
43
+ Secrets are resolved inside Conning at the last moment and never returned by any tool.
44
+ - **Lean results.** Exit code first, output capped at 8 KB by default (the agent may ask for more, up
45
+ to a ceiling), with a handle to page the rest. Fan-out to many targets collapses identical results.
46
+ - **Guardrails in code, not in the prompt.** Each target has a mode (`observe`, `ask`, `lease`).
47
+ Commands outside the allowlist wait for your approval; "always allow" remembers two words, so
48
+ `systemctl status` never lets through `systemctl stop`.
49
+ - **Plain OpenSSH underneath.** Linux and Windows (OpenSSH + PowerShell 7), pinned host keys,
50
+ forwarding forced off.
51
+
52
+ ## Install
53
+
54
+ ```sh
55
+ uv tool install conning # or: pipx install conning
56
+ conn mcp install claude # or codex, cursor, opencode, pi: adds the server and denies raw ssh/scp
57
+ ```
58
+
59
+ The MCP server needs no install at all:
60
+
61
+ ```sh
62
+ claude mcp add conning -- uvx conning mcp
63
+ ```
64
+
65
+ ## The agent's four tools
66
+
67
+ | Tool | What it does |
68
+ |---|---|
69
+ | `targets(filter?, check?)` | One line per target: name, OS, shell, user, tags, mode. Never a host or secret. |
70
+ | `run(target, cmd \| argv, wait=30, max_bytes=8192, ...)` | Runs on one target, a list or `tag:<tag>`. Exit code first. Still running after `wait` seconds: returns a job id (`wait=0` is async). |
71
+ | `read(id, wait?, range?, grep?, signal?)` | Long-polls a job for new lines, pages a saved output, or reads a remote file. |
72
+ | `transfer(source, dest)` | Copies files between `local:<path>` and `<target>:<path>`, checked by sha256. |
73
+
74
+ Agents without MCP can use the same commands through the `conn` CLI; the output is identical.
75
+
76
+ ## For agents: CLI reference
77
+
78
+ This block is generated by `conn help --markdown`, so you don't need to call `--help`. A test keeps it
79
+ in sync with the code.
80
+
81
+ <!-- conn-help:start -->
82
+ ```
83
+ conn targets [--check] [filter]
84
+ List targets: name, OS, shell, user, tags, mode. Never hosts or secrets.
85
+
86
+ conn run [--wait WAIT] [--timeout TIMEOUT] [--cwd CWD] [--shell]
87
+ [--max-bytes MAX_BYTES] [--grep GREP]
88
+ target [argv ...]
89
+ Run a command on one target, a list, or tag:<tag>. Exit code first.
90
+
91
+ conn read [--wait WAIT] [--range RANGE] [--grep GREP] [--signal {INT,TERM,KILL}]
92
+ [--max-bytes MAX_BYTES]
93
+ id
94
+ Page a job (new lines only), a saved output, an approval, or a remote file.
95
+
96
+ conn transfer source dest
97
+ Copy files: local:<path> to <target>:<path>, or back. sha256 checked.
98
+
99
+ conn add [--host HOST] [--user USER] [--like TARGET] [--port PORT]
100
+ [--auth {ssh-agent,key,password}] [--secret SECRET] [--key KEY]
101
+ [--os {linux,windows,darwin}] [--mode {observe,ask,lease}] [--tag TAG] [--retry]
102
+ name
103
+ Add a target. Without a terminal it is saved as pending until a human approves it.
104
+
105
+ conn approve [--always] what
106
+ Human only: make a pending target live, or allow a pending command a:<id>.
107
+
108
+ conn import [--match MATCH]
109
+ Import hosts from ~/.ssh/config as pending targets (unsafe options dropped).
110
+
111
+ conn rm name
112
+ Remove a target and its pinned host key.
113
+
114
+ conn test name
115
+ Probe a target: reachability, OS, shell, pinned host key.
116
+
117
+ conn lease [--minutes MINUTES] name
118
+ Human only: give a target a full shell for a time box (1-60 minutes).
119
+
120
+ conn allow target [words ...]
121
+ Human only: let a command run without asking (no words: list the rules).
122
+
123
+ conn deny target words [words ...]
124
+ Remove an allow rule, so the command asks again.
125
+
126
+ conn watch [--history HISTORY] [--no-prompt]
127
+ Live control room: every command on every target, job output, approval prompts.
128
+
129
+ conn doctor
130
+ Check this machine's setup: config and state dirs, ssh, keychain, targets.
131
+
132
+ conn mcp [--approve-in-client | --no-approve-in-client] <serve|install> ...
133
+ Run the MCP server on stdio, or install it into an agent client.
134
+
135
+ conn help [--markdown]
136
+ Show this help; --markdown prints the block cached in README.md.
137
+ ```
138
+ <!-- conn-help:end -->
139
+
140
+ A target is one login on one machine. To use the same machine as another user, add it again:
141
+ `conn add lab-tester --like lab --user tester` copies the host, port, OS and tags and asks for the new
142
+ user's password. `conn targets` shows which user each target uses.
143
+
144
+ A target you add with `conn add` from an agent session is saved as **pending**. It does nothing until
145
+ the human runs `conn approve <name>`, which shows the host, the pinned host-key fingerprint and where
146
+ the secret comes from.
147
+
148
+ A command outside a target's allowlist returns `status=pending_approval id=a:<id>`, and a desktop
149
+ notification tells the human. They answer in one of three places (allow once, always allow its first
150
+ two words, or deny), and the agent picks up the result with `read a:<id>`:
151
+
152
+ - **In the agent client**: any MCP client that supports elicitation shows the question before the
153
+ command is queued, and an approved command runs in the same call. Clients without it fall back to
154
+ the two below. If a client would answer such prompts by itself instead of asking you, run the server
155
+ as `conn mcp --no-approve-in-client`.
156
+ - **In `conn watch`**, which also shows every command and its output as it happens.
157
+ - **With `conn approve a:<id>`** in any terminal. When you run `conn run` yourself at a terminal, it
158
+ just asks you there and prints the result.
159
+
160
+ Read-only commands such as `uname`, `hostname`, `df`, `ps`, `ls`, `ip addr`, `systemctl status` and
161
+ `journalctl` run without asking on every target; each is checked so its changing forms (`hostname x`,
162
+ `ip addr add`) still ask, and `safe = false` in a target's entry turns the list off.
163
+ `conn allow <target> make test` lets another command run without asking from then on; `conn deny`
164
+ takes it back. Every command, answer and rule change lands in a hash-chained audit log, and
165
+ `conn doctor` checks your setup when something doesn't work.
166
+
167
+ ## Safety model
168
+
169
+ | Mode | What the agent can do | Default for |
170
+ |---|---|---|
171
+ | `observe` | The built-in read-only list and allowlisted commands only; everything else is refused. | targets tagged `shared` or `prod` |
172
+ | `ask` | The built-in read-only list and allowlisted commands run; anything else waits for your approval. | new lab targets |
173
+ | `lease` | Any command, for a time box you grant (15 min default, 60 max). | never by default |
174
+
175
+ - No tool returns a secret, adds a live target or changes policy.
176
+ - Secrets travel over stdin or the SSH channel's env, never argv. Output is redacted before it is saved.
177
+ - Remote output is marked untrusted. Shell wrappers (`sh -c`, `python -c`, `sudo`...) and shell syntax
178
+ (`;`, `|`, `$(...)`) always ask.
179
+ - `conn mcp install` also denies the agent raw `ssh`/`scp`, so it can't go around Conning (pi has no
180
+ permission rules, so there it only adds the server).
181
+ - The audit log is hash-chained. It runs as your user, so it is tamper-evident, not tamper-proof.
182
+
183
+ ## Development
184
+
185
+ ```sh
186
+ uv sync
187
+ uv run pytest --cov=conning # CI requires 95% coverage on Linux
188
+ uv run ruff check && uv run ruff format --check
189
+ ```
190
+
191
+ After changing the CLI, refresh the README block with `uv run conn help --markdown`.
192
+
193
+ ## Docs
194
+
195
+ - [docs/design.md](docs/design.md): the design and every decision, with its status.
196
+ - [docs/build-log.html](docs/build-log.html): how the design came together, as a blog post.
197
+
198
+ ## License
199
+
200
+ [Apache-2.0](LICENSE)