cli-anything-jumpserver
Stateful CLI harness for JumpServer bastion host. Manage assets, users, permissions, accounts, sessions, audits, and more via the JumpServer REST API.
Quick Start
# Install
cd agent-harness && pip install -e .
# Authenticate
cli-anything-jumpserver auth login --url https://jumpserver.example.com --username admin
# List hosts
cli-anything-jumpserver asset list --type host
# Interactive REPL mode
cli-anything-jumpserver --interactive
Agent Usage Guidance
This CLI is designed for AI agent consumption. Key features for agents:
JSON Output Mode
All commands support --output json for machine-parseable output:
cli-anything-jumpserver asset list --type host --output json
Dry Run Mode
All mutation commands support --dry-run to preview without execution:
cli-anything-jumpserver asset create --name test --address 10.0.0.1 --platform 1 --dry-run --output json
Environment Variables
JUMPSERVER_URL - Default JumpServer URL
JUMPSERVER_USERNAME - Default username
JUMPSERVER_PASSWORD - Default password
Typical Agent Workflows
1. Discovery and Inventory
# Check connection
cli-anything-jumpserver auth status --output json
# List all hosts
cli-anything-jumpserver asset list --type host --output json
# Get asset details
cli-anything-jumpserver asset get <ID> --type host --output json
# List all users
cli-anything-jumpserver user list --output json
2. User and Permission Management
# Create user
cli-anything-jumpserver user create --name "New User" --username newuser --email user@example.com --output json --dry-run
# Grant asset access
cli-anything-jumpserver perm create --name "App Access" --users "user1,user2" --assets "asset1,asset2" --output json --dry-run
# Verify permissions
cli-anything-jumpserver perm users <PERM_ID> --output json
3. Security Audit
# Check failed logins
cli-anything-jumpserver audit login --status failed --output json
# Review operations
cli-anything-jumpserver audit operate --action delete --output json
# Check active sessions
cli-anything-jumpserver session list --active --output json
# View command history
cli-anything-jumpserver session command list --risk 5 --output json
4. Session Management
# Monitor active sessions
cli-anything-jumpserver session list --active --output json
# Check terminal health
cli-anything-jumpserver session terminal list --output json
cli-anything-jumpserver session terminal status <TERMINAL_ID> --output json
Output Formats
| Format |
Flag |
Use Case |
| Table |
--output table (default) |
Human-readable display |
| JSON |
--output json |
Agent consumption, scripting |
| YAML |
--output yaml |
Configuration, readability |
Exit Codes
| Code |
Meaning |
| 0 |
Success |
| 1 |
CLI error (auth, API, etc.) |
| 2 |
Usage error (invalid options/arguments) |
| 130 |
Interrupted (Ctrl+C) |
File Locations
| Path |
Purpose |
~/.jumpserver-cli/session.json |
Authentication session |
~/.jumpserver-cli/state.json |
CLI operational state |
1---
2name: "cli-anything-jumpserver"
3description: Stateful CLI harness for JumpServer bastion host management. Supports asset, user, permission, account, session, audit, and operations management via REST API, with both one-shot and interactive REPL modes.
4version: 0.1.0
5category: infrastructure
6tags:
7 - jumpserver
8 - bastion
9 - pam
10 - security
11 - ssh
12 - cli
13commands:
14 - group: auth
15 description: Authentication and session management
16 subcommands:
17 - name: login
18 description: Authenticate to JumpServer and store session token
19 options: ["--url", "--username", "--password", "--org", "--insecure"]
20 - name: logout
21 description: Clear the current session
22 - name: status
23 description: Show current authentication status
24 - name: org
25 description: Switch or list organizations
26 options: ["--list"]
27
28 - group: asset
29 description: Manage assets (hosts, devices, databases, nodes, platforms, gateways, zones)
30 subcommands:
31 - name: list
32 description: List assets of a given type
33 options: ["--type", "--search", "--node", "--platform", "--active/--inactive", "--limit", "--offset"]
34 - name: get
35 description: Get details of a specific asset
36 - name: create
37 description: Create a new asset
38 options: ["--name", "--address", "--platform", "--type", "--nodes", "--dry-run"]
39 - name: update
40 description: Update an existing asset
41 options: ["--name", "--address", "--comment", "--active/--inactive", "--dry-run"]
42 - name: delete
43 description: Delete an asset
44 options: ["--force", "--dry-run"]
45 - name: node
46 description: Manage asset nodes (tree organization)
47 subcommands:
48 - name: list
49 description: List nodes
50 options: ["--tree", "--parent"]
51 - name: create
52 description: Create a new node
53 - name: delete
54 description: Delete a node
55 - name: add-assets
56 description: Add assets to a node
57 - name: platform
58 description: Manage asset platforms
59 subcommands:
60 - name: list
61 description: List platforms
62 - name: gateway
63 description: Manage gateways
64 subcommands:
65 - name: list
66 description: List gateways
67 - name: test
68 description: Test gateway connectivity
69 - name: zone
70 description: Manage zones
71 subcommands:
72 - name: list
73 description: List zones
74
75 - group: user
76 description: Manage users and user groups
77 subcommands:
78 - name: list
79 description: List users
80 options: ["--search", "--source", "--active/--inactive"]
81 - name: get
82 description: Get user details
83 - name: create
84 description: Create a new user
85 options: ["--name", "--username", "--email", "--password", "--role", "--dry-run"]
86 - name: update
87 description: Update a user
88 - name: delete
89 description: Delete a user
90 - name: reset-password
91 description: Reset a user's password
92 - name: unblock
93 description: Unblock a locked user
94 - name: profile
95 description: Show current user profile
96 - name: my-assets
97 description: List assets the current user can access
98 - name: group
99 description: Manage user groups
100 subcommands:
101 - name: list
102 description: List user groups
103 - name: create
104 description: Create a user group
105 - name: members
106 description: List members of a user group
107
108 - group: perm
109 description: Manage asset permissions
110 subcommands:
111 - name: list
112 description: List asset permissions
113 options: ["--search", "--user", "--active/--inactive"]
114 - name: get
115 description: Get permission details
116 - name: create
117 description: Create a new asset permission
118 options: ["--name", "--users", "--user-groups", "--assets", "--nodes", "--actions", "--dry-run"]
119 - name: update
120 description: Update an asset permission
121 - name: delete
122 description: Delete an asset permission
123 - name: users
124 description: List users assigned to a permission
125 - name: assets
126 description: List assets authorized by a permission
127
128 - group: account
129 description: Manage asset accounts and credentials
130 subcommands:
131 - name: list
132 description: List asset accounts
133 options: ["--search", "--asset", "--secret-type", "--privileged/--unprivileged"]
134 - name: get
135 description: Get account details
136 - name: create
137 description: Create a new asset account
138 options: ["--asset", "--username", "--secret-type", "--secret", "--dry-run"]
139 - name: update
140 description: Update an asset account
141 - name: delete
142 description: Delete an asset account
143 - name: secret
144 description: View account secrets/passwords
145 subcommands:
146 - name: view
147 description: View an account's password/secret
148 - name: history
149 description: View password change history
150 - name: template
151 description: Manage account templates
152 subcommands:
153 - name: list
154 description: List account templates
155
156 - group: session
157 description: Manage terminal sessions and replays
158 subcommands:
159 - name: list
160 description: List terminal sessions
161 options: ["--search", "--user", "--asset", "--protocol", "--active/--finished"]
162 - name: get
163 description: Get session details
164 - name: replay
165 description: Get session replay URL/info
166 - name: kill
167 description: Kill an active session
168 - name: command
169 description: View session command history
170 subcommands:
171 - name: list
172 description: List command records
173 options: ["--session", "--user", "--risk"]
174 - name: terminal
175 description: Manage terminal components
176 subcommands:
177 - name: list
178 description: List terminal components
179 - name: status
180 description: Get terminal component status
181
182 - group: audit
183 description: View audit logs
184 subcommands:
185 - name: login
186 description: View user login audit logs
187 - name: operate
188 description: View resource operation audit logs
189 - name: ftp
190 description: View FTP file transfer audit logs
191 - name: password
192 description: View password change audit logs
193 - name: activity
194 description: View user activity logs
195
196 - group: ops
197 description: Manage operations and job execution
198 subcommands:
199 - name: job-list
200 description: List execution jobs
201 - name: job-log
202 description: Get job execution log
203 - name: adhoc-list
204 description: List ad-hoc command executions
205 - name: playbook-list
206 description: List Ansible playbooks
207
208 - group: system
209 description: Manage system settings
210 subcommands:
211 - name: settings
212 description: List system settings
213 - name: health
214 description: Check system health
215 - name: info
216 description: Show system information
217
218 - group: label
219 description: Manage labels
220 subcommands:
221 - name: list
222 description: List labels
223
224 - group: role
225 description: Manage roles and permissions
226 subcommands:
227 - name: list
228 description: List roles
229 - name: bindings
230 description: List role bindings
231---
232
233# cli-anything-jumpserver
234
235Stateful CLI harness for JumpServer bastion host. Manage assets, users, permissions, accounts, sessions, audits, and more via the JumpServer REST API.
236
237## Quick Start
238
239```bash
240# Install
241cd agent-harness && pip install -e .
242
243# Authenticate
244cli-anything-jumpserver auth login --url https://jumpserver.example.com --username admin
245
246# List hosts
247cli-anything-jumpserver asset list --type host
248
249# Interactive REPL mode
250cli-anything-jumpserver --interactive
251```
252
253## Agent Usage Guidance
254
255This CLI is designed for AI agent consumption. Key features for agents:
256
257### JSON Output Mode
258All commands support `--output json` for machine-parseable output:
259```bash
260cli-anything-jumpserver asset list --type host --output json
261```
262
263### Dry Run Mode
264All mutation commands support `--dry-run` to preview without execution:
265```bash
266cli-anything-jumpserver asset create --name test --address 10.0.0.1 --platform 1 --dry-run --output json
267```
268
269### Environment Variables
270- `JUMPSERVER_URL` - Default JumpServer URL
271- `JUMPSERVER_USERNAME` - Default username
272- `JUMPSERVER_PASSWORD` - Default password
273
274### Typical Agent Workflows
275
276**1. Discovery and Inventory**
277```bash
278# Check connection
279cli-anything-jumpserver auth status --output json
280
281# List all hosts
282cli-anything-jumpserver asset list --type host --output json
283
284# Get asset details
285cli-anything-jumpserver asset get <ID> --type host --output json
286
287# List all users
288cli-anything-jumpserver user list --output json
289```
290
291**2. User and Permission Management**
292```bash
293# Create user
294cli-anything-jumpserver user create --name "New User" --username newuser --email user@example.com --output json --dry-run
295
296# Grant asset access
297cli-anything-jumpserver perm create --name "App Access" --users "user1,user2" --assets "asset1,asset2" --output json --dry-run
298
299# Verify permissions
300cli-anything-jumpserver perm users <PERM_ID> --output json
301```
302
303**3. Security Audit**
304```bash
305# Check failed logins
306cli-anything-jumpserver audit login --status failed --output json
307
308# Review operations
309cli-anything-jumpserver audit operate --action delete --output json
310
311# Check active sessions
312cli-anything-jumpserver session list --active --output json
313
314# View command history
315cli-anything-jumpserver session command list --risk 5 --output json
316```
317
318**4. Session Management**
319```bash
320# Monitor active sessions
321cli-anything-jumpserver session list --active --output json
322
323# Check terminal health
324cli-anything-jumpserver session terminal list --output json
325cli-anything-jumpserver session terminal status <TERMINAL_ID> --output json
326```
327
328## Output Formats
329
330| Format | Flag | Use Case |
331|--------|------|----------|
332| Table | `--output table` (default) | Human-readable display |
333| JSON | `--output json` | Agent consumption, scripting |
334| YAML | `--output yaml` | Configuration, readability |
335
336## Exit Codes
337
338| Code | Meaning |
339|------|---------|
340| 0 | Success |
341| 1 | CLI error (auth, API, etc.) |
342| 2 | Usage error (invalid options/arguments) |
343| 130 | Interrupted (Ctrl+C) |
344
345## File Locations
346
347| Path | Purpose |
348|------|---------|
349| `~/.jumpserver-cli/session.json` | Authentication session |
350| `~/.jumpserver-cli/state.json` | CLI operational state |