-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathssh-remote.json
More file actions
139 lines (139 loc) · 4.51 KB
/
ssh-remote.json
File metadata and controls
139 lines (139 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{
"version": "0.2",
"identity_profiles": [
{
"id": "ssh-monitor",
"provider": "none",
"subject": {
"kind": "service",
"principal": "agent://ops/ssh-monitor",
"display_name": "SSH Monitor Agent"
},
"trust": {
"level": "restricted",
"constraints": {
"max_autonomy": "restricted",
"escalation": "fail"
}
}
},
{
"id": "ssh-deploy",
"provider": "none",
"subject": {
"kind": "service",
"principal": "agent://ops/ssh-deploy",
"display_name": "SSH Deploy Agent"
},
"trust": {
"level": "supervised",
"constraints": {
"max_autonomy": "supervised",
"escalation": "human-approval"
}
}
}
],
"evidence_profiles": [
{
"id": "ssh-evidence",
"provider": "ssh",
"payload": {
"bind": ["execution_id", "declared_identity", "command", "result"],
"format": "canonical-json"
},
"verify": { "required": false }
}
],
"workflows": [
{
"id": "ssh-remote",
"name": "SSH Remote Operations",
"contract": {
"sandbox": "permissive",
"network": "unrestricted",
"audit": "always"
},
"tasks": [
{
"id": "check-uptime",
"name": "Check Remote Uptime",
"shell": {
"program": "ssh",
"args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", "user@host", "uptime"]
},
"target": { "session_target": "shell" },
"identity": { "ref": "ssh-monitor" },
"output": { "format": "text", "preview_bytes": 1000 },
"schedule": { "cron": "*/5 * * * *" }
},
{
"id": "check-disk",
"name": "Check Remote Disk Usage",
"shell": {
"program": "ssh",
"args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", "user@host", "df", "-h"]
},
"target": { "session_target": "shell" },
"identity": { "ref": "ssh-monitor" },
"output": { "format": "text", "preview_bytes": 4000 },
"schedule": { "cron": "*/10 * * * *" }
},
{
"id": "check-memory",
"name": "Check Remote Memory Usage",
"shell": {
"program": "ssh",
"args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", "user@host", "free", "-m"]
},
"target": { "session_target": "shell" },
"identity": { "ref": "ssh-monitor" },
"output": { "format": "text", "preview_bytes": 2000 },
"schedule": { "cron": "*/10 * * * *" }
},
{
"id": "deploy-update",
"name": "Restart Application Service",
"shell": {
"program": "ssh",
"args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", "user@host", "sudo", "systemctl", "restart", "myapp"]
},
"target": { "session_target": "shell" },
"identity": { "ref": "ssh-deploy" },
"evidence": { "ref": "ssh-evidence" },
"output": { "format": "text", "preview_bytes": 2000 },
"contract": {
"required_trust_level": "supervised",
"trust_enforcement": "strict"
},
"schedule": { "cron": "0 3 * * *" },
"on_failure": {
"id": "triage-deploy-failure",
"name": "Triage Deploy Failure",
"prompt": "The remote service restart failed. Determine whether this is an SSH connectivity issue, a systemd unit failure, a permissions problem, or a service dependency error, and recommend the safest recovery step.",
"target": { "session_target": "isolated", "agent_id": "main" },
"intent": { "mode": "plan", "read_only": true },
"context": { "retrieval": "recent", "limit": 5 },
"delivery": { "mode": "announce", "to": "@owner_dm" }
}
},
{
"id": "tail-logs",
"name": "Tail Application Logs",
"shell": {
"program": "ssh",
"args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=5", "user@host", "journalctl", "-u", "myapp", "-n", "50", "--no-pager"]
},
"target": { "session_target": "shell" },
"identity": { "ref": "ssh-monitor" },
"output": { "format": "text", "preview_bytes": 8000 },
"trigger": {
"parent": "deploy-update",
"on": "success",
"delay_s": 10
}
}
]
}
]
}