@hivemagnus/magnus-skills 3.3.5 → 3.4.0
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.
- package/package.json +1 -1
- package/skills/backup-manager/backup.sh +4 -4
- package/skills/cert-manager/certs.sh +7 -7
- package/skills/cron-manager/crontabs.sh +6 -6
- package/skills/disk-cleaner/SKILL.md +3 -3
- package/skills/disk-cleaner/cleaner.sh +17 -16
- package/skills/disk-cleaner/manifest.json +2 -2
- package/skills/dns-manager/dns.sh +8 -8
- package/skills/docker-manager/containers.sh +12 -12
- package/skills/energy-profiler/energy.sh +7 -7
- package/skills/firewall-manager/firewall.sh +5 -5
- package/skills/git-repo-scanner/git-scan.sh +14 -14
- package/skills/index.json +3 -4
- package/skills/llm-gateway-monitor/llm-monitor.sh +14 -14
- package/skills/log-analyzer/analyze.sh +2 -2
- package/skills/login-auditor/logins.sh +6 -6
- package/skills/mount-inspector/mounts.sh +10 -10
- package/skills/network-diagnostics/netdiag.sh +4 -4
- package/skills/news-reporter/prompt-filter.sh +1 -1
- package/skills/news-reporter/reporter.sh +1 -1
- package/skills/ntp-manager/timesync.sh +5 -5
- package/skills/package-manager/packages.sh +12 -12
- package/skills/process-inspector/procs.sh +11 -11
- package/skills/security-auditor/audit.sh +7 -7
- package/skills/service-watcher/watcher.sh +5 -5
- package/skills/swap-manager/swap.sh +7 -7
- package/skills/sysctl-tuner/tuner.sh +5 -5
- package/skills/system-monitor/monitor.sh +10 -10
- package/skills/update-manager/updates.sh +13 -13
- package/skills/user-manager/users.sh +2 -2
- package/skills/wazuh-agent-monitor/wazuh-agent.sh +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hivemagnus/magnus-skills",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Ubuntu operations skill catalogue for Magnus and Hermes Agent: package, service, network, storage and security runbooks with validated manifests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"magnus",
|
|
@@ -51,7 +51,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
51
51
|
-vv) VERBOSE=2; shift ;;
|
|
52
52
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
53
53
|
--) shift; break ;;
|
|
54
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
54
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
55
55
|
*) break ;;
|
|
56
56
|
esac
|
|
57
57
|
done
|
|
@@ -76,8 +76,8 @@ ARCHIVE="$DEST/backup-$STAMP.tar.gz"
|
|
|
76
76
|
|
|
77
77
|
# ── Disk space check ──
|
|
78
78
|
log_v1 "Checking available disk space at $DEST"
|
|
79
|
-
AVAIL_KB=$(df --output=avail "$DEST" 2>/dev/null | tail -1 | xargs)
|
|
80
|
-
SRC_KB=$(du -sk "$SRC" 2>/dev/null | awk '{print $1}')
|
|
79
|
+
AVAIL_KB=$(df --output=avail "$DEST" 2>/dev/null | tail -1 | xargs || true)
|
|
80
|
+
SRC_KB=$(du -sk "$SRC" 2>/dev/null | awk '{print $1}' || true)
|
|
81
81
|
if [[ -n "$AVAIL_KB" && -n "$SRC_KB" && "$AVAIL_KB" -lt "$SRC_KB" ]]; then
|
|
82
82
|
echo "⚠ Warning: available space (${AVAIL_KB}K) may be insufficient for source (${SRC_KB}K)"
|
|
83
83
|
fi
|
|
@@ -107,7 +107,7 @@ fi
|
|
|
107
107
|
|
|
108
108
|
echo "--- Retention Cleanup ---"
|
|
109
109
|
# Only this tool's own archives directly in DEST, never matching files in directories below it.
|
|
110
|
-
DELETED=$(find "$DEST" -maxdepth 1 -type f -name "backup-*.tar.gz" -mtime +"$RETENTION_DAYS" -delete -print | wc -l)
|
|
110
|
+
DELETED=$(find "$DEST" -maxdepth 1 -type f -name "backup-*.tar.gz" -mtime +"$RETENTION_DAYS" -delete -print | wc -l || true)
|
|
111
111
|
echo "Purged $DELETED old backup(s) (> ${RETENTION_DAYS} days)"
|
|
112
112
|
|
|
113
113
|
echo "--- Current Backups ---"
|
|
@@ -45,7 +45,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
45
45
|
-vv) VERBOSE=2; shift ;;
|
|
46
46
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
47
47
|
--) shift; break ;;
|
|
48
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
48
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
49
49
|
*) break ;;
|
|
50
50
|
esac
|
|
51
51
|
done
|
|
@@ -76,23 +76,23 @@ for dir in "${CERT_DIRS[@]}"; do
|
|
|
76
76
|
echo " ✓ $cert — ${DAYS_LEFT}d remaining"
|
|
77
77
|
fi
|
|
78
78
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
79
|
-
SUBJECT=$(openssl x509 -subject -noout -in "$cert" 2>/dev/null | sed 's/subject=//')
|
|
80
|
-
ISSUER=$(openssl x509 -issuer -noout -in "$cert" 2>/dev/null | sed 's/issuer=//')
|
|
79
|
+
SUBJECT=$(openssl x509 -subject -noout -in "$cert" 2>/dev/null | sed 's/subject=//' || true)
|
|
80
|
+
ISSUER=$(openssl x509 -issuer -noout -in "$cert" 2>/dev/null | sed 's/issuer=//' || true)
|
|
81
81
|
echo " Subject: $SUBJECT"
|
|
82
82
|
echo " Issuer: $ISSUER"
|
|
83
83
|
fi
|
|
84
84
|
if [[ $VERBOSE -ge 2 ]]; then
|
|
85
|
-
KEY_SIZE=$(openssl x509 -text -noout -in "$cert" 2>/dev/null | grep "Public-Key:" | head -1)
|
|
86
|
-
SIG_ALG=$(openssl x509 -text -noout -in "$cert" 2>/dev/null | grep "Signature Algorithm:" | head -1)
|
|
85
|
+
KEY_SIZE=$(openssl x509 -text -noout -in "$cert" 2>/dev/null | grep "Public-Key:" | head -1 || true)
|
|
86
|
+
SIG_ALG=$(openssl x509 -text -noout -in "$cert" 2>/dev/null | grep "Signature Algorithm:" | head -1 || true)
|
|
87
87
|
echo " ${KEY_SIZE:-}"
|
|
88
88
|
echo " ${SIG_ALG:-}"
|
|
89
89
|
# Chain validation
|
|
90
90
|
openssl verify "$cert" 2>/dev/null | sed 's/^/ /' || true
|
|
91
91
|
fi
|
|
92
92
|
if [[ $VERBOSE -ge 3 ]]; then
|
|
93
|
-
openssl x509 -text -noout -in "$cert" 2>/dev/null | sed 's/^/ /'
|
|
93
|
+
openssl x509 -text -noout -in "$cert" 2>/dev/null | sed 's/^/ /' || true
|
|
94
94
|
fi
|
|
95
|
-
done
|
|
95
|
+
done || true
|
|
96
96
|
done
|
|
97
97
|
|
|
98
98
|
echo "--- Let's Encrypt Status ---"
|
|
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
41
41
|
-vv) VERBOSE=2; shift ;;
|
|
42
42
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
43
43
|
--) shift; break ;;
|
|
44
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
44
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
45
45
|
*) break ;;
|
|
46
46
|
esac
|
|
47
47
|
done
|
|
@@ -62,12 +62,12 @@ done
|
|
|
62
62
|
echo "--- Cron Directories ---"
|
|
63
63
|
for dir in /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly; do
|
|
64
64
|
if [[ -d "$dir" ]]; then
|
|
65
|
-
COUNT=$(find "$dir" -maxdepth 1 -type f -executable 2>/dev/null | wc -l)
|
|
65
|
+
COUNT=$(find "$dir" -maxdepth 1 -type f -executable 2>/dev/null | wc -l || true)
|
|
66
66
|
echo " $dir: $COUNT script(s)"
|
|
67
67
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
68
68
|
find "$dir" -maxdepth 1 -type f -executable 2>/dev/null | while read -r s; do
|
|
69
69
|
echo " $(basename "$s")"
|
|
70
|
-
done
|
|
70
|
+
done || true
|
|
71
71
|
fi
|
|
72
72
|
fi
|
|
73
73
|
done
|
|
@@ -107,10 +107,10 @@ fi
|
|
|
107
107
|
# ── At queue ──
|
|
108
108
|
echo "--- At Queue ---"
|
|
109
109
|
if command -v atq &>/dev/null; then
|
|
110
|
-
AT_JOBS=$(atq 2>/dev/null | wc -l)
|
|
110
|
+
AT_JOBS=$(atq 2>/dev/null | wc -l || true)
|
|
111
111
|
echo " Pending at jobs: $AT_JOBS"
|
|
112
112
|
if [[ $VERBOSE -ge 1 && $AT_JOBS -gt 0 ]]; then
|
|
113
|
-
atq 2>/dev/null | head -10 | sed 's/^/ /'
|
|
113
|
+
atq 2>/dev/null | head -10 | sed 's/^/ /' || true
|
|
114
114
|
fi
|
|
115
115
|
else
|
|
116
116
|
echo " at not installed"
|
|
@@ -122,7 +122,7 @@ if [[ $VERBOSE -ge 2 ]]; then
|
|
|
122
122
|
for f in /etc/crontab /etc/cron.d/*; do
|
|
123
123
|
[[ -f "$f" ]] || continue
|
|
124
124
|
grep -Ev '^\s*#|^\s*$|^(SHELL|PATH|MAILTO|HOME)' "$f" 2>/dev/null | while read -r line; do
|
|
125
|
-
CMD=$(echo "$line" | awk '{for(i=6;i<=NF;i++) printf "%s ", $i; print ""}' | awk '{print $1}')
|
|
125
|
+
CMD=$(echo "$line" | awk '{for(i=6;i<=NF;i++) printf "%s ", $i; print ""}' | awk '{print $1}' || true)
|
|
126
126
|
[[ -z "$CMD" ]] && continue
|
|
127
127
|
if command -v "$CMD" &>/dev/null; then
|
|
128
128
|
log_v2 " ✓ $CMD exists"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: disk-cleaner
|
|
3
|
-
description: "
|
|
3
|
+
description: "Disk space report — finds old temp files, large logs, package and container caches and the largest directories, and prints the cleanup commands to run. Read-only: it deletes nothing. Configurable usage threshold."
|
|
4
4
|
version: 1.0.0
|
|
5
5
|
platforms: [linux]
|
|
6
6
|
metadata:
|
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
# Disk Cleaner
|
|
13
13
|
|
|
14
14
|
## When to Use
|
|
15
|
-
Use this skill when managing or auditing a Magnus-managed Linux node and the task matches this capability:
|
|
15
|
+
Use this skill when managing or auditing a Magnus-managed Linux node and the task matches this capability: Disk space report — finds old temp files, large logs, package and container caches and the largest directories, and prints the cleanup commands to run. Read-only: it deletes nothing. Configurable usage threshold.
|
|
16
16
|
|
|
17
17
|
## Procedure
|
|
18
18
|
1. Inspect the local node context and confirm the task is appropriate for this skill.
|
|
@@ -21,7 +21,7 @@ Use this skill when managing or auditing a Magnus-managed Linux node and the tas
|
|
|
21
21
|
4. Summarize the findings, actions taken, and any follow-up risk for the operator.
|
|
22
22
|
|
|
23
23
|
## Requirements
|
|
24
|
-
Expected host commands: `find`, `du`, `df
|
|
24
|
+
Expected host commands: `find`, `du`, `df`.
|
|
25
25
|
|
|
26
26
|
## Verification
|
|
27
27
|
Confirm the script exits successfully and that its summary output matches the requested node-management task.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# disk-cleaner —
|
|
2
|
+
# disk-cleaner — Report disk space cleanup opportunities on Ubuntu servers (read-only)
|
|
3
3
|
set -euo pipefail
|
|
4
4
|
|
|
5
5
|
VERBOSE=0
|
|
@@ -9,9 +9,10 @@ usage() {
|
|
|
9
9
|
cat <<EOF
|
|
10
10
|
Usage: $(basename "$0") [OPTIONS] [THRESHOLD]
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Disk space report for Ubuntu. Identifies cleanup opportunities (temp
|
|
13
|
+
files, old logs, APT cache, snap cache, journal logs, Docker dangling
|
|
14
|
+
images, orphaned packages) and prints the commands to clean them.
|
|
15
|
+
Read-only: it deletes nothing.
|
|
15
16
|
|
|
16
17
|
Positional arguments:
|
|
17
18
|
THRESHOLD Disk usage % to consider critical (default: 80)
|
|
@@ -45,7 +46,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
45
46
|
-vv) VERBOSE=2; shift ;;
|
|
46
47
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
47
48
|
--) shift; break ;;
|
|
48
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
49
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
49
50
|
*) break ;;
|
|
50
51
|
esac
|
|
51
52
|
done
|
|
@@ -56,16 +57,16 @@ echo "=== Disk Cleaner ==="
|
|
|
56
57
|
echo "Critical threshold: ${THRESHOLD}%"
|
|
57
58
|
|
|
58
59
|
echo "--- Current Usage ---"
|
|
59
|
-
df -h --output=target,pcent,avail,size | head -15
|
|
60
|
+
df -h --output=target,pcent,avail,size | head -15 || true
|
|
60
61
|
# Flag any partition over threshold
|
|
61
|
-
df --output=target,pcent 2>/dev/null | awk -v thresh="$THRESHOLD" 'NR>1 {gsub(/%/,"",$2); if ($2+0 >= thresh+0) print " ⚠ " $1 " at " $2 "%"}'
|
|
62
|
+
df --output=target,pcent 2>/dev/null | awk -v thresh="$THRESHOLD" 'NR>1 {gsub(/%/,"",$2); if ($2+0 >= thresh+0) print " ⚠ " $1 " at " $2 "%"}' || true
|
|
62
63
|
|
|
63
64
|
echo "--- Temp Files (> 7 days) ---"
|
|
64
|
-
COUNT=$(find /tmp /var/tmp -type f -mtime +7 2>/dev/null | wc -l)
|
|
65
|
-
SIZE=$(find /tmp /var/tmp -type f -mtime +7 -exec du -ch {} + 2>/dev/null | tail -1 | awk '{print $1}')
|
|
65
|
+
COUNT=$(find /tmp /var/tmp -type f -mtime +7 2>/dev/null | wc -l || true)
|
|
66
|
+
SIZE=$(find /tmp /var/tmp -type f -mtime +7 -exec du -ch {} + 2>/dev/null | tail -1 | awk '{print $1}' || true)
|
|
66
67
|
echo " Found $COUNT old temp files (${SIZE:-0})"
|
|
67
68
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
68
|
-
find /tmp /var/tmp -type f -mtime +7 2>/dev/null -exec ls -lh {} \; | awk '{print " " $5, $9}' | head -15
|
|
69
|
+
find /tmp /var/tmp -type f -mtime +7 2>/dev/null -exec ls -lh {} \; | awk '{print " " $5, $9}' | head -15 || true
|
|
69
70
|
fi
|
|
70
71
|
|
|
71
72
|
echo "--- Large Log Files (> 100MB) ---"
|
|
@@ -80,7 +81,7 @@ fi
|
|
|
80
81
|
|
|
81
82
|
echo "--- APT Cache ---"
|
|
82
83
|
if command -v apt &>/dev/null; then
|
|
83
|
-
CACHE_SIZE=$(du -sh /var/cache/apt/archives 2>/dev/null | awk '{print $1}')
|
|
84
|
+
CACHE_SIZE=$(du -sh /var/cache/apt/archives 2>/dev/null | awk '{print $1}' || true)
|
|
84
85
|
echo " APT cache: ${CACHE_SIZE:-unknown}"
|
|
85
86
|
echo " Clean with: sudo apt clean && sudo apt autoremove"
|
|
86
87
|
if [[ $VERBOSE -ge 2 ]]; then
|
|
@@ -91,22 +92,22 @@ fi
|
|
|
91
92
|
|
|
92
93
|
echo "--- Snap Cache ---"
|
|
93
94
|
if command -v snap &>/dev/null; then
|
|
94
|
-
SNAP_CACHE=$(du -sh /var/lib/snapd/cache 2>/dev/null | awk '{print $1}')
|
|
95
|
+
SNAP_CACHE=$(du -sh /var/lib/snapd/cache 2>/dev/null | awk '{print $1}' || true)
|
|
95
96
|
echo " Snap cache: ${SNAP_CACHE:-N/A}"
|
|
96
97
|
# Count disabled snap revisions
|
|
97
|
-
DISABLED=$(snap list --all 2>/dev/null | awk '/disabled/ {print $1, $3}' | wc -l)
|
|
98
|
+
DISABLED=$(snap list --all 2>/dev/null | awk '/disabled/ {print $1, $3}' | wc -l || true)
|
|
98
99
|
if [[ $DISABLED -gt 0 ]]; then
|
|
99
100
|
echo " ⚠ $DISABLED disabled snap revision(s) can be removed"
|
|
100
101
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
101
|
-
snap list --all 2>/dev/null | awk '/disabled/ {print " " $1, "rev", $3}'
|
|
102
|
+
snap list --all 2>/dev/null | awk '/disabled/ {print " " $1, "rev", $3}' || true
|
|
102
103
|
fi
|
|
103
104
|
fi
|
|
104
105
|
fi
|
|
105
106
|
|
|
106
107
|
echo "--- Docker (if present) ---"
|
|
107
108
|
if command -v docker &>/dev/null && docker info &>/dev/null 2>&1; then
|
|
108
|
-
DANGLING=$(docker images -f "dangling=true" -q 2>/dev/null | wc -l)
|
|
109
|
-
STOPPED=$(docker ps -aq --filter "status=exited" 2>/dev/null | wc -l)
|
|
109
|
+
DANGLING=$(docker images -f "dangling=true" -q 2>/dev/null | wc -l || true)
|
|
110
|
+
STOPPED=$(docker ps -aq --filter "status=exited" 2>/dev/null | wc -l || true)
|
|
110
111
|
echo " Dangling images: $DANGLING"
|
|
111
112
|
echo " Stopped containers: $STOPPED"
|
|
112
113
|
if [[ $DANGLING -gt 0 || $STOPPED -gt 0 ]]; then
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disk-cleaner",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Disk space report — finds old temp files, large logs, package and container caches and the largest directories, and prints the cleanup commands to run. Read-only: it deletes nothing. Configurable usage threshold.",
|
|
5
5
|
"author": "magnus",
|
|
6
6
|
"entryPoint": "cleaner.sh",
|
|
7
|
-
"dependencies": ["find", "du", "df"
|
|
7
|
+
"dependencies": ["find", "du", "df"],
|
|
8
8
|
"tags": ["disk", "cleanup", "maintenance", "storage"]
|
|
9
9
|
}
|
|
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
41
41
|
-vv) VERBOSE=2; shift ;;
|
|
42
42
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
43
43
|
--) shift; break ;;
|
|
44
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
44
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
45
45
|
*) break ;;
|
|
46
46
|
esac
|
|
47
47
|
done
|
|
@@ -71,7 +71,7 @@ NAMESERVERS=$(grep -E '^nameserver' /etc/resolv.conf 2>/dev/null | awk '{print $
|
|
|
71
71
|
TEST_DOMAIN="google.com"
|
|
72
72
|
for ns in $NAMESERVERS; do
|
|
73
73
|
if dig +short +timeout=3 +tries=1 "$TEST_DOMAIN" "@$ns" >/dev/null 2>&1; then
|
|
74
|
-
LATENCY=$(dig +noall +stats "$TEST_DOMAIN" "@$ns" 2>/dev/null | grep 'Query time' | awk '{print $4 " " $5}')
|
|
74
|
+
LATENCY=$(dig +noall +stats "$TEST_DOMAIN" "@$ns" 2>/dev/null | grep 'Query time' | awk '{print $4 " " $5}' || true)
|
|
75
75
|
echo " ✓ $ns — responsive ($LATENCY)"
|
|
76
76
|
else
|
|
77
77
|
echo " ✗ $ns — FAILED to resolve $TEST_DOMAIN"
|
|
@@ -80,7 +80,7 @@ done
|
|
|
80
80
|
|
|
81
81
|
echo "--- Basic Resolution Test ---"
|
|
82
82
|
for domain in google.com github.com apt.ubuntu.com; do
|
|
83
|
-
RESULT=$(dig +short "$domain" 2>/dev/null | head -3 | tr '\n' ', ' | sed 's/,$//')
|
|
83
|
+
RESULT=$(dig +short "$domain" 2>/dev/null | head -3 | tr '\n' ', ' | sed 's/,$//' || true)
|
|
84
84
|
if [[ -n "$RESULT" ]]; then
|
|
85
85
|
echo " ✓ $domain → $RESULT"
|
|
86
86
|
else
|
|
@@ -91,7 +91,7 @@ done
|
|
|
91
91
|
echo "--- Reverse DNS ---"
|
|
92
92
|
# Check if this node's IPs have valid PTR records
|
|
93
93
|
for ip in $(hostname -I 2>/dev/null | tr ' ' '\n' | head -3); do
|
|
94
|
-
PTR=$(dig +short -x "$ip" 2>/dev/null | head -1)
|
|
94
|
+
PTR=$(dig +short -x "$ip" 2>/dev/null | head -1 || true)
|
|
95
95
|
if [[ -n "$PTR" ]]; then
|
|
96
96
|
echo " $ip → $PTR"
|
|
97
97
|
else
|
|
@@ -111,14 +111,14 @@ if [[ $VERBOSE -ge 1 ]]; then
|
|
|
111
111
|
|
|
112
112
|
echo "--- DNSSEC Validation ---"
|
|
113
113
|
# Test DNSSEC with a known signed zone
|
|
114
|
-
DNSSEC_RESULT=$(dig +dnssec +short dnssec.works 2>/dev/null | head -1)
|
|
114
|
+
DNSSEC_RESULT=$(dig +dnssec +short dnssec.works 2>/dev/null | head -1 || true)
|
|
115
115
|
if [[ -n "$DNSSEC_RESULT" ]]; then
|
|
116
116
|
echo " ✓ DNSSEC validation working (dnssec.works resolved)"
|
|
117
117
|
else
|
|
118
118
|
echo " ⚠ DNSSEC may not be enabled or working"
|
|
119
119
|
fi
|
|
120
120
|
# Test with a known DNSSEC-failing domain
|
|
121
|
-
FAIL_RESULT=$(dig +dnssec +short fail01.dnssec.works 2>/dev/null | head -1)
|
|
121
|
+
FAIL_RESULT=$(dig +dnssec +short fail01.dnssec.works 2>/dev/null | head -1 || true)
|
|
122
122
|
if [[ -z "$FAIL_RESULT" ]]; then
|
|
123
123
|
echo " ✓ DNSSEC correctly rejects invalid signatures"
|
|
124
124
|
else
|
|
@@ -131,12 +131,12 @@ if [[ $VERBOSE -ge 2 ]]; then
|
|
|
131
131
|
echo "--- Split-Horizon Check ---"
|
|
132
132
|
HOSTNAME_FQDN=$(hostname -f 2>/dev/null || hostname)
|
|
133
133
|
for ns in $NAMESERVERS; do
|
|
134
|
-
RESULT=$(dig +short "$HOSTNAME_FQDN" "@$ns" 2>/dev/null | head -1)
|
|
134
|
+
RESULT=$(dig +short "$HOSTNAME_FQDN" "@$ns" 2>/dev/null | head -1 || true)
|
|
135
135
|
echo " $ns resolves $(hostname -f 2>/dev/null || hostname) → ${RESULT:-(NXDOMAIN)}"
|
|
136
136
|
done
|
|
137
137
|
# Also check against public resolvers
|
|
138
138
|
for public in 8.8.8.8 1.1.1.1; do
|
|
139
|
-
RESULT=$(dig +short +timeout=3 "$HOSTNAME_FQDN" "@$public" 2>/dev/null | head -1)
|
|
139
|
+
RESULT=$(dig +short +timeout=3 "$HOSTNAME_FQDN" "@$public" 2>/dev/null | head -1 || true)
|
|
140
140
|
echo " $public resolves $(hostname -f 2>/dev/null || hostname) → ${RESULT:-(NXDOMAIN)}"
|
|
141
141
|
done
|
|
142
142
|
|
|
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
41
41
|
-vv) VERBOSE=2; shift ;;
|
|
42
42
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
43
43
|
--) shift; break ;;
|
|
44
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
44
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
45
45
|
*) break ;;
|
|
46
46
|
esac
|
|
47
47
|
done
|
|
@@ -66,18 +66,18 @@ log_v1 "Docker root: $(docker info --format '{{.DockerRootDir}}' 2>/dev/null)"
|
|
|
66
66
|
|
|
67
67
|
# ── Containers ──
|
|
68
68
|
echo "--- Containers ---"
|
|
69
|
-
RUNNING=$(docker ps -q 2>/dev/null | wc -l)
|
|
70
|
-
TOTAL=$(docker ps -aq 2>/dev/null | wc -l)
|
|
69
|
+
RUNNING=$(docker ps -q 2>/dev/null | wc -l || true)
|
|
70
|
+
TOTAL=$(docker ps -aq 2>/dev/null | wc -l || true)
|
|
71
71
|
STOPPED=$((TOTAL - RUNNING))
|
|
72
72
|
echo " Running: $RUNNING | Stopped: $STOPPED | Total: $TOTAL"
|
|
73
73
|
|
|
74
74
|
if [[ $RUNNING -gt 0 ]]; then
|
|
75
|
-
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}\t{{.Ports}}" 2>/dev/null | head -20
|
|
75
|
+
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}\t{{.Ports}}" 2>/dev/null | head -20 || true
|
|
76
76
|
fi
|
|
77
77
|
|
|
78
78
|
if [[ $STOPPED -gt 0 ]]; then
|
|
79
79
|
echo " Stopped containers:"
|
|
80
|
-
docker ps -a --filter "status=exited" --format " {{.Names}} ({{.Status}})" 2>/dev/null | head -10
|
|
80
|
+
docker ps -a --filter "status=exited" --format " {{.Names}} ({{.Status}})" 2>/dev/null | head -10 || true
|
|
81
81
|
fi
|
|
82
82
|
|
|
83
83
|
# ── Container stats (verbose 1+) ──
|
|
@@ -88,27 +88,27 @@ fi
|
|
|
88
88
|
|
|
89
89
|
# ── Images ──
|
|
90
90
|
echo "--- Images ---"
|
|
91
|
-
IMAGE_COUNT=$(docker images -q 2>/dev/null | wc -l)
|
|
92
|
-
DANGLING=$(docker images -f "dangling=true" -q 2>/dev/null | wc -l)
|
|
91
|
+
IMAGE_COUNT=$(docker images -q 2>/dev/null | wc -l || true)
|
|
92
|
+
DANGLING=$(docker images -f "dangling=true" -q 2>/dev/null | wc -l || true)
|
|
93
93
|
echo " Total: $IMAGE_COUNT | Dangling: $DANGLING"
|
|
94
94
|
|
|
95
95
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
96
|
-
docker images --format " {{.Repository}}:{{.Tag}} ({{.Size}}, {{.CreatedSince}})" 2>/dev/null | head -15
|
|
96
|
+
docker images --format " {{.Repository}}:{{.Tag}} ({{.Size}}, {{.CreatedSince}})" 2>/dev/null | head -15 || true
|
|
97
97
|
fi
|
|
98
98
|
|
|
99
99
|
if [[ $DANGLING -gt 0 ]]; then
|
|
100
|
-
DANGLING_SIZE=$(docker images -f "dangling=true" --format '{{.Size}}' 2>/dev/null | head -5)
|
|
100
|
+
DANGLING_SIZE=$(docker images -f "dangling=true" --format '{{.Size}}' 2>/dev/null | head -5 || true)
|
|
101
101
|
echo " ⚠ $DANGLING dangling image(s) can be cleaned with: docker image prune"
|
|
102
102
|
fi
|
|
103
103
|
|
|
104
104
|
# ── Volumes ──
|
|
105
105
|
echo "--- Volumes ---"
|
|
106
|
-
VOL_COUNT=$(docker volume ls -q 2>/dev/null | wc -l)
|
|
107
|
-
DANGLING_VOLS=$(docker volume ls -f "dangling=true" -q 2>/dev/null | wc -l)
|
|
106
|
+
VOL_COUNT=$(docker volume ls -q 2>/dev/null | wc -l || true)
|
|
107
|
+
DANGLING_VOLS=$(docker volume ls -f "dangling=true" -q 2>/dev/null | wc -l || true)
|
|
108
108
|
echo " Total: $VOL_COUNT | Unused: $DANGLING_VOLS"
|
|
109
109
|
|
|
110
110
|
if [[ $VERBOSE -ge 2 ]]; then
|
|
111
|
-
docker volume ls --format " {{.Name}} ({{.Driver}})" 2>/dev/null | head -15
|
|
111
|
+
docker volume ls --format " {{.Name}} ({{.Driver}})" 2>/dev/null | head -15 || true
|
|
112
112
|
fi
|
|
113
113
|
|
|
114
114
|
if [[ $DANGLING_VOLS -gt 0 ]]; then
|
|
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
41
41
|
-vv) VERBOSE=2; shift ;;
|
|
42
42
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
43
43
|
--) shift; break ;;
|
|
44
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
44
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
45
45
|
*) break ;;
|
|
46
46
|
esac
|
|
47
47
|
done
|
|
@@ -166,7 +166,7 @@ if [[ $VERBOSE -ge 1 ]]; then
|
|
|
166
166
|
ZONE=$(basename "$tz")
|
|
167
167
|
for trip in "${tz}"trip_point_*_temp; do
|
|
168
168
|
[[ -f "$trip" ]] || continue
|
|
169
|
-
TRIP_NUM=$(echo "$trip" | grep -oP 'trip_point_\K\d+')
|
|
169
|
+
TRIP_NUM=$(echo "$trip" | grep -oP 'trip_point_\K\d+' || true)
|
|
170
170
|
TRIP_TEMP=$(($(cat "$trip" 2>/dev/null || echo 0) / 1000))
|
|
171
171
|
TRIP_TYPE=$(cat "${tz}trip_point_${TRIP_NUM}_type" 2>/dev/null || echo "?")
|
|
172
172
|
echo " $ZONE trip $TRIP_NUM: ${TRIP_TEMP}°C ($TRIP_TYPE)"
|
|
@@ -186,24 +186,24 @@ if [[ $VERBOSE -ge 2 ]]; then
|
|
|
186
186
|
echo "--- Per-Core Frequency ---"
|
|
187
187
|
for freq_file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq; do
|
|
188
188
|
[[ -f "$freq_file" ]] || continue
|
|
189
|
-
CPU=$(echo "$freq_file" | grep -oP 'cpu\K\d+')
|
|
189
|
+
CPU=$(echo "$freq_file" | grep -oP 'cpu\K\d+' || true)
|
|
190
190
|
FREQ=$(($(cat "$freq_file") / 1000))
|
|
191
191
|
echo " cpu$CPU: ${FREQ} MHz"
|
|
192
|
-
done | head -32
|
|
192
|
+
done | head -32 || true
|
|
193
193
|
fi
|
|
194
194
|
|
|
195
195
|
# ── Full dump (verbose 3) ──
|
|
196
196
|
if [[ $VERBOSE -ge 3 ]]; then
|
|
197
197
|
echo "--- /proc/cpuinfo (freq fields) ---"
|
|
198
|
-
grep -i "model name\|cpu mhz\|bogomips" /proc/cpuinfo 2>/dev/null | sort -u | sed 's/^/ /'
|
|
198
|
+
grep -i "model name\|cpu mhz\|bogomips" /proc/cpuinfo 2>/dev/null | sort -u | sed 's/^/ /' || true
|
|
199
199
|
|
|
200
200
|
echo "--- Runtime PM Stats ---"
|
|
201
201
|
for dev in /sys/bus/pci/devices/*/power/runtime_status; do
|
|
202
202
|
[[ -f "$dev" ]] || continue
|
|
203
|
-
DEVID=$(echo "$dev" | grep -oP '/\K[^/]+(?=/power)')
|
|
203
|
+
DEVID=$(echo "$dev" | grep -oP '/\K[^/]+(?=/power)' || true)
|
|
204
204
|
STATUS=$(cat "$dev" 2>/dev/null)
|
|
205
205
|
echo " $DEVID: $STATUS"
|
|
206
|
-
done 2>/dev/null | head -20
|
|
206
|
+
done 2>/dev/null | head -20 || true
|
|
207
207
|
|
|
208
208
|
echo "--- Kernel Power Parameters ---"
|
|
209
209
|
cat /sys/module/*/parameters/*power* 2>/dev/null | head -10 | sed 's/^/ /' || echo " none"
|
|
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
41
41
|
-vv) VERBOSE=2; shift ;;
|
|
42
42
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
43
43
|
--) shift; break ;;
|
|
44
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
44
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
45
45
|
*) break ;;
|
|
46
46
|
esac
|
|
47
47
|
done
|
|
@@ -65,7 +65,7 @@ if command -v ufw &>/dev/null; then
|
|
|
65
65
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
66
66
|
echo "--- UFW App Profiles ---"
|
|
67
67
|
ufw app list 2>/dev/null | sed 's/^/ /' || true
|
|
68
|
-
log_v1 "Default incoming: $(ufw status verbose 2>/dev/null | grep 'Default:' | head -1)"
|
|
68
|
+
log_v1 "Default incoming: $(ufw status verbose 2>/dev/null | grep 'Default:' | head -1)" || true
|
|
69
69
|
fi
|
|
70
70
|
|
|
71
71
|
if [[ $VERBOSE -ge 2 ]]; then
|
|
@@ -87,8 +87,8 @@ if [[ $VERBOSE -ge 3 ]]; then
|
|
|
87
87
|
fi
|
|
88
88
|
|
|
89
89
|
echo "--- Open Ports (no firewall rule) ---"
|
|
90
|
-
LISTENING=$(ss -tlnp 2>/dev/null | awk 'NR>1 {print $4}' | grep -oP ':\K\d+' | sort -un)
|
|
91
|
-
echo " Listening: $(echo "$LISTENING" | tr '\n' ' ')"
|
|
90
|
+
LISTENING=$(ss -tlnp 2>/dev/null | awk 'NR>1 {print $4}' | grep -oP ':\K\d+' | sort -un || true)
|
|
91
|
+
echo " Listening: $(echo "$LISTENING" | tr '\n' ' ')" || true
|
|
92
92
|
|
|
93
93
|
if [[ $VERBOSE -ge 2 ]]; then
|
|
94
94
|
echo "--- Port Details ---"
|
|
@@ -103,7 +103,7 @@ if command -v fail2ban-client &>/dev/null; then
|
|
|
103
103
|
if [[ "$STATUS" == "active" ]]; then
|
|
104
104
|
fail2ban-client status 2>/dev/null | sed 's/^/ /' || true
|
|
105
105
|
if [[ $VERBOSE -ge 1 ]]; then
|
|
106
|
-
JAILS=$(fail2ban-client status 2>/dev/null | grep "Jail list:" | sed 's/.*://; s/,/ /g' | xargs)
|
|
106
|
+
JAILS=$(fail2ban-client status 2>/dev/null | grep "Jail list:" | sed 's/.*://; s/,/ /g' | xargs || true)
|
|
107
107
|
for jail in $JAILS; do
|
|
108
108
|
echo " --- Jail: $jail ---"
|
|
109
109
|
fail2ban-client status "$jail" 2>/dev/null | grep -E 'Currently|Total' | sed 's/^/ /' || true
|
|
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
41
41
|
-vv) VERBOSE=2; shift ;;
|
|
42
42
|
-v) VERBOSE=$((VERBOSE + 1)); shift ;;
|
|
43
43
|
--) shift; break ;;
|
|
44
|
-
-*) echo "Unknown option: $1" >&2; usage ;;
|
|
44
|
+
-*) echo "Unknown option: $1" >&2; (usage) >&2; exit 2 ;;
|
|
45
45
|
*) break ;;
|
|
46
46
|
esac
|
|
47
47
|
done
|
|
@@ -75,7 +75,7 @@ CLEAN_COUNT=0
|
|
|
75
75
|
for repo in "${REPOS[@]}"; do
|
|
76
76
|
cd "$repo" 2>/dev/null || continue
|
|
77
77
|
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "detached")
|
|
78
|
-
DIRTY=$(git status --porcelain 2>/dev/null | wc -l)
|
|
78
|
+
DIRTY=$(git status --porcelain 2>/dev/null | wc -l || true)
|
|
79
79
|
LAST_COMMIT=$(git log -1 --format='%cr' 2>/dev/null || echo "unknown")
|
|
80
80
|
|
|
81
81
|
if [[ $DIRTY -gt 0 ]]; then
|
|
@@ -97,10 +97,10 @@ if [[ $VERBOSE -ge 1 ]]; then
|
|
|
97
97
|
echo "--- Repository Sizes ---"
|
|
98
98
|
for repo in "${REPOS[@]}"; do
|
|
99
99
|
[[ -d "$repo/.git" ]] || continue
|
|
100
|
-
GIT_SIZE=$(du -sh "$repo/.git" 2>/dev/null | awk '{print $1}')
|
|
101
|
-
WORK_SIZE=$(du -sh "$repo" 2>/dev/null | awk '{print $1}')
|
|
100
|
+
GIT_SIZE=$(du -sh "$repo/.git" 2>/dev/null | awk '{print $1}' || true)
|
|
101
|
+
WORK_SIZE=$(du -sh "$repo" 2>/dev/null | awk '{print $1}' || true)
|
|
102
102
|
echo " $repo — working: $WORK_SIZE, .git: $GIT_SIZE"
|
|
103
|
-
done | sort -t':' -k2 -rh | head -20
|
|
103
|
+
done | sort -t':' -k2 -rh | head -20 || true
|
|
104
104
|
|
|
105
105
|
echo "--- Remote Origins ---"
|
|
106
106
|
for repo in "${REPOS[@]}"; do
|
|
@@ -137,7 +137,7 @@ if [[ $VERBOSE -ge 1 ]]; then
|
|
|
137
137
|
echo " $repo ← $branch (${AGE}d old)"
|
|
138
138
|
fi
|
|
139
139
|
done
|
|
140
|
-
done | head -20
|
|
140
|
+
done | head -20 || true
|
|
141
141
|
fi
|
|
142
142
|
|
|
143
143
|
# ── Secrets and large files (verbose 2+) ──
|
|
@@ -145,20 +145,20 @@ if [[ $VERBOSE -ge 2 ]]; then
|
|
|
145
145
|
echo "--- Potential Secrets in Working Tree ---"
|
|
146
146
|
SECRET_PATTERNS='(password|secret|api.key|token|private.key|AWS_SECRET|PRIVATE_KEY).*='
|
|
147
147
|
for repo in "${REPOS[@]}"; do
|
|
148
|
-
HITS=$(grep -rl --include='*.env' --include='*.yml' --include='*.yaml' --include='*.json' --include='*.conf' -E "$SECRET_PATTERNS" "$repo" 2>/dev/null | head -5)
|
|
148
|
+
HITS=$(grep -rl --include='*.env' --include='*.yml' --include='*.yaml' --include='*.json' --include='*.conf' -E "$SECRET_PATTERNS" "$repo" 2>/dev/null | head -5 || true)
|
|
149
149
|
if [[ -n "$HITS" ]]; then
|
|
150
150
|
echo " ⚠ $repo:"
|
|
151
|
-
echo "$HITS" | sed 's/^/ /'
|
|
151
|
+
echo "$HITS" | sed 's/^/ /' || true
|
|
152
152
|
fi
|
|
153
153
|
done
|
|
154
154
|
|
|
155
155
|
echo "--- Large Files (>10MB in working tree) ---"
|
|
156
156
|
for repo in "${REPOS[@]}"; do
|
|
157
|
-
LARGE=$(find "$repo" -not -path '*/.git/*' -type f -size +10M 2>/dev/null | head -5)
|
|
157
|
+
LARGE=$(find "$repo" -not -path '*/.git/*' -type f -size +10M 2>/dev/null | head -5 || true)
|
|
158
158
|
if [[ -n "$LARGE" ]]; then
|
|
159
159
|
echo " $repo:"
|
|
160
160
|
echo "$LARGE" | while read -r f; do
|
|
161
|
-
SIZE=$(du -h "$f" 2>/dev/null | awk '{print $1}')
|
|
161
|
+
SIZE=$(du -h "$f" 2>/dev/null | awk '{print $1}' || true)
|
|
162
162
|
echo " $f ($SIZE)"
|
|
163
163
|
done
|
|
164
164
|
fi
|
|
@@ -168,7 +168,7 @@ if [[ $VERBOSE -ge 2 ]]; then
|
|
|
168
168
|
for repo in "${REPOS[@]}"; do
|
|
169
169
|
cd "$repo" 2>/dev/null || continue
|
|
170
170
|
if git lfs ls-files &>/dev/null; then
|
|
171
|
-
LFS_COUNT=$(git lfs ls-files 2>/dev/null | wc -l)
|
|
171
|
+
LFS_COUNT=$(git lfs ls-files 2>/dev/null | wc -l || true)
|
|
172
172
|
if [[ $LFS_COUNT -gt 0 ]]; then
|
|
173
173
|
echo " $repo: $LFS_COUNT LFS-tracked files"
|
|
174
174
|
fi
|
|
@@ -182,11 +182,11 @@ if [[ $VERBOSE -ge 3 ]]; then
|
|
|
182
182
|
for repo in "${REPOS[@]}"; do
|
|
183
183
|
cd "$repo" 2>/dev/null || continue
|
|
184
184
|
echo " ── $repo ──"
|
|
185
|
-
git status --short 2>/dev/null | head -20 | sed 's/^/ /'
|
|
185
|
+
git status --short 2>/dev/null | head -20 | sed 's/^/ /' || true
|
|
186
186
|
echo " Recent commits:"
|
|
187
|
-
git log --oneline -5 2>/dev/null | sed 's/^/ /'
|
|
187
|
+
git log --oneline -5 2>/dev/null | sed 's/^/ /' || true
|
|
188
188
|
echo " Branches:"
|
|
189
|
-
git branch -a 2>/dev/null | sed 's/^/ /'
|
|
189
|
+
git branch -a 2>/dev/null | sed 's/^/ /' || true
|
|
190
190
|
done
|
|
191
191
|
|
|
192
192
|
echo "--- .gitignore Coverage ---"
|
package/skills/index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "https://agentskills.io/schema/v1",
|
|
3
|
-
"generatedAt": "2026-
|
|
3
|
+
"generatedAt": "2026-11-26T14:50:42.595Z",
|
|
4
4
|
"count": 26,
|
|
5
5
|
"skills": [
|
|
6
6
|
{
|
|
@@ -64,14 +64,13 @@
|
|
|
64
64
|
{
|
|
65
65
|
"name": "disk-cleaner",
|
|
66
66
|
"version": "1.0.0",
|
|
67
|
-
"description": "
|
|
67
|
+
"description": "Disk space report — finds old temp files, large logs, package and container caches and the largest directories, and prints the cleanup commands to run. Read-only: it deletes nothing. Configurable usage threshold.",
|
|
68
68
|
"author": "magnus",
|
|
69
69
|
"entryPoint": "cleaner.sh",
|
|
70
70
|
"dependencies": [
|
|
71
71
|
"find",
|
|
72
72
|
"du",
|
|
73
|
-
"df"
|
|
74
|
-
"logrotate"
|
|
73
|
+
"df"
|
|
75
74
|
],
|
|
76
75
|
"tags": [
|
|
77
76
|
"disk",
|