Compare commits
416
Commits
18d57ea4fb
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e84b5344de | ||
|
|
2f245d4934 | ||
|
|
24696e79d0 | ||
|
|
f76a02181a | ||
|
|
6a2550b733 | ||
|
|
241d41e128 | ||
|
|
44e9687c75 | ||
|
|
1f634a6aa0 | ||
|
|
6683c8c892 | ||
|
|
1590923b58 | ||
|
|
23237f8934 | ||
|
|
acf880afe1 | ||
|
|
29b398976e | ||
|
|
7216eb5583 | ||
|
|
2806eab187 | ||
|
|
eea5495fc8 | ||
|
|
95f475c2f9 | ||
|
|
8f38cab2b3 | ||
|
|
36db591bfd | ||
|
|
69f86c2368 | ||
|
|
a59ba939ca | ||
|
|
ba54c55329 | ||
|
|
8e0a67fd20 | ||
|
|
f96baa77d1 | ||
|
|
6f02cd3425 | ||
|
|
1d7c74676c | ||
|
|
59f155d06e | ||
|
|
dbecf87806 | ||
|
|
13f4e44671 | ||
|
|
2aeda8a39d | ||
|
|
404e608b14 | ||
|
|
894acd626e | ||
|
|
d648bfeda2 | ||
|
|
ba6f30492c | ||
|
|
77e88c98a1 | ||
|
|
d4cbdf5ef4 | ||
|
|
95ad74a068 | ||
|
|
b909cd5afb | ||
|
|
cddf4351e1 | ||
|
|
db6c7829ee | ||
|
|
c115ea8ea1 | ||
|
|
96e01987c1 | ||
|
|
75b8cb5d9b | ||
|
|
f9954fd9b4 | ||
|
|
78e31ea450 | ||
|
|
116bc1ef01 | ||
|
|
b39fb246ef | ||
|
|
512860703e | ||
|
|
ec6e228b05 | ||
|
|
25a71c0265 | ||
|
|
776afc212d | ||
|
|
457d78d4f0 | ||
|
|
8081d09e73 | ||
|
|
7814227259 | ||
|
|
d22db46e9f | ||
|
|
7fb37d5b40 | ||
|
|
7be2be4027 | ||
|
|
608c006c9e | ||
|
|
16db9b0426 | ||
|
|
5614138919 | ||
|
|
88faf35ec3 | ||
|
|
d6988bb35f | ||
|
|
bad40feae6 | ||
|
|
4f82520e0e | ||
|
|
d4850a3c02 | ||
|
|
75e229c0ab | ||
|
|
30ddb37b34 | ||
|
|
6c58671d15 | ||
|
|
317a98b9b1 | ||
|
|
33b5c76bec | ||
|
|
d159504121 | ||
|
|
04ed433e84 | ||
|
|
ea54beea70 | ||
|
|
959c3a5bb9 | ||
|
|
4d86012762 | ||
|
|
6244c1cc25 | ||
|
|
46c35106fb | ||
|
|
a1beb6cd3e | ||
|
|
9c2882ea00 | ||
|
|
290245349f | ||
|
|
0a8865de38 | ||
|
|
cd1c2f7332 | ||
|
|
24b08aa592 | ||
|
|
26de312c42 | ||
|
|
d9b32e4eef | ||
|
|
e7312ad460 | ||
|
|
48cdd81779 | ||
|
|
4b26aca5ee | ||
|
|
5456c783c6 | ||
|
|
0fa0692c37 | ||
|
|
54e9927167 | ||
|
|
72ab6b4b32 | ||
|
|
25a7234f40 | ||
|
|
51db52f862 | ||
|
|
050e235f8b | ||
|
|
fa0c77fb58 | ||
|
|
80693e4f8e | ||
|
|
396349640f | ||
|
|
9c47d93a2f | ||
|
|
edb34a75ec | ||
|
|
23e5ecc4cb | ||
|
|
915111e9dd | ||
|
|
6199368710 | ||
|
|
575d79f611 | ||
|
|
428e9ecb1d | ||
|
|
b860cb116d | ||
|
|
b6f94483e5 | ||
|
|
28e0b0c7a6 | ||
|
|
0600321968 | ||
|
|
5dcddfa4ba | ||
|
|
322e20e50f | ||
|
|
eb99b00a70 | ||
|
|
799d270261 | ||
|
|
8124483da8 | ||
|
|
8f1642bf96 | ||
|
|
174deea2a9 | ||
|
|
99270c344d | ||
|
|
6b6a8ff021 | ||
|
|
4f2bfe18a5 | ||
|
|
a7fbad60ab | ||
|
|
c2b592a66b | ||
|
|
4851517947 | ||
|
|
132c0854d1 | ||
|
|
b1088e8487 | ||
|
|
1951667f8b | ||
|
|
9a4961d94b | ||
|
|
f010fa9609 | ||
|
|
1044224d02 | ||
|
|
291a7ebc27 | ||
|
|
53954d8494 | ||
|
|
4201f3e669 | ||
|
|
65b972e623 | ||
|
|
bd00b61047 | ||
|
|
1fb1413f5b | ||
|
|
a54da7a43a | ||
|
|
40dfda47f2 | ||
|
|
21cc6ee54c | ||
|
|
b19bc87361 | ||
|
|
6d77775bd6 | ||
|
|
5f26f7dca1 | ||
|
|
53d953e092 | ||
|
|
163ef9de16 | ||
|
|
a4cdd2ee30 | ||
|
|
550d2cd078 | ||
|
|
83e4d7e8ce | ||
|
|
377c83bcf1 | ||
|
|
97ff9c321d | ||
|
|
5928d96aec | ||
|
|
688b7190e6 | ||
|
|
65d4985d16 | ||
|
|
453f3a22ac | ||
|
|
f283f8cfb8 | ||
|
|
d33c8df277 | ||
|
|
2930eeaf27 | ||
|
|
870540840c | ||
|
|
5e2eaff55d | ||
|
|
8f19c9fb6e | ||
|
|
40ab4608e2 | ||
|
|
47ddb93fef | ||
|
|
e73b81e229 | ||
|
|
39e37d0f76 | ||
|
|
31e66864ad | ||
|
|
0006eefcf1 | ||
|
|
abfaf765e6 | ||
|
|
1f2bd31380 | ||
|
|
93cea874a8 | ||
|
|
a898ebc59d | ||
|
|
78cc8cbcf3 | ||
|
|
495d0bb03b | ||
|
|
7a7d23f36c | ||
|
|
84f3ca3b0e | ||
|
|
f9f32612bb | ||
|
|
09063bfee4 | ||
|
|
5bbaff89e9 | ||
|
|
5a8561ea84 | ||
|
|
2fa32a5eb7 | ||
|
|
83d5cf2f8d | ||
|
|
49e57ff846 | ||
|
|
47b5a976c2 | ||
|
|
a710fc7b4e | ||
|
|
c6e458de8b | ||
|
|
e31bab4162 | ||
|
|
86740b8c7d | ||
|
|
f585f90b7f | ||
|
|
24c10b6f35 | ||
|
|
634a998d7e | ||
|
|
e3685f68ad | ||
|
|
ac857c91c3 | ||
|
|
a632e7d514 | ||
|
|
f6acf660f6 | ||
|
|
0c736c7295 | ||
|
|
273e7fe674 | ||
|
|
6609d7d9e3 | ||
|
|
0588b2dd60 | ||
|
|
f399308b2d | ||
|
|
45b53efe11 | ||
|
|
b0d1ae0a3e | ||
|
|
a2ff47e5d2 | ||
|
|
b5d09e64f0 | ||
|
|
edc3ca26ad | ||
|
|
a272764d66 | ||
|
|
97b67ea1fc | ||
|
|
a86b2ea09b | ||
|
|
54cfcf669f | ||
|
|
28c18a2bda | ||
|
|
168456ee7f | ||
|
|
d6364eac7a | ||
|
|
d2100d1146 | ||
|
|
5c20f167b2 | ||
|
|
3b705a23ba | ||
|
|
319cd61ad4 | ||
|
|
1e458f0fae | ||
|
|
0bf88e3d8c | ||
|
|
bf4efcdf5a | ||
|
|
f9f556111b | ||
|
|
7e5302b5e6 | ||
|
|
885487fce5 | ||
|
|
ba8efdfa0b | ||
|
|
1d14c9c9a2 | ||
|
|
d3e4fb5014 | ||
|
|
001faf76a3 | ||
|
|
52e8ecf779 | ||
|
|
24946292e7 | ||
|
|
cb10cdf1cc | ||
|
|
f2dc2ce29e | ||
|
|
d1ef7118d5 | ||
|
|
160d1b26cc | ||
|
|
ce5bb0be6f | ||
|
|
ce1bf7d220 | ||
|
|
0175a00458 | ||
|
|
0f52d19229 | ||
|
|
0937036155 | ||
|
|
02a874f713 | ||
|
|
259a4f07b7 | ||
|
|
f06d8b1fe5 | ||
|
|
d76613c0dc | ||
|
|
5deaecd79f | ||
|
|
c58c3f116e | ||
|
|
e4e1c66111 | ||
|
|
d60c03b116 | ||
|
|
6cdc7bbba7 | ||
|
|
ba384498c0 | ||
|
|
8669b64adc | ||
|
|
13e2678be4 | ||
|
|
1e3c7a97af | ||
|
|
b7c329ddb8 | ||
|
|
3207f1a870 | ||
|
|
0041e95d59 | ||
|
|
c476f84943 | ||
|
|
8c38bcc57c | ||
|
|
7431c1eb4e | ||
|
|
38b779f054 | ||
|
|
197d8e2d27 | ||
|
|
0ee847f556 | ||
|
|
7457db098f | ||
|
|
109acf07be | ||
|
|
7ad5a2a8e7 | ||
|
|
86cded93c5 | ||
|
|
ce45ec1684 | ||
|
|
15074a99f4 | ||
|
|
982389fb63 | ||
|
|
7b3549c617 | ||
|
|
a9318aee60 | ||
|
|
ede6aa0562 | ||
|
|
445cbbefde | ||
|
|
89ac84c4e1 | ||
|
|
5eb2f6b3d5 | ||
|
|
adc57c1e37 | ||
|
|
29dca6241e | ||
|
|
a38eac2e77 | ||
|
|
0016e1aaeb | ||
|
|
80dd021217 | ||
|
|
4e3368156c | ||
|
|
46020fecf5 | ||
|
|
e3683db3cf | ||
|
|
c77d932dd2 | ||
|
|
ffdef9500c | ||
|
|
363c845ead | ||
|
|
df7f369f8c | ||
|
|
63536f2684 | ||
|
|
063cfc2262 | ||
|
|
1887920f52 | ||
|
|
c1791eaa43 | ||
|
|
94eed1ab9d | ||
|
|
55178257ef | ||
|
|
486a150e5e | ||
|
|
8c68a975e0 | ||
|
|
066708f101 | ||
|
|
9be83022e6 | ||
|
|
66976c2ed0 | ||
|
|
03abf42065 | ||
|
|
6df6aba2dd | ||
|
|
d80dd973e4 | ||
|
|
fe89e56e4a | ||
|
|
0773dcb372 | ||
|
|
6e6a57f61b | ||
|
|
ccb24fe403 | ||
|
|
c75d0e39a6 | ||
|
|
f3070de151 | ||
|
|
d82c8733fa | ||
|
|
d64d75cb3b | ||
|
|
f0654723e5 | ||
|
|
fd9c50d151 | ||
|
|
4375b82f55 | ||
|
|
8d16f8e8f7 | ||
|
|
6d5732964c | ||
|
|
10ce9ca724 | ||
|
|
a277a36b39 | ||
|
|
87b31b845d | ||
|
|
a8a07b7c5d | ||
|
|
f0e8482e71 | ||
|
|
17924e8f88 | ||
|
|
a458c39ddc | ||
|
|
7e4aa53c33 | ||
|
|
0c75da8b08 | ||
|
|
db6643c825 | ||
|
|
7a5b90ae84 | ||
|
|
23cba4713b | ||
|
|
dc40896af0 | ||
|
|
396891af1c | ||
|
|
89814e2113 | ||
|
|
5549409dcc | ||
|
|
8c14f7823b | ||
|
|
012fcb1698 | ||
|
|
93dcd9fc92 | ||
|
|
ef50e10cba | ||
|
|
eeea9a98de | ||
|
|
a5f0cba15c | ||
|
|
e9874c75a5 | ||
|
|
fe830a1ad9 | ||
|
|
4c20af7fb9 | ||
|
|
ae147b7cd0 | ||
|
|
178c4068c2 | ||
|
|
8009651e1e | ||
|
|
4f416b9748 | ||
|
|
cf68f49b17 | ||
|
|
bc955b0bb2 | ||
|
|
ffd4f74c4a | ||
|
|
09be6ebfb7 | ||
|
|
3f0bf60b44 | ||
|
|
8f76bd1ad1 | ||
|
|
47b651ac15 | ||
|
|
e77c972787 | ||
|
|
f2b46b7b97 | ||
|
|
b82f16bfb6 | ||
|
|
cfa08ec8f5 | ||
|
|
d0d9db84b2 | ||
|
|
f4cfe89fa1 | ||
|
|
82c93f4190 | ||
|
|
61009a4158 | ||
|
|
8b83dbac4b | ||
|
|
8de1a76003 | ||
|
|
31532c9f44 | ||
|
|
18c5e4495d | ||
|
|
ed347d83dc | ||
|
|
39c7e4d36f | ||
|
|
f8bc62b329 | ||
|
|
f7f0eb6c9d | ||
|
|
b2844f8bad | ||
|
|
1a8980afc6 | ||
|
|
4a38cd404f | ||
|
|
cbe446b115 | ||
|
|
83c8fc02a9 | ||
|
|
3730e7ac54 | ||
|
|
b79fcc0e5a | ||
|
|
400644f281 | ||
|
|
bb93cd7ee2 | ||
|
|
9c659f8a4d | ||
|
|
459da206bf | ||
|
|
d78409315f | ||
|
|
bde664f38f | ||
|
|
d53b4fd5ef | ||
|
|
1093db16c0 | ||
|
|
aef7bb1e18 | ||
|
|
fdbf33d3b9 | ||
|
|
5e83e5ca68 | ||
|
|
8385dc1e4d | ||
|
|
7c30abb120 | ||
|
|
fc5e8288e1 | ||
|
|
27f2ab1c29 | ||
|
|
97aedd1467 | ||
|
|
c365d232fa | ||
|
|
87397d2bb6 | ||
|
|
70f8a69e2d | ||
|
|
b0979f2452 | ||
|
|
d30ab20589 | ||
|
|
672e0ee52a | ||
|
|
3efc67fbd6 | ||
|
|
4cb67a990b | ||
|
|
4939ff2551 | ||
|
|
6799e6fde0 | ||
|
|
81031e9499 | ||
|
|
6a5a73d1b4 | ||
|
|
48d411c184 | ||
|
|
37901f9690 | ||
|
|
14dbc889ff | ||
|
|
3dae330386 | ||
|
|
00344fccf7 | ||
|
|
8d097ebfeb | ||
|
|
b2dee012f0 | ||
|
|
48a8dec064 | ||
|
|
bbe7500e11 | ||
|
|
1f267940d5 | ||
|
|
3195bb6f26 | ||
|
|
3e8220a939 | ||
|
|
4fd2c83037 | ||
|
|
bfa510cab9 | ||
|
|
03da9af74c | ||
|
|
b14a386db1 | ||
|
|
4766bcf6db | ||
|
|
c3bed5cebf | ||
|
|
789780766e | ||
|
|
867371f736 | ||
|
|
38f3531f06 | ||
|
|
90ee01d9f1 | ||
|
|
d2e4cd9128 |
@@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!crush.json
|
||||||
|
!.gitignore
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PreToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": "^(bash|edit|write|multiedit|lsp_replace_symbol|lsp_rename)$",
|
||||||
|
"command": "./hooks/ticket-gate.sh",
|
||||||
|
"timeout": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# PFVCluster environment variables
|
||||||
|
# Copy to .env and fill in values for local development/testing.
|
||||||
|
|
||||||
|
# Pi-hole (netinfra/pihole/docker-compose.yml)
|
||||||
|
PIHOLE_WEB_PASSWORD=changeme
|
||||||
|
|
||||||
|
# Shellcheck wrapper (tests/shellcheck.sh) — no config needed, uses Docker.
|
||||||
+29
-2
@@ -1,5 +1,9 @@
|
|||||||
# Crush internal state
|
# Crush internal state (track crush.json config, ignore session data)
|
||||||
.crush/
|
.crush/crush.db
|
||||||
|
.crush/crush.db-*
|
||||||
|
.crush/logs/
|
||||||
|
.crush/memory/
|
||||||
|
.crush/active-ticket
|
||||||
|
|
||||||
# OS/editor
|
# OS/editor
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@@ -17,3 +21,26 @@ __pycache__/
|
|||||||
*.tmp
|
*.tmp
|
||||||
*.bak
|
*.bak
|
||||||
*.log.tmp
|
*.log.tmp
|
||||||
|
|
||||||
|
# LOGFILENAME artifacts: the framework (Logging.sh + PrettyPrint.sh) appends
|
||||||
|
# every print_info/print_error line to LOGFILENAME, defined as
|
||||||
|
# "$0.<Weekday>-YYYY-MM-DD-HH:MM:SS.$$". Running any script that sources the
|
||||||
|
# framework therefore drops a timestamped log file next to it.
|
||||||
|
*.Monday-*
|
||||||
|
*.Tuesday-*
|
||||||
|
*.Wednesday-*
|
||||||
|
*.Thursday-*
|
||||||
|
*.Friday-*
|
||||||
|
*.Saturday-*
|
||||||
|
*.Sunday-*
|
||||||
|
|
||||||
|
# Sensitive exports / runtime data
|
||||||
|
dns-cluster-setup/.export/
|
||||||
|
returned-logs/
|
||||||
|
|
||||||
|
# Kubernetes secrets (kubeconfig contains embedded client certs)
|
||||||
|
k8s/kubeconfig.yaml
|
||||||
|
k8s/*.token
|
||||||
|
|
||||||
|
# Pi-hole web UI password (real value only in on-box .env, never committed)
|
||||||
|
netinfra/pihole/.env
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# ShellCheck configuration for PFVCluster
|
||||||
|
# (used when running `shellcheck` directly; tests/shellcheck.sh applies the
|
||||||
|
# same disables via -e for consistent results under Docker)
|
||||||
|
#
|
||||||
|
# These checks are DISABLED because they flag intentional conventions of this
|
||||||
|
# codebase, not bugs:
|
||||||
|
#
|
||||||
|
# SC1090 / SC1091 — cannot follow dynamically-computed `source` paths. The KNEL
|
||||||
|
# framework (vendor/) and test harness source helpers via computed include
|
||||||
|
# dirs, which shellcheck cannot resolve statically.
|
||||||
|
# SC2029 — ssh orchestration (tests/remote.sh and perf/k8s/dns scripts)
|
||||||
|
# deliberately builds and expands the remote command on the CLIENT side before
|
||||||
|
# sending it. That is the whole point of the single-chokepoint remote pattern.
|
||||||
|
disable=SC1090,SC1091,SC2029
|
||||||
|
|
||||||
|
# Treat external-sourced files as bash (matches #!/usr/bin/env bash framework).
|
||||||
|
external-sources=true
|
||||||
@@ -1,157 +1,587 @@
|
|||||||
# AGENTS.md — Proxmox Performance Optimization Project
|
# Agent Guidelines
|
||||||
|
|
||||||
**Read this first.** This is a solo-founder R&D Proxmox cluster in a private
|
## Agent Authority (NON-NEGOTIABLE)
|
||||||
residence server room. Shoestring budget. Redundancy is NOT a concern — this
|
|
||||||
is for batch jobs. Backups DO matter (PBS in use). Production lives elsewhere.
|
|
||||||
|
|
||||||
**Four .md files exist:**
|
**No work is permissible on any system without an approved Redmine ticket.
|
||||||
- `AGENTS.md` (this file) -- operating context for the AI agent
|
There are no exceptions to this rule.**
|
||||||
- `PROJECT.md` -- comprehensive board-ready report for the user
|
|
||||||
- `K8S.md` -- kubernetes architecture deep-dive (for a future session)
|
|
||||||
- `TODO.md` -- pending user actions (tsys2 hardware commands, Friday plan)
|
|
||||||
|
|
||||||
## Current state (as of 2026-07-27)
|
### Scope of authority
|
||||||
|
|
||||||
### DONE — 5 of 7 hosts fully optimized and validated
|
1. **Tickets govern all work.** The agent performs ONLY the work described in
|
||||||
|
the approved Redmine ticket. Anything outside that scope — no matter how
|
||||||
|
small, helpful, or "obvious" — is prohibited.
|
||||||
|
|
||||||
| Host | Status | Notes |
|
2. **No autonomous system changes.** The agent does not modify, configure,
|
||||||
|------|--------|-------|
|
create, delete, or grant anything on a production system unless it is
|
||||||
| pfv-tsys1 | COMPLETE | 11 VMs, infra host, USB for HA/CA |
|
explicitly directed by an approved ticket. "Production system" means
|
||||||
| pfv-tsys3 | COMPLETE | 1 VM, laptop, kernel 7.0.14 (skewed) |
|
every system in the fleet — there is no "test" exception unless the ticket
|
||||||
| pfv-tsys6 | COMPLETE | 5 VMs, bond layer3+4, LACP 1.83 Gbps confirmed |
|
says so.
|
||||||
| pfv-tsys7 | COMPLETE | 4 VMs, bond layer3+4, LACP 1.83 Gbps confirmed |
|
|
||||||
| pfv-tsys9 | COMPLETE | 5 VMs, validated this session, **storage NIC is USB dongle** |
|
|
||||||
|
|
||||||
### PENDING — 2 hosts blocked on physical hardware work (Friday)
|
3. **Propose, never implement.** If the agent discovers additional work that
|
||||||
|
should be done — a bug, a misconfiguration, a missing dependency, an
|
||||||
|
enhancement — it does NOT implement it. Instead, it creates a Redmine
|
||||||
|
sub-ticket (status Feedback) describing the finding and surfaces it to
|
||||||
|
the user for approval.
|
||||||
|
|
||||||
| Host | Blocker | What's staged |
|
4. **Security and access changes require extra scrutiny.** Changes to sudoers,
|
||||||
|------|---------|---------------|
|
SSH keys, user accounts, firewall rules, authentication policy, file
|
||||||
| **pfv-tsys4** | PCIe NIC (replace USB dongle) + RAM (16→64GB) | All sysctl/tuned/NFS applied. DO NOT reboot until hardware installed. |
|
permissions, or any privilege-related configuration are treated as
|
||||||
| **pfv-tsys5** | 2nd ethernet cable (bond0 broken: 1 slave, no LACP partner) | BBR/swappiness applied. NFS staged. Reboot after cable + layer3+4 hash. |
|
policy decisions, not implementation details. The agent may suggest
|
||||||
|
them but NEVER implements them without explicit user direction in the
|
||||||
|
ticket or a sub-ticket the user has approved.
|
||||||
|
|
||||||
### INCOMING
|
5. **The user makes policy. The agent implements policy.** The agent does
|
||||||
|
not decide who gets sudo, what keys go where, what services run, or what
|
||||||
|
the access model is. The agent executes the user's decisions, exactly
|
||||||
|
as specified.
|
||||||
|
|
||||||
- **pfv-tsys2** (Precision 5520, i7-7820HQ, 32GB max, Quadro M1200): Currently
|
6. **When in doubt, ask.** If the ticket is ambiguous, if a task seems to
|
||||||
Win10. Will be rebuilt as Proxmox. K8s-dedicated host. **Hardware validated
|
require something not explicitly authorized, or if the agent is unsure
|
||||||
2026-07-27: 2 SSDs (Samsung 960 PRO NVMe 512GB + Samsung 850 EVO SATA 1TB)
|
whether an action is in scope — STOP and ask the user via the ticket
|
||||||
-- best local storage in fleet. Both NICs are USB dongles (ASIX + Realtek)
|
or directly. Asking is always acceptable. Overstepping is never
|
||||||
-- unavoidable on laptop, no PCIe NIC option.**
|
acceptable.
|
||||||
- **tsys5 NVMe**: PCI NVMe drive being added Friday. Recommend local-only
|
|
||||||
(not NFS-exported) for VM images.
|
|
||||||
|
|
||||||
## Role taxonomy (user directive)
|
7. **NEVER close a ticket without explicit user permission.** You may
|
||||||
|
SUGGEST a close when the result is clearly scoped and delivered. If
|
||||||
|
it's ambiguous whether the work is truly complete, don't suggest a
|
||||||
|
close — leave that decision to the user. This applies to ALL tickets,
|
||||||
|
no exceptions.
|
||||||
|
8. **User acceptance testing is MANDATORY before declaring work done.**
|
||||||
|
The agent performs implementation and technical validation (services
|
||||||
|
running, configs correct, APIs responding). The user performs UAT —
|
||||||
|
visually confirming dashboards render data, alerts deliver, tools are
|
||||||
|
usable. The agent MUST NOT set done-ratio to 100%, MUST NOT suggest
|
||||||
|
closing, and MUST NOT move to the next ticket until the user explicitly
|
||||||
|
accepts the work. "Technically wired but blank dashboard" is NOT done.
|
||||||
|
9. **NEVER access a database directly if an API exists.** APIs are the
|
||||||
|
stable contract; databases change schemas without warning. If a tool
|
||||||
|
has an API, use it — exhaust all API endpoints, check the docs, try
|
||||||
|
alternative methods. Only fall back to direct DB access as a last
|
||||||
|
resort AND with explicit user approval for that specific instance.
|
||||||
|
Soon all DB access will route through a proxy under zero trust;
|
||||||
|
building API-first habits now ensures that transition is clean.
|
||||||
|
|
||||||
| Role | Hosts | Workload |
|
### Access-channel policy: SSH only (NON-NEGOTIABLE)
|
||||||
|------|-------|----------|
|
|
||||||
| **Infrastructure + k8s control** | tsys1, tsys9 | Infra VMs + pfv-k8s cnodes (control plane) + small wnodes |
|
|
||||||
| **Kubernetes workers** | tsys2, tsys3, tsys6, tsys7 | pfv-k8s wnodes (heavy workers) -- max RAM for ETL/HPC |
|
|
||||||
| **Storage** | tsys4, tsys5 | NFS server + PBS. tsys5 also runs sectestbed. |
|
|
||||||
|
|
||||||
Cnodes weighted to tsys1/9 (lightweight hosts, keep heavy hosts free for
|
**The qemu guest-agent is NEVER an access, execution, or key-delivery
|
||||||
workers). Wnodes: one per hypervisor host across the fleet. Production lives
|
channel.** SSH (`sshd`) is the only approved remote access path. Every
|
||||||
on a VPS in Reston VA (Cloudron) -- this cluster is R&D only.
|
command must flow through sshd so it is captured by the standard
|
||||||
|
auth/logging/audit infrastructure. This is an ITAR/CMMC/TS/SCI
|
||||||
|
environment — there is no back-door exception, ever.
|
||||||
|
|
||||||
## Critical VM-layer findings (re-audited 2026-07-27 21:50)
|
- **Forbidden:** `qm guest exec` (runs arbitrary commands inside a guest
|
||||||
|
over an unaudited channel) and any wrapper around it (e.g. a `vm-guest`
|
||||||
|
mode). This includes using guest-agent to *deliver* an SSH key, even if
|
||||||
|
the resulting SSH login is itself audited — the delivery bypassed audit.
|
||||||
|
- **Allowed:** installing or checking qemu-guest-agent for its intended
|
||||||
|
purpose — letting Proxmox see guest state (`qm guest cmd <id> ping`,
|
||||||
|
`agent: 1` config, `apt install qemu-guest-agent`). Visibility only;
|
||||||
|
never execution.
|
||||||
|
- **Enforced mechanically:** `scripts/check-rules.sh` rule #11 fails on
|
||||||
|
any `qm guest exec` / `vm-guest` pattern in code. `tests/remote.sh` has
|
||||||
|
no guest-exec mode.
|
||||||
|
- **If a system is locked out** (no SSH key, no guest-exec path): surface
|
||||||
|
it to the user. Do NOT improvise an alternate back-channel. The user
|
||||||
|
authorizes the unblock method (console login, credential, etc.).
|
||||||
|
|
||||||
1. **4 of 5 cnodes still on tsys4 NFS** (cnode5 moved to tsys5 S2). Need 2
|
### Ticket-closing policy (NON-NEGOTIABLE)
|
||||||
more moves (cnode3→S3, cnode4→S2) for etcd quorum survival. User has been
|
|
||||||
actively rebalancing via PDM -- storage distribution improved 90/10 to 73/27.
|
|
||||||
2. **Both -01/-02 pairs (netinfra, UCS) on tsys4 NFS.** TODO today: move
|
|
||||||
netinfra-02 to S3, ucs-02 to S2 (both tsys5 HDD).
|
|
||||||
3. **No k8s node uses SSD/NVMe yet.** tsys3 has 349 GB unused local NVMe
|
|
||||||
(Samsung PM961), tsys9 has 136 GB local SSD. Deferred to k8s session.
|
|
||||||
4. **tsys6/7 local-lvm is USB 2.0 portable HDD** (~30 MB/s). Slower than NFS.
|
|
||||||
Do NOT use for VM storage. User accepts OS-on-USB for these hosts.
|
|
||||||
5. **Storage philosophy:** NVMe/SSD = k8s scratch + ultix-streaming (dev
|
|
||||||
workstation). Spinning rust = all infrastructure VMs.
|
|
||||||
6. **Hosts are standalone, managed via PDM** (Proxmox Datacenter Manager).
|
|
||||||
VM migration between nodes is done through PDM UI, not manual disk copy.
|
|
||||||
|
|
||||||
## Storage network IPs (VLAN1000, 10.100.100.0/24)
|
**NEVER close a Redmine ticket without explicit user permission.** You
|
||||||
|
may SUGGEST a close when the result is clearly scoped and delivered. If
|
||||||
|
it's ambiguous whether the work is truly complete, don't suggest a close
|
||||||
|
— leave that decision to the user. This applies to ALL tickets, no
|
||||||
|
exceptions.
|
||||||
|
|
||||||
|
### What this means in practice
|
||||||
|
|
||||||
|
- Discovered a typo in a config during approved work? **Finish the approved
|
||||||
|
work. Create a sub-ticket for the typo. Do not fix it inline.**
|
||||||
|
- Think a system should also have localuser sudo configured? **Do not add
|
||||||
|
it. Propose it in a sub-ticket.**
|
||||||
|
- Need to install a package the ticket didn't mention? **Ask first.**
|
||||||
|
- Found a security issue? **Create a ticket immediately with full details.
|
||||||
|
Do not remediate without approval.**
|
||||||
|
|
||||||
|
This environment operates in ITAR/CMMC/TS/SCI space. Every action must be
|
||||||
|
traceable to an approved ticket. There is no "I thought it would help."
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
**You are an AI agent working on this project. Your first actions, in order:**
|
||||||
|
|
||||||
|
> **SESSION-START GATE (NON-NEGOTIABLE):** Steps 1-3 orient you. Step 4 is the
|
||||||
|
> check-for-understanding gate (rule summary). Steps 5-7 gather state. Step 8 is
|
||||||
|
> the scope-alignment gate. You MUST NOT begin any task work until the user
|
||||||
|
> (a) confirms your rule summary AND (b) names the ticket to work on. This runs
|
||||||
|
> **every session, automatically** — the user should never have to ask for it.
|
||||||
|
|
||||||
|
1. **Set up the environment:** `bash scripts/setup-hooks.sh` (installs git hooks — idempotent).
|
||||||
|
2. **Read this file** (`AGENTS.md`) — project policy and domain knowledge.
|
||||||
|
3. **Read the latest questions file** (`questions-v*.md`) — open questions awaiting human input. The version number increments each round (v1, v2, v3...).
|
||||||
|
4. **Check for understanding — GATE.** In your own words, summarize ALL the rules
|
||||||
|
back to the user before doing any work: Agent Authority (ticket-governed,
|
||||||
|
propose-never-implement), Access-Channel SSH-only policy, Remote access
|
||||||
|
(remote.sh chokepoint mandatory, DNS names only — never IP literals),
|
||||||
|
Questions policy (no harness question-tools), Documentation policy
|
||||||
|
(Discourse is SoR), Redmine tracking, Git policy (always commit+push,
|
||||||
|
shellcheck), Mandatory infra-change documentation (#298 audit log), SSH
|
||||||
|
routing chokepoints (`tests/remote.sh`), the mechanically enforced
|
||||||
|
`check-rules.sh` rules, and Credentials (Vault migration TODO). Then stop
|
||||||
|
and wait for the user to confirm. This checkpoint guarantees every
|
||||||
|
session starts aligned.
|
||||||
|
5. **Check Redmine** — `docker run --rm --env-file ~/.creds/redmine.env git.knownelement.com/reachableceo/redmine-cli:latest list --assigned-to-me -p 55` for active work.
|
||||||
|
6. **Check current state:** `git log --oneline -10`.
|
||||||
|
7. **Run rule audit:** `bash scripts/check-rules.sh --fast`.
|
||||||
|
8. **Scope-alignment — GATE.** Present the session handoff's "What's Left"
|
||||||
|
priority list (or the Redmine queue if no handoff exists). Do NOT scan the
|
||||||
|
full ticket queue and pick work on your own — **the user directs what gets
|
||||||
|
worked on, always.** Note any new or urgent items from the Redmine check,
|
||||||
|
then ask which ticket to work on tonight. **STOP and wait.** Do not set
|
||||||
|
`.crush/active-ticket`, do not read systems, do not run diagnostics, until
|
||||||
|
the user names the target. This gate prevents the agent from burning
|
||||||
|
context on work the user didn't ask for.
|
||||||
|
|
||||||
|
## Enforcement Model
|
||||||
|
|
||||||
|
Git hooks (`scripts/pre-commit`, `scripts/pre-push`) enforce the rules defined in
|
||||||
|
`scripts/check-rules.sh`. The rules engine checks: shellcheck (zero warnings
|
||||||
|
including info-level), Docker image pinning (no `:latest`), container naming,
|
||||||
|
required files, Discourse pointer headers, and more. Run `bash scripts/check-rules.sh`
|
||||||
|
for a full audit or `--fast` for pre-commit speed. Bypass with `--no-verify`
|
||||||
|
(emergencies only).
|
||||||
|
|
||||||
|
## Task Tracking
|
||||||
|
|
||||||
|
- **Redmine is the system of record for all work.**
|
||||||
|
- **NEVER close a ticket without explicit user permission.** Suggest a
|
||||||
|
close when clearly scoped/delivered; if ambiguous, don't suggest.
|
||||||
|
- **Ticket-first enforcement (mechanically enforced).** Before starting
|
||||||
|
any work, set the active ticket: `echo '#NNN' > .crush/active-ticket`.
|
||||||
|
The Crush hook (`hooks/ticket-gate.sh`) blocks modifying operations
|
||||||
|
until this file exists. If no ticket exists, CREATE ONE FIRST via
|
||||||
|
redmine-cli, then set it. Clear when done: `> .crush/active-ticket`.
|
||||||
|
- **WORKING.md** is the only in-repo task tracker — a scratchpad for the current
|
||||||
|
session. The pre-commit hook blocks commits while any task remains unchecked.
|
||||||
|
- Clear WORKING.md before responding to the user.
|
||||||
|
|
||||||
|
## Rolling HUD (session-scoped, NOT persisted)
|
||||||
|
|
||||||
|
The rolling HUD is a **live status display** the agent maintains throughout
|
||||||
|
the session to help the human follow along. It is NOT a system of record —
|
||||||
|
Redmine, Discourse, and git are the durable systems. The HUD exists purely
|
||||||
|
for the human's situational awareness during the session.
|
||||||
|
|
||||||
|
- **Format:** a compact block shown at the end of each significant response
|
||||||
|
(after completing a step, hitting a blocker, or pivoting). Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─ SESSION HUD ────────────────────────────────────────
|
||||||
|
│ Active: #343 (Monitoring coverage matrix)
|
||||||
|
│ Done: ✓ scope-alignment gate added to both AGENTS.md
|
||||||
|
│ ✓ committed + pushed (6a2550b)
|
||||||
|
│ Now: drafting coverage matrix on Discourse
|
||||||
|
│ Next: → #341 TEMPer USB (deploy on pfv-tsys1)
|
||||||
|
│ → #338 LibreNMS alerts (BLOCKED: pushover.env)
|
||||||
|
├─ USER ACTION ITEMS ──────────────────────────────────
|
||||||
|
│ • Populate ~/.creds/pushover.env (unblocks #338, #428)
|
||||||
|
│ • Populate ~/.creds/prometheus.env + grafana.env (#430)
|
||||||
|
└──────────────────────────────────────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Placement:** may be written to `.crush/hud.md` on disk to keep context
|
||||||
|
window smaller (re-read and update rather than hold in memory). Never
|
||||||
|
committed to git. Wiped at session end.
|
||||||
|
- **Sections:**
|
||||||
|
- **Active:** current ticket number + one-line description
|
||||||
|
- **Done:** ✓ items completed this session (append as work progresses)
|
||||||
|
- **Now:** what the agent is actively doing
|
||||||
|
- **Next:** the queued items (per handoff priority or user direction)
|
||||||
|
- **User action items:** things ONLY the user can do (populate creds,
|
||||||
|
physical work, manual deploys) with the tickets they unblock
|
||||||
|
- **When to show it:** after each logical unit of work, at blockers, and
|
||||||
|
when pivoting between tickets. Not every trivial response — use judgment.
|
||||||
|
- **NOT a substitute for Redmine/Discourse/git.** The HUD is ephemeral. When
|
||||||
|
work completes, update the durable systems (ticket notes, Discourse wiki,
|
||||||
|
commits). The HUD just tracks the live narrative for the human.
|
||||||
|
|
||||||
|
## Working Style
|
||||||
|
|
||||||
|
- **Stop over-thinking.** Get to code and output faster. Explore with code;
|
||||||
|
gather ground truth. Do not burn tokens reasoning about things a quick command
|
||||||
|
answers.
|
||||||
|
- **Farm work out to deterministic tooling:** linters, LSPs, formatters, test
|
||||||
|
runners. If an LSP is wired up, use it; otherwise pull a Docker image and lint
|
||||||
|
inside it.
|
||||||
|
- **Use sub-agents as subcontractors:** scoped spec in, distilled deliverable out.
|
||||||
|
Never read 10+ files sequentially; batch into agent calls.
|
||||||
|
- **Command timeouts (NON-NEGOTIABLE):** Every command that touches a remote
|
||||||
|
system MUST be wrapped with `timeout`. Hard limits: 30s for quick reads
|
||||||
|
(status, ps, ls), 120s for standard operations, 300s for deployments/pulls.
|
||||||
|
If a command hits the timeout, STOP and investigate root cause — never
|
||||||
|
blindly retry. A hung command is a failed command. Detect failure fast,
|
||||||
|
diagnose, fix, move on. Example: `timeout 120 bash tests/remote.sh vm 'cmd'`.
|
||||||
|
This applies to ALL tools — bash, docker, CLIs, sub-agents.
|
||||||
|
|
||||||
|
## Questions (NON-NEGOTIABLE)
|
||||||
|
|
||||||
|
**NEVER use a harness "question"/"ask user" tool** (structured prompts,
|
||||||
|
modal forms, tabbed questions). Banned across every project, every harness.
|
||||||
|
They are not portable, not version-controlled, and bypass the git record.
|
||||||
|
**All questions go in the current `questions-v(N).md` file** — write the
|
||||||
|
question; the human edits the answer inline in the same file. **Version up
|
||||||
|
the filename each time answers land** (v1 → v2 → v3...): create
|
||||||
|
`questions-v2.md` with resolved Q&A marked, new questions appended. This
|
||||||
|
preserves the history of each Q&A round. Synthesize resolved Q&A into
|
||||||
|
Discourse (decisions) and Redmine (work items). See `BASELINE-PROMPT.md`
|
||||||
|
§10.
|
||||||
|
|
||||||
|
## Documentation policy (IMPORTANT)
|
||||||
|
|
||||||
|
**Discourse is the canonical source of truth for all knowledge documentation.**
|
||||||
|
Knowledge docs (architecture, runbooks, references, audits, policies) have been
|
||||||
|
migrated to [community.turnsys.com](https://community.turnsys.com/c/vp-techops)
|
||||||
|
as wiki topics in the **VP TechOps** category.
|
||||||
|
|
||||||
|
All `.md` files in this repo (except `AGENTS.md` and `LICENSE`) are now
|
||||||
|
**pointers** that link to their corresponding Discourse topic. **Do not update
|
||||||
|
documentation content in git** — edit the Discourse wiki topic instead. Git
|
||||||
|
edit history no longer serves as the documentation changelog; Discourse
|
||||||
|
preserves wiki edit history automatically.
|
||||||
|
|
||||||
|
Code (scripts, configs, playbooks) still lives in git as the source of truth
|
||||||
|
for executables. Only *documentation* moved to Discourse.
|
||||||
|
|
||||||
|
## Top-level files
|
||||||
|
|
||||||
|
All `.md` files now point to Discourse. The key pointers:
|
||||||
|
|
||||||
|
| File | Points to | Discourse topic |
|
||||||
|
|------|-----------|-----------------|
|
||||||
|
| `README.md` | Project overview | [#296](https://community.turnsys.com/t/296) |
|
||||||
|
| `STATUS.md` | Ticket index + infra summary | [#297](https://community.turnsys.com/t/297) |
|
||||||
|
| `docs/docmap.md` | Documentation index | [#296](https://community.turnsys.com/t/296) |
|
||||||
|
|
||||||
|
Work tracking stays in [Redmine](https://projects.knownelement.com).
|
||||||
|
|
||||||
|
## Repository Layout
|
||||||
|
|
||||||
```
|
```
|
||||||
tsys1=.1 tsys3=.3 tsys4=.4 tsys5=.5 tsys6=.6 tsys7=.7 tsys9=.9
|
dcinfra/ Data-center infra: PDU (powerman), serial console (console), UPS (ups)
|
||||||
|
netinfra/ DNS/NTP/DHCP setup + audit; DNS cluster replication (dns-cluster-setup);
|
||||||
|
switch captures (switches); DHCP config (dhcp)
|
||||||
|
k8s/ k3s cluster setup scripts (HA control plane over Tailscale) + docs/
|
||||||
|
proxmox/ Proxmox fleet docs (hardware audit, capacity, storage) + perf tuning (perf/)
|
||||||
|
awx/ Ansible AWX deployment (k3s + AWX Operator)
|
||||||
|
tests/ Test suite + VM validation harness + remote.sh SSH chokepoint
|
||||||
|
scripts/ Framework: git hooks, rule engine (check-rules.sh), shared lib
|
||||||
|
docs/ Server-build docs, docmap index, and archive
|
||||||
|
archive/ Historical/superseded code (provisioning -> replaced by KNELIAC project)
|
||||||
|
vendor/ Vendored KNELShellFramework
|
||||||
```
|
```
|
||||||
|
|
||||||
## NFS export topology
|
- **Server provisioning moved to KNELIAC**: The
|
||||||
|
[`archive/provisioning/`](archive/provisioning/) tree is historical. Active
|
||||||
|
server provisioning lives in the **KNELIAC** project at
|
||||||
|
`/home/reachableceo/projects/KNELIAC`.
|
||||||
|
- **Non-bash files**: Some files under `archive/provisioning/Agents/` have `.sh`
|
||||||
|
extension but are PHP (shebang `#!/usr/bin/php`). Skip in syntax checks.
|
||||||
|
- **Remote access (NON-NEGOTIABLE):** ALL SSH/SCP to ANY host MUST go
|
||||||
|
through the chokepoint scripts — [`tests/remote.sh`](tests/remote.sh)
|
||||||
|
(Proxmox hosts + all VMs) or
|
||||||
|
[`netinfra/dns-cluster-setup/remote-dns.sh`](netinfra/dns-cluster-setup/remote-dns.sh)
|
||||||
|
(DNS infra hosts: netinfra-01/02, tsrouter, netboot). NEVER call
|
||||||
|
`ssh`/`scp` directly — the harness blocks raw ssh and the command scanner
|
||||||
|
rejects it. There are no exceptions.
|
||||||
|
- **DNS names ONLY (NON-NEGOTIABLE):** NEVER use IP address literals
|
||||||
|
(neither LAN nor Tailscale IPs) in any command, script, or config.
|
||||||
|
ALWAYS use DNS names. For Proxmox hosts: `PROX_HOST=<dns-name>`. For VMs:
|
||||||
|
`VM_IP=<dns-name>`. For conman/SNMP/any tool: pass the DNS name. If a
|
||||||
|
DNS name does not resolve, fix it in DNS (Technitium) or consult the
|
||||||
|
[system inventory — Discourse #307](https://community.turnsys.com/t/307).
|
||||||
|
Do NOT fall back to IP literals. This rule eliminates the per-session
|
||||||
|
discovery tax of finding the right IP for each host.
|
||||||
|
- **How to access a production VM:**
|
||||||
|
1. Look up the DNS name in the [system inventory — Discourse #307](https://community.turnsys.com/t/307).
|
||||||
|
2. `VM_IP=<dns-name> VM_USER=root bash tests/remote.sh vm '<command>'`
|
||||||
|
3. If the name does not resolve from the workstation, use `PROX_HOST=<proxmox-node>`
|
||||||
|
and run `qm guest cmd <vmid> network-get-interfaces` (visibility only —
|
||||||
|
NOT execution) to find the Tailscale DNS name, then access via that.
|
||||||
|
|
||||||
**tsys4 exports (primary, overloaded):**
|
## Git Policy
|
||||||
- D2 = WDC Red 3TB HDD — most VMs live here
|
|
||||||
- D5 = Hitachi 2TB HDD
|
|
||||||
- (sda Hitachi 1.8T at /mnt/albert — not NFS shared)
|
|
||||||
- (sdd WDC 1T — idle, unmounted, removable)
|
|
||||||
- (sdf WDC 4.5T SMR at /mnt/backup — PBS target)
|
|
||||||
|
|
||||||
**tsys5 exports (fast-tier hub -- consolidated Friday):**
|
1. **ALWAYS commit + push. Never wait. Ever.** After each logical unit of
|
||||||
- S1/S2/S3 = Seagate 1TB HDD each
|
work, immediately stage, commit (conventional format), and push to
|
||||||
- S4 = Toshiba 500GB HDD
|
`origin/main`. Do NOT pause for review. Do NOT ask permission. Do NOT
|
||||||
- T5-SSD = Samsung 860 PRO 256GB SSD (existing)
|
stop to "let the user read it first." The user reviews rendered markdown
|
||||||
- **D3 = SK hynix SC300 512GB SSD** (moving from tsys4 USB to tsys5 SAS Friday)
|
on Gitea AFTER it is pushed. **This rule overrides any default
|
||||||
- **NVMe (local, new Friday)** — local-only, wnode-tsys5 boot + HPC scratch
|
conservative commit-and-hold behavior** — if a default instruction says
|
||||||
|
"never commit unless asked," that instruction is superseded here.
|
||||||
|
2. **Atomic commits.** Each commit coherent on its own.
|
||||||
|
3. **Conventional format**: `feat(scope): desc`, `fix(scope): desc`,
|
||||||
|
`docs: desc`, `refactor(scope): desc`, `test(scope): desc`.
|
||||||
|
4. **All shell scripts MUST pass `shellcheck` before commit.** No exceptions.
|
||||||
|
Run it via the wrapper:
|
||||||
|
```bash
|
||||||
|
bash tests/shellcheck.sh # whole repo
|
||||||
|
bash tests/shellcheck.sh ups/*.sh # specific files
|
||||||
|
```
|
||||||
|
This invokes `koalaman/shellcheck:stable` through Docker (no native binary
|
||||||
|
needed). Fix every reported finding — including `info`-level — or add a
|
||||||
|
targeted `# shellcheck disable=SCxxxx # <reason>` directive with a
|
||||||
|
justification. A script that emits any diagnostic is a protocol violation.
|
||||||
|
Non-bash scripts (PHP with `.sh` shebang `#!/usr/bin/php`, etc.) are exempt.
|
||||||
|
|
||||||
**tsys5 hardware:** LSI SAS1068E (8-port, 5 free) + Intel ICH10 SATA (6-port,
|
## Redmine Tracking Policy
|
||||||
2 free) + 2x Renesas USB 3.0 xHCI. Plenty of room for the SSD + NVMe.
|
|
||||||
|
|
||||||
**Friday change:** D3 export repoints from pfv-tsys4-nfs-stor to
|
**Redmine is the system of record for all work.** Do not track status,
|
||||||
pfv-tsys5-nfs-stor. Update storage.cfg cluster-wide. VMs on D3 (currently
|
checklists, or TODOs in repo files. Use Redmine tickets instead.
|
||||||
none of significance — it's 99% empty) keep working after remount.
|
|
||||||
|
|
||||||
## SSH access
|
- **URL:** https://projects.knownelement.com
|
||||||
|
- **Version:** Potential to Kinetic Ready (due 2026-09-30)
|
||||||
|
- **Project:** Known Element Enterprises - Technology & Facility Services (id 55)
|
||||||
|
|
||||||
SSH keys deployed to root on all hosts. Direct ssh/scp blocked in Crush bash;
|
### Rules
|
||||||
use `deploy-check.sh` / `deploy-tuning.sh` wrapper patterns instead.
|
1. **Every piece of work** (feature, fix, deployment, config change) gets a
|
||||||
|
Redmine ticket. If one doesn't exist, create it.
|
||||||
|
2. **Reference tickets in docs and commits** using `[#NNN]` notation.
|
||||||
|
Example: `[#367] Rebuilt k3s control plane after cnode wipe`.
|
||||||
|
3. **When work completes**, update the ticket: set done ratio to 100%,
|
||||||
|
add a note describing what was done and where the code lives.
|
||||||
|
**NEVER close a ticket without explicit user permission.** You may
|
||||||
|
SUGGEST a close when the result is clearly scoped and delivered. If
|
||||||
|
it's ambiguous whether the work is truly complete, don't suggest a
|
||||||
|
close — leave that decision to the user.
|
||||||
|
4. **Operations Status** lives on Discourse ([topic #297](https://community.turnsys.com/t/297)) — update that wiki topic if the infrastructure summary needs refreshing. The `STATUS.md` file in git is now a pointer only.
|
||||||
|
5. **Link code to tickets** — ticket descriptions and notes should reference
|
||||||
|
the relevant file paths in this repo (e.g., `dcinfra/ups/`).
|
||||||
|
|
||||||
## Critical lessons (do NOT regress)
|
### CLI access (read + write)
|
||||||
|
|
||||||
1. NFS `options` line in storage.cfg must NOT include `version=4.2` — Proxmox
|
Tickets are managed via the `redmine-cli` container, invoked directly
|
||||||
sets NFS version separately. Use only `options nconnect=4,noatime`.
|
with `docker run` (no wrapper script). Full command reference, patterns, and
|
||||||
2. NFS nconnect=4 only activates on fresh mount — requires VM start or reboot,
|
the subtask escape hatch live in the CLI's own `AGENTS.md`
|
||||||
NOT `mount -o remount`.
|
(`~/projects/KNEL-AIMiddleware/tooling-cli/redmine/AGENTS.md`) — read it
|
||||||
3. bond0 xmit_hash_policy: apply live via sysfs, then persist in
|
for anything beyond the basics.
|
||||||
`/etc/network/interfaces` with awk (sed fails on tab-indented stanza).
|
|
||||||
4. Always shellcheck before shipping: `docker run --rm -v "$PWD:/mnt"
|
|
||||||
koalaman/shellcheck:stable --severity=style scripts/*.sh`
|
|
||||||
5. The hosts are **standalone Proxmox installs** (not a pvecm cluster), but
|
|
||||||
managed collectively via **Proxmox Datacenter Manager (PDM)**. PDM supports
|
|
||||||
VM migration between nodes via the UI. NFS exports are visible to all nodes;
|
|
||||||
local storage migration is done through PDM's "Storage Migrate" function.
|
|
||||||
6. **Storage philosophy:** NVMe/SSD is for k8s worker scratch + ultix-streaming
|
|
||||||
(developer workstation for "cluster of 1" pre-prod jobs). Spinning rust
|
|
||||||
hosts all infrastructure VMs (UCS, netinfra, LibreNMS, SIEM).
|
|
||||||
|
|
||||||
## Friday walkthrough (user action)
|
```bash
|
||||||
|
# Connection sanity check (run first in any session):
|
||||||
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
|
git.knownelement.com/reachableceo/redmine-cli:latest whoami
|
||||||
|
|
||||||
### Step 1: tsys5 storage cable + NVMe
|
# Your queue (project 55):
|
||||||
1. Plug 2nd ethernet cable into tsys5 storage NIC
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
2. Verify: `cat /proc/net/bonding/bond0` — need "Number of ports: 2" + partner MAC
|
git.knownelement.com/reachableceo/redmine-cli:latest list --assigned-to-me -p 55
|
||||||
3. Apply: `echo "layer3+4" > /sys/class/net/bond0/bonding/xmit_hash_policy`
|
|
||||||
4. Install PCI NVMe, format as directory storage (local-only)
|
|
||||||
5. Reboot tsys5
|
|
||||||
|
|
||||||
### Step 2: tsys4 hardware install
|
# Show / create / update / close:
|
||||||
1. Install PCIe NIC + add RAM (16→64 GB)
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
2. Update `/etc/network/interfaces` — replace `enx8cae4ccda926` with new NIC
|
git.knownelement.com/reachableceo/redmine-cli:latest show 367
|
||||||
3. Reboot tsys4 (PBS VM restarts — OK)
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
|
git.knownelement.com/reachableceo/redmine-cli:latest create -p 55 -s "Subject" -d "desc"
|
||||||
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
|
git.knownelement.com/reachableceo/redmine-cli:latest update 367 -n "Done: committed in abc123" --done-ratio 100
|
||||||
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
|
git.knownelement.com/reachableceo/redmine-cli:latest close 367
|
||||||
|
```
|
||||||
|
|
||||||
### Step 3: Post-hardware validation
|
Key IDs: project **55** (`technicaloperations`), user **5** (`reachableceo`).
|
||||||
1. `iperf-full-matrix.sh` — re-test all paths
|
Statuses: New(1), In Progress(2), Resolved(3,closed), Feedback(4), Closed(5),
|
||||||
2. `validate-fixes.sh pfv-tsys4` and `validate-fixes.sh pfv-tsys5`
|
Rejected(6). New subtasks go to **Feedback (4)**. Tracker **3** = Support.
|
||||||
3. Update PROJECT.md with post-hardware numbers
|
**Gotcha:** `create` has no `--parent` flag — to make a subtask, use the
|
||||||
|
`python-redmine` escape hatch inside the container (see
|
||||||
|
`tooling-cli/redmine/AGENTS.md`). Always `show` a ticket before updating it.
|
||||||
|
|
||||||
## Version control
|
Credentials (`REDMINE_URL`/`REDMINE_API_KEY`) live in the centralized store
|
||||||
|
at `~/.creds/redmine.env`.
|
||||||
|
|
||||||
This project is tracked in a local git repo (`main` branch). Use **atomic
|
## Documentation Workflow
|
||||||
commits with conventional commit messages** (e.g., `docs: add disk utilization
|
|
||||||
to storage section`, `feat: add tsys9 validation support`). Never push to
|
|
||||||
remote unless explicitly asked.
|
|
||||||
|
|
||||||
## Key scripts
|
**Discourse is the source of truth for all knowledge docs.** After any work
|
||||||
|
session, an agent MUST:
|
||||||
|
|
||||||
|
1. **Update Discourse wiki topics** — if infrastructure facts changed (new
|
||||||
|
VM, IP change, host retired), edit the relevant wiki topic at
|
||||||
|
[community.turnsys.com/c/vp-techops](https://community.turnsys.com/c/vp-techops).
|
||||||
|
2. **Update the Operations Status topic** ([#297](https://community.turnsys.com/t/297))
|
||||||
|
if tickets were opened or closed.
|
||||||
|
3. **Grep for stale paths in code** — `grep -rn 'old/path' --include='*.sh'`
|
||||||
|
after any rename or restructure. Fix all references in the same commit.
|
||||||
|
4. **If a new top-level directory was created**, update:
|
||||||
|
- `AGENTS.md` → "Repository Layout" code block
|
||||||
|
- `AGENTS.md` → "Key Scripts" table (if it has an entrypoint script)
|
||||||
|
- Create a new Discourse wiki topic for any documentation
|
||||||
|
5. **Self-audit before commit.** Code changes must be internally consistent.
|
||||||
|
Documentation changes go to Discourse, not git.
|
||||||
|
|
||||||
|
### CLI access (read + write)
|
||||||
|
|
||||||
|
Wiki topics are managed via the `discourse-cli` container, invoked directly
|
||||||
|
with `docker run` (no wrapper script). Full command reference, patterns, and
|
||||||
|
the raw-API escape hatch live in the CLI's own `AGENTS.md`
|
||||||
|
(`~/projects/KNEL-AIMiddleware/tooling-cli/discourse/AGENTS.md`) — read it
|
||||||
|
for anything beyond the basics.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Connection sanity check (run first in any session):
|
||||||
|
docker run --rm --env-file ~/.creds/discourse.env \
|
||||||
|
git.knownelement.com/reachableceo/discourse-cli:latest whoami
|
||||||
|
|
||||||
|
# List VP TechOps topics:
|
||||||
|
docker run --rm --env-file ~/.creds/discourse.env \
|
||||||
|
git.knownelement.com/reachableceo/discourse-cli:latest ls -c vp-techops
|
||||||
|
|
||||||
|
# Show a topic / edit a wiki post (find post id via `show`):
|
||||||
|
docker run --rm --env-file ~/.creds/discourse.env \
|
||||||
|
git.knownelement.com/reachableceo/discourse-cli:latest show 297
|
||||||
|
docker run --rm --env-file ~/.creds/discourse.env \
|
||||||
|
git.knownelement.com/reachableceo/discourse-cli:latest update <post_id> -b "new markdown body"
|
||||||
|
```
|
||||||
|
|
||||||
|
VP TechOps = category **74**. Key topics: #296 (project overview), #297
|
||||||
|
(ops status), #298 (audit log). The API user is trust-level 4 but **not
|
||||||
|
admin** — admin-only ops (category creation, setting the wiki flag) will
|
||||||
|
403; surface those to the user rather than retrying. **Gotcha:**
|
||||||
|
`update`/`delete` take a post **id**, not a post number. Never create a new
|
||||||
|
topic for an update to existing knowledge — edit the wiki post in place.
|
||||||
|
|
||||||
|
Credentials (`DISCOURSE_URL`/`DISCOURSE_API_KEY`/`DISCOURSE_API_USERNAME`)
|
||||||
|
live in the centralized store at `~/.creds/discourse.env`.
|
||||||
|
|
||||||
|
## Key Scripts
|
||||||
|
|
||||||
| Script | Purpose |
|
| Script | Purpose |
|
||||||
|--------|---------|
|
|--------|---------|
|
||||||
| `scripts/check.sh` | Read-only data collector |
|
| [`scripts/check-rules.sh`](scripts/check-rules.sh) | Rule audit engine (shellcheck, image pinning, Discourse pointers, required files) |
|
||||||
| `scripts/apply-tunings.sh` | Tier 0 tunings (dry-run/apply/rollback) |
|
| [`scripts/setup-hooks.sh`](scripts/setup-hooks.sh) | Install git hooks (pre-commit, pre-push) |
|
||||||
| `scripts/fix-bond-nfs.sh` | Fix NFS options + bond hash |
|
| [`tests/remote.sh`](tests/remote.sh) | **SSH chokepoint** — all Proxmox host + sandbox VM access routes here |
|
||||||
| `validate-fixes.sh` | Validation of all applied changes |
|
| [`netinfra/dns-cluster-setup/remote-dns.sh`](netinfra/dns-cluster-setup/remote-dns.sh) | SSH chokepoint for DNS infra hosts (netinfra-01/02, tsrouter, netboot) |
|
||||||
| `iperf-full-matrix.sh` | Full iperf suite |
|
| `redmine-cli` container | Redmine CLI (ticket read/write via `docker run`; see `tooling-cli/redmine/`) |
|
||||||
| `deploy-check.sh` | Deploy check.sh to hosts via SSH |
|
| `discourse-cli` container | Discourse CLI (wiki topic read/write via `docker run`; see `tooling-cli/discourse/`) |
|
||||||
|
| `dns-cli` container | Technitium DNS CLI (zones, list, add, delete, search, flush; see `tooling-cli/dns/`) |
|
||||||
|
| [`tests/vm-validation.sh`](tests/vm-validation.sh) | Deploy + validate on sandbox VM |
|
||||||
|
| [`tests/run-tests.sh`](tests/run-tests.sh) | Test suite |
|
||||||
|
| [`netinfra/dns-cluster-setup/setup.sh`](netinfra/dns-cluster-setup/setup.sh) | DNS cluster replication |
|
||||||
|
| [`k8s/install-cp.sh`](k8s/install-cp.sh) | Bootstrap k3s HA control plane |
|
||||||
|
| [`dcinfra/powerman/setup.sh`](dcinfra/powerman/setup.sh) | Configure Cyclades PDU via powerman |
|
||||||
|
| [`dcinfra/console/setup.sh`](dcinfra/console/setup.sh) | Configure serial console access via ser2net + conman |
|
||||||
|
| [`dcinfra/ups/setup.sh`](dcinfra/ups/setup.sh) | Configure NUT (Network UPS Tools) for UPS monitoring |
|
||||||
|
| [`proxmox/perf/deploy-tuning.sh`](proxmox/perf/deploy-tuning.sh) | Deploy perf tunings |
|
||||||
|
| [`proxmox/perf/scripts/`](proxmox/perf/scripts/) | Read-only audit: probe-storage, probe-network, conman-console, snmp-switch-audit, probe-drift, audit-vm-disks, audit-guest-io, deploy-tuned-guests |
|
||||||
|
|
||||||
|
## Switch Console Access (conman)
|
||||||
|
|
||||||
|
Switch configs are pulled via serial console through a conman + ser2net
|
||||||
|
stack on pfv-tsys4.
|
||||||
|
|
||||||
|
- **conmand server:** pfv-tsys4 (port 7890)
|
||||||
|
- **ser2net:** pfv-tsys4, TCP ports 2001-2006
|
||||||
|
(do NOT connect to ser2net directly — it conflicts with conman's
|
||||||
|
persistent sessions; always use the conman client)
|
||||||
|
- **Script:** [`proxmox/perf/scripts/conman-console.py`](proxmox/perf/scripts/conman-console.py)
|
||||||
|
— drives console sessions read-only via PTY. No expect/tcl required.
|
||||||
|
- **Command files:** [`netinfra/switches/`](netinfra/switches/) — `.cmds` files
|
||||||
|
with switch-specific show commands
|
||||||
|
- **Query available consoles:** `conman -d 100.70.77.93 -q`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Pull a switch config (example):
|
||||||
|
CONMAN_SERVER=100.70.77.93:7890 python3 proxmox/perf/scripts/conman-console.py \
|
||||||
|
--console pfv-r5-core-01 --cmds netinfra/switches/pfv-r5-core-01.cmds
|
||||||
|
```
|
||||||
|
|
||||||
|
| Console name | TCP port | Device |
|
||||||
|
|--------------|----------|--------|
|
||||||
|
| pfv-r5-core-01 | 2001 | Dell PowerConnect 5448 (rack 5 core, mgmt+storage) |
|
||||||
|
| pfv-r3-tor-mgmt-01 | 2002 | Dell PowerConnect 5324 (rack 3 mgmt TOR) |
|
||||||
|
| pfv-r3-tor-stor-01 | 2003 | Dell PowerConnect 5324 (rack 3 storage TOR) |
|
||||||
|
| pfv-rrinfra-rtr | 2004 | Cisco router (rrinfra) |
|
||||||
|
| pfv-r2-tor-01 | 2005 | Rack 2 TOR switch |
|
||||||
|
| pfv-r6-mgmt-01 | 2006 | Rack 6 management switch |
|
||||||
|
|
||||||
|
## Mandatory: Document ALL Infrastructure Changes
|
||||||
|
|
||||||
|
**This is non-negotiable. Every infrastructure change (VM config, disk
|
||||||
|
cache, network setting, service config, storage migration) MUST be
|
||||||
|
documented BEFORE moving to the next task step — not "later" or "at the
|
||||||
|
end."**
|
||||||
|
|
||||||
|
Required for EVERY infrastructure change:
|
||||||
|
|
||||||
|
1. **Redmine ticket** — create one if none exists. Reference as `[#NNN]`.
|
||||||
|
2. **Discourse audit log** — reply to topic
|
||||||
|
[#298](https://community.turnsys.com/t/298) with a dated entry (what
|
||||||
|
changed, why, where).
|
||||||
|
3. **Discourse relevant wiki topic** — update the architecture/reference
|
||||||
|
topic if the change affects documented infrastructure facts (storage
|
||||||
|
#300, network #299, k8s #305, etc.).
|
||||||
|
4. **Git commit** — if code/config changed in the repo, commit + push
|
||||||
|
immediately per the Git Policy above.
|
||||||
|
|
||||||
|
## Tooling
|
||||||
|
|
||||||
|
- `gh`, `docker`, `jq` available on the workstation.
|
||||||
|
- No native shellcheck — use `bash tests/shellcheck.sh` (Docker wrapper
|
||||||
|
`koalaman/shellcheck:stable`). ALL scripts must pass including info-level.
|
||||||
|
- For raw API calls not covered by the Redmine/Discourse CLIs, use
|
||||||
|
`python3` inside the CLI Docker containers (escape hatch pattern in
|
||||||
|
`tooling-cli/{discourse,redmine}/AGENTS.md`).
|
||||||
|
- `curl`/`wget`/`httpie` may be blocked by some harnesses. Use the CLIs or
|
||||||
|
the python-in-Docker escape hatch for HTTP writes.
|
||||||
|
|
||||||
|
## Key Commands Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Tests + validation:
|
||||||
|
bash tests/run-tests.sh # test suite
|
||||||
|
bash tests/vm-validation.sh # VM validation
|
||||||
|
bash tests/shellcheck.sh # shellcheck whole repo
|
||||||
|
bash tests/shellcheck.sh path/to/*.sh # shellcheck specific files
|
||||||
|
|
||||||
|
# Redmine + Discourse sanity checks (run first in any session):
|
||||||
|
docker run --rm --env-file ~/.creds/redmine.env \
|
||||||
|
git.knownelement.com/reachableceo/redmine-cli:latest whoami
|
||||||
|
docker run --rm --env-file ~/.creds/discourse.env \
|
||||||
|
git.knownelement.com/reachableceo/discourse-cli:latest whoami
|
||||||
|
|
||||||
|
# Proxmox host access (DNS names only — never IPs):
|
||||||
|
PROX_HOST=pfv-tsys5 bash tests/remote.sh prox 'qm list'
|
||||||
|
PROX_HOST=pfv-tsys5 bash tests/remote.sh prox 'pvesm status'
|
||||||
|
|
||||||
|
# Production VM access (DNS names only — never IPs):
|
||||||
|
VM_IP=tsys-librenms VM_USER=root bash tests/remote.sh vm 'systemctl status cron'
|
||||||
|
|
||||||
|
# DNS infra access:
|
||||||
|
bash netinfra/dns-cluster-setup/remote-dns.sh netinfra01-root 'systemctl status docker'
|
||||||
|
|
||||||
|
# Switch console (read-only config pull — DNS names only):
|
||||||
|
CONMAN_SERVER=pfv-tsys4:7890 python3 proxmox/perf/scripts/conman-console.py \
|
||||||
|
--console pfv-r5-core-01 --cmds netinfra/switches/pfv-r5-core-01.cmds
|
||||||
|
```
|
||||||
|
|
||||||
|
## Credential Management
|
||||||
|
|
||||||
|
- API keys currently in `.env` files under KNEL-AIMiddleware (gitignored).
|
||||||
|
- User goal: migrate all keys to Hashicorp Vault
|
||||||
|
(`vault.knownelement.com`). No vault token present yet
|
||||||
|
(`~/.vault-token` missing). Track as high-priority TODO.
|
||||||
|
|
||||||
|
## Key Docs
|
||||||
|
|
||||||
|
→ **All documentation lives on Discourse:**
|
||||||
|
[community.turnsys.com/c/vp-techops](https://community.turnsys.com/c/vp-techops)
|
||||||
|
|
||||||
|
→ All `.md` files in this repo are pointers to Discourse topics.
|
||||||
|
|
||||||
|
→ **Complete Linux System Inventory:**
|
||||||
|
[Topic #307](https://community.turnsys.com/t/307) — every Linux system
|
||||||
|
(hosts + VMs + physical), with Tailscale IPs, DNS names, SSH access
|
||||||
|
status, and tuned profiles. Reference this for monitoring coverage,
|
||||||
|
access management, and hostname consistency.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
Solo-founder R&D Proxmox cluster in a private residence. Shoestring budget.
|
||||||
|
Production lives on a Cloudron VPS in Reston VA. See the
|
||||||
|
[Operations Status topic](https://community.turnsys.com/t/297) for the ticket
|
||||||
|
index and infrastructure summary.
|
||||||
|
All work is tracked in [Redmine](https://projects.knownelement.com)
|
||||||
|
(version: Potential to Kinetic Ready, due 2026-09-30).
|
||||||
|
|||||||
@@ -1,485 +0,0 @@
|
|||||||
# K8S.md -- Kubernetes Architecture Deep-Dive
|
|
||||||
|
|
||||||
**Date:** 2026-07-27
|
|
||||||
**Purpose:** Detailed kubernetes architecture plan for the pfv-k8s cluster.
|
|
||||||
Companion to `PROJECT.md` (which has the fleet-wide assessment).
|
|
||||||
**Status:** For discussion in a future session. No changes made.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
1. [Workload Profile](#1-workload-profile)
|
|
||||||
2. [Current State](#2-current-state)
|
|
||||||
3. [Target Architecture](#3-target-architecture)
|
|
||||||
4. [Control Plane (Cnodes)](#4-control-plane-cnodes)
|
|
||||||
5. [Worker Nodes (Wnodes)](#5-worker-nodes-wnodes)
|
|
||||||
6. [Storage Class Design](#6-storage-class-design)
|
|
||||||
7. [ETL/HPC Considerations](#7-etlhpc-considerations)
|
|
||||||
8. [Migration Plan](#8-migration-plan)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. Workload Profile
|
|
||||||
|
|
||||||
This cluster runs **R&D and RackRental (containerlab) workloads** via
|
|
||||||
Kubernetes. Production (Gitea, RustFS, Redmine, websites) lives on a VPS in
|
|
||||||
Reston, VA running Cloudron.
|
|
||||||
|
|
||||||
**Workload types expected:**
|
|
||||||
|
|
||||||
| Type | Description | Storage need | RAM need | Examples |
|
|
||||||
|------|------------|-------------|----------|---------|
|
|
||||||
| **ETL (weather/GIS)** | Batch processing of large geospatial datasets. Sequential reads, transform, sequential writes. | High capacity (100s of GB), moderate IOPS | Medium (8-32 GB per job) | GRIB/NetCDF processing, raster reprojection |
|
|
||||||
| **HPC (hardware startup)** | Compute-intensive simulations, firmware build pipelines, hardware-in-the-loop testing. | Low capacity, moderate IOPS | High (32-128 GB per job) | RTL simulation, PCB thermal analysis |
|
|
||||||
| **RackRental (containerlab)** | Rapid deployment/teardown of network lab topologies. Many containers, short-lived. | Low capacity, high IOPS (container image pulls) | Low-Medium (4-16 GB) | Network topology testing, protocol validation |
|
|
||||||
|
|
||||||
**Key storage insight:** ETL workloads need bulk capacity (NFS-HDD is fine --
|
|
||||||
sequential I/O). HPC and containerlab need low-latency random I/O (local
|
|
||||||
SSD/NVMe is essential). The tiered StorageClass design (section 6) serves both.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. Current State
|
|
||||||
|
|
||||||
### 2.1 pfv-k8s nodes and their storage
|
|
||||||
|
|
||||||
| Node | Type | Host | Storage | Disk type | Status |
|
|
||||||
|------|------|------|---------|-----------|--------|
|
|
||||||
| cnode1 (107) | control | tsys1 | D5 (tsys4) | NFS-HDD | running |
|
|
||||||
| cnode2 (603) | control | tsys6 | D2 (tsys4) | NFS-HDD | running |
|
|
||||||
| cnode3 (106) | control | tsys1 | D2 (tsys4) | NFS-HDD | running |
|
|
||||||
| cnode4 (601) | control | tsys6 | D2 (tsys4) | NFS-HDD | running |
|
|
||||||
| cnode5 (602) | control | tsys6 | D5 (tsys4) | NFS-HDD | running |
|
|
||||||
| wnode-tsys3 (313) | worker | tsys3 | D5 (tsys4) | NFS-HDD | running |
|
|
||||||
| wnode-tsys5 (509) | worker | tsys5 | D2 (tsys4) | NFS-HDD | running |
|
|
||||||
| wnode-tsys6 (100) | worker | tsys6 | D5 (tsys4) | NFS-HDD | **STOPPED** |
|
|
||||||
| wnode-tsys7 (701) | worker | tsys7 | D5 (tsys4) | NFS-HDD | running |
|
|
||||||
| wnode-tsys9 (905) | worker | tsys9 | S3 (tsys5) | NFS-HDD | running |
|
|
||||||
|
|
||||||
### 2.2 Problems
|
|
||||||
|
|
||||||
1. **100% of cnodes on tsys4 NFS.** D2 disk failure loses 3 of 5 cnodes =
|
|
||||||
etcd quorum lost.
|
|
||||||
2. **90% of all k8s nodes on tsys4 NFS.** tsys4 failure kills the cluster.
|
|
||||||
3. **Zero nodes use SSD or NVMe.** All on NFS-over-HDD.
|
|
||||||
4. **Zero nodes use local-lvm.** tsys3/6/7/9 all have empty local storage
|
|
||||||
(349 GB / 1.7 TB / 1.7 TB / 136 GB SSD respectively).
|
|
||||||
5. **wnode-tsys6 is stopped.** Reduces cluster capacity.
|
|
||||||
6. **3 cnodes on tsys6** -- should be on lighter hosts to free tsys6 for workers.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. Target Architecture
|
|
||||||
|
|
||||||
### 3.1 Design principles
|
|
||||||
|
|
||||||
1. **Cnodes on lightweight hosts** (tsys1, tsys9, tsys3) -- frees tsys6/7 for
|
|
||||||
heavy workers.
|
|
||||||
2. **Cnode storage split across tsys4 and tsys5** -- etcd survives either
|
|
||||||
storage server failing.
|
|
||||||
3. **Wnode boot disks on local storage** -- eliminates NFS latency for
|
|
||||||
container runtime and kubelet.
|
|
||||||
4. **Wnode data disks on NFS-HDD** -- bulk capacity for ETL/weather/GIS.
|
|
||||||
5. **tsys5 NVMe dedicated to wnode-tsys5** -- fastest tier for HPC jobs.
|
|
||||||
6. **One wnode per hypervisor host** -- maximize total cluster capacity.
|
|
||||||
|
|
||||||
### 3.2 Target node-host-storage matrix
|
|
||||||
|
|
||||||
| Node | Type | Host | Boot disk | Data disk | Disk type |
|
|
||||||
|------|------|------|-----------|-----------|-----------|
|
|
||||||
| cnode1 | control | tsys1 | D5 (tsys4) | -- | NFS-HDD |
|
|
||||||
| cnode2 | control | tsys9 | D2 (tsys4) | -- | NFS-HDD |
|
|
||||||
| cnode3 | control | tsys1 | S2 (tsys5) | -- | NFS-HDD |
|
|
||||||
| cnode4 | control | tsys9 | D5 (tsys4) | -- | NFS-HDD |
|
|
||||||
| cnode5 | control | tsys3 | S3 (tsys5) | -- | NFS-HDD |
|
|
||||||
| wnode-tsys1 | worker | tsys1 | D5 (tsys4) | -- | NFS-HDD (small) |
|
|
||||||
| wnode-tsys2 | worker | tsys2 | **NVMe (960 PRO 512GB)** | **SATA SSD (850 EVO 1TB)** | **NVMe + SSD -- no NFS needed** |
|
|
||||||
| wnode-tsys3 | worker | tsys3 | **local-lvm (NVMe PM961)** | S3 (NFS) | **LOCAL-NVMe** |
|
|
||||||
| wnode-tsys5 | worker | tsys5 | **NVMe (local, Friday)** | local-nonprod (HDD) | **NVMe** |
|
|
||||||
| wnode-tsys6 | worker | tsys6 | D2 (tsys4 NFS) | -- | NFS-HDD (local-lvm is USB 2.0 -- do not use) |
|
|
||||||
| wnode-tsys7 | worker | tsys7 | D5 (tsys4 NFS) | -- | NFS-HDD (local-lvm is USB 2.0 -- do not use) |
|
|
||||||
| wnode-tsys9 | worker | tsys9 | **local-lvm (SSD)** | S2 (NFS) | **LOCAL-SSD** |
|
|
||||||
|
|
||||||
### 3.3 Storage server distribution after changes
|
|
||||||
|
|
||||||
| Storage server | cnodes | wnodes (boot) | wnodes (data) |
|
|
||||||
|---------------|--------|---------------|---------------|
|
|
||||||
| tsys4 (D2) | cnode2 | wnode-tsys6 | wnode-tsys7 |
|
|
||||||
| tsys4 (D5) | cnode1, cnode4 | wnode-tsys1 | -- |
|
|
||||||
| tsys5 (S2) | cnode3 | wnode-tsys9 | -- |
|
|
||||||
| tsys5 (S3) | cnode5 | -- | wnode-tsys3 |
|
|
||||||
|
|
||||||
**Note:** wnode-tsys2 needs no NFS (1.5 TB local SSD). wnode-tsys6/7 stay on
|
|
||||||
NFS by design -- their local-lvm is USB 2.0 portable HDD (~30 MB/s), slower
|
|
||||||
than NFS-HDD, and the user has chosen not to install internal drives.
|
|
||||||
|
|
||||||
**No single disk or server is a quorum-losing failure point.**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. Control Plane (Cnodes)
|
|
||||||
|
|
||||||
### 4.1 Cnode sizing
|
|
||||||
|
|
||||||
Each cnode: 4 cores, 4 GB RAM, 32 GB disk. This is sufficient for etcd +
|
|
||||||
kubernetes control plane components (API server, scheduler, controller-manager).
|
|
||||||
|
|
||||||
### 4.2 Cnode host placement rationale
|
|
||||||
|
|
||||||
| Host | cnodes | RAM for cnodes | Total host RAM | Remaining for other VMs |
|
|
||||||
|------|--------|---------------|---------------|------------------------|
|
|
||||||
| tsys1 | 2 (cnode1, cnode3) | 8 GB | 32 GB | ~24 GB (but 11 infra VMs consume most) |
|
|
||||||
| tsys9 | 2 (cnode2, cnode4) | 8 GB | 24 GB | ~16 GB (4 infra VMs + 1 wnode) |
|
|
||||||
| tsys3 | 1 (cnode5) | 4 GB | 32 GB | ~28 GB (1 wnode at 20 GB = 8 GB headroom) |
|
|
||||||
|
|
||||||
**tsys6 and tsys7 have ZERO cnodes** -- fully dedicated to heavy worker nodes.
|
|
||||||
|
|
||||||
### 4.3 Cnode storage placement rationale
|
|
||||||
|
|
||||||
The 5 cnodes are split 3-on-tsys4 / 2-on-tsys5:
|
|
||||||
|
|
||||||
| Disk | cnodes | Rationale |
|
|
||||||
|------|--------|-----------|
|
|
||||||
| D5 (tsys4 HDD) | cnode1, cnode4 | Spread load across 2 disks on tsys4 |
|
|
||||||
| D2 (tsys4 HDD) | cnode2 | Only 1 cnode on D2 (was 3 -- reduces blast radius) |
|
|
||||||
| S2 (tsys5 HDD) | cnode3 | tsys5 storage for quorum diversity |
|
|
||||||
| S3 (tsys5 HDD) | cnode5 | tsys5 storage, different disk than S2 |
|
|
||||||
|
|
||||||
**If D2 fails:** cnode2 dies. 4 of 5 survive. Quorum OK.
|
|
||||||
**If D5 fails:** cnode1 + cnode4 die. 3 of 5 survive. Quorum OK.
|
|
||||||
**If tsys4 fails:** cnode1, cnode2, cnode4 die. cnode3 + cnode5 survive on
|
|
||||||
tsys5. **Only 2 of 5 -- QUORUM LOST.**
|
|
||||||
|
|
||||||
Wait -- that is a problem. If tsys4 goes completely offline, we lose 3
|
|
||||||
cnodes and only have 2 on tsys5. That loses quorum (need 3).
|
|
||||||
|
|
||||||
**Revision needed:** Move 1 more cnode to tsys5 storage. Target: 2 on tsys4,
|
|
||||||
3 on tsys5. But that means tsys5 failure (3 cnodes die) leaves only 2 on
|
|
||||||
tsys4. Same problem inverted.
|
|
||||||
|
|
||||||
The fundamental issue: with 5 cnodes and 2 storage servers, the best split is
|
|
||||||
3/2. The server holding 3 cnodes is a quorum-loss risk if it fails. The server
|
|
||||||
holding 2 cnodes is safe (3 survive).
|
|
||||||
|
|
||||||
**Proper solution: 3 cnodes on the "less likely to fail" server, 2 on the
|
|
||||||
other.** After Friday's hardware work:
|
|
||||||
- tsys4 will have a new PCIe NIC + 64 GB RAM -- more reliable
|
|
||||||
- tsys5 will have bond0 fixed + NVMe -- more reliable
|
|
||||||
|
|
||||||
Either way, 3/2 split means one server failure could lose quorum. **To truly
|
|
||||||
solve this, use a 3rd storage target.** Options:
|
|
||||||
- Use tsys9 local SSD for 1 cnode (breaks the 2-server model, adds a 3rd
|
|
||||||
independent failure domain)
|
|
||||||
- Use local-lvm on the cnode's own host (etcd data is local to the VM's host,
|
|
||||||
no NFS dependency at all)
|
|
||||||
|
|
||||||
**Best option: put cnode boot disks on local-lvm where available.** This
|
|
||||||
eliminates NFS entirely for the control plane. Each cnode's etcd data lives on
|
|
||||||
its own host's local disk -- no shared dependency.
|
|
||||||
|
|
||||||
| cnode | Host | **Recommended storage** | Type |
|
|
||||||
|-------|------|------------------------|------|
|
|
||||||
| cnode1 | tsys1 | **local-lvm** (if space) or D5 (tsys4) | LOCAL-HDD or NFS-HDD |
|
|
||||||
| cnode2 | tsys9 | **local-lvm (SSD)** | **LOCAL-SSD** |
|
|
||||||
| cnode3 | tsys1 | **S2 (tsys5)** | NFS-HDD |
|
|
||||||
| cnode4 | tsys9 | **local-lvm (SSD)** | **LOCAL-SSD** |
|
|
||||||
| cnode5 | tsys3 | **local-lvm** | LOCAL-HDD |
|
|
||||||
|
|
||||||
With this layout, a tsys4 failure takes down 0 cnodes. A tsys5 failure takes
|
|
||||||
down 1 (cnode3). A host failure takes down at most 2 cnodes. Quorum always
|
|
||||||
survives.
|
|
||||||
|
|
||||||
**This is the recommended approach.** Local storage for cnodes wherever
|
|
||||||
possible. NFS only as fallback.
|
|
||||||
|
|
||||||
### 4.4 etcd performance on local vs NFS
|
|
||||||
|
|
||||||
| Storage | Typical fsync latency | etcd commit latency | Impact |
|
|
||||||
|---------|----------------------|--------------------|--------|
|
|
||||||
| NFS-HDD (via USB dongle on tsys4) | 5-15 ms | 10-30 ms | Slow API responses, sluggish pod scheduling |
|
|
||||||
| NFS-HDD (via PCIe NIC, post-Friday) | 2-8 ms | 5-15 ms | Better but still network-bound |
|
|
||||||
| Local HDD (tsys1/3/6/7 local-lvm) | 1-5 ms | 3-10 ms | No network hop, moderate improvement |
|
|
||||||
| Local SSD (tsys9 PNY CS900) | 0.1-0.5 ms | 0.5-2 ms | **10-30x faster than NFS-HDD** |
|
|
||||||
| NVMe (tsys5, Friday) | 0.02-0.1 ms | 0.1-0.5 ms | **100x faster than NFS-HDD** |
|
|
||||||
|
|
||||||
etcd is the heartbeat of the kubernetes control plane. Every API call, every
|
|
||||||
pod schedule, every controller reconciliation involves an etcd write. Cutting
|
|
||||||
etcd commit latency from 15 ms to 1 ms makes the entire cluster feel 15x more
|
|
||||||
responsive. **This is the single highest-impact change for k8s performance.**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 5. Worker Nodes (Wnodes)
|
|
||||||
|
|
||||||
### 5.1 One wnode per hypervisor host
|
|
||||||
|
|
||||||
| Host | wnode | Boot disk | Data disk | Total RAM | wnode RAM | Role |
|
|
||||||
|------|-------|-----------|-----------|-----------|-----------|------|
|
|
||||||
| tsys1 | wnode-tsys1 | D5 (tsys4 NFS) | -- | 32 GB | 4-8 GB | Small worker, infra co-tenant |
|
|
||||||
| tsys2 | wnode-tsys2 | **NVMe (960 PRO 512GB)** | **SATA SSD (850 EVO 1TB)** | 32 GB | 16-24 GB | **Best storage of any worker -- 1.5TB local SSD, no NFS needed** |
|
|
||||||
| tsys3 | wnode-tsys3 | **local-lvm (349 GB)** | S3 (NFS) | 32 GB | 20 GB | General worker |
|
|
||||||
| tsys5 | wnode-tsys5 | **NVMe (local)** | local-nonprod (HDD) | 96 GB | 32-64 GB | **HPC/ETL powerhouse** |
|
|
||||||
| tsys6 | wnode-tsys6 | D2 (tsys4 NFS) | -- | 128 GB | 64-96 GB | **Heavy worker, max RAM.** local-lvm is USB 2.0 -- stays on NFS |
|
|
||||||
| tsys7 | wnode-tsys7 | D5 (tsys4 NFS) | -- | 192 GB | 96-128 GB | **Heavy worker, max RAM.** local-lvm is USB 2.0 -- stays on NFS |
|
|
||||||
| tsys9 | wnode-tsys9 | **local-lvm SSD (136 GB)** | S2 (NFS) | 24 GB | 4-8 GB | Small worker, SSD boot |
|
|
||||||
|
|
||||||
### 5.2 Why boot disks on local-lvm
|
|
||||||
|
|
||||||
Current: all wnodes boot from NFS. Every container image pull, every kubelet
|
|
||||||
log write, every ephemeral volume traverses the NFS network path.
|
|
||||||
|
|
||||||
With local-lvm boot disks:
|
|
||||||
- **Container image pulls** write to local disk (100-150 MB/s HDD, no network
|
|
||||||
hop) instead of NFS-HDD (80-120 MB/s with network latency)
|
|
||||||
- **kubelet logs** stay local (no NFS writes for log rotation)
|
|
||||||
- **ephemeral storage** (emptyDir volumes) uses local disk by default
|
|
||||||
- **NFS server failure does not kill the wnode** -- the VM stays running, only
|
|
||||||
the data disk (if mounted) goes away
|
|
||||||
|
|
||||||
### 5.3 Wnode sizing guidance
|
|
||||||
|
|
||||||
| Host | Recommended wnode config | Rationale |
|
|
||||||
|------|------------------------|-----------|
|
|
||||||
| tsys7 (192 GB) | 8-12 cores, 96-128 GB RAM, NFS boot | Largest host -- run the heaviest ETL/HPC jobs here. local-lvm is USB 2.0 |
|
|
||||||
| tsys6 (128 GB) | 8 cores, 64-96 GB RAM, NFS boot | Second-largest -- parallel heavy jobs. local-lvm is USB 2.0 |
|
|
||||||
| tsys5 (96 GB + NVMe) | 4 cores, 32-64 GB RAM, NVMe boot + HDD data | NVMe makes this fastest for I/O-bound HPC |
|
|
||||||
| tsys3 (32 GB) | 4 cores, 20 GB RAM, local-lvm boot | General-purpose worker |
|
|
||||||
| tsys2 (32 GB, NVMe+SSD, incoming) | 4 cores, 16-24 GB RAM, **NVMe boot + SSD data** | **Fastest storage worker** -- HPC with I/O bounds |
|
|
||||||
| tsys1 (32 GB) | 2 cores, 4-8 GB RAM | Small worker, don't starve infra VMs |
|
|
||||||
| tsys9 (24 GB) | 2-4 cores, 4-8 GB RAM | Small worker, SSD boot is the advantage |
|
|
||||||
|
|
||||||
### 5.4 Tainting and labeling strategy
|
|
||||||
|
|
||||||
Label wnodes by capability so the k8s scheduler can target them:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Heavy RAM hosts (ETL/HPC)
|
|
||||||
wnode-tsys6: workload=heavy, ram=128g
|
|
||||||
wnode-tsys7: workload=heavy, ram=192g
|
|
||||||
|
|
||||||
# NVMe host (I/O-intensive HPC)
|
|
||||||
wnode-tsys5: workload=hpc, storage=nvme
|
|
||||||
|
|
||||||
# SSD boot host (low-latency)
|
|
||||||
wnode-tsys9: workload=light, storage=ssd
|
|
||||||
|
|
||||||
# General workers
|
|
||||||
wnode-tsys3: workload=general
|
|
||||||
wnode-tsys2: workload=storage-fast, storage=nvme
|
|
||||||
wnode-tsys1: workload=light
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use nodeSelector or nodeAffinity in job specs:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Weather/GIS ETL job -- needs lots of RAM
|
|
||||||
spec:
|
|
||||||
nodeSelector:
|
|
||||||
workload: heavy
|
|
||||||
|
|
||||||
# Firmware build -- needs fast storage
|
|
||||||
spec:
|
|
||||||
nodeSelector:
|
|
||||||
storage: nvme
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6. Storage Class Design
|
|
||||||
|
|
||||||
### 6.1 Proposed StorageClasses
|
|
||||||
|
|
||||||
| StorageClass | Provisioner | Where | Speed | Use case |
|
|
||||||
|-------------|------------|-------|-------|----------|
|
|
||||||
| `local-fast` | local-path (k8s) | wnode local-lvm / NVMe | 100-3500 MB/s | Container runtime, scratch, databases |
|
|
||||||
| `nfs-hdd` | nfs-subdir-external-provisioner | tsys4 D2/D5, tsys5 S1-S4 | 80-120 MB/s | Bulk data, weather/GIS datasets |
|
|
||||||
| `nfs-ssd` | nfs-subdir-external-provisioner | tsys4 D3, tsys5 T5-SSD | 200-400 MB/s | Latency-sensitive persistent data |
|
|
||||||
|
|
||||||
### 6.2 How this maps to wnode disk topology
|
|
||||||
|
|
||||||
Each wnode has:
|
|
||||||
- **Disk 1 (boot/OS):** local-lvm or NVMe. Contains the OS, kubelet, container
|
|
||||||
runtime. k8s `local-fast` StorageClass provisioner points here.
|
|
||||||
- **Disk 2 (bulk data, optional):** NFS mount. Mounted inside the VM as a
|
|
||||||
second block device or filesystem. k8s `nfs-hdd` provisioner points here.
|
|
||||||
|
|
||||||
Inside k8s, pods request storage via PVC:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# ETL job: needs bulk storage for weather data
|
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
spec:
|
|
||||||
storageClassName: nfs-hdd
|
|
||||||
accessModes: [ReadWriteMany] # NFS allows RWX
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 500Gi
|
|
||||||
|
|
||||||
# HPC job: needs fast scratch
|
|
||||||
spec:
|
|
||||||
storageClassName: local-fast
|
|
||||||
accessModes: [ReadWriteOnce]
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 50Gi
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6.3 NFS-SSD tier (D3 and T5-SSD -- both on tsys5 after Friday)
|
|
||||||
|
|
||||||
**Storage philosophy (user directive): NVMe/SSD is EXCLUSIVELY for k8s worker
|
|
||||||
scratch space, with the exception of ultix-streaming which stays on T5-SSD.
|
|
||||||
Spinning rust hosts all other infrastructure VMs** (UCS, netinfra, LibreNMS,
|
|
||||||
SIEM, etc.).
|
|
||||||
|
|
||||||
The SSD NFS exports:
|
|
||||||
- **D3 (tsys5 SAS, 445 GB free):** k8s scratch exclusively (etcd, container
|
|
||||||
cache, ephemeral volumes). Currently 99% empty.
|
|
||||||
- **T5-SSD (tsys5 SAS, 140 GB free after ultix-streaming):** ultix-streaming
|
|
||||||
occupies 83 GB. Remaining 140 GB available for k8s use.
|
|
||||||
|
|
||||||
**tsys5 is the fast-tier hub:** NVMe (local) + D3 SSD + T5-SSD all on one host.
|
|
||||||
This simplifies the StorageClass design -- latency-sensitive k8s PVCs target
|
|
||||||
tsys5 SSD exports, bulk PVCs target either server.
|
|
||||||
|
|
||||||
### 6.4 NFS data distribution across storage servers
|
|
||||||
|
|
||||||
To avoid re-creating the "everything on tsys4" problem, distribute NFS data
|
|
||||||
disks across both servers:
|
|
||||||
|
|
||||||
| wnode | Boot (local) | Bulk data (NFS) | NFS server |
|
|
||||||
|-------|-------------|-----------------|------------|
|
|
||||||
| wnode-tsys3 | local-lvm | S3 | tsys5 |
|
|
||||||
| wnode-tsys5 | NVMe | local-nonprod | local (no NFS) |
|
|
||||||
| wnode-tsys6 | D2 (tsys4 NFS) | -- | tsys4 |
|
|
||||||
| wnode-tsys7 | D5 (tsys4 NFS) | -- | tsys4 |
|
|
||||||
| wnode-tsys9 | local-lvm (SSD) | S2 | tsys5 |
|
|
||||||
|
|
||||||
This balances: 2 wnodes using tsys4 for bulk data, 2 using tsys5.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 7. ETL/HPC Considerations
|
|
||||||
|
|
||||||
### 7.1 Weather/GIS ETL pipeline
|
|
||||||
|
|
||||||
Typical flow: download GRIB/NetCDF files -> process (reproject, aggregate) ->
|
|
||||||
store results.
|
|
||||||
|
|
||||||
| Stage | Storage class | Why |
|
|
||||||
|-------|-------------|-----|
|
|
||||||
| Download raw data | `nfs-hdd` | Large sequential writes. NFS-HDD handles this well. |
|
|
||||||
| Processing scratch | `local-fast` | Random access during transform. Local disk avoids NFS latency. |
|
|
||||||
| Store results | `nfs-hdd` | Large sequential writes. Persistent. |
|
|
||||||
|
|
||||||
**Recommendation:** Deploy a `local-fast` PV mount as `/scratch` on every
|
|
||||||
wnode. ETL jobs use `/scratch` for intermediate processing and write final
|
|
||||||
output to the NFS-mounted `/data`.
|
|
||||||
|
|
||||||
### 7.2 HPC workloads (hardware startup)
|
|
||||||
|
|
||||||
Use cases: RTL simulation, PCB thermal analysis, firmware build pipelines.
|
|
||||||
|
|
||||||
| Workload | Best wnode | Why |
|
|
||||||
|----------|-----------|-----|
|
|
||||||
| RTL simulation (CPU-bound, high RAM) | tsys7 (192 GB) | Most RAM, most cores (24t) |
|
|
||||||
| Firmware builds (I/O-bound, moderate RAM) | tsys5 (NVMe) | Fastest storage for compile I/O |
|
|
||||||
| Hardware-in-the-loop (latency-sensitive) | tsys9 (local SSD) | Lowest latency storage |
|
|
||||||
| Parallel batch jobs | tsys6 + tsys7 | Distribute across both heavy hosts |
|
|
||||||
|
|
||||||
### 7.3 RackRental/containerlab
|
|
||||||
|
|
||||||
Rapid container deployment. Key need: fast container image pulls.
|
|
||||||
|
|
||||||
This is where **local-lvm boot disks** shine. Currently, every container image
|
|
||||||
pull writes through NFS to a spinning disk -- slow. With local-lvm, images
|
|
||||||
cache on local disk (even HDD is 2-3x faster than NFS-HDD for random I/O).
|
|
||||||
On tsys9 (SSD) and tsys5 (NVMe), image pulls are near-instant.
|
|
||||||
|
|
||||||
### 7.4 Data locality for ETL
|
|
||||||
|
|
||||||
For weather/GIS data that is read repeatedly (e.g., climate reanalysis), cache
|
|
||||||
it on local-lvm of the heavy hosts:
|
|
||||||
|
|
||||||
```
|
|
||||||
tsys3 local-lvm (NVMe 349 GB): /data/cache/weather/ -- fastest cache tier
|
|
||||||
tsys5 NVMe (local): /data/cache/gis/ -- fastest cache tier
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** tsys6/7 local-lvm is USB 2.0 portable HDD (~30 MB/s) -- cannot
|
|
||||||
be used for caching. Pre-populate weather/GIS data on D2/D5 (NFS) instead.
|
|
||||||
|
|
||||||
This avoids re-reading the same data from the same NFS export on every job
|
|
||||||
if the data is already cached in the page cache.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 8. Migration Plan
|
|
||||||
|
|
||||||
**Key enabler:** The hosts are standalone Proxmox installs, but **Proxmox
|
|
||||||
Datacenter Manager (PDM)** manages them collectively and supports VM migration
|
|
||||||
between nodes. Storage migration can be done via the PDM/Proxmox UI rather
|
|
||||||
than manual disk copies -- the destination node just needs access to the target
|
|
||||||
storage (which all nodes have for NFS exports, and local storage can be
|
|
||||||
migrated through the UI's "Storage Migrate" function).
|
|
||||||
|
|
||||||
### 8.1 Phase 1: Friday (after hardware work)
|
|
||||||
|
|
||||||
After tsys5 cable + NVMe and tsys4 NIC + RAM:
|
|
||||||
|
|
||||||
1. **Format tsys5 NVMe** as local directory storage (e.g., `nvme-local`)
|
|
||||||
2. **Restart wnode-tsys6** (VM 100). Keep on NFS (D5). local-lvm is USB 2.0 --
|
|
||||||
do not use for VM storage. Recreate on D2 or D5 NFS.
|
|
||||||
3. **Move wnode-tsys9** (VM 905) disk from S3 (NFS) to local-lvm (SSD).
|
|
||||||
|
|
||||||
### 8.2 Phase 2: Cnode rebalance (maintenance window)
|
|
||||||
|
|
||||||
These changes require creating new VMs on target hosts and migrating disks.
|
|
||||||
Plan for a maintenance window with the k8s cluster briefly down.
|
|
||||||
|
|
||||||
1. Create cnode2 on tsys9 (local-lvm SSD if possible, or D2 NFS).
|
|
||||||
2. Create cnode4 on tsys9 (D5 NFS or local-lvm SSD).
|
|
||||||
3. Create cnode5 on tsys3 (S3 NFS or local-lvm).
|
|
||||||
4. Move cnode3 disk from D2 to S2 (tsys4 to tsys5).
|
|
||||||
5. Join new cnodes to etcd cluster, drain old cnode2/4/5, remove.
|
|
||||||
|
|
||||||
### 8.3 Phase 3: Wnode local storage migration (maintenance window)
|
|
||||||
|
|
||||||
1. Recreate wnode-tsys3 with boot disk on local-lvm (349 GB).
|
|
||||||
2. wnode-tsys6 stays on NFS (local-lvm is USB 2.0 HDD -- not suitable).
|
|
||||||
3. wnode-tsys7 stays on NFS (same reason).
|
|
||||||
4. Recreate wnode-tsys5 with boot disk on NVMe.
|
|
||||||
5. Add data disks (NFS) as second SCSI devices where applicable.
|
|
||||||
|
|
||||||
### 8.4 Phase 4: tsys2 integration (when rebuilt)
|
|
||||||
|
|
||||||
1. Install Proxmox on tsys2.
|
|
||||||
2. Run `scripts/check.sh` to inventory.
|
|
||||||
3. Run `scripts/apply-tunings.sh --apply`.
|
|
||||||
4. Create wnode-tsys2 with **boot disk on NVMe (960 PRO)** and **data disk on SATA SSD (850 EVO)**. No NFS needed -- 1.5 TB local SSD is the most local storage of any worker.
|
|
||||||
5. Join to k8s cluster.
|
|
||||||
|
|
||||||
### 8.5 Phase 5: Critical VM relocation
|
|
||||||
|
|
||||||
1. Move netinfra-02 (VM 904) from D2 to S3 (tsys5 HDD).
|
|
||||||
2. Move ucs-02 (VM 902) from D5 to S2 (tsys5 HDD).
|
|
||||||
3. (No change to T5-SSD -- ultix-streaming stays.)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Open questions for next session
|
|
||||||
|
|
||||||
1. **Are the hosts a Proxmox cluster (pvecm) or standalone?** This determines
|
|
||||||
whether live migration is available (huge simplification) or we need manual
|
|
||||||
disk migration. Check `pvecm status` on each host.
|
|
||||||
2. **What k8s distribution is in use?** (k3s, kubeadm, RKE2?) This affects how
|
|
||||||
nodes are joined/drain and how StorageClasses are configured.
|
|
||||||
3. **Container runtime?** (containerd, cri-o?) Affects local storage layout.
|
|
||||||
4. **Is there a container image registry mirror in the cluster?** Or do all
|
|
||||||
pulls go to Docker Hub / external? A local registry on D3 SSD would speed
|
|
||||||
up all pulls.
|
|
||||||
5. **What specific ETL tools?** (GDAL, PostGIS, xarray, Dask?) This affects
|
|
||||||
whether jobs need shared (RWX) or exclusive (RWO) storage.
|
|
||||||
6. **HPC job scheduler?** (plain k8s Jobs, Argo Workflows, Volcano?) Affects
|
|
||||||
how we label and taint nodes.
|
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
FetchApply
|
||||||
|
Copyright (C) 2024 VpTechnicalOperations
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# Makefile — convenience dispatch to scripts/.
|
||||||
|
#
|
||||||
|
# Not required. The scripts in scripts/ are the real entry points and work
|
||||||
|
# standalone. This file just gives you short verbs if you're at a terminal.
|
||||||
|
#
|
||||||
|
# In Mode 2 (Hermes/OWUI/MCP), agents call the scripts directly or via API —
|
||||||
|
# they don't need this file.
|
||||||
|
|
||||||
|
# Project-specific overrides for check-rules.sh
|
||||||
|
export PROJECT_DOC_EXEMPT ?= AGENTS.md STATUS.md WORKING.md README.md ADOPTING.md LICENSE .env.example questions-v1.md BASELINE-PROMPT.md PATTERNS.md
|
||||||
|
export PROJECT_DISCOURSE_HOST ?= community.turnsys.com
|
||||||
|
|
||||||
|
.PHONY: setup validate fast lint test garden up down status clean help
|
||||||
|
|
||||||
|
help: ## Show available targets
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
|
setup: ## Install git hooks
|
||||||
|
@bash scripts/setup-hooks.sh
|
||||||
|
|
||||||
|
validate: ## Full rule audit (includes tests)
|
||||||
|
@bash scripts/check-rules.sh
|
||||||
|
|
||||||
|
fast: ## Fast rule audit (pre-commit equivalent)
|
||||||
|
@bash scripts/check-rules.sh --fast
|
||||||
|
|
||||||
|
lint: ## Lint shell scripts (shellcheck via docker)
|
||||||
|
@docker run --rm -v "$$(pwd):/mnt" koalaman/shellcheck:stable \
|
||||||
|
$$(find . -path ./.git -prune -o -path ./.tmp -prune -o -path ./vendor -prune -o -path ./node_modules -prune -o \( -name '*.sh' -o -name '*.bash' \) -print | sed 's|^\./|/mnt/|') || true
|
||||||
|
|
||||||
|
test: ## Run the test suite (override per project)
|
||||||
|
@bash scripts/test.sh
|
||||||
|
|
||||||
|
garden: ## Doc-sprawl / Discourse-migration report
|
||||||
|
@bash scripts/garden.sh
|
||||||
|
|
||||||
|
up: ## Bring up the docker-compose stack
|
||||||
|
@bash scripts/up.sh
|
||||||
|
|
||||||
|
down: ## Bring down the docker-compose stack
|
||||||
|
@bash scripts/down.sh
|
||||||
|
|
||||||
|
status: ## Show repo status snapshot
|
||||||
|
@echo "== branch =="; git branch --show-current 2>/dev/null || echo "(no branch)"
|
||||||
|
@echo "== last commit =="; git log --oneline -1 2>/dev/null || true
|
||||||
|
@echo "== working tree =="; git status --short 2>/dev/null || echo "(not a git repo)"
|
||||||
|
@echo "== STATUS.md head =="; sed -n '1,12p' STATUS.md 2>/dev/null || echo "(no STATUS.md)"
|
||||||
|
|
||||||
|
clean: ## Remove build/test artifacts (override per project)
|
||||||
|
@echo "make clean: nothing to clean — override this in your project's Makefile."
|
||||||
-857
@@ -1,857 +0,0 @@
|
|||||||
# Proxmox Cluster Project Report
|
|
||||||
|
|
||||||
**Date:** 2026-07-27 (re-audited)
|
|
||||||
**Prepared by:** Performance Optimization Engagement
|
|
||||||
**Status:** Comprehensive fleet assessment with VM placement and redundancy analysis
|
|
||||||
|
|
||||||
**Data freshness:** All 7 hosts re-audited at 21:50 CDT 2026-07-27 via
|
|
||||||
`deploy-check.sh`. VM placements reflect live state after user's PDM
|
|
||||||
migrations. This is ground truth.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
1. [Executive Summary](#1-executive-summary)
|
|
||||||
2. [Host Fleet](#2-host-fleet)
|
|
||||||
3. [Storage Architecture](#3-storage-architecture)
|
|
||||||
4. [VM Fleet Inventory](#4-vm-fleet-inventory)
|
|
||||||
5. [Kubernetes Node Distribution](#5-kubernetes-node-distribution)
|
|
||||||
6. [Storage Redundancy Analysis](#6-storage-redundancy-analysis)
|
|
||||||
7. [Local SSD/NVMe Opportunity](#7-local-ssdnvme-opportunity)
|
|
||||||
8. [Role Alignment Audit](#8-role-alignment-audit)
|
|
||||||
9. [Network Findings](#9-network-findings)
|
|
||||||
10. [Recommendations](#10-recommendations)
|
|
||||||
11. [Hardware End-of-Support Exposure](#11-hardware-end-of-support-exposure)
|
|
||||||
12. [Open Items](#12-open-items)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. Executive Summary
|
|
||||||
|
|
||||||
The cluster consists of 7 active Proxmox hosts and 1 incoming (pfv-tsys2),
|
|
||||||
running 43 VMs across two NFS storage servers (tsys4, tsys5). Host-side
|
|
||||||
performance tunings are complete on 5 of 7 hosts. Two hosts (tsys4, tsys5)
|
|
||||||
are blocked on physical hardware work scheduled for Friday.
|
|
||||||
|
|
||||||
**Progress since initial audit:** The user has been actively rebalancing k8s
|
|
||||||
nodes via PDM. Storage distribution improved from 90%/10% (tsys4/tsys5) to
|
|
||||||
73%/27%. One cnode now uses tsys5 storage (cnode5 on S2). More migration
|
|
||||||
needed for etcd quorum survival.
|
|
||||||
|
|
||||||
The VM-layer assessment reveals:
|
|
||||||
|
|
||||||
| # | Finding | Severity | Status |
|
|
||||||
|---|---------|----------|--------|
|
|
||||||
| 1 | **4 of 5 cnodes still store disks on tsys4 NFS.** cnode5 moved to tsys5. Still need 1-2 more moves for quorum survival. | **CRITICAL** | Improving |
|
|
||||||
| 2 | **Both -01/-02 infrastructure pairs (netinfra, UCS) on tsys4 NFS only.** | **HIGH** | TODO today |
|
|
||||||
| 3 | **No k8s node uses SSD or NVMe yet.** tsys3 has 349 GB unused local NVMe; tsys9 has 136 GB local SSD. | **HIGH** | Deferred to k8s session |
|
|
||||||
| 4 | **D3 SSD (tsys4, USB) is 99% empty (445 GB free).** Moving to tsys5 SAS Friday. | **MEDIUM** | Friday |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. Host Fleet
|
|
||||||
|
|
||||||
### 2.1 Inventory
|
|
||||||
|
|
||||||
| Host | Model | CPU (year) | Cores | RAM | Local Disk | Role (intended) | Tuning |
|
|
||||||
|------|-------|-----------|-------|-----|-----------|-----------------|--------|
|
|
||||||
| pfv-tsys1 | OptiPlex 9020 | i7-4770 Haswell (2013) | 4c/8t | 32 GB DDR3 | HDD (LVM-thin) | **Infrastructure** | Done |
|
|
||||||
| pfv-tsys2 | Precision 5520 | i7-7820HQ Kaby Lake (2017) | 4c/8t | 32 GB (max) | **NVMe 512GB + SATA SSD 1TB** | **Kubernetes** | Incoming (Win10) |
|
|
||||||
| pfv-tsys3 | Precision 7510 | Xeon E3-1535M v5 Skylake (2015) | 4c/8t | 32 GB DDR4 | HDD (LVM-thin) | **Kubernetes** | Done |
|
|
||||||
| pfv-tsys4 | Precision T1700 | Xeon E3-1246 v3 Haswell (2013) | 4c/8t | 16 GB DDR3 | 6 disks (HDD+SSD+SMR) | **Storage (NFS+PBS)** | Blocked (NIC+RAM) |
|
|
||||||
| pfv-tsys5 | Precision T7500 | Xeon E5620 Westmere (2010) | 4c/8t | 96 GB DDR3 | 6 disks (HDD+SSD) | **Storage (NFS+VMs)** | Blocked (cable) |
|
|
||||||
| pfv-tsys6 | PowerEdge R610 | 2x Xeon E5530 Nehalem (2009) | 8c/16t | 128 GB DDR3 | HDD (LVM-thin) | **Kubernetes** | Done |
|
|
||||||
| pfv-tsys7 | PowerEdge R620 | 2x Xeon E5-2630 v2 Ivy Bridge (2013) | 12c/24t | 192 GB DDR3 | HDD (LVM-thin) | **Kubernetes** | Done |
|
|
||||||
| pfv-tsys9 | OptiPlex 7080 | i5-10500 Comet Lake (2020) | 6c/12t | 24 GB DDR4 | **250 GB SSD** (PNY CS900) | **Infrastructure** | Done |
|
|
||||||
|
|
||||||
### 2.2 Role taxonomy (per user directive)
|
|
||||||
|
|
||||||
| Role | Hosts | Workload |
|
|
||||||
|------|-------|----------|
|
|
||||||
| **Infrastructure + k8s control** | tsys1, tsys9 | Infra VMs (netinfra, UCS, PBS, CA, HA) + pfv-k8s cnodes (control plane) + small wnodes |
|
|
||||||
| **Kubernetes workers** | tsys2, tsys3, tsys6, tsys7 | pfv-k8s wnodes (heavy workers) -- these hosts have the RAM (32-192 GB) for ETL/HPC |
|
|
||||||
| **Storage** | tsys4, tsys5 | NFS server + PBS backup target. tsys5 also runs sectestbed/preprod VMs |
|
|
||||||
|
|
||||||
**Design rationale:** cnodes (control plane) are lightweight (4 cores, 4 GB
|
|
||||||
RAM each) and are weighted toward tsys1/tsys9 to keep the heavy RAM/CPU hosts
|
|
||||||
(tsys6 with 128 GB, tsys7 with 192 GB) free for large worker nodes. wnodes
|
|
||||||
run one per hypervisor host across the fleet to maximize total cluster capacity.
|
|
||||||
|
|
||||||
pfv-k8s runs all R&D and RackRental (containerlab) workloads via Kubernetes.
|
|
||||||
Production (Gitea, RustFS, Redmine, websites) lives on a VPS in Reston, VA
|
|
||||||
running Cloudron -- not in this cluster.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. Storage Architecture
|
|
||||||
|
|
||||||
### 3.1 NFS exports from tsys4 (primary storage server)
|
|
||||||
|
|
||||||
| Export | Disk model | Type | Bus | Total | Used | Free | Use% |
|
|
||||||
|--------|-----------|------|-----|-------|------|------|------|
|
|
||||||
| D2 | WDC WD30EFRX Red | HDD (7200rpm) | SATA | 2.7 TB | 187 GB | **2.4 TB** | 8% |
|
|
||||||
| ~~D3~~ | ~~SK hynix SC300~~ | ~~SSD~~ | ~~USB~~ | — | — | — | **moving to tsys5 Friday** |
|
|
||||||
| D5 | Hitachi HDS72302 | HDD (7200rpm) | SATA | 1.8 TB | 236 GB | **1.5 TB** | 14% |
|
|
||||||
|
|
||||||
Non-exported disks on tsys4:
|
|
||||||
- sda (Hitachi 1.8T) at /mnt/albert -- not NFS shared, 1.7 TB free
|
|
||||||
- sdd (WDC 1T) -- **idle, unmounted, removable** (free up for other use)
|
|
||||||
- sdf (WDC 4.5T SMR) at /mnt/backup -- **PBS backup target**, 4.3 TB free
|
|
||||||
|
|
||||||
**D3 migration (Friday):** The SK hynix SC300 SSD is currently USB-attached on
|
|
||||||
tsys4 (via a "ThinkPad SSD" USB adapter). It is moving to a tsys5 SAS port,
|
|
||||||
eliminating the USB bottleneck. tsys4's 4 SATA ports are all occupied (sda/sdb
|
|
||||||
/sdc/sdd), so tsys5 is the better target. See section 3.2.
|
|
||||||
|
|
||||||
### 3.2 NFS exports from tsys5 (secondary storage -- becoming the fast-tier hub)
|
|
||||||
|
|
||||||
| Export | Disk model | Type | Bus | Total | Used | Free | Use% |
|
|
||||||
|--------|-----------|------|-----|-------|------|------|------|
|
|
||||||
| S1 | Seagate ST1000VN | HDD | SAS | 916 GB | 60 GB | 810 GB | 7% |
|
|
||||||
| S2 | Seagate ST1000VN | HDD | SAS | 916 GB | **6.9 GB** | **863 GB** | **1%** |
|
|
||||||
| S3 | Seagate ST1000VN | HDD | SAS | 916 GB | 7.0 GB | **863 GB** | **1%** |
|
|
||||||
| S4 | Toshiba DT01ACA050 | HDD | SAS | 458 GB | 2 MB | **435 GB** | **0%** |
|
|
||||||
| T5-SSD | Samsung 860 PRO | **SSD** | SAS | 234 GB | **122 GB** | **101 GB** | **55%** |
|
|
||||||
| **D3** (Friday) | SK hynix SC300 | **SSD** | **SAS** | **469 GB** | **2 MB** | **445 GB** | **0%** |
|
|
||||||
|
|
||||||
**tsys5 storage controllers (plenty of free ports):**
|
|
||||||
- LSI SAS1068E (SAS 6/iR): 8 ports, 3 used (Samsung SSD, Hitachi, Seagate),
|
|
||||||
**5 free**
|
|
||||||
- Intel ICH10 SATA #1 (4-port): 2 used (Seagate S3, Toshiba S4), **2 free**
|
|
||||||
- Intel ICH10 SATA #2 (2-port): **status unknown, likely free**
|
|
||||||
- 2x Renesas USB 3.0 xHCI controllers (real USB 3.0, unlike tsys6/7)
|
|
||||||
|
|
||||||
**Key finding: S2 and S3 now have k8s node disks.** S2 holds cnode5 +
|
|
||||||
wnode-tsys1 + wnode-tsys9 (6.9 GB used). S3 has wnode-tsys9's old disk
|
|
||||||
(unused, 7 GB). S4 still 99% empty (435 GB free).
|
|
||||||
|
|
||||||
T5-SSD grew to 55% used (122 GB) -- ultix-streaming is the primary consumer.
|
|
||||||
|
|
||||||
**Friday additions:**
|
|
||||||
1. **D3 (SK hynix SSD)** moves from tsys4 USB to tsys5 SAS port. Eliminates
|
|
||||||
USB 2.0 bottleneck. Becomes the second SSD-tier NFS export.
|
|
||||||
2. **PCI NVMe drive** (local-only, not NFS-exported). Used for wnode-tsys5
|
|
||||||
boot disk and HPC scratch. The fastest tier in the fleet.
|
|
||||||
|
|
||||||
After Friday, **tsys5 consolidates all fast storage**: NVMe (local) + 2 SSD
|
|
||||||
NFS exports (D3 + T5-SSD) + 4 HDD NFS exports (S1-S4). This makes tsys5 the
|
|
||||||
natural home for latency-sensitive workloads and the k8s StorageClass design
|
|
||||||
center.
|
|
||||||
|
|
||||||
### 3.3 Local storage tiers (per host, with utilization)
|
|
||||||
|
|
||||||
| Host | Storage ID | Disk type | Bus | Total | Used | Free | Used by VMs? |
|
|
||||||
|------|-----------|-----------|-----|-------|------|------|-------------|
|
|
||||||
| tsys1 | local-lvm | HDD | SATA | ~90 GB | low | ~90 GB | No (all VMs on NFS) |
|
|
||||||
| **tsys3** | **local-lvm** | **NVMe (Samsung PM961)** | **NVMe** | **349 GB** | **0 GB** | **349 GB** | **No (all VMs on NFS)** |
|
|
||||||
| tsys4 | local-lvm | HDD | SATA | ~94 GB | PBS VM | ~62 GB | Yes (PBS VM 400) |
|
|
||||||
| tsys5 | local-lvm | HDD (Hitachi 1.8T) | SATA | 1.7 TB | 40 MB | **1.7 TB** | No |
|
|
||||||
| tsys5 | local-nonprod | HDD (Seagate 1T, =S1) | SATA | 916 GB | 53 GB | **856 GB** | Yes (sectestbed suite) |
|
|
||||||
| **tsys6** | **local-lvm** | **HDD (WD My Passport)** | **USB 2.0** | **1.7 TB** | **0 GB** | **1.7 TB** | **No -- DO NOT USE for VM storage** |
|
|
||||||
| **tsys7** | **local-lvm** | **HDD (WD portable)** | **USB 2.0** | **1.7 TB** | **0 GB** | **1.7 TB** | **No -- DO NOT USE for VM storage** |
|
|
||||||
| **tsys9** | **local-lvm** | **SSD (PNY CS900)** | **SATA** | **136 GB** | **0 GB** | **136 GB** | **No (all VMs on NFS)** |
|
|
||||||
| **tsys2** | **NVMe** (Samsung 960 PRO) | **NVMe** | **NVMe** | **512 GB** | (Win10) | **512 GB** | **Incoming -- fastest boot tier after tsys5 NVMe** |
|
|
||||||
| **tsys2** | **SATA SSD** (Samsung 850 EVO) | **SSD** | **SATA** | **1 TB** | (Win10) | **1 TB** | **Incoming -- bulk data on SSD, not rust** |
|
|
||||||
|
|
||||||
**CRITICAL WARNING: tsys6 and tsys7 local-lvm is USB 2.0 portable HDD.**
|
|
||||||
|
|
||||||
The entire Proxmox OS, swap, and local-lvm on both R610 and R620 run on a
|
|
||||||
single **USB 2.0-attached WD My Passport portable HDD** (tsys6: "My Passport
|
|
||||||
260D"; tsys7: "Drive 2657"). Both servers' only USB controllers are EHCI
|
|
||||||
(USB 2.0, ~480 Mbps). There is **no USB 3.0/xHCI** on either host.
|
|
||||||
|
|
||||||
**USB 2.0 practical throughput is ~30-35 MB/s.** This is 3-4x SLOWER than
|
|
||||||
NFS-over-HDD (~80-120 MB/s). Moving wnode boot disks to local-lvm on these
|
|
||||||
hosts would **decrease** performance. local-lvm on tsys6/7 must NOT be used
|
|
||||||
for VM storage.
|
|
||||||
|
|
||||||
Additionally, both servers have completely empty internal drive bays:
|
|
||||||
- **tsys6**: SAS controller present but **DISABLED** in BIOS. No internal
|
|
||||||
drives.
|
|
||||||
- **tsys7**: 6-port SATA AHCI controller present, **5 ports EMPTY** (only
|
|
||||||
DVD-ROM on port 5). No internal drives.
|
|
||||||
|
|
||||||
This is a reliability risk beyond performance: the entire host OS boots
|
|
||||||
from a consumer-grade portable USB drive not designed for 24/7 server use.
|
|
||||||
|
|
||||||
**tsys3 correction:** Previously documented as HDD. Actually boots from a
|
|
||||||
**Samsung PM961 NVMe 512GB SSD** -- the fastest existing local storage in the
|
|
||||||
fleet. Its 349 GB of local-lvm is excellent for wnode boot disk use.
|
|
||||||
|
|
||||||
**Critical observation: every k8s host has 0% used local-lvm.** tsys3
|
|
||||||
(Samsung PM961 **NVMe**, 349 GB), tsys6 (WD My Passport **USB 2.0** HDD,
|
|
||||||
1.7 TB), tsys7 (WD portable **USB 2.0** HDD, 1.7 TB) all have unused local
|
|
||||||
storage.
|
|
||||||
|
|
||||||
**However, only tsys3's local-lvm is suitable for VM storage.** tsys6 and
|
|
||||||
tsys7 local-lvm is USB 2.0 portable HDD (~30-35 MB/s) -- slower than
|
|
||||||
NFS-over-HDD and unsuitable for wnode boot disks.
|
|
||||||
|
|
||||||
### 3.4 Disk speed tiers summary
|
|
||||||
|
|
||||||
| Tier | Where | Speed class | Best for |
|
|
||||||
|------|-------|------------|----------|
|
|
||||||
| **NVMe** | tsys3 (Samsung PM961), tsys5 (Friday addition), **tsys2 (Samsung 960 PRO 512GB)** | 2000-3500 MB/s | HPC scratch, ETL staging, container runtime, wnode boot, etcd |
|
|
||||||
| **Local SSD** | tsys9 (PNY CS900, 136 GB), **tsys2 (Samsung 850 EVO 1TB)** | 500 MB/s | wnode boot disk, etcd |
|
|
||||||
| **NFS-SSD** | tsys5 D3 (SK hynix, **SAS post-Friday**), tsys5 T5-SSD (Samsung) | 200-400 MB/s over NFS | **k8s worker scratch only** (etcd, container cache, ephemeral volumes) |
|
|
||||||
| **NFS-HDD** | tsys4 D2/D5, tsys5 S1-S4 | 80-120 MB/s over NFS | Bulk data, large disks, non-critical VMs, **wnode boot on tsys6/7** |
|
|
||||||
| **Local SATA HDD** | tsys1 local-lvm | 100-150 MB/s | Host OS only |
|
|
||||||
| **USB 2.0 HDD** | tsys6/7 local-lvm (WD My Passport) | **~30-35 MB/s** | **NOTHING -- slower than NFS, do not use for VMs** |
|
|
||||||
|
|
||||||
### 3.5 Storage tier characterization per host
|
|
||||||
|
|
||||||
| Host | Storage profile | Detail |
|
|
||||||
|------|----------------|--------|
|
|
||||||
| **tsys2** | **SSD/NVMe only** | 960 PRO NVMe 512GB + 850 EVO SATA SSD 1TB. No spinning disk. |
|
|
||||||
| **tsys3** | **NVMe only** | Samsung PM961 NVMe 512GB. No spinning disk. |
|
|
||||||
| **tsys5** | **Hybrid** (fast-tier hub) | NVMe (local, Friday) + D3 SSD + T5-SSD + S1-S4 HDD |
|
|
||||||
| **tsys4** | **Bulk/spinning disk only** | D2 HDD 3TB + D5 HDD 2TB. D3 SSD leaving Friday. PBS target on SMR HDD. |
|
|
||||||
| **tsys9** | **Local SSD + NFS** | PNY CS900 SSD 136GB local + NFS client |
|
|
||||||
| **tsys1** | **Local HDD + NFS** | Small local-lvm + NFS client |
|
|
||||||
| **tsys6/7** | **NFS only** | local-lvm is USB 2.0 HDD (unusable for VMs). All VMs on NFS. |
|
|
||||||
|
|
||||||
### 3.6 All exports are single-disk with no redundancy
|
|
||||||
|
|
||||||
Every NFS export is a single physical disk formatted ext4. No RAID, no ZFS
|
|
||||||
mirror, no mdraid. A single disk failure takes down every VM whose disk lives
|
|
||||||
on that export. This applies to **both storage servers** and to the **PBS
|
|
||||||
backup target** (a single 4.5T SMR drive).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. VM Fleet Inventory
|
|
||||||
|
|
||||||
### 4.1 Complete VM roster (running VMs only, 40 VMs across 7 hosts)
|
|
||||||
|
|
||||||
#### tsys1 (Infrastructure) -- 11 running VMs
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 100 | pfv-bms (HomeAssistant) | 2 | 4096 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 101 | tsys-ca | 2 | 2048 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 103 | **pfv-netinfra-01** | 2 | 2048 | 32 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
| 104 | tsys-librenms | 2 | 2048 | 50 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 105 | tsys-proxmox-datacenter | 2 | 2048 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 106 | **pfv-k8s-cnode3** | 2 | 4096 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 107 | **pfv-k8s-cnode1** | 2 | 4096 | 32 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
| 108 | **tsys-ucs-01** | 2x2 | 8000 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 109 | tailscale-router | 2 | 2048 | 25 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 114 | kali-tsys | 2 | 2048 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 117 | tsys-secure-workbench | 2 | 4000 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
|
|
||||||
#### tsys3 (Kubernetes) -- 1 running VM
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 313 | **pfv-k8s-wnode-tsys3** | 4x2 | 20000 | 32 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
|
|
||||||
#### tsys4 (Storage) -- 1 running VM
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 400 | pfv-proxmox-backup-server | 2 | 2048 | 32 GB | local-lvm | LOCAL |
|
|
||||||
|
|
||||||
#### tsys5 (Storage) -- 15 running VMs
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 509 | **pfv-k8s-wnode-tsys5** | 2x4 | 32000 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 5101 | sectestbed-siem | 2x2 | 10000 | 132 GB | local-nonprod | LOCAL |
|
|
||||||
| 5105 | sectestbed-awx | 2x2 | 4096 | 288 GB | local-nonprod | LOCAL |
|
|
||||||
| 5106 | sectestbed-k8s-cnode | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 5107 | sectestbed-k8s-wnode | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 5108 | sectestbed-librenms | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 5109 | sectestbed-netinfra | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 5111 | ultix-streaming | 2x2 | 9000 | 288 GB | T5-SSD (tsys5 SSD) | NFS-SSD |
|
|
||||||
| 5112 | ultix-offstage | 2x2 | 6000 | 288 GB | local-lvm | LOCAL |
|
|
||||||
| 6000 | sectestbed-sandbox | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 51010 | sectestbed-tctc | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 51011 | sectestbed-cloudron | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 51012 | sectestbed-hfnoc | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 51013 | sectestbed-rancherplatform | 2x2 | 4096 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 53100 | tsys-preprod-awx | 2x2 | 9000 | 160 GB | local-nonprod | LOCAL |
|
|
||||||
| 53101 | tsys-preprod-siem | 2x2 | 12000 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
| 53102 | tsys-preprod-rancherplatform | 2x2 | 8000 | 32 GB | local-nonprod | LOCAL |
|
|
||||||
|
|
||||||
#### tsys6 (Kubernetes) -- 3 running VMs (1 wnode stopped)
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 100 | pfv-k8s-wnode-tsys6 | 2x2 | 32000 | 32 GB | D5 (tsys4 HDD) | NFS -- **STOPPED** |
|
|
||||||
| 600 | tsys-awx | 2x2 | 12000 | 32 GB | D2 (tsys4 HDD) | NFS -- **STOPPED** |
|
|
||||||
| 601 | **pfv-k8s-cnode4** | 4 | 4096 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 602 | **pfv-k8s-cnode5** | 4 | 4096 | 32 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
| 603 | **pfv-k8s-cnode2** | 4 | 4096 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
|
|
||||||
#### tsys7 (Kubernetes) -- 4 running VMs
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 701 | **pfv-k8s-wnode-tsys7** | 4 | 32000 | 32 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
| 702 | hfnoc-uisp | 2x2 | 8000 | 100 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 703 | rr-middleware | 2 | 2048 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 704 | TCTC | 4 | 6000 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
|
|
||||||
#### tsys9 (Infrastructure) -- 5 running VMs
|
|
||||||
|
|
||||||
| VMID | Name | Cores | RAM (MB) | Disk | Storage | Tier |
|
|
||||||
|------|------|-------|----------|------|---------|------|
|
|
||||||
| 901 | tsys-siem | 2 | 8000 | 132 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 902 | **tsys-ucs-02** | 2x2 | 8000 | 50 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
| 903 | kali-rd | 2 | 2048 | 32 GB | D5 (tsys4 HDD) | NFS |
|
|
||||||
| 904 | **pfv-netinfra-02** | 2 | 4000 | 32 GB | D2 (tsys4 HDD) | NFS |
|
|
||||||
| 905 | **pfv-k8s-wnode-tsys9** | 4 | 4096 | 32 GB | S3 (tsys5 HDD) | NFS |
|
|
||||||
|
|
||||||
### 4.2 Storage concentration summary
|
|
||||||
|
|
||||||
| Storage target | # of running VMs | % of fleet |
|
|
||||||
|---------------|-----------------|------------|
|
|
||||||
| **D2 (tsys4 WDC Red 3TB HDD)** | **18** | **45%** |
|
|
||||||
| D5 (tsys4 Hitachi 2TB HDD) | 9 | 23% |
|
|
||||||
| local-nonprod (tsys5 local HDD) | 10 | 25% |
|
|
||||||
| S3 (tsys5 Seagate 1TB HDD) | 1 | 3% |
|
|
||||||
| T5-SSD (tsys5 Samsung SSD) | 1 | 3% |
|
|
||||||
| local-lvm (tsys4 local) | 1 | 3% |
|
|
||||||
|
|
||||||
**27 of 40 running VMs (68%) store their disks on tsys4 NFS exports.**
|
|
||||||
If tsys4 goes offline, two-thirds of the fleet loses its storage.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 5. Kubernetes Node Distribution (re-audited 21:50 CDT)
|
|
||||||
|
|
||||||
### 5.1 pfv-k8s cnode (control plane) placement -- CURRENT
|
|
||||||
|
|
||||||
| VMID | Name | Hypervisor | Storage | NFS Server | Changed? |
|
|
||||||
|------|------|------------|---------|-----------|----------|
|
|
||||||
| 906 | cnode1 | **tsys9** | D5 | tsys4 | **MOVED from tsys1** |
|
|
||||||
| 705 | cnode2 | **tsys7** | D2 | tsys4 | **MOVED from tsys6** |
|
|
||||||
| 106 | cnode3 | tsys1 | D2 | tsys4 | no change |
|
|
||||||
| 601 | cnode4 | tsys6 | D2 | tsys4 | no change |
|
|
||||||
| 706 | cnode5 | **tsys7** | **S2** | **tsys5** | **MOVED from tsys6, storage moved D5→S2** |
|
|
||||||
|
|
||||||
**Storage distribution:**
|
|
||||||
|
|
||||||
| Storage server | cnodes | Quorum impact if it fails |
|
|
||||||
|---------------|--------|--------------------------|
|
|
||||||
| tsys4 (D2+D5) | **4** (cnode1,2,3,4) | Only cnode5 survives = **QUORUM LOST** |
|
|
||||||
| tsys5 (S2) | **1** (cnode5) | 4 survive = quorum OK |
|
|
||||||
|
|
||||||
**Progress:** cnode5 is now on tsys5 (was all 5 on tsys4). But 4-of-5 on tsys4
|
|
||||||
still means a tsys4 failure loses quorum. **Need 2 more cnodes on tsys5.**
|
|
||||||
|
|
||||||
**Host distribution:** cnodes spread across 4 hosts (tsys1, tsys6, tsys7,
|
|
||||||
tsys9) -- good host diversity.
|
|
||||||
|
|
||||||
### 5.2 pfv-k8s wnode (worker) placement -- CURRENT
|
|
||||||
|
|
||||||
| VMID | Name | Hypervisor | Storage | NFS Server | RAM | Status | Changed? |
|
|
||||||
|------|------|------------|---------|-----------|-----|--------|----------|
|
|
||||||
| 102 | wnode-tsys1 | tsys1 | S2 | tsys5 | 4 GB | **STOPPED** | **NEW** |
|
|
||||||
| 313 | wnode-tsys3 | tsys3 | D5 | tsys4 | **28 GB** | running | **RAM bumped 20→28** |
|
|
||||||
| 509 | wnode-tsys5 | tsys5 | D2 | tsys4 | 32 GB | running | no change |
|
|
||||||
| 100 | wnode-tsys6 | tsys6 | D5 | tsys4 | 32 GB | running | **NOW RUNNING** |
|
|
||||||
| 701 | wnode-tsys7 | tsys7 | D5 | tsys4 | 32 GB | running | no change |
|
|
||||||
| 905 | wnode-tsys9 | tsys9 | **S2** | tsys5 | 4 GB | running | **Storage moved S3→S2** |
|
|
||||||
|
|
||||||
**One wnode per host achieved** (tsys1,3,5,6,7,9). wnode-tsys1 is created but
|
|
||||||
stopped. wnode-tsys6 restarted.
|
|
||||||
|
|
||||||
**Storage distribution:**
|
|
||||||
|
|
||||||
| Storage server | wnodes | Notes |
|
|
||||||
|---------------|--------|-------|
|
|
||||||
| tsys4 (D2+D5) | 4 (tsys3,5,6,7) | Still concentrated |
|
|
||||||
| tsys5 (S2) | 2 (tsys1,tsys9) | Improving |
|
|
||||||
|
|
||||||
### 5.3 Summary: k8s node storage distribution
|
|
||||||
|
|
||||||
| Storage server | cnodes | wnodes | Total k8s nodes |
|
|
||||||
|---------------|--------|--------|-----------------|
|
|
||||||
| **tsys4 NFS** | **4 (80%)** | **4 (67%)** | **8 (73%)** |
|
|
||||||
| **tsys5 NFS** | **1 (20%)** | **2 (33%)** | **3 (27%)** |
|
|
||||||
| Local SSD/NVMe | 0 | 0 | 0 (0%) |
|
|
||||||
|
|
||||||
**Was 90%/10%. Now 73%/27%.** Improving but still tsys4-heavy. Target: 3
|
|
||||||
cnodes on each storage server (60/40 or better) so either server failing
|
|
||||||
leaves quorum intact.
|
|
||||||
|
|
||||||
### 5.4 Remaining cnode migration needed for etcd quorum survival
|
|
||||||
|
|
||||||
To survive a tsys4 failure with quorum (3 of 5 alive), at least 3 cnodes must
|
|
||||||
be on tsys5:
|
|
||||||
|
|
||||||
| Action | Effect |
|
|
||||||
|--------|--------|
|
|
||||||
| Move cnode3 (D2→S3 on tsys5) | 3 cnodes on tsys5, 2 on tsys4. tsys4 fail = 3 survive |
|
|
||||||
| Move cnode4 (D2→S2 on tsys5) | Same result, different disk |
|
|
||||||
| Leave cnode1 and one other on tsys4 | tsys5 fail = 4 survive (OK) |
|
|
||||||
|
|
||||||
**Simplest path:** migrate cnode3 and cnode4 storage to tsys5 (S3 and S2) via
|
|
||||||
PDM. Then tsys4 failure leaves cnode5 + cnode3 + cnode4 = 3 of 5 = quorum OK.
|
|
||||||
|
|
||||||
### 5.5 Future k8s architecture (next session -- see K8S.md)
|
|
||||||
|
|
||||||
The k8s layer will be tackled soon. Key requirements from user:
|
|
||||||
|
|
||||||
- **Platform:** vcluster + Rancher for multi-tenant management
|
|
||||||
- **Auth:** OIDC to Keycloak (running on Cloudron in Reston, VA production)
|
|
||||||
- **Workload isolation (vcluster per tenant):**
|
|
||||||
- RackRental workloads (containerlab network labs)
|
|
||||||
- Suborbital ITAR (compliance-restricted)
|
|
||||||
- Suborbital non-ITAR
|
|
||||||
- Starting Line Productions customer workloads
|
|
||||||
- **Solar-aware scale-out:** PowerEdge 19xx and 2950 systems (older hardware)
|
|
||||||
will be brought online during peak solar production for burst capacity.
|
|
||||||
These older cores/ram supplement the main fleet when power is abundant.
|
|
||||||
- **WNode sizing:** every Proxmox node will have a wnode. Some nodes will host
|
|
||||||
both cnodes + wnodes. Worker sizes will vary from small (4 GB, fitting into
|
|
||||||
leftover host capacity) to large (28-32 GB, consuming most of a host).
|
|
||||||
- **Friday final audit:** tsys2 will be loaded with Proxmox on Friday, and a
|
|
||||||
full final audit will be performed at that time (post-NVMe install on tsys5,
|
|
||||||
post-D3 SSD relocation, post-tsys4 NIC+RAM).
|
|
||||||
|
|
||||||
### 5.4 sectestbed k8s nodes (separate from pfv-k8s)
|
|
||||||
|
|
||||||
tsys5 also hosts a separate sectestbed kubernetes stack using local storage:
|
|
||||||
|
|
||||||
| VMID | Name | Storage |
|
|
||||||
|------|------|---------|
|
|
||||||
| 5106 | sectestbed-k8s-cnode | local-nonprod (local HDD) |
|
|
||||||
| 5107 | sectestbed-k8s-wnode | local-nonprod (local HDD) |
|
|
||||||
|
|
||||||
These are on local storage (good -- no NFS dependency) but on a single host's
|
|
||||||
single local disk (no redundancy). They are isolated from the pfv-k8s cluster.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6. Storage Redundancy Analysis
|
|
||||||
|
|
||||||
### 6.1 -01/-02 infrastructure pair audit
|
|
||||||
|
|
||||||
Two -01/-02 pairs exist in the fleet:
|
|
||||||
|
|
||||||
**Pair 1: pfv-netinfra (network infrastructure)**
|
|
||||||
|
|
||||||
| Role | VMID | Host | Storage | NFS Server |
|
|
||||||
|------|------|------|---------|-----------|
|
|
||||||
| -01 | 103 | tsys1 | D5 | **tsys4** |
|
|
||||||
| -02 | 904 | tsys9 | D2 | **tsys4** |
|
|
||||||
|
|
||||||
**Verdict: HOST redundancy OK (different hosts), STORAGE redundancy FAILED.**
|
|
||||||
Both halves depend on tsys4. If tsys4 goes down, both netinfra VMs lose their
|
|
||||||
disks. The -02 half should be on an S2/S3/S4 export from tsys5.
|
|
||||||
|
|
||||||
**Pair 2: tsys-ucs (Univention Corporate Server)**
|
|
||||||
|
|
||||||
| Role | VMID | Host | Storage | NFS Server |
|
|
||||||
|------|------|------|---------|-----------|
|
|
||||||
| -01 | 108 | tsys1 | D2 | **tsys4** |
|
|
||||||
| -02 | 902 | tsys9 | D5 | **tsys4** |
|
|
||||||
|
|
||||||
**Verdict: HOST redundancy OK (different hosts), STORAGE redundancy FAILED.**
|
|
||||||
Same issue. Both halves on tsys4. The -02 half should be on tsys5 storage.
|
|
||||||
|
|
||||||
### 6.2 Redundancy principle for paired VMs
|
|
||||||
|
|
||||||
For any -01/-02 pair to survive a single storage server failure:
|
|
||||||
|
|
||||||
```
|
|
||||||
-01 VM disk -> tsys4 NFS export (D2/D3/D5)
|
|
||||||
-02 VM disk -> tsys5 NFS export (S2/S3/S4/T5-SSD)
|
|
||||||
```
|
|
||||||
|
|
||||||
This ensures that losing either tsys4 or tsys5 takes down only one half of
|
|
||||||
the pair. Currently, **both pairs fail this test** because both halves are on
|
|
||||||
tsys4.
|
|
||||||
|
|
||||||
### 6.3 NFS server failure blast radius
|
|
||||||
|
|
||||||
If **tsys4** goes offline (USB NIC failure, disk failure, reboot):
|
|
||||||
|
|
||||||
| Impact | Count |
|
|
||||||
|--------|-------|
|
|
||||||
| k8s cnodes that lose storage | 5 of 5 (**etcd quorum lost**) |
|
|
||||||
| k8s wnodes that lose storage | 4 of 5 |
|
|
||||||
| Infrastructure VMs that lose storage | 11 of 12 on tsys1 (all on D2/D5) |
|
|
||||||
| Total VMs that lose storage | **27 of 40 (68%)** |
|
|
||||||
|
|
||||||
If **tsys5** goes offline:
|
|
||||||
|
|
||||||
| Impact | Count |
|
|
||||||
|--------|-------|
|
|
||||||
| k8s cnodes that lose storage | 0 of 5 |
|
|
||||||
| k8s wnodes that lose storage | 1 of 5 |
|
|
||||||
| Total VMs that lose storage | 1 of 40 (3%) |
|
|
||||||
|
|
||||||
**tsys4 is a massive blast-radius liability. tsys5 is barely used.**
|
|
||||||
Rebalancing VM storage across both servers dramatically reduces risk.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 7. Local SSD/NVMe Opportunity
|
|
||||||
|
|
||||||
### 7.1 Available fast tiers (currently unused by k8s)
|
|
||||||
|
|
||||||
| Host | Device | Type | Size | Available for VMs? | Currently used by k8s? |
|
|
||||||
|------|--------|------|------|--------------------|-----------------------|
|
|
||||||
| tsys4 | D3 (SK hynix SC300, USB) | SSD | 512 GB | Yes (via NFS) | **No** |
|
|
||||||
| tsys5 | T5-SSD (Samsung 860 PRO) | SSD | 256 GB | Yes (via NFS) | **No** (used by ultix-streaming) |
|
|
||||||
| tsys5 | **New NVMe (Friday)** | **NVMe** | TBD | **Yes (local or NFS)** | **No** |
|
|
||||||
| tsys9 | local-lvm (PNY CS900) | SSD | 137 GB free | Yes (local) | **No** |
|
|
||||||
|
|
||||||
### 7.2 Why local storage matters for k8s nodes
|
|
||||||
|
|
||||||
Kubernetes nodes are latency-sensitive in two specific areas:
|
|
||||||
|
|
||||||
1. **etcd (control plane):** etcd writes are synchronous and latency-critical.
|
|
||||||
On NFS over HDD, every etcd write traverses: VM -> virtio-scsi -> NFS
|
|
||||||
client -> TCP -> USB dongle (on tsys4) -> ext4 -> spinning disk. Typical
|
|
||||||
latency: 2-10 ms per write. On local SSD: 0.1-0.5 ms. On NVMe: 0.02-0.1 ms.
|
|
||||||
This directly affects k8s API responsiveness and pod scheduling speed.
|
|
||||||
|
|
||||||
2. **Container image pulls:** Worker nodes pull container images frequently.
|
|
||||||
On NFS-over-HDD, image layer extraction is seek-bound and slow. Local SSD
|
|
||||||
eliminates the network hop and reduces seek time. This matters most for
|
|
||||||
RackRental/containerlab workloads that spin up containers rapidly.
|
|
||||||
|
|
||||||
### 7.3 Current waste: tsys9 local SSD
|
|
||||||
|
|
||||||
tsys9 has a 250 GB PNY CS900 SSD with 137 GB of LVM-thin space available.
|
|
||||||
**Zero VMs use it.** All 5 VMs on tsys9 boot from NFS. The local SSD sits
|
|
||||||
idle. wnode-tsys9 (VM 905) would benefit significantly from local SSD --
|
|
||||||
its disk is currently on S3 (tsys5 NFS over a Seagate HDD).
|
|
||||||
|
|
||||||
### 7.4 Upcoming opportunity: tsys5 NVMe (Friday)
|
|
||||||
|
|
||||||
The PCI NVMe being added to tsys5 will be the fastest storage tier in the
|
|
||||||
fleet. Two placement options:
|
|
||||||
|
|
||||||
**Option A: NFS-export the NVMe (shared).** All hosts can use it. Good for
|
|
||||||
VMs that might need migration. Adds the NFS/network overhead back.
|
|
||||||
|
|
||||||
**Option B: Local-only on tsys5.** VMs on tsys5 get full NVMe speed with no
|
|
||||||
network overhead. Best for k8s wnode-tsys5 and sectestbed VMs. Cannot be
|
|
||||||
accessed from other hosts.
|
|
||||||
|
|
||||||
**Recommendation:** Option B (local-only). k8s worker nodes do not need
|
|
||||||
shared storage -- pods are ephemeral and reschedule on failure. The NVMe
|
|
||||||
should be formatted as a Proxmox directory storage (or LVM-thin) on tsys5
|
|
||||||
and used for local VM images.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 8. Role Alignment Audit
|
|
||||||
|
|
||||||
Per the user's intended role taxonomy: tsys1/9 = infrastructure + k8s control
|
|
||||||
plane; tsys2/3/6/7 = k8s workers; tsys4/5 = storage. Cnodes on tsys1/9 is
|
|
||||||
**correct by design** (keeps heavy hosts free for workers).
|
|
||||||
|
|
||||||
### 8.1 VMs that need to move
|
|
||||||
|
|
||||||
| VMID | Name | Current host | Issue | Target |
|
|
||||||
|------|------|-------------|-------|--------|
|
|
||||||
| 509 | pfv-k8s-wnode-tsys5 | tsys5 (storage) | Worker on storage host | tsys7 or tsys2 (when online) |
|
|
||||||
| 905 | pfv-k8s-wnode-tsys9 | tsys9 (infra) | Can stay if small; user decides | tsys9 OK if small wnode |
|
|
||||||
|
|
||||||
### 8.2 Host capacity for k8s nodes
|
|
||||||
|
|
||||||
| Host | Role | Current k8s nodes | k8s RAM used | RAM total | Headroom |
|
|
||||||
|------|------|-------------------|-------------|-----------|----------|
|
|
||||||
| tsys1 | Infra+k8s ctrl | 2 cnodes | 8 GB | 32 GB | ~12 GB (after 11 infra VMs) |
|
|
||||||
| tsys3 | K8s worker | 1 wnode | 20 GB | 32 GB | ~12 GB |
|
|
||||||
| tsys6 | K8s worker | 3 cnodes + 1 wnode (stopped) | 12 GB | 128 GB | **~116 GB** |
|
|
||||||
| tsys7 | K8s worker | 1 wnode | 32 GB | 192 GB | **~160 GB** |
|
|
||||||
| tsys9 | Infra+k8s ctrl | 1 wnode | 4 GB | 24 GB | ~12 GB (after 4 infra VMs) |
|
|
||||||
| tsys2 | K8s worker | 0 (incoming) | 0 | 32 GB | ~32 GB |
|
|
||||||
|
|
||||||
**tsys6 and tsys7 are dramatically underutilized** -- 116 GB and 160 GB of
|
|
||||||
free RAM respectively. They should be the primary targets for heavy worker
|
|
||||||
nodes and ETL/HPC workloads.
|
|
||||||
|
|
||||||
### 8.3 tsys6 wnode-tsys6 is stopped
|
|
||||||
|
|
||||||
VM 100 (pfv-k8s-wnode-tsys6) is stopped on tsys6. Its disk is on D5 (tsys4
|
|
||||||
NFS). This wnode should be restarted (or recreated on local-lvm) to restore
|
|
||||||
cluster capacity.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 9. Network Findings
|
|
||||||
|
|
||||||
### 9.1 tsys9 storage NIC is a USB dongle (new finding)
|
|
||||||
|
|
||||||
Validating tsys9 revealed that its storage network interface
|
|
||||||
(`enx9c69d36a5b6c`) is USB-attached (`parentbus usb`). This is the same
|
|
||||||
anti-pattern as tsys4. The onboard Intel NIC (`enp0s31f6`) is used for
|
|
||||||
management; storage uses the USB adapter.
|
|
||||||
|
|
||||||
**Impact:** Same as tsys4 -- achieves line rate but is susceptible to cable
|
|
||||||
wobble, ESD, and USB controller resets. For an infrastructure host with 5
|
|
||||||
VMs, this is a reliability risk.
|
|
||||||
|
|
||||||
**Mitigation:** tsys9 is an OptiPlex 7080 SFF -- it has PCIe slots. A
|
|
||||||
PCIe NIC would eliminate this risk (same recommendation as tsys4).
|
|
||||||
|
|
||||||
### 9.2 tsys4 and tsys5 still blocked (Friday hardware work)
|
|
||||||
|
|
||||||
| Host | Blocker | Staged fix |
|
|
||||||
|------|---------|-----------|
|
|
||||||
| tsys4 | USB cdc_ncm storage NIC | PCIe NIC install + RAM upgrade (16 to 64 GB) |
|
|
||||||
| tsys5 | bond0 broken (1 of 2 slaves) | Plug 2nd ethernet cable + apply layer3+4 hash |
|
|
||||||
|
|
||||||
### 9.3 LACP resolved on tsys6/tsys7
|
|
||||||
|
|
||||||
tsys6 to tsys7 storage path now measures **1.83 Gbps** (was 943 Mbps).
|
|
||||||
The switch LACP hash change took effect after renegotiation. The 56-106K
|
|
||||||
retransmits on this path are confirmed to be non-lossy multi-flow TCP-over-
|
|
||||||
LACP overhead. See `RESULTS.md` for the full analysis.
|
|
||||||
|
|
||||||
### 9.4 NFS nconnect=4 + noatime confirmed active
|
|
||||||
|
|
||||||
All hosts (including tsys9) show `nconnect=4,noatime` in their NFS mount
|
|
||||||
options. Each host maintains 4 TCP connections per NFS mount to each storage
|
|
||||||
server. This was the Tier 0 tuning item from the performance optimization
|
|
||||||
engagement and is confirmed working cluster-wide.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 10. Recommendations
|
|
||||||
|
|
||||||
**No changes have been made. These are assessment-only recommendations.**
|
|
||||||
See `K8S.md` for the detailed kubernetes architecture deep-dive.
|
|
||||||
|
|
||||||
### 10.1 CRITICAL: Critical infrastructure VM placement (netinfra, UCS)
|
|
||||||
|
|
||||||
These are the most critical production VMs in the fleet. They must survive
|
|
||||||
any single-point failure (host, storage server, or disk).
|
|
||||||
|
|
||||||
**Design principle for -01/-02 HA pairs:**
|
|
||||||
- Different hypervisors (already satisfied: tsys1 vs tsys9)
|
|
||||||
- Different storage servers (currently FAILED: all on tsys4)
|
|
||||||
- Prefer SSD for latency-sensitive services
|
|
||||||
|
|
||||||
**Recommended placement:**
|
|
||||||
|
|
||||||
| VM | Host | Storage | Tier | Free space | Rationale |
|
|
||||||
|----|------|---------|------|-----------|-----------|
|
|
||||||
| **netinfra-01** (103) | tsys1 | **D5 (tsys4 HDD)** | NFS-HDD | 1.5 TB | DNS/DHCP/NTP = minimal I/O. Stays put. |
|
|
||||||
| **netinfra-02** (904) | tsys9 | **S3 (tsys5 HDD)** | NFS-HDD | 870 GB | Move from D2. Cross-server redundancy. Minimal I/O. |
|
|
||||||
| **ucs-01** (108) | tsys1 | **D2 (tsys4 HDD)** | NFS-HDD | 2.4 TB | Stays put. LDAP/AD does not need SSD. |
|
|
||||||
| **ucs-02** (902) | tsys9 | **S2 (tsys5 HDD)** | NFS-HDD | 870 GB | Move from D5. Cross-server redundancy. No SSD needed. |
|
|
||||||
|
|
||||||
**Failure survival matrix (all single-point failures):**
|
|
||||||
|
|
||||||
| Failure | netinfra-01 | netinfra-02 | ucs-01 | ucs-02 | Result |
|
|
||||||
|---------|-------------|-------------|--------|--------|--------|
|
|
||||||
| tsys4 dies | dies (D5) | **alive** (S3) | dies (D2) | **alive** (S2) | netinfra-02 + ucs-02 alive |
|
|
||||||
| tsys5 dies | **alive** (D5) | dies (S3) | **alive** (D2) | dies (S2) | netinfra-01 + ucs-01 alive |
|
|
||||||
| tsys1 dies | dies | **alive** | dies | **alive** | -02 pair survives |
|
|
||||||
| tsys9 dies | **alive** | dies | **alive** | dies | -01 pair survives |
|
|
||||||
| Any single disk | **all 4 on different disks/servers** | **all 4 alive** | | | |
|
|
||||||
|
|
||||||
**Why this works:** Every row has at least one netinfra and one UCS alive.
|
|
||||||
The network (DNS/DHCP) and directory (AD/LDAP) services never go fully dark.
|
|
||||||
|
|
||||||
**D3 SSD repurposed:** With UCS staying on HDD, the D3 SSD (moving to tsys5
|
|
||||||
Friday) is freed for latency-sensitive workloads that actually benefit from
|
|
||||||
SSD -- sectestbed k8s nodes, CI/CD artifact cache, or a container image
|
|
||||||
registry mirror. Not infrastructure VMs.
|
|
||||||
|
|
||||||
### 10.2 CRITICAL: Cnode (control plane) storage split
|
|
||||||
|
|
||||||
**Problem:** All 5 cnodes store disks on tsys4. D2 disk failure loses etcd
|
|
||||||
quorum (3 of 5 cnodes share D2).
|
|
||||||
|
|
||||||
**Target: cnodes weighted toward tsys1/tsys9 (lightweight hosts), freeing
|
|
||||||
tsys6/tsys7 for heavy workers. Storage splits across tsys4 and tsys5.**
|
|
||||||
|
|
||||||
| cnode | Current host | **Target host** | Current storage | **Target storage** | Rationale |
|
|
||||||
|-------|-------------|----------------|----------------|-------------------|-----------|
|
|
||||||
| cnode1 (107) | tsys1 | **tsys1** (stays) | D5 (tsys4) | **D5 (tsys4)** -- no change | Already correct |
|
|
||||||
| cnode3 (106) | tsys1 | **tsys1** (stays) | D2 (tsys4) | **S2 (tsys5)** -- **MOVE disk** | Split storage to tsys5 |
|
|
||||||
| cnode2 (603) | tsys6 | **tsys9** | D2 (tsys4) | **D2 (tsys4)** -- no disk change | Free tsys6 for heavy workers |
|
|
||||||
| cnode4 (601) | tsys6 | **tsys9** | D2 (tsys4) | **D5 (tsys4)** -- spread disk | Free tsys6; spread off D2 |
|
|
||||||
| cnode5 (602) | tsys6 | **tsys3** | D5 (tsys4) | **S3 (tsys5)** -- **MOVE disk** | Free tsys6; split storage to tsys5 |
|
|
||||||
|
|
||||||
**Result after changes:**
|
|
||||||
|
|
||||||
| Host | cnodes | Storage server |
|
|
||||||
|------|--------|---------------|
|
|
||||||
| tsys1 | cnode1 (D5), cnode3 (S2) | tsys4 + tsys5 |
|
|
||||||
| tsys9 | cnode2 (D2), cnode4 (D5) | tsys4 |
|
|
||||||
| tsys3 | cnode5 (S3) | tsys5 |
|
|
||||||
|
|
||||||
- 3 cnodes on tsys4 storage, 2 on tsys5. Either storage server can fail and
|
|
||||||
etcd keeps quorum (3 of 5 survive).
|
|
||||||
- D2 has 1 cnode (was 3). D5 has 2. S2 and S3 have 1 each. No single disk
|
|
||||||
holds more than 2 cnodes.
|
|
||||||
- Cnodes now on 3 hosts (tsys1, tsys9, tsys3). Any single host failure leaves
|
|
||||||
at least 3 cnodes alive.
|
|
||||||
- **tsys6 and tsys7 are fully freed** for heavy worker nodes.
|
|
||||||
|
|
||||||
Note: tsys1 RAM is tight (32 GB, 11 infra VMs). Adding 0 new cnodes (keeping
|
|
||||||
the 2 already there) is feasible with KSM. tsys9 (24 GB) has room for 2
|
|
||||||
cnodes (8 GB). tsys3 (32 GB) has room for 1 cnode (4 GB) alongside its wnode.
|
|
||||||
|
|
||||||
### 10.3 HIGH: Wnode distribution -- one per host, tiered storage
|
|
||||||
|
|
||||||
**Target: one wnode per hypervisor host, using local storage where possible
|
|
||||||
and NFS-HDD for bulk data.**
|
|
||||||
|
|
||||||
| wnode | Host | Boot disk (OS+containers) | Data disk (bulk/ETL) | Rationale |
|
|
||||||
|-------|------|--------------------------|---------------------|-----------|
|
|
||||||
| wnode-tsys1 | tsys1 | D5 (tsys4 NFS) | -- | Small wnode on infra host. Minimal capacity. |
|
|
||||||
| wnode-tsys3 | tsys3 | **local-lvm (349 GB NVMe)** | S3 (NFS) | Move from NFS to **NVMe** (Samsung PM961). Fastest boot disk after tsys5/2. |
|
|
||||||
| wnode-tsys6 | tsys6 | D2 (tsys4 NFS) | -- | **Stays on NFS.** local-lvm is USB 2.0 HDD (~30 MB/s) -- slower than NFS. |
|
|
||||||
| wnode-tsys7 | tsys7 | D5 (tsys4 NFS) | -- | **Stays on NFS.** local-lvm is USB 2.0 HDD (~30 MB/s) -- slower than NFS. |
|
|
||||||
| wnode-tsys9 | tsys9 | **local-lvm (136 GB SSD)** | S2 (NFS) | Move from NFS to local SSD. Fast boot, NFS for bulk. |
|
|
||||||
| wnode-tsys2 | tsys2 | **NVMe (Samsung 960 PRO 512GB)** | **SATA SSD (Samsung 850 EVO 1TB)** | **Best storage of any wnode.** No NFS needed -- 1.5 TB local SSD. |
|
|
||||||
| wnode-tsys5 | tsys5 | **new NVMe (local)** | local-nonprod (HDD) | **Fastest wnode in fleet.** HPC/ETL workloads land here. |
|
|
||||||
|
|
||||||
**Storage tiering strategy per wnode:**
|
|
||||||
|
|
||||||
Each wnode gets two disk tiers mapped to k8s StorageClasses:
|
|
||||||
|
|
||||||
1. **Boot + container runtime** (local-lvm or NVMe): OS, kubelet, container
|
|
||||||
images, ephemeral storage. This is where local SSD/NVMe shines -- container
|
|
||||||
image pulls and layer extraction are seek-bound and benefit enormously from
|
|
||||||
low-latency storage.
|
|
||||||
|
|
||||||
2. **Bulk data** (NFS-HDD via D2/D5/S2/S3): weather/GIS datasets, ETL staging
|
|
||||||
areas, large files that do not fit on local storage. Mounted as a second
|
|
||||||
disk in the VM and exposed to k8s as a StorageClass.
|
|
||||||
|
|
||||||
This maps to two k8s StorageClasses:
|
|
||||||
- `local-storage`: bound to the wnode's boot/local disk (fast, ephemeral)
|
|
||||||
- `nfs-bulk`: bound to NFS exports (slow, persistent, large capacity)
|
|
||||||
|
|
||||||
### 10.4 HIGH: Dedicate D3 SSD exclusively to k8s scratch
|
|
||||||
|
|
||||||
**Storage philosophy (user directive): NVMe/SSD is for k8s worker scratch
|
|
||||||
space and ultix-streaming (developer workstation running "cluster of 1"
|
|
||||||
pre-production jobs). Spinning rust hosts all other infrastructure VMs**
|
|
||||||
(UCS, netinfra, LibreNMS, SIEM, etc.).
|
|
||||||
|
|
||||||
SSD allocation after Friday:
|
|
||||||
- **D3 (tsys5 SAS, 445 GB free, 0% used)** -- dedicated to k8s scratch via
|
|
||||||
the `nfs-ssd` StorageClass (etcd, container cache, ephemeral volumes).
|
|
||||||
- **T5-SSD (tsys5 SAS, 140 GB free)** -- ultix-streaming (VM 5111) stays here
|
|
||||||
(developer workstation, runs single-node test jobs before k8s). Remaining
|
|
||||||
140 GB available for k8s.
|
|
||||||
|
|
||||||
**Deep-dive on exact k8s scratch allocation is deferred to the next session**
|
|
||||||
(K8S.md) once we know the k8s distribution, job scheduler, and workload mix.
|
|
||||||
|
|
||||||
### 10.5 MEDIUM: Restart wnode-tsys6
|
|
||||||
|
|
||||||
VM 100 (pfv-k8s-wnode-tsys6) is stopped on tsys6. Recreate on local-lvm
|
|
||||||
(1.7 TB free) instead of D5 NFS. This restores cluster capacity and moves
|
|
||||||
the boot disk to local storage simultaneously.
|
|
||||||
|
|
||||||
### 10.6 MEDIUM: tsys5 NVMe placement (Friday)
|
|
||||||
|
|
||||||
**Recommendation: local-only on tsys5, formatted as Proxmox LVM-thin or
|
|
||||||
directory storage.**
|
|
||||||
|
|
||||||
Use for:
|
|
||||||
- wnode-tsys5 boot disk (primary beneficiary -- HPC/ETL workloads)
|
|
||||||
- sectestbed VMs that need fast scratch space
|
|
||||||
- Not NFS-exported (avoid adding network overhead to the fastest tier)
|
|
||||||
|
|
||||||
### 10.7 LOW: Add PCIe NIC to tsys9
|
|
||||||
|
|
||||||
tsys9's storage NIC is a USB dongle. tsys9 is an OptiPlex 7080 with PCIe
|
|
||||||
slots. A $150 PCIe NIC eliminates the USB reliability risk.
|
|
||||||
|
|
||||||
### 10.8 LOW: Standardize PVE/kernel versions
|
|
||||||
|
|
||||||
tsys3 is on PVE kernel 7.0.14; others on 6.17.x. PVE-manager versions vary
|
|
||||||
(9.1.1 / 9.1.5 / 9.2.5). Standardize in a maintenance window.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 11. Hardware End-of-Support Exposure
|
|
||||||
|
|
||||||
| Host | EOS date | Years past | Form factor |
|
|
||||||
|------|----------|-----------|-------------|
|
|
||||||
| pfv-tsys6 (R610) | 2013-05 | 13.2 | 1U server |
|
|
||||||
| pfv-tsys5 (T7500) | 2014-12 | 11.7 | Workstation |
|
|
||||||
| pfv-tsys4 (T1700) | 2018-03 | 8.4 | Workstation |
|
|
||||||
| pfv-tsys7 (R620) | 2019-03 | 7.4 | 1U server |
|
|
||||||
| pfv-tsys1 (9020) | 2019-07 | 7.0 | SFF desktop |
|
|
||||||
| pfv-tsys3 (7510) | 2020-07 | 6.0 | Laptop |
|
|
||||||
| pfv-tsys2 (5520) | TBD | -- | Laptop |
|
|
||||||
| **pfv-tsys9 (7080)** | **2024-02** | **2.4** | **SFF desktop (only supported)** |
|
|
||||||
|
|
||||||
**6 of 8 hosts are past vendor end-of-support.** Only tsys9 is still covered.
|
|
||||||
The two actual rack servers (R610, R620) are the most overdue for replacement.
|
|
||||||
This belongs in the next budget cycle.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 12. Open Items
|
|
||||||
|
|
||||||
### 12.1 Immediate (do today via PDM)
|
|
||||||
|
|
||||||
1. **Migrate ucs-02** (VM 902) from D5 (tsys4) to S2 (tsys5) for cross-server
|
|
||||||
redundancy. UCS stays on HDD.
|
|
||||||
2. **Migrate netinfra-02** (VM 904) from D2 (tsys4) to S3 (tsys5).
|
|
||||||
3. **Migrate cnode3** (VM 106) from D2 (tsys4) to S3 (tsys5) -- etcd quorum.
|
|
||||||
4. **Migrate cnode4** (VM 601) from D2 (tsys4) to S2 (tsys5) -- etcd quorum.
|
|
||||||
5. **Start wnode-tsys1** (VM 102) if the cluster needs the capacity.
|
|
||||||
|
|
||||||
### 12.2 Friday maintenance window (user action)
|
|
||||||
|
|
||||||
1. **tsys4:** Install PCIe NIC (replace USB dongle), add RAM (16 to 64 GB),
|
|
||||||
reconfigure `/etc/network/interfaces`, reboot.
|
|
||||||
2. **tsys5:** Plug 2nd ethernet cable, verify bond0, apply layer3+4 hash,
|
|
||||||
install PCI NVMe, relocate D3 SSD from tsys4 USB to tsys5 SAS port,
|
|
||||||
format NVMe as local storage, reboot.
|
|
||||||
3. **tsys2:** Load Proxmox (replacing Windows 10).
|
|
||||||
4. **Final audit:** Re-run `deploy-check.sh` across all hosts including tsys2.
|
|
||||||
|
|
||||||
### 12.3 Post-Friday validation
|
|
||||||
|
|
||||||
1. Re-run iperf matrix: `./iperf-full-matrix.sh`
|
|
||||||
2. Validate tsys4 and tsys5: `./validate-fixes.sh pfv-tsys4 && ./validate-fixes.sh pfv-tsys5`
|
|
||||||
3. Run `scripts/check.sh` on tsys2 once Proxmox is loaded.
|
|
||||||
4. Update PROJECT.md with post-hardware numbers.
|
|
||||||
|
|
||||||
### 12.4 Future: Kubernetes deep-dive (see K8S.md)
|
|
||||||
|
|
||||||
Next major workstream. Requirements captured:
|
|
||||||
- **vcluster + Rancher** for multi-tenant k8s management
|
|
||||||
- **OIDC auth** to Keycloak (on Cloudron, Reston VA production)
|
|
||||||
- **Workload isolation** via separate vclusters:
|
|
||||||
- RackRental (containerlab)
|
|
||||||
- Suborbital ITAR
|
|
||||||
- Suborbital non-ITAR
|
|
||||||
- Starting Line Productions customer workloads
|
|
||||||
- **Solar-aware scale-out:** PowerEdge 19xx + 2950 systems brought online
|
|
||||||
during peak solar production for burst capacity
|
|
||||||
- **Every host gets a wnode** (variable sizing: small 4 GB to large 32 GB)
|
|
||||||
- **SSD/NVMe reserved for k8s scratch** (plus ultix-streaming exception)
|
|
||||||
- **Spinning rust for all infrastructure VMs**
|
|
||||||
|
|
||||||
### 12.5 Data gaps
|
|
||||||
|
|
||||||
| Gap | How to close |
|
|
||||||
|-----|--------------|
|
|
||||||
| tsys5 SDR/parallel-port workload dependency | Confirm what uses the SDR |
|
|
||||||
| tsys2 post-Proxmox baseline | Run `check.sh` after Friday install |
|
|
||||||
| tsys5 NVMe size and model | Confirm after Friday installation |
|
|
||||||
| tsys3 thermal state (laptop in rack) | Check `sensors` on next maintenance |
|
|
||||||
| PowerEdge 19xx/2950 inventory | When solar scale-out is planned |
|
|
||||||
|
|
||||||
### 12.6 Scripts and tools available
|
|
||||||
|
|
||||||
| Script | Purpose |
|
|
||||||
|--------|---------|
|
|
||||||
| `scripts/check.sh` | Read-only data collector (run on hosts) |
|
|
||||||
| `scripts/apply-tunings.sh` | Apply all Tier 0 tunings (dry-run/apply/rollback) |
|
|
||||||
| `scripts/fix-bond-nfs.sh` | Fix NFS options + bond hash |
|
|
||||||
| `validate-fixes.sh` | Read-only validation of all applied changes |
|
|
||||||
| `iperf-full-matrix.sh` | Full iperf test suite (mgmt + storage) |
|
|
||||||
| `deploy-check.sh` | Deploy check.sh to all hosts via SSH (now includes tsys9) |
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# README.md
|
||||||
|
|
||||||
|
> **Documentation moved to Discourse — the canonical source of truth.**
|
||||||
|
>
|
||||||
|
> **Project overview, architecture, quick start**
|
||||||
|
>
|
||||||
|
> **Read it here:** https://community.turnsys.com/t/296
|
||||||
|
>
|
||||||
|
> *Migrated 2026-08-06. This file is kept as a pointer for git-browsing context.
|
||||||
|
> Do not update content here — edit the Discourse wiki topic instead.*
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# STATUS.md
|
||||||
|
|
||||||
|
> **Documentation moved to Discourse — the canonical source of truth.**
|
||||||
|
>
|
||||||
|
> **Ticket index + infrastructure summary**
|
||||||
|
>
|
||||||
|
> **Read it here:** https://community.turnsys.com/t/297
|
||||||
|
>
|
||||||
|
> *Migrated 2026-08-06. This file is kept as a pointer for git-browsing context.
|
||||||
|
> Do not update content here — edit the Discourse wiki topic instead.*
|
||||||
@@ -1,242 +0,0 @@
|
|||||||
# TODO.md — Pending User Actions
|
|
||||||
|
|
||||||
**Date:** 2026-07-27
|
|
||||||
**Items needing user input or physical action.**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. tsys2 Windows hardware inventory (run on the Windows host)
|
|
||||||
|
|
||||||
pfv-tsys2 is currently Windows 10. Before rebuilding it as Proxmox, gather
|
|
||||||
hardware data so the architecture plan can account for it.
|
|
||||||
|
|
||||||
### Option A: PowerShell (recommended — single command, copy-paste output)
|
|
||||||
|
|
||||||
Open **PowerShell as Administrator** and run:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
# Full hardware inventory in one shot
|
|
||||||
Write-Output "=== COMPUTER ==="
|
|
||||||
Get-CimInstance Win32_ComputerSystem | Select-Object Manufacturer, Model, SystemType, TotalPhysicalMemory | Format-List
|
|
||||||
|
|
||||||
Write-Output "`n=== CPU ==="
|
|
||||||
Get-CimInstance Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed | Format-List
|
|
||||||
|
|
||||||
Write-Output "`n=== MEMORY STICKS ==="
|
|
||||||
Get-CimInstance Win32_PhysicalMemory | Select-Object Manufacturer, PartNumber, Capacity, Speed, ConfiguredClockSpeed, DeviceLocator, FormFactor | Format-Table -AutoSize
|
|
||||||
|
|
||||||
Write-Output "`n=== DISKS ==="
|
|
||||||
Get-PhysicalDisk | Select-Object FriendlyName, MediaType, BusType, Size, SpindleSpeed | Format-Table -AutoSize
|
|
||||||
|
|
||||||
Write-Output "`n=== DISK PARTITIONS ==="
|
|
||||||
Get-Disk | Select-Object Number, FriendlyName, Size, PartitionStyle, OperationalStatus | Format-Table -AutoSize
|
|
||||||
|
|
||||||
Write-Output "`n=== NETWORK ADAPTERS ==="
|
|
||||||
Get-NetAdapter | Select-Object Name, InterfaceDescription, Status, LinkSpeed, MacAddress | Format-Table -AutoSize
|
|
||||||
|
|
||||||
Write-Output "`n=== GPU(s) ==="
|
|
||||||
Get-CimInstance Win32_VideoController | Select-Object Name, AdapterRAM, DriverVersion, VideoProcessor | Format-List
|
|
||||||
|
|
||||||
Write-Output "`n=== PCIe SLOTS ==="
|
|
||||||
Get-CimInstance Win32_SystemSlot | Select-Object SlotDesignation, CurrentUsage, Status | Format-Table -AutoSize
|
|
||||||
|
|
||||||
Write-Output "`n=== USB DEVICES (storage + network only) ==="
|
|
||||||
Get-PnpDevice -PresentOnly | Where-Object { $_.Class -in @('DiskDrive','Net','USB') } | Select-Object Class, FriendlyName, Status | Format-Table -AutoSize
|
|
||||||
```
|
|
||||||
|
|
||||||
Copy the full output into a file (e.g., `tsys2-hardware.txt`) or paste it
|
|
||||||
directly into the chat.
|
|
||||||
|
|
||||||
### Option B: Command Prompt (cmd.exe) fallbacks
|
|
||||||
|
|
||||||
If PowerShell is unavailable for some reason, these cmd commands give a
|
|
||||||
subset:
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
:: Computer model and serial
|
|
||||||
wmic computersystem get manufacturer,model
|
|
||||||
wmic bios get serialnumber
|
|
||||||
|
|
||||||
:: CPU
|
|
||||||
wmic cpu get name,numberofcores,numberoflogicalprocessors,maxclockspeed
|
|
||||||
|
|
||||||
:: RAM (total)
|
|
||||||
wmic computersystem get totalphysicalmemory
|
|
||||||
|
|
||||||
:: RAM sticks (per-slot detail)
|
|
||||||
wmic memorychip get manufacturer,capacity,speed,partnumber,devicelocator
|
|
||||||
|
|
||||||
:: Disks
|
|
||||||
wmic diskdrive get model,size,interfacetype,mediatype
|
|
||||||
|
|
||||||
:: Network adapters
|
|
||||||
wmic nic where netenabled=true get name,speed,macaddress
|
|
||||||
|
|
||||||
:: GPU
|
|
||||||
wmic path win32_videocontroller get name,adapterram,driverversion
|
|
||||||
```
|
|
||||||
|
|
||||||
### What I'm looking for
|
|
||||||
|
|
||||||
- **Disk inventory**: Are there any SSDs/NVMe available locally? (Determines
|
|
||||||
whether wnode-tsys2 can use local storage like the other wnodes.)
|
|
||||||
- **Network adapters**: How many onboard NICs? Model? (Determines whether
|
|
||||||
tsys2 needs a USB dongle for storage network like tsys4/9, or has a real
|
|
||||||
onboard NIC available.)
|
|
||||||
- **RAM layout**: Is all 32 GB in 1 stick, 2 sticks, or 4 sticks? (Affects
|
|
||||||
memory bandwidth for HPC workloads — dual-channel matters.)
|
|
||||||
- **GPU detail**: Confirm the Quadro M1200 model and VRAM for passthrough
|
|
||||||
planning.
|
|
||||||
- **PCIe slots**: Is there a free PCIe slot for adding a NIC or HBA?
|
|
||||||
- **Service tag confirmation**: `GH1XZG2` (already on file from spreadsheet).
|
|
||||||
|
|
||||||
### STATUS: Collected 2026-07-27
|
|
||||||
|
|
||||||
**Disk inventory — RESOLVED:**
|
|
||||||
- Disk 0: Samsung SSD 960 PRO **512 GB NVMe** (best local storage in fleet)
|
|
||||||
- Disk 1: Samsung SSD 850 EVO **1 TB SATA SSD**
|
|
||||||
- Both SSDs, no spinning rust. 1.5 TB total local SSD.
|
|
||||||
|
|
||||||
**Network adapters — RESOLVED (concerning):**
|
|
||||||
- StorageNetwork: **ASIX USB to Gigabit Ethernet** (dongle, D4-81-D7-3E-0D-5E)
|
|
||||||
- Ethernet: **Realtek USB GbE Family Controller** (also USB, 18-FD-CB-00-D2-CA)
|
|
||||||
- Wi-Fi: Intel 8265 (disconnected)
|
|
||||||
- **Both wired NICs are USB-attached.** Same anti-pattern as tsys4/9.
|
|
||||||
Unavoidable on this laptop form factor — no onboard PCIe NIC available.
|
|
||||||
|
|
||||||
**GPU — RESOLVED:**
|
|
||||||
- Intel HD Graphics 630 (integrated, 1 GB)
|
|
||||||
- NVIDIA Quadro M1200 (4 GB, confirmed for passthrough)
|
|
||||||
|
|
||||||
**PCIe slots — RESOLVED:**
|
|
||||||
- Slots 3/6/7/8 report "Available" but these are laptop M.2/WWAN slots, not
|
|
||||||
user-accessible full PCIe. **Cannot add a PCIe NIC.** NVMe slot occupied
|
|
||||||
by 960 PRO.
|
|
||||||
|
|
||||||
**RAM — PARTIAL:**
|
|
||||||
- Total 32 GB confirmed (34,097,573,888 bytes).
|
|
||||||
- Per-stick detail failed to run (PowerShell line-break split
|
|
||||||
`Format-T` + `able`). Re-run the command below if bandwidth planning
|
|
||||||
needs stick-level detail:
|
|
||||||
```powershell
|
|
||||||
Get-CimInstance Win32_PhysicalMemory | Select-Object Manufacturer, PartNumber, Capacity, Speed, ConfiguredClockSpeed, DeviceLocator, FormFactor | Format-Table -AutoSize
|
|
||||||
```
|
|
||||||
|
|
||||||
**Service tag — CONFIRMED:** `GH1XZG2` (Precision 5520).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. Friday maintenance window (physical hardware)
|
|
||||||
|
|
||||||
### tsys4 — install PCIe NIC + add RAM
|
|
||||||
|
|
||||||
1. Power down tsys4 (graceful shutdown via Proxmox UI or `shutdown -h now`).
|
|
||||||
2. Install the **PCIe NIC** (Intel i350-T2 or similar 1 GbE dual-port).
|
|
||||||
3. Add **RAM**: 16 GB → 64 GB DDR3 ECC.
|
|
||||||
4. Power on, then update `/etc/network/interfaces` to replace
|
|
||||||
`enx8cae4ccda926` (USB dongle) with the new PCIe NIC device name.
|
|
||||||
5. Reboot to activate new NIC and NFS nconnect.
|
|
||||||
6. Run `validate-fixes.sh pfv-tsys4` to confirm.
|
|
||||||
|
|
||||||
### tsys5 — plug storage cable + install NVMe + relocate D3 SSD
|
|
||||||
|
|
||||||
1. Plug the **second ethernet cable** into tsys5's dedicated storage NIC.
|
|
||||||
2. Verify bond0 recovery: `cat /proc/net/bonding/bond0` — look for
|
|
||||||
"Number of ports: 2" and a real partner MAC (not all zeros).
|
|
||||||
3. Apply bond hash fix (same as tsys6/7):
|
|
||||||
```bash
|
|
||||||
echo "layer3+4" > /sys/class/net/bond0/bonding/xmit_hash_policy
|
|
||||||
```
|
|
||||||
4. **Relocate D3 SSD** from tsys4 USB to tsys5 SAS port:
|
|
||||||
- Power down tsys4
|
|
||||||
- Remove the SK hynix SC300 SSD from its USB enclosure on tsys4
|
|
||||||
- Install it on a free SAS port on tsys5 (5 ports free on LSI SAS1068E)
|
|
||||||
- On tsys5: mount as `/mnt/pfv-tsys5/D3`, add to `/etc/exports`
|
|
||||||
- Update `/etc/pve/storage.cfg` cluster-wide: repoint D3 `server` from
|
|
||||||
`pfv-tsys4-nfs-stor` to `pfv-tsys5-nfs-stor`, update `export` path
|
|
||||||
- Copy any existing D3 data from tsys4 first (currently ~2 MB, essentially
|
|
||||||
empty, so minimal migration)
|
|
||||||
5. Install the **PCI NVMe drive** (uses a PCI slot, not a SATA/SAS port).
|
|
||||||
6. Format NVMe as local directory storage (see TODO section 3 below).
|
|
||||||
7. Reboot tsys5 to activate NFS nconnect.
|
|
||||||
8. Run `validate-fixes.sh pfv-tsys5` to confirm.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. tsys5 NVMe format/mount decision (after Friday install)
|
|
||||||
|
|
||||||
**Recommendation: local-only, not NFS-exported.** Format as Proxmox directory
|
|
||||||
storage so it shows up as a VM image target in the Proxmox UI.
|
|
||||||
|
|
||||||
After the NVMe is physically installed and visible in Proxmox:
|
|
||||||
|
|
||||||
1. Identify the device: `lsblk` or `ls /dev/nvme*`
|
|
||||||
2. Format and add to Proxmox:
|
|
||||||
```bash
|
|
||||||
# Option A: LVM-thin (thin provisioning, snapshots)
|
|
||||||
pvcreate /dev/nvme0n1
|
|
||||||
vgcreate nvme-pool /dev/nvme0n1
|
|
||||||
lvcreate -l 100%FREE -T nvme-pool/data
|
|
||||||
# Then in Proxmox UI: Datacenter > Storage > Add > LVM-Thin
|
|
||||||
# ID: nvme-local
|
|
||||||
# Volume Group: nvme-pool
|
|
||||||
# Thin Pool: data
|
|
||||||
# Content: Disk image, Container template
|
|
||||||
|
|
||||||
# Option B: Directory (simpler, no thin provisioning)
|
|
||||||
mkfs.ext4 /dev/nvme0n1
|
|
||||||
mkdir -p /mnt/nvme
|
|
||||||
mount /dev/nvme0n1 /mnt/nvme
|
|
||||||
# Add to /etc/fstab for persistence
|
|
||||||
# Then in Proxmox UI: Datacenter > Storage > Add > Directory
|
|
||||||
# ID: nvme-local
|
|
||||||
# Directory: /mnt/nvme
|
|
||||||
# Content: Disk image, Container template
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Use for wnode-tsys5 boot disk (highest impact) and sectestbed VM scratch.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. Post-hardware validation (run after Friday work)
|
|
||||||
|
|
||||||
1. Re-run iperf matrix: `./iperf-full-matrix.sh`
|
|
||||||
2. Validate tsys4 and tsys5: `./validate-fixes.sh pfv-tsys4 && ./validate-fixes.sh pfv-tsys5`
|
|
||||||
3. Update PROJECT.md with post-hardware iperf numbers.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 5. UCS storage migration to spinning disk (do today)
|
|
||||||
|
|
||||||
UCS (Univention Corporate Server / open-source AD) does not need SSD. Both
|
|
||||||
UCS VMs should stay on spinning disk (HDD) and be split across storage
|
|
||||||
servers for redundancy.
|
|
||||||
|
|
||||||
| VM | Current | Target | Action |
|
|
||||||
|----|---------|--------|--------|
|
|
||||||
| ucs-01 (108) | D2 (tsys4 HDD) | **D2 (tsys4 HDD) -- no change** | Already correct |
|
|
||||||
| ucs-02 (902) | D5 (tsys4 HDD) | **S2 (tsys5 HDD)** | Move for cross-server redundancy |
|
|
||||||
|
|
||||||
**To migrate ucs-02 to S2 (use PDM/Proxmox UI):**
|
|
||||||
1. In Proxmox Datacenter or the node UI, select VM 902 on tsys9
|
|
||||||
2. Use "Migrate" or "Storage Migrate" to move the disk from D5 to S2
|
|
||||||
(both are NFS exports visible to tsys9, so this is a storage-only migration)
|
|
||||||
3. Verify VM 902 boots and LDAP/AD services are healthy after migration
|
|
||||||
|
|
||||||
Note: both VMs are currently on tsys4 HDD, which is fine for UCS. Only
|
|
||||||
ucs-02 needs to move -- it should be on a different storage server than
|
|
||||||
ucs-01 so a tsys4 failure doesn't take down both halves of the AD pair.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 6. Open questions for next session
|
|
||||||
|
|
||||||
- Are the hosts a Proxmox cluster (`pvecm status`) or standalone installs?
|
|
||||||
Determines whether live migration is available.
|
|
||||||
- What k8s distribution is in use? (k3s, kubeadm, RKE2?)
|
|
||||||
- Container runtime? (containerd, cri-o?)
|
|
||||||
- Is there a local container image registry mirror?
|
|
||||||
- What specific ETL tools? (GDAL, PostGIS, xarray, Dask?)
|
|
||||||
- HPC job scheduler? (plain k8s Jobs, Argo Workflows, Volcano?)
|
|
||||||
- What uses tsys5's SDR + parallel port before planning tsys5 role changes?
|
|
||||||
- tsys3 thermal state (laptop in rack for years) — check `sensors`.
|
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
# WORKING.md — Active Session Tracker
|
||||||
|
|
||||||
|
Agent work only. The human decides when it's done.
|
||||||
|
A commit is blocked while any task below remains unchecked.
|
||||||
|
|
||||||
|
## Current Tasks
|
||||||
|
|
||||||
|
(all done — session complete)
|
||||||
|
|
||||||
|
- [x] Add ticket-gate Crush hook (blocks work without active ticket)
|
||||||
|
- [x] Document active-ticket workflow in AGENTS.md + meta template
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
# access-matrix.sh — definitive access verification across all Linux Tailscale nodes.
|
||||||
|
# Uses the correct SSH user(s) per system type, checks sudo where applicable.
|
||||||
|
# Routes through remote.sh (the only allowed ssh path).
|
||||||
|
set -u
|
||||||
|
cd /home/reachableceo/projects/PFVCluster || exit 1
|
||||||
|
|
||||||
|
# Policy-excluded systems (never attempt access)
|
||||||
|
EXCLUDE=':tsys-cloudron:pfv-bms:tsys-umbrel:tsys-ucs-01:tsys-ucs-02:stlpc-bizoffice:ultix-highside:'
|
||||||
|
|
||||||
|
# Determine the SSH user(s) for a given hostname and whether sudo is expected.
|
||||||
|
# Returns "user1:user2:...:sudoflag" where sudoflag is "yes" or "no".
|
||||||
|
users_for() {
|
||||||
|
local name="$1"
|
||||||
|
case "$name" in
|
||||||
|
pfv-tsys[0-9]) echo "root:no" ;;
|
||||||
|
*-proxmox-datacenter) echo "root:no" ;;
|
||||||
|
*-proxmox-pve) echo "root:no" ;;
|
||||||
|
*-proxmox-pbs) echo "root:no" ;;
|
||||||
|
*-proxmox-mailgw*) echo "root:no" ;;
|
||||||
|
*-proxmox-backup*) echo "root:no" ;;
|
||||||
|
tsys-ucs-*) echo "root:no" ;;
|
||||||
|
ultix-streaming) echo "root:no" ;;
|
||||||
|
stlpc-*) echo "root:labuser:no" ;;
|
||||||
|
ultix-field) echo "ultixfield:yes" ;;
|
||||||
|
subopi*) echo "subodev:yes" ;;
|
||||||
|
*) echo "localuser:yes" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
check_user() {
|
||||||
|
local ip="$1" user="$2" expect_sudo="$3"
|
||||||
|
local out sudo
|
||||||
|
out=$(VM_IP="$ip" VM_USER="$user" bash tests/remote.sh vm 'echo SSHOK; id -un' </dev/null 2>&1 | grep -oE 'SSHOK|keyboard-interactive|Connection refused' | head -1)
|
||||||
|
case "$out" in
|
||||||
|
SSHOK)
|
||||||
|
if [ "$expect_sudo" = "yes" ]; then
|
||||||
|
sudo=$(VM_IP="$ip" VM_USER="$user" bash tests/remote.sh vm 'sudo -n true 2>/dev/null && echo SUDOOK || echo SUDONO' </dev/null 2>&1 | grep -oE 'SUDOOK|SUDONO' | head -1)
|
||||||
|
printf '%s(%s)' "$user" "${sudo:-?}"
|
||||||
|
else
|
||||||
|
printf '%s(ok)' "$user"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
keyboard-interactive) printf '%s(2FA)' "$user" ;;
|
||||||
|
'Connection refused') printf '%s(NOSSH)' "$user" ;;
|
||||||
|
*) printf '%s(NOKEY)' "$user" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
printf '%-32s %-16s %s\n' "NAME" "TS-IP" "ACCESS"
|
||||||
|
printf '%-32s %-16s %s\n' "----" "-----" "------"
|
||||||
|
|
||||||
|
tailscale status 2>/dev/null | awk '$4=="linux" {print $2, $1}' | sort | while read -r name ip; do
|
||||||
|
[ -n "$name" ] || continue
|
||||||
|
case "$EXCLUDE" in *":$name:"*) printf '%-32s %-16s %s\n' "$name" "$ip" "EXCLUDED"; continue;; esac
|
||||||
|
|
||||||
|
map=$(users_for "$name")
|
||||||
|
expect_sudo="${map##*:}"
|
||||||
|
users="${map%:*}"
|
||||||
|
result=""
|
||||||
|
IFS=':' read -ra user_list <<< "$users"
|
||||||
|
for u in "${user_list[@]}"; do
|
||||||
|
r=$(check_user "$ip" "$u" "$expect_sudo")
|
||||||
|
[ -z "$result" ] && result="$r" || result="$result $r"
|
||||||
|
done
|
||||||
|
printf '%-32s %-16s %s\n' "$name" "$ip" "$result"
|
||||||
|
done
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# agent-bootstrap.sh
|
||||||
|
#
|
||||||
|
# Run INSIDE a guest (via SSH, console, or guest-agent) to bring the
|
||||||
|
# system fully under agent management in one shot:
|
||||||
|
# 1. install + enable qemu-guest-agent (VMs only, skipped on bare metal)
|
||||||
|
# 2. push the agent SSH key to root + AGENT_USER (+ labuser if present)
|
||||||
|
# 3. grant AGENT_USER passwordless sudo
|
||||||
|
#
|
||||||
|
# AGENT_USER defaults to "localuser". Override for systems with a different
|
||||||
|
# unprivileged agent user:
|
||||||
|
# AGENT_USER=subodev bash agent-bootstrap.sh
|
||||||
|
#
|
||||||
|
# After this runs once, the agent has SSH+sudo immediately.
|
||||||
|
#
|
||||||
|
# Usage (from a root shell in the guest):
|
||||||
|
# bash agent-bootstrap.sh
|
||||||
|
# AGENT_USER=subodev bash agent-bootstrap.sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
KEY='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIWms/uCXnjjo4KyxHBcYI2TDHe8OZ2wle6W/0hSRQLu reachableceo@ultix-streaming'
|
||||||
|
AGENT_USER="${AGENT_USER:-localuser}"
|
||||||
|
|
||||||
|
# 1. guest-agent (skip on bare metal — no virtio-serial device)
|
||||||
|
if command -v systemd-detect-virt >/dev/null 2>&1 && \
|
||||||
|
[ "$(systemd-detect-virt --vm 2>/dev/null || echo none)" != "none" ]; then
|
||||||
|
if ! command -v qemu-ga >/dev/null 2>&1; then
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y qemu-guest-agent
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
dnf install -y qemu-guest-agent
|
||||||
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
|
yum install -y qemu-guest-agent
|
||||||
|
else
|
||||||
|
echo "WARN: no supported package manager; skipping agent install" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
systemctl enable --now qemu-guest-agent 2>/dev/null || \
|
||||||
|
systemctl enable --now qemu-ga 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. SSH key for root + AGENT_USER + labuser (if present)
|
||||||
|
for u in root "$AGENT_USER" labuser; do
|
||||||
|
if ! getent passwd "$u" >/dev/null 2>&1; then continue; fi
|
||||||
|
H=$(getent passwd "$u" | cut -d: -f6)
|
||||||
|
mkdir -p "$H/.ssh"; chmod 700 "$H/.ssh"
|
||||||
|
AK="$H/.ssh/authorized_keys"; touch "$AK"; chmod 600 "$AK"
|
||||||
|
grep -qF "$KEY" "$AK" || echo "$KEY" >> "$AK"
|
||||||
|
chown -R "$u": "$H/.ssh"
|
||||||
|
done
|
||||||
|
|
||||||
|
# 3. passwordless sudo for AGENT_USER only
|
||||||
|
if getent passwd "$AGENT_USER" >/dev/null 2>&1 && [ -d /etc/sudoers.d ]; then
|
||||||
|
echo "${AGENT_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/010-agent
|
||||||
|
chmod 440 /etc/sudoers.d/010-agent
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo BOOTSTRAP-DONE
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Check_MK LibreNMS Agent Socket
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
ListenStream=6556
|
||||||
|
Accept=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sockets.target
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Check_MK LibreNMS Agent Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/check_mk_agent
|
||||||
|
StandardOutput=socket
|
||||||
@@ -0,0 +1,659 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
#
|
||||||
|
# This file is part of Check_MK.
|
||||||
|
# The official homepage is at http://mathias-kettner.de/check_mk.
|
||||||
|
#
|
||||||
|
# check_mk is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation in version 2. check_mk is distributed
|
||||||
|
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
|
||||||
|
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
|
||||||
|
# ails. You should have received a copy of the GNU General Public
|
||||||
|
# License along with GNU Make; see the file COPYING. If not, write
|
||||||
|
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
# Remove locale settings to eliminate localized outputs where possible
|
||||||
|
export LC_ALL=C
|
||||||
|
unset LANG
|
||||||
|
|
||||||
|
export MK_LIBDIR="/usr/lib/check_mk_agent"
|
||||||
|
export MK_CONFDIR="/etc/check_mk"
|
||||||
|
export MK_VARDIR="/var/lib/check_mk_agent"
|
||||||
|
|
||||||
|
# Provide information about the remote host. That helps when data
|
||||||
|
# is being sent only once to each remote host.
|
||||||
|
if [ "$REMOTE_HOST" ] ; then
|
||||||
|
export REMOTE=$REMOTE_HOST
|
||||||
|
elif [ "$SSH_CLIENT" ] ; then
|
||||||
|
export REMOTE=${SSH_CLIENT%% *}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure, locally installed binaries are found
|
||||||
|
PATH=$PATH:/usr/local/bin
|
||||||
|
|
||||||
|
# All executables in PLUGINSDIR will simply be executed and their
|
||||||
|
# ouput appended to the output of the agent. Plugins define their own
|
||||||
|
# sections and must output headers with '<<<' and '>>>'
|
||||||
|
PLUGINSDIR=$MK_LIBDIR/plugins
|
||||||
|
|
||||||
|
# All executables in LOCALDIR will by executabled and their
|
||||||
|
# output inserted into the section <<<local>>>. Please
|
||||||
|
# refer to online documentation for details about local checks.
|
||||||
|
LOCALDIR=$MK_LIBDIR/local
|
||||||
|
|
||||||
|
# All files in SPOOLDIR will simply appended to the agent
|
||||||
|
# output if they are not outdated (see below)
|
||||||
|
SPOOLDIR=$MK_VARDIR/spool
|
||||||
|
|
||||||
|
# close standard input (for security reasons) and stderr
|
||||||
|
if [ "$1" = -d ]
|
||||||
|
then
|
||||||
|
set -xv
|
||||||
|
else
|
||||||
|
exec </dev/null 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Runs a command asynchronous by use of a cache file
|
||||||
|
function run_cached () {
|
||||||
|
local section=
|
||||||
|
if [ "$1" = -s ] ; then local section="echo '<<<$2>>>' ; " ; shift ; fi
|
||||||
|
local NAME=$1
|
||||||
|
local MAXAGE=$2
|
||||||
|
shift 2
|
||||||
|
local CMDLINE="$section$@"
|
||||||
|
|
||||||
|
if [ ! -d $MK_VARDIR/cache ]; then mkdir -p $MK_VARDIR/cache ; fi
|
||||||
|
CACHEFILE="$MK_VARDIR/cache/$NAME.cache"
|
||||||
|
|
||||||
|
# Check if the creation of the cache takes suspiciously long and return
|
||||||
|
# nothing if the age (access time) of $CACHEFILE.new is twice the MAXAGE
|
||||||
|
local NOW=$(date +%s)
|
||||||
|
if [ -e "$CACHEFILE.new" ] ; then
|
||||||
|
local CF_ATIME=$(stat -c %X "$CACHEFILE.new")
|
||||||
|
if [ $((NOW - CF_ATIME)) -ge $((MAXAGE * 2)) ] ; then
|
||||||
|
# Kill the process still accessing that file in case
|
||||||
|
# it is still running. This avoids overlapping processes!
|
||||||
|
fuser -k -9 "$CACHEFILE.new" >/dev/null 2>&1
|
||||||
|
rm -f "$CACHEFILE.new"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if cache file exists and is recent enough
|
||||||
|
if [ -s "$CACHEFILE" ] ; then
|
||||||
|
local MTIME=$(stat -c %Y "$CACHEFILE")
|
||||||
|
if [ $((NOW - MTIME)) -le $MAXAGE ] ; then local USE_CACHEFILE=1 ; fi
|
||||||
|
# Output the file in any case, even if it is
|
||||||
|
# outdated. The new file will not yet be available
|
||||||
|
cat "$CACHEFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cache file outdated and new job not yet running? Start it
|
||||||
|
if [ -z "$USE_CACHEFILE" -a ! -e "$CACHEFILE.new" ] ; then
|
||||||
|
echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make run_cached available for subshells (plugins, local checks, etc.)
|
||||||
|
export -f run_cached
|
||||||
|
|
||||||
|
echo '<<<check_mk>>>'
|
||||||
|
echo Version: 1.2.6b5
|
||||||
|
echo AgentOS: linux
|
||||||
|
echo AgentDirectory: $MK_CONFDIR
|
||||||
|
echo DataDirectory: $MK_VARDIR
|
||||||
|
echo SpoolDirectory: $SPOOLDIR
|
||||||
|
echo PluginsDirectory: $PLUGINSDIR
|
||||||
|
echo LocalDirectory: $LOCALDIR
|
||||||
|
|
||||||
|
# If we are called via xinetd, try to find only_from configuration
|
||||||
|
if [ -n "$REMOTE_HOST" ]
|
||||||
|
then
|
||||||
|
echo -n 'OnlyFrom: '
|
||||||
|
echo $(sed -n '/^service[[:space:]]*check_mk/,/}/s/^[[:space:]]*only_from[[:space:]]*=[[:space:]]*\(.*\)/\1/p' /etc/xinetd.d/* | head -n1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print out Partitions / Filesystems. (-P gives non-wrapped POSIXed output)
|
||||||
|
# Heads up: NFS-mounts are generally supressed to avoid agent hangs.
|
||||||
|
# If hard NFS mounts are configured or you have too large nfs retry/timeout
|
||||||
|
# settings, accessing those mounts from the agent would leave you with
|
||||||
|
# thousands of agent processes and, ultimately, a dead monitored system.
|
||||||
|
# These should generally be monitored on the NFS server, not on the clients.
|
||||||
|
|
||||||
|
echo '<<<df>>>'
|
||||||
|
# The exclusion list is getting a bit of a problem. -l should hide any remote FS but seems
|
||||||
|
# to be all but working.
|
||||||
|
excludefs="-x smbfs -x cifs -x iso9660 -x udf -x nfsv4 -x nfs -x mvfs -x zfs"
|
||||||
|
df -PTlk $excludefs | sed 1d
|
||||||
|
|
||||||
|
# df inodes information
|
||||||
|
echo '<<<df>>>'
|
||||||
|
echo '[df_inodes_start]'
|
||||||
|
df -PTli $excludefs | sed 1d
|
||||||
|
echo '[df_inodes_end]'
|
||||||
|
|
||||||
|
# Filesystem usage for ZFS
|
||||||
|
if type zfs > /dev/null 2>&1 ; then
|
||||||
|
echo '<<<zfsget>>>'
|
||||||
|
zfs get -Hp name,quota,used,avail,mountpoint,type -t filesystem,volume || \
|
||||||
|
zfs get -Hp name,quota,used,avail,mountpoint,type
|
||||||
|
echo '[df]'
|
||||||
|
df -PTlk -t zfs | sed 1d
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check NFS mounts by accessing them with stat -f (System
|
||||||
|
# call statfs()). If this lasts more then 2 seconds we
|
||||||
|
# consider it as hanging. We need waitmax.
|
||||||
|
if type waitmax >/dev/null
|
||||||
|
then
|
||||||
|
STAT_VERSION=$(stat --version | head -1 | cut -d" " -f4)
|
||||||
|
STAT_BROKE="5.3.0"
|
||||||
|
|
||||||
|
echo '<<<nfsmounts>>>'
|
||||||
|
sed -n '/ nfs4\? /s/[^ ]* \([^ ]*\) .*/\1/p' < /proc/mounts |
|
||||||
|
sed 's/\\040/ /g' |
|
||||||
|
while read MP
|
||||||
|
do
|
||||||
|
if [ $STAT_VERSION != $STAT_BROKE ]; then
|
||||||
|
waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" || \
|
||||||
|
echo "$MP hanging 0 0 0 0"
|
||||||
|
else
|
||||||
|
waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" && \
|
||||||
|
printf '\n'|| echo "$MP hanging 0 0 0 0"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo '<<<cifsmounts>>>'
|
||||||
|
sed -n '/ cifs\? /s/[^ ]* \([^ ]*\) .*/\1/p' < /proc/mounts |
|
||||||
|
sed 's/\\040/ /g' |
|
||||||
|
while read MP
|
||||||
|
do
|
||||||
|
if [ $STAT_VERSION != $STAT_BROKE ]; then
|
||||||
|
waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" || \
|
||||||
|
echo "$MP hanging 0 0 0 0"
|
||||||
|
else
|
||||||
|
waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" && \
|
||||||
|
printf '\n'|| echo "$MP hanging 0 0 0 0"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check mount options. Filesystems may switch to 'ro' in case
|
||||||
|
# of a read error.
|
||||||
|
echo '<<<mounts>>>'
|
||||||
|
grep ^/dev < /proc/mounts
|
||||||
|
|
||||||
|
# processes including username, without kernel processes
|
||||||
|
echo '<<<ps>>>'
|
||||||
|
ps ax -o user,vsz,rss,cputime,pid,command --columns 10000 | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) */(\1,\2,\3,\4,\5) /'
|
||||||
|
|
||||||
|
# Memory usage
|
||||||
|
echo '<<<mem>>>'
|
||||||
|
egrep -v '^Swap:|^Mem:|total:' < /proc/meminfo
|
||||||
|
|
||||||
|
# Load and number of processes
|
||||||
|
echo '<<<cpu>>>'
|
||||||
|
echo "$(cat /proc/loadavg) $(grep -E '^CPU|^processor' < /proc/cpuinfo | wc -l)"
|
||||||
|
|
||||||
|
# Uptime
|
||||||
|
echo '<<<uptime>>>'
|
||||||
|
cat /proc/uptime
|
||||||
|
|
||||||
|
|
||||||
|
# New variant: Information about speed and state in one section
|
||||||
|
echo '<<<lnx_if:sep(58)>>>'
|
||||||
|
sed 1,2d /proc/net/dev
|
||||||
|
if type ethtool > /dev/null
|
||||||
|
then
|
||||||
|
for eth in $(sed -e 1,2d < /proc/net/dev | cut -d':' -f1 | sort)
|
||||||
|
do
|
||||||
|
echo "[$eth]"
|
||||||
|
ethtool $eth | egrep '(Speed|Duplex|Link detected|Auto-negotiation):'
|
||||||
|
echo -en "\tAddress: " ; cat /sys/class/net/$eth/address ; echo
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Current state of bonding interfaces
|
||||||
|
if [ -e /proc/net/bonding ] ; then
|
||||||
|
echo '<<<lnx_bonding:sep(58)>>>'
|
||||||
|
pushd /proc/net/bonding > /dev/null ; head -v -n 1000 * ; popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Same for Open vSwitch bonding
|
||||||
|
if type ovs-appctl > /dev/null ; then
|
||||||
|
echo '<<<ovs_bonding:sep(58)>>>'
|
||||||
|
for bond in $(ovs-appctl bond/list | sed -e 1d | cut -f2) ; do
|
||||||
|
echo "[$bond]"
|
||||||
|
ovs-appctl bond/show $bond
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Number of TCP connections in the various states
|
||||||
|
echo '<<<tcp_conn_stats>>>'
|
||||||
|
# waitmax 10 netstat -nt | awk ' /^tcp/ { c[$6]++; } END { for (x in c) { print x, c[x]; } }'
|
||||||
|
# New implementation: netstat is very slow for large TCP tables
|
||||||
|
cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk ' /:/ { c[$4]++; } END { for (x in c) { print x, c[x]; } }'
|
||||||
|
|
||||||
|
# Linux Multipathing
|
||||||
|
if type multipath >/dev/null ; then
|
||||||
|
echo '<<<multipath>>>'
|
||||||
|
multipath -l
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Performancecounter Platten
|
||||||
|
echo '<<<diskstat>>>'
|
||||||
|
date +%s
|
||||||
|
egrep ' (x?[shv]d[a-z]*|cciss/c[0-9]+d[0-9]+|emcpower[a-z]+|dm-[0-9]+|VxVM.*|mmcblk.*) ' < /proc/diskstats
|
||||||
|
if type dmsetup >/dev/null ; then
|
||||||
|
echo '[dmsetup_info]'
|
||||||
|
dmsetup info -c --noheadings --separator ' ' -o name,devno,vg_name,lv_name
|
||||||
|
fi
|
||||||
|
if [ -d /dev/vx/dsk ] ; then
|
||||||
|
echo '[vx_dsk]'
|
||||||
|
stat -c "%t %T %n" /dev/vx/dsk/*/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Performancecounter Kernel
|
||||||
|
echo '<<<kernel>>>'
|
||||||
|
date +%s
|
||||||
|
cat /proc/vmstat /proc/stat
|
||||||
|
|
||||||
|
# Hardware sensors via IPMI (need ipmitool)
|
||||||
|
if type ipmitool > /dev/null
|
||||||
|
then
|
||||||
|
run_cached -s ipmi 300 "ipmitool sensor list | grep -v 'command failed' | sed -e 's/ *| */|/g' -e 's/ /_/g' -e 's/_*"'$'"//' -e 's/|/ /g' | egrep -v '^[^ ]+ na ' | grep -v ' discrete '"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# IPMI data via ipmi-sensors (of freeipmi). Please make sure, that if you
|
||||||
|
# have installed freeipmi that IPMI is really support by your hardware.
|
||||||
|
if type ipmi-sensors >/dev/null
|
||||||
|
then
|
||||||
|
echo '<<<ipmi_sensors>>>'
|
||||||
|
# Newer ipmi-sensors version have new output format; Legacy format can be used
|
||||||
|
if ipmi-sensors --help | grep -q legacy-output; then
|
||||||
|
IPMI_FORMAT="--legacy-output"
|
||||||
|
else
|
||||||
|
IPMI_FORMAT=""
|
||||||
|
fi
|
||||||
|
# At least with ipmi-sensoirs 0.7.16 this group is Power_Unit instead of "Power Unit"
|
||||||
|
run_cached -s ipmi_sensors 300 "for class in Temperature Power_Unit Fan
|
||||||
|
do
|
||||||
|
ipmi-sensors $IPMI_FORMAT --sdr-cache-directory /var/cache -g "$class" | sed -e 's/ /_/g' -e 's/:_\?/ /g' -e 's@ \([^(]*\)_(\([^)]*\))@ \2_\1@'
|
||||||
|
# In case of a timeout immediately leave loop.
|
||||||
|
if [ $? = 255 ] ; then break ; fi
|
||||||
|
done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RAID status of Linux software RAID
|
||||||
|
echo '<<<md>>>'
|
||||||
|
cat /proc/mdstat
|
||||||
|
|
||||||
|
# RAID status of Linux RAID via device mapper
|
||||||
|
if type dmraid >/dev/null && DMSTATUS=$(dmraid -r)
|
||||||
|
then
|
||||||
|
echo '<<<dmraid>>>'
|
||||||
|
|
||||||
|
# Output name and status
|
||||||
|
dmraid -s | grep -e ^name -e ^status
|
||||||
|
|
||||||
|
# Output disk names of the RAID disks
|
||||||
|
DISKS=$(echo "$DMSTATUS" | cut -f1 -d\:)
|
||||||
|
|
||||||
|
for disk in $DISKS ; do
|
||||||
|
device=$(cat /sys/block/$(basename $disk)/device/model )
|
||||||
|
status=$(echo "$DMSTATUS" | grep ^${disk})
|
||||||
|
echo "$status Model: $device"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RAID status of LSI controllers via cfggen
|
||||||
|
if type cfggen > /dev/null ; then
|
||||||
|
echo '<<<lsi>>>'
|
||||||
|
cfggen 0 DISPLAY | egrep '(Target ID|State|Volume ID|Status of volume)[[:space:]]*:' | sed -e 's/ *//g' -e 's/:/ /'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RAID status of LSI MegaRAID controller via MegaCli. You can download that tool from:
|
||||||
|
# http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip
|
||||||
|
if type MegaCli >/dev/null ; then
|
||||||
|
MegaCli_bin="MegaCli"
|
||||||
|
elif type MegaCli64 >/dev/null ; then
|
||||||
|
MegaCli_bin="MegaCli64"
|
||||||
|
elif type megacli >/dev/null ; then
|
||||||
|
MegaCli_bin="megacli"
|
||||||
|
else
|
||||||
|
MegaCli_bin="unknown"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MegaCli_bin" != "unknown" ]; then
|
||||||
|
echo '<<<megaraid_pdisks>>>'
|
||||||
|
for part in $($MegaCli_bin -EncInfo -aALL -NoLog < /dev/null \
|
||||||
|
| sed -rn 's/:/ /g; s/[[:space:]]+/ /g; s/^ //; s/ $//; s/Number of enclosures on adapter ([0-9]+).*/adapter \1/g; /^(Enclosure|Device ID|adapter) [0-9]+$/ p'); do
|
||||||
|
[ $part = adapter ] && echo ""
|
||||||
|
[ $part = 'Enclosure' ] && echo -ne "\ndev2enc"
|
||||||
|
echo -n " $part"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
$MegaCli_bin -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry|Adapter'
|
||||||
|
echo '<<<megaraid_ldisks>>>'
|
||||||
|
$MegaCli_bin -LDInfo -Lall -aALL -NoLog < /dev/null | egrep 'Size|State|Number|Adapter|Virtual'
|
||||||
|
echo '<<<megaraid_bbu>>>'
|
||||||
|
$MegaCli_bin -AdpBbuCmd -GetBbuStatus -aALL -NoLog < /dev/null | grep -v Exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RAID status of 3WARE disk controller (by Radoslaw Bak)
|
||||||
|
if type tw_cli > /dev/null ; then
|
||||||
|
for C in $(tw_cli show | awk 'NR < 4 { next } { print $1 }'); do
|
||||||
|
echo '<<<3ware_info>>>'
|
||||||
|
tw_cli /$C show all | egrep 'Model =|Firmware|Serial'
|
||||||
|
echo '<<<3ware_disks>>>'
|
||||||
|
tw_cli /$C show drivestatus | egrep 'p[0-9]' | sed "s/^/$C\//"
|
||||||
|
echo '<<<3ware_units>>>'
|
||||||
|
tw_cli /$C show unitstatus | egrep 'u[0-9]' | sed "s/^/$C\//"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RAID controllers from areca (Taiwan)
|
||||||
|
# cli64 can be found at ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/Linux/CLI/
|
||||||
|
if type cli64 >/dev/null ; then
|
||||||
|
run_cached -s arc_raid_status 300 "cli64 rsf info | tail -n +3 | head -n -2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# VirtualBox Guests. Section must always been output. Otherwise the
|
||||||
|
# check would not be executed in case no guest additions are installed.
|
||||||
|
# And that is something the check wants to detect
|
||||||
|
echo '<<<vbox_guest>>>'
|
||||||
|
if type VBoxControl >/dev/null 2>&1 ; then
|
||||||
|
VBoxControl -nologo guestproperty enumerate | cut -d, -f1,2
|
||||||
|
[ ${PIPESTATUS[0]} = 0 ] || echo "ERROR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OpenVPN Clients. Currently we assume that the configuration # is in
|
||||||
|
# /etc/openvpn. We might find a safer way to find the configuration later.
|
||||||
|
if [ -e /etc/openvpn/openvpn-status.log ] ; then
|
||||||
|
echo '<<<openvpn_clients:sep(44)>>>'
|
||||||
|
sed -n -e '/CLIENT LIST/,/ROUTING TABLE/p' < /etc/openvpn/openvpn-status.log | sed -e 1,3d -e '$d'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Time synchronization with NTP
|
||||||
|
if type ntpq > /dev/null 2>&1 ; then
|
||||||
|
# remove heading, make first column space separated
|
||||||
|
run_cached -s ntp 30 "waitmax 5 ntpq -np | sed -e 1,2d -e 's/^\(.\)/\1 /' -e 's/^ /%/'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Time synchronization with Chrony
|
||||||
|
if type chronyc > /dev/null 2>&1 ; then
|
||||||
|
# Force successful exit code. Otherwise section will be missing if daemon not running
|
||||||
|
run_cached -s chrony 30 "waitmax 5 chronyc tracking || true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if type nvidia-settings >/dev/null && [ -S /tmp/.X11-unix/X0 ]
|
||||||
|
then
|
||||||
|
echo '<<<nvidia>>>'
|
||||||
|
for var in GPUErrors GPUCoreTemp
|
||||||
|
do
|
||||||
|
DISPLAY=:0 waitmax 2 nvidia-settings -t -q $var | sed "s/^/$var: /"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e /proc/drbd ]; then
|
||||||
|
echo '<<<drbd>>>'
|
||||||
|
cat /proc/drbd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Status of CUPS printer queues
|
||||||
|
if type lpstat > /dev/null 2>&1; then
|
||||||
|
if pgrep cups > /dev/null 2>&1; then
|
||||||
|
echo '<<<cups_queues>>>'
|
||||||
|
CPRINTCONF=/etc/cups/printers.conf
|
||||||
|
if [ -r "$CPRINTCONF" ] ; then
|
||||||
|
LOCAL_PRINTERS=$(grep -E "<(Default)?Printer .*>" $CPRINTCONF | awk '{print $2}' | sed -e 's/>//')
|
||||||
|
lpstat -p | while read LINE
|
||||||
|
do
|
||||||
|
PRINTER=$(echo $LINE | awk '{print $2}')
|
||||||
|
if echo "$LOCAL_PRINTERS" | grep -q "$PRINTER"; then
|
||||||
|
echo $LINE
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo '---'
|
||||||
|
lpstat -o | while read LINE
|
||||||
|
do
|
||||||
|
PRINTER=${LINE%%-*}
|
||||||
|
if echo "$LOCAL_PRINTERS" | grep -q "$PRINTER"; then
|
||||||
|
echo $LINE
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
lpstat -p
|
||||||
|
echo '---'
|
||||||
|
lpstat -o | sort
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Heartbeat monitoring
|
||||||
|
# Different handling for heartbeat clusters with and without CRM
|
||||||
|
# for the resource state
|
||||||
|
if [ -S /var/run/heartbeat/crm/cib_ro -o -S /var/run/crm/cib_ro ] || pgrep crmd > /dev/null 2>&1; then
|
||||||
|
echo '<<<heartbeat_crm>>>'
|
||||||
|
crm_mon -1 -r | grep -v ^$ | sed 's/^ //; /^\sResource Group:/,$ s/^\s//; s/^\s/_/g'
|
||||||
|
fi
|
||||||
|
if type cl_status > /dev/null 2>&1; then
|
||||||
|
echo '<<<heartbeat_rscstatus>>>'
|
||||||
|
cl_status rscstatus
|
||||||
|
|
||||||
|
echo '<<<heartbeat_nodes>>>'
|
||||||
|
for NODE in $(cl_status listnodes); do
|
||||||
|
if [ $NODE != $(echo $HOSTNAME | tr 'A-Z' 'a-z') ]; then
|
||||||
|
STATUS=$(cl_status nodestatus $NODE)
|
||||||
|
echo -n "$NODE $STATUS"
|
||||||
|
for LINK in $(cl_status listhblinks $NODE 2>/dev/null); do
|
||||||
|
echo -n " $LINK $(cl_status hblinkstatus $NODE $LINK)"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Postfix mailqueue monitoring
|
||||||
|
#
|
||||||
|
# Only handle mailq when postfix user is present. The mailq command is also
|
||||||
|
# available when postfix is not installed. But it produces different outputs
|
||||||
|
# which are not handled by the check at the moment. So try to filter out the
|
||||||
|
# systems not using postfix by searching for the postfix user.a
|
||||||
|
#
|
||||||
|
# Cannot take the whole outout. This could produce several MB of agent output
|
||||||
|
# on blocking queues.
|
||||||
|
# Only handle the last 6 lines (includes the summary line at the bottom and
|
||||||
|
# the last message in the queue. The last message is not used at the moment
|
||||||
|
# but it could be used to get the timestamp of the last message.
|
||||||
|
if type postconf >/dev/null ; then
|
||||||
|
echo '<<<postfix_mailq>>>'
|
||||||
|
postfix_queue_dir=$(postconf -h queue_directory)
|
||||||
|
postfix_count=$(find $postfix_queue_dir/deferred -type f | wc -l)
|
||||||
|
postfix_size=$(du -ks $postfix_queue_dir/deferred | awk '{print $1 }')
|
||||||
|
if [ $postfix_count -gt 0 ]
|
||||||
|
then
|
||||||
|
echo -- $postfix_size Kbytes in $postfix_count Requests.
|
||||||
|
else
|
||||||
|
echo Mail queue is empty
|
||||||
|
fi
|
||||||
|
elif [ -x /usr/sbin/ssmtp ] ; then
|
||||||
|
echo '<<<postfix_mailq>>>'
|
||||||
|
mailq 2>&1 | sed 's/^[^:]*: \(.*\)/\1/' | tail -n 6
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Check status of qmail mailqueue
|
||||||
|
if type qmail-qstat >/dev/null
|
||||||
|
then
|
||||||
|
echo "<<<qmail_stats>>>"
|
||||||
|
qmail-qstat
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check status of OMD sites
|
||||||
|
if type omd >/dev/null
|
||||||
|
then
|
||||||
|
run_cached -s omd_status 60 "omd status --bare --auto"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Welcome the ZFS check on Linux
|
||||||
|
# We do not endorse running ZFS on linux if your vendor doesnt support it ;)
|
||||||
|
# check zpool status
|
||||||
|
if type zpool >/dev/null; then
|
||||||
|
echo "<<<zpool_status>>>"
|
||||||
|
zpool status -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Fileinfo-Check: put patterns for files into /etc/check_mk/fileinfo.cfg
|
||||||
|
if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
|
||||||
|
echo '<<<fileinfo:sep(124)>>>'
|
||||||
|
date +%s
|
||||||
|
stat -c "%n|%s|%Y" $(cat "$MK_CONFDIR/fileinfo.cfg")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get stats about OMD monitoring cores running on this machine.
|
||||||
|
# Since cd is a shell builtin the check does not affect the performance
|
||||||
|
# on non-OMD machines.
|
||||||
|
if cd /omd/sites
|
||||||
|
then
|
||||||
|
echo '<<<livestatus_status:sep(59)>>>'
|
||||||
|
for site in *
|
||||||
|
do
|
||||||
|
if [ -S "/omd/sites/$site/tmp/run/live" ] ; then
|
||||||
|
echo "[$site]"
|
||||||
|
echo -e "GET status" | waitmax 3 /omd/sites/$site/bin/unixcat /omd/sites/$site/tmp/run/live
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get statistics about monitored jobs. Below the job directory there
|
||||||
|
# is a sub directory per user that ran a job. That directory must be
|
||||||
|
# owned by the user so that a symlink or hardlink attack for reading
|
||||||
|
# arbitrary files can be avoided.
|
||||||
|
if pushd $MK_VARDIR/job >/dev/null; then
|
||||||
|
echo '<<<job>>>'
|
||||||
|
for username in *
|
||||||
|
do
|
||||||
|
if [ -d "$username" ] && cd "$username" ; then
|
||||||
|
su "$username" -c "head -n -0 -v *"
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Gather thermal information provided e.g. by acpi
|
||||||
|
# At the moment only supporting thermal sensors
|
||||||
|
if ls /sys/class/thermal/thermal_zone* >/dev/null 2>&1; then
|
||||||
|
echo '<<<lnx_thermal>>>'
|
||||||
|
for F in /sys/class/thermal/thermal_zone*; do
|
||||||
|
echo -n "${F##*/} "
|
||||||
|
if [ ! -e $F/mode ] ; then echo -n "- " ; fi
|
||||||
|
cat $F/{mode,type,temp,trip_point_*} | tr \\n " "
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Libelle Business Shadow
|
||||||
|
if type trd >/dev/null; then
|
||||||
|
echo "<<<libelle_business_shadow:sep(58)>>>"
|
||||||
|
trd -s
|
||||||
|
fi
|
||||||
|
|
||||||
|
# MK's Remote Plugin Executor
|
||||||
|
if [ -e "$MK_CONFDIR/mrpe.cfg" ]
|
||||||
|
then
|
||||||
|
echo '<<<mrpe>>>'
|
||||||
|
grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/mrpe.cfg" | \
|
||||||
|
while read descr cmdline
|
||||||
|
do
|
||||||
|
PLUGIN=${cmdline%% *}
|
||||||
|
OUTPUT=$(eval "$cmdline")
|
||||||
|
echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Local checks
|
||||||
|
echo '<<<local>>>'
|
||||||
|
if cd $LOCALDIR ; then
|
||||||
|
for skript in $(ls) ; do
|
||||||
|
if [ -f "$skript" -a -x "$skript" ] ; then
|
||||||
|
./$skript
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Call some plugins only every X'th minute
|
||||||
|
for skript in [1-9]*/* ; do
|
||||||
|
if [ -x "$skript" ] ; then
|
||||||
|
run_cached local_${skript//\//\\} ${skript%/*} "$skript"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Plugins
|
||||||
|
if cd $PLUGINSDIR ; then
|
||||||
|
for skript in $(ls) ; do
|
||||||
|
if [ -f "$skript" -a -x "$skript" ] ; then
|
||||||
|
./$skript
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Call some plugins only every Xth minute
|
||||||
|
for skript in [1-9]*/* ; do
|
||||||
|
if [ -x "$skript" ] ; then
|
||||||
|
run_cached plugins_${skript//\//\\} ${skript%/*} "$skript"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Agent output snippets created by cronjobs, etc.
|
||||||
|
if [ -d "$SPOOLDIR" ]
|
||||||
|
then
|
||||||
|
pushd "$SPOOLDIR" > /dev/null
|
||||||
|
now=$(date +%s)
|
||||||
|
|
||||||
|
for file in *
|
||||||
|
do
|
||||||
|
# output every file in this directory. If the file is prefixed
|
||||||
|
# with a number, then that number is the maximum age of the
|
||||||
|
# file in seconds. If the file is older than that, it is ignored.
|
||||||
|
maxage=""
|
||||||
|
part="$file"
|
||||||
|
|
||||||
|
# Each away all digits from the front of the filename and
|
||||||
|
# collect them in the variable maxage.
|
||||||
|
while [ "${part/#[0-9]/}" != "$part" ]
|
||||||
|
do
|
||||||
|
maxage=$maxage${part:0:1}
|
||||||
|
part=${part:1}
|
||||||
|
done
|
||||||
|
|
||||||
|
# If there is at least one digit, than we honor that.
|
||||||
|
if [ "$maxage" ] ; then
|
||||||
|
mtime=$(stat -c %Y "$file")
|
||||||
|
if [ $((now - mtime)) -gt $maxage ] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Output the file
|
||||||
|
cat "$file"
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Detects which OS and if it is Linux then it will detect which Linux Distribution.
|
||||||
|
|
||||||
|
OS=`uname -s`
|
||||||
|
REV=`uname -r`
|
||||||
|
MACH=`uname -m`
|
||||||
|
|
||||||
|
if [ "${OS}" = "SunOS" ] ; then
|
||||||
|
OS=Solaris
|
||||||
|
ARCH=`uname -p`
|
||||||
|
OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
|
||||||
|
|
||||||
|
elif [ "${OS}" = "AIX" ] ; then
|
||||||
|
OSSTR="${OS} `oslevel` (`oslevel -r`)"
|
||||||
|
|
||||||
|
elif [ "${OS}" = "Linux" ] ; then
|
||||||
|
KERNEL=`uname -r`
|
||||||
|
|
||||||
|
if [ -f /etc/fedora-release ]; then
|
||||||
|
DIST=$(cat /etc/fedora-release | awk '{print $1}')
|
||||||
|
REV=`cat /etc/fedora-release | sed s/.*release\ // | sed s/\ .*//`
|
||||||
|
|
||||||
|
elif [ -f /etc/redhat-release ] ; then
|
||||||
|
DIST=$(cat /etc/redhat-release | awk '{print $1}')
|
||||||
|
if [ "${DIST}" = "CentOS" ]; then
|
||||||
|
DIST="CentOS"
|
||||||
|
elif [ "${DIST}" = "Mandriva" ]; then
|
||||||
|
DIST="Mandriva"
|
||||||
|
PSEUDONAME=`cat /etc/mandriva-release | sed s/.*\(// | sed s/\)//`
|
||||||
|
REV=`cat /etc/mandriva-release | sed s/.*release\ // | sed s/\ .*//`
|
||||||
|
elif [ -f /etc/oracle-release ]; then
|
||||||
|
DIST="Oracle"
|
||||||
|
else
|
||||||
|
DIST="RedHat"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PSEUDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
|
||||||
|
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
|
||||||
|
|
||||||
|
elif [ -f /etc/mandrake-release ] ; then
|
||||||
|
DIST='Mandrake'
|
||||||
|
PSEUDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
|
||||||
|
REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
|
||||||
|
|
||||||
|
elif [ -f /etc/devuan_version ] ; then
|
||||||
|
DIST="Devuan `cat /etc/devuan_version`"
|
||||||
|
REV=""
|
||||||
|
|
||||||
|
elif [ -f /etc/debian_version ] ; then
|
||||||
|
DIST="Debian `cat /etc/debian_version`"
|
||||||
|
REV=""
|
||||||
|
ID=`lsb_release -i | awk -F ':' '{print $2}' | sed 's/ //g'`
|
||||||
|
if [ "${ID}" = "Raspbian" ] ; then
|
||||||
|
DIST="Raspbian `cat /etc/debian_version`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ -f /etc/gentoo-release ] ; then
|
||||||
|
DIST="Gentoo"
|
||||||
|
REV=$(tr -d '[[:alpha:]]' </etc/gentoo-release | tr -d " ")
|
||||||
|
|
||||||
|
elif [ -f /etc/arch-release ] ; then
|
||||||
|
DIST="Arch Linux"
|
||||||
|
REV="" # Omit version since Arch Linux uses rolling releases
|
||||||
|
IGNORE_LSB=1 # /etc/lsb-release would overwrite $REV with "rolling"
|
||||||
|
|
||||||
|
elif [ -f /etc/os-release ] ; then
|
||||||
|
DIST=$(grep '^NAME=' /etc/os-release | cut -d= -f2- | tr -d '"')
|
||||||
|
REV=$(grep '^VERSION_ID=' /etc/os-release | cut -d= -f2- | tr -d '"')
|
||||||
|
|
||||||
|
elif [ -f /etc/openwrt_version ] ; then
|
||||||
|
DIST="OpenWrt"
|
||||||
|
REV=$(cat /etc/openwrt_version)
|
||||||
|
|
||||||
|
elif [ -f /etc/pld-release ] ; then
|
||||||
|
DIST=$(cat /etc/pld-release)
|
||||||
|
REV=""
|
||||||
|
|
||||||
|
elif [ -f /etc/SuSE-release ] ; then
|
||||||
|
DIST=$(echo SLES $(grep VERSION /etc/SuSE-release | cut -d = -f 2 | tr -d " "))
|
||||||
|
REV=$(echo SP$(grep PATCHLEVEL /etc/SuSE-release | cut -d = -f 2 | tr -d " "))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/lsb-release -a "${IGNORE_LSB}" != 1 ] ; then
|
||||||
|
LSB_DIST=$(lsb_release -si)
|
||||||
|
LSB_REV=$(lsb_release -sr)
|
||||||
|
if [ "$LSB_DIST" != "" ] ; then
|
||||||
|
DIST=$LSB_DIST
|
||||||
|
fi
|
||||||
|
if [ "$LSB_REV" != "" ] ; then
|
||||||
|
REV=$LSB_REV
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "`uname -a | awk '{print $(NF)}'`" = "DD-WRT" ] ; then
|
||||||
|
DIST="dd-wrt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${REV}" ]
|
||||||
|
then
|
||||||
|
OSSTR="${DIST} ${REV}"
|
||||||
|
else
|
||||||
|
OSSTR="${DIST}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "${OS}" = "Darwin" ] ; then
|
||||||
|
if [ -f /usr/bin/sw_vers ] ; then
|
||||||
|
OSSTR=`/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' '`
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "${OS}" = "FreeBSD" ] ; then
|
||||||
|
OSSTR=`/usr/bin/uname -mior`
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ${OSSTR}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo '<<<dmi>>>'
|
||||||
|
|
||||||
|
# requires dmidecode
|
||||||
|
for FIELD in bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency
|
||||||
|
do
|
||||||
|
echo $FIELD="$(dmidecode -s $FIELD | grep -v '^#')"
|
||||||
|
done
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Cache the file for 30 minutes
|
||||||
|
# If you want to override this, put the command in cron.
|
||||||
|
# We cache because it is a 1sec delay, which is painful for the poller
|
||||||
|
if [ -x /usr/bin/dpkg-query ]; then
|
||||||
|
DATE=$(date +%s)
|
||||||
|
FILE=/var/cache/librenms/agent-local-dpkg
|
||||||
|
|
||||||
|
[ -d /var/cache/librenms ] || mkdir -p /var/cache/librenms
|
||||||
|
|
||||||
|
if [ ! -e $FILE ]; then
|
||||||
|
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep " installed "|cut -d\ -f4- > $FILE
|
||||||
|
fi
|
||||||
|
FILEMTIME=$(stat -c %Y $FILE)
|
||||||
|
FILEAGE=$(($DATE-$FILEMTIME))
|
||||||
|
if [ $FILEAGE -gt 1800 ]; then
|
||||||
|
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep " installed "|cut -d\ -f4- > $FILE
|
||||||
|
fi
|
||||||
|
echo "<<<dpkg>>>"
|
||||||
|
cat $FILE
|
||||||
|
fi
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Please make sure the paths below are correct.
|
||||||
|
# Alternatively you can put them in $0.conf, meaning if you've named
|
||||||
|
# this script ntp-client then it must go in ntp-client.conf .
|
||||||
|
#
|
||||||
|
# NTPQV output version of "ntpq -c rv"
|
||||||
|
# Version 4 is the most common and up to date version.
|
||||||
|
#
|
||||||
|
# If you are unsure, which to set, run this script and make sure that
|
||||||
|
# the JSON output variables match that in "ntpq -c rv".
|
||||||
|
#
|
||||||
|
################################################################
|
||||||
|
# Don't change anything unless you know what are you doing #
|
||||||
|
################################################################
|
||||||
|
BIN_NTPQ='/usr/bin/env ntpq'
|
||||||
|
BIN_GREP='/usr/bin/env grep'
|
||||||
|
BIN_AWK='/usr/bin/env awk'
|
||||||
|
|
||||||
|
CONFIG=$0".conf"
|
||||||
|
if [ -f "$CONFIG" ]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
NTP_OFFSET=$($BIN_NTPQ -c rv | $BIN_GREP "offset" | $BIN_AWK -Foffset= '{print $2}' | $BIN_AWK -F, '{print $1}')
|
||||||
|
NTP_FREQUENCY=$($BIN_NTPQ -c rv | $BIN_GREP "frequency" | $BIN_AWK -Ffrequency= '{print $2}' | $BIN_AWK -F, '{print $1}')
|
||||||
|
NTP_SYS_JITTER=$($BIN_NTPQ -c rv | $BIN_GREP "sys_jitter" | $BIN_AWK -Fsys_jitter= '{print $2}' | $BIN_AWK -F, '{print $1}')
|
||||||
|
NTP_CLK_JITTER=$($BIN_NTPQ -c rv | $BIN_GREP "clk_jitter" | $BIN_AWK -Fclk_jitter= '{print $2}' | $BIN_AWK -F, '{print $1}')
|
||||||
|
NTP_WANDER=$($BIN_NTPQ -c rv | $BIN_GREP "clk_wander" | $BIN_AWK -Fclk_wander= '{print $2}' | $BIN_AWK -F, '{print $1}')
|
||||||
|
NTP_VERSION=$($BIN_NTPQ -c rv | $BIN_GREP "version" | $BIN_AWK -F'ntpd ' '{print $2}' | $BIN_AWK -F. '{print $1}')
|
||||||
|
|
||||||
|
echo '{"data":{"offset":"'"$NTP_OFFSET"'","frequency":"'"$NTP_FREQUENCY"'","sys_jitter":"'"$NTP_SYS_JITTER"'","clk_jitter":"'"$NTP_CLK_JITTER"'","clk_wander":"'"$NTP_WANDER"'"},"version":"'"$NTP_VERSION"'","error":"0","errorString":""}'
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Please make sure the paths below are correct.
|
||||||
|
# Alternatively you can put them in $0.conf, meaning if you've named
|
||||||
|
# this script ntp-client.sh then it must go in ntp-client.sh.conf .
|
||||||
|
#
|
||||||
|
# NTPQV output version of "ntpq -c rv"
|
||||||
|
# p1 DD-WRT and some other outdated linux distros
|
||||||
|
# p11 FreeBSD 11 and any linux distro that is up to date
|
||||||
|
#
|
||||||
|
# If you are unsure, which to set, run this script and make sure that
|
||||||
|
# the JSON output variables match that in "ntpq -c rv".
|
||||||
|
#
|
||||||
|
BIN_NTPD='/usr/bin/env ntpd'
|
||||||
|
BIN_NTPQ='/usr/bin/env ntpq'
|
||||||
|
BIN_NTPDC='/usr/bin/env ntpdc'
|
||||||
|
BIN_GREP='/usr/bin/env grep'
|
||||||
|
BIN_TR='/usr/bin/env tr'
|
||||||
|
BIN_CUT='/usr/bin/env cut'
|
||||||
|
BIN_SED="/usr/bin/env sed"
|
||||||
|
BIN_AWK='/usr/bin/env awk'
|
||||||
|
NTPQV="p11"
|
||||||
|
################################################################
|
||||||
|
# Don't change anything unless you know what are you doing #
|
||||||
|
################################################################
|
||||||
|
CONFIG=$0".conf"
|
||||||
|
if [ -f $CONFIG ]; then
|
||||||
|
. $CONFIG
|
||||||
|
fi
|
||||||
|
VERSION=1
|
||||||
|
|
||||||
|
STRATUM=`$BIN_NTPQ -c rv | $BIN_GREP -Eow "stratum=[0-9]+" | $BIN_CUT -d "=" -f 2`
|
||||||
|
|
||||||
|
# parse the ntpq info that requires version specific info
|
||||||
|
NTPQ_RAW=`$BIN_NTPQ -c rv | $BIN_GREP jitter | $BIN_SED 's/[[:alpha:]=,_]/ /g'`
|
||||||
|
if [ $NTPQV = "p11" ]; then
|
||||||
|
OFFSET=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $3}'`
|
||||||
|
FREQUENCY=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $4}'`
|
||||||
|
SYS_JITTER=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $5}'`
|
||||||
|
CLK_JITTER=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $6}'`
|
||||||
|
CLK_WANDER=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $7}'`
|
||||||
|
fi
|
||||||
|
if [ $NTPQV = "p1" ]; then
|
||||||
|
OFFSET=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $2}'`
|
||||||
|
FREQUENCY=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $3}'`
|
||||||
|
SYS_JITTER=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $4}'`
|
||||||
|
CLK_JITTER=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $5}'`
|
||||||
|
CLK_WANDER=`echo $NTPQ_RAW | $BIN_AWK -F ' ' '{print $6}'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
VER=`$BIN_NTPD --version`
|
||||||
|
if [ "$VER" = '4.2.6p5' ]; then
|
||||||
|
USECMD=`echo $BIN_NTPDC -c iostats`
|
||||||
|
else
|
||||||
|
USECMD=`echo $BIN_NTPQ -c iostats localhost`
|
||||||
|
fi
|
||||||
|
CMD2=`$USECMD | $BIN_TR -d ' ' | $BIN_CUT -d : -f 2 | $BIN_TR '\n' ' '`
|
||||||
|
|
||||||
|
TIMESINCERESET=`echo $CMD2 | $BIN_AWK -F ' ' '{print $1}'`
|
||||||
|
RECEIVEDBUFFERS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $2}'`
|
||||||
|
FREERECEIVEBUFFERS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $3}'`
|
||||||
|
USEDRECEIVEBUFFERS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $4}'`
|
||||||
|
LOWWATERREFILLS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $5}'`
|
||||||
|
DROPPEDPACKETS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $6}'`
|
||||||
|
IGNOREDPACKETS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $7}'`
|
||||||
|
RECEIVEDPACKETS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $8}'`
|
||||||
|
PACKETSSENT=`echo $CMD2 | $BIN_AWK -F ' ' '{print $9}'`
|
||||||
|
PACKETSENDFAILURES=`echo $CMD2 | $BIN_AWK -F ' ' '{print $10}'`
|
||||||
|
INPUTWAKEUPS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $11}'`
|
||||||
|
USEFULINPUTWAKEUPS=`echo $CMD2 | $BIN_AWK -F ' ' '{print $12}'`
|
||||||
|
|
||||||
|
echo '{"data":{"offset":"'$OFFSET\
|
||||||
|
'","frequency":"'$FREQUENCY\
|
||||||
|
'","sys_jitter":"'$SYS_JITTER\
|
||||||
|
'","clk_jitter":"'$CLK_JITTER\
|
||||||
|
'","clk_wander":"'$CLK_WANDER\
|
||||||
|
'","stratum":"'$STRATUM\
|
||||||
|
'","time_since_reset":"'$TIMESINCERESET\
|
||||||
|
'","receive_buffers":"'$RECEIVEDBUFFERS\
|
||||||
|
'","free_receive_buffers":"'$FREERECEIVEBUFFERS\
|
||||||
|
'","used_receive_buffers":"'$USEDRECEIVEBUFFERS\
|
||||||
|
'","low_water_refills":"'$LOWWATERREFILLS\
|
||||||
|
'","dropped_packets":"'$DROPPEDPACKETS\
|
||||||
|
'","ignored_packets":"'$IGNOREDPACKETS\
|
||||||
|
'","received_packets":"'$RECEIVEDPACKETS\
|
||||||
|
'","packets_sent":"'$PACKETSSENT\
|
||||||
|
'","packet_send_failures":"'$PACKETSENDFAILURES\
|
||||||
|
'","input_wakeups":"'$PACKETSENDFAILURES\
|
||||||
|
'","useful_input_wakeups":"'$USEFULINPUTWAKEUPS\
|
||||||
|
'"},"error":"0","errorString":"","version":"'$VERSION'"}'
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
################################################################
|
||||||
|
# copy this script to /etc/snmp/ and make it executable: #
|
||||||
|
# chmod +x /etc/snmp/os-updates.sh #
|
||||||
|
# ------------------------------------------------------------ #
|
||||||
|
# edit your snmpd.conf and include: #
|
||||||
|
# extend osupdate /opt/os-updates.sh #
|
||||||
|
#--------------------------------------------------------------#
|
||||||
|
# restart snmpd and activate the app for desired host #
|
||||||
|
#--------------------------------------------------------------#
|
||||||
|
# please make sure you have the path/binaries below #
|
||||||
|
################################################################
|
||||||
|
BIN_WC='/usr/bin/wc'
|
||||||
|
BIN_GREP='/bin/grep'
|
||||||
|
CMD_GREP='-c'
|
||||||
|
CMD_WC='-l'
|
||||||
|
BIN_ZYPPER='/usr/bin/zypper'
|
||||||
|
CMD_ZYPPER='-q lu'
|
||||||
|
BIN_YUM='/usr/bin/yum'
|
||||||
|
CMD_YUM='-q check-update'
|
||||||
|
BIN_DNF='/usr/bin/dnf'
|
||||||
|
CMD_DNF='-q check-update'
|
||||||
|
BIN_APT='/usr/bin/apt-get'
|
||||||
|
CMD_APT='-qq -s upgrade'
|
||||||
|
BIN_PACMAN='/usr/bin/pacman'
|
||||||
|
CMD_PACMAN='-Sup'
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Don't change anything unless you know what are you doing #
|
||||||
|
################################################################
|
||||||
|
if [ -f $BIN_ZYPPER ]; then
|
||||||
|
# OpenSUSE
|
||||||
|
UPDATES=`$BIN_ZYPPER $CMD_ZYPPER | $BIN_WC $CMD_WC`
|
||||||
|
if [ $UPDATES -ge 2 ]; then
|
||||||
|
echo $(($UPDATES-2));
|
||||||
|
else
|
||||||
|
echo "0";
|
||||||
|
fi
|
||||||
|
elif [ -f $BIN_DNF ]; then
|
||||||
|
# Fedora
|
||||||
|
UPDATES=`$BIN_DNF $CMD_DNF | $BIN_WC $CMD_WC`
|
||||||
|
if [ $UPDATES -ge 1 ]; then
|
||||||
|
echo $(($UPDATES-1));
|
||||||
|
else
|
||||||
|
echo "0";
|
||||||
|
fi
|
||||||
|
elif [ -f $BIN_PACMAN ]; then
|
||||||
|
# Arch
|
||||||
|
UPDATES=`$BIN_PACMAN $CMD_PACMAN | $BIN_WC $CMD_WC`
|
||||||
|
if [ $UPDATES -ge 1 ]; then
|
||||||
|
echo $(($UPDATES-1));
|
||||||
|
else
|
||||||
|
echo "0";
|
||||||
|
fi
|
||||||
|
elif [ -f $BIN_YUM ]; then
|
||||||
|
# CentOS / Redhat
|
||||||
|
UPDATES=`$BIN_YUM $CMD_YUM | $BIN_WC $CMD_WC`
|
||||||
|
if [ $UPDATES -ge 1 ]; then
|
||||||
|
echo $(($UPDATES-1));
|
||||||
|
else
|
||||||
|
echo "0";
|
||||||
|
fi
|
||||||
|
elif [ -f $BIN_APT ]; then
|
||||||
|
# Debian / Devuan / Ubuntu
|
||||||
|
UPDATES=`$BIN_APT $CMD_APT | $BIN_GREP $CMD_GREP 'Inst'`
|
||||||
|
if [ $UPDATES -ge 1 ]; then
|
||||||
|
echo $UPDATES;
|
||||||
|
else
|
||||||
|
echo "0";
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "0";
|
||||||
|
fi
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Written by Valec 2006. Steal and share.
|
||||||
|
#Get postfix queue lengths
|
||||||
|
|
||||||
|
#extend mailq /opt/observer/scripts/getmailq.sh
|
||||||
|
|
||||||
|
QUEUES="incoming active deferred hold"
|
||||||
|
|
||||||
|
for i in $QUEUES; do
|
||||||
|
COUNT=$(qshape "$i" | grep TOTAL | awk '{print $2}')
|
||||||
|
printf "$COUNT\n"
|
||||||
|
done
|
||||||
@@ -0,0 +1,548 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
# add this to your snmpd.conf file as below
|
||||||
|
# extend postfixdetailed /etc/snmp/postfixdetailed
|
||||||
|
|
||||||
|
# The cache file to use.
|
||||||
|
my $cache='/var/cache/postfixdetailed';
|
||||||
|
|
||||||
|
# the location of pflogsumm
|
||||||
|
my $pflogsumm='/usr/bin/env pflogsumm';
|
||||||
|
|
||||||
|
#totals
|
||||||
|
# 847 received = received
|
||||||
|
# 852 delivered = delivered
|
||||||
|
# 0 forwarded = forwarded
|
||||||
|
# 3 deferred (67 deferrals)= deferred
|
||||||
|
# 0 bounced = bounced
|
||||||
|
# 593 rejected (41%) = rejected
|
||||||
|
# 0 reject warnings = rejectw
|
||||||
|
# 0 held = held
|
||||||
|
# 0 discarded (0%) = discarded
|
||||||
|
|
||||||
|
# 16899k bytes received = bytesr
|
||||||
|
# 18009k bytes delivered = bytesd
|
||||||
|
# 415 senders = senders
|
||||||
|
# 266 sending hosts/domains = sendinghd
|
||||||
|
# 15 recipients = recipients
|
||||||
|
# 9 recipient hosts/domains = recipienthd
|
||||||
|
|
||||||
|
######message deferral detail
|
||||||
|
#Connection refused = deferralcr
|
||||||
|
#Host is down = deferralhid
|
||||||
|
|
||||||
|
########message reject detail
|
||||||
|
#Client host rejected = chr
|
||||||
|
#Helo command rejected: need fully-qualified hostname = hcrnfqh
|
||||||
|
#Sender address rejected: Domain not found = sardnf
|
||||||
|
#Sender address rejected: not owned by user = sarnobu
|
||||||
|
#blocked using = bu
|
||||||
|
#Recipient address rejected: User unknown = raruu
|
||||||
|
#Helo command rejected: Invalid name = hcrin
|
||||||
|
#Sender address rejected: need fully-qualified address = sarnfqa
|
||||||
|
#Recipient address rejected: Domain not found = rardnf
|
||||||
|
#Recipient address rejected: need fully-qualified address = rarnfqa
|
||||||
|
#Improper use of SMTP command pipelining = iuscp
|
||||||
|
#Message size exceeds fixed limit = msefl
|
||||||
|
#Server configuration error = sce
|
||||||
|
#Server configuration problem = scp
|
||||||
|
#unknown reject reason = urr
|
||||||
|
|
||||||
|
my $old='';
|
||||||
|
|
||||||
|
#reads in the old data if it exists
|
||||||
|
if ( -f $cache ){
|
||||||
|
open(my $fh, "<", $cache) or die "Can't open '".$cache."'";
|
||||||
|
# if this is over 2048, something is most likely wrong
|
||||||
|
read($fh , $old , 2048);
|
||||||
|
close($fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
my ( $received,
|
||||||
|
$delivered,
|
||||||
|
$forwarded,
|
||||||
|
$deferred,
|
||||||
|
$bounced,
|
||||||
|
$rejected,
|
||||||
|
$rejectw,
|
||||||
|
$held,
|
||||||
|
$discarded,
|
||||||
|
$bytesr,
|
||||||
|
$bytesd,
|
||||||
|
$senders,
|
||||||
|
$sendinghd,
|
||||||
|
$recipients,
|
||||||
|
$recipienthd,
|
||||||
|
$deferralcr,
|
||||||
|
$deferralhid,
|
||||||
|
$chr,
|
||||||
|
$hcrnfqh,
|
||||||
|
$sardnf,
|
||||||
|
$sarnobu,
|
||||||
|
$bu,
|
||||||
|
$raruu,
|
||||||
|
$hcrin,
|
||||||
|
$sarnfqa,
|
||||||
|
$rardnf,
|
||||||
|
$rarnfqa,
|
||||||
|
$iuscp,
|
||||||
|
$sce,
|
||||||
|
$scp,
|
||||||
|
$urr,
|
||||||
|
$msefl) = split ( /\n/, $old );
|
||||||
|
|
||||||
|
if ( ! defined( $received ) ){ $received=0; }
|
||||||
|
if ( ! defined( $delivered ) ){ $delivered=0; }
|
||||||
|
if ( ! defined( $forwarded ) ){ $forwarded=0; }
|
||||||
|
if ( ! defined( $deferred ) ){ $deferred=0; }
|
||||||
|
if ( ! defined( $bounced ) ){ $bounced=0; }
|
||||||
|
if ( ! defined( $rejected ) ){ $rejected=0; }
|
||||||
|
if ( ! defined( $rejectw ) ){ $rejectw=0; }
|
||||||
|
if ( ! defined( $held ) ){ $held=0; }
|
||||||
|
if ( ! defined( $discarded ) ){ $discarded=0; }
|
||||||
|
if ( ! defined( $bytesr ) ){ $bytesr=0; }
|
||||||
|
if ( ! defined( $bytesd ) ){ $bytesd=0; }
|
||||||
|
if ( ! defined( $senders ) ){ $senders=0; }
|
||||||
|
if ( ! defined( $sendinghd ) ){ $sendinghd=0; }
|
||||||
|
if ( ! defined( $recipients ) ){ $recipients=0; }
|
||||||
|
if ( ! defined( $recipienthd ) ){ $recipienthd=0; }
|
||||||
|
if ( ! defined( $deferralcr ) ){ $deferralcr=0; }
|
||||||
|
if ( ! defined( $deferralhid ) ){ $deferralhid=0; }
|
||||||
|
if ( ! defined( $chr ) ){ $chr=0; }
|
||||||
|
if ( ! defined( $hcrnfqh ) ){ $hcrnfqh=0; }
|
||||||
|
if ( ! defined( $sardnf ) ){ $sardnf=0; }
|
||||||
|
if ( ! defined( $sarnobu ) ){ $sarnobu=0; }
|
||||||
|
if ( ! defined( $bu ) ){ $bu=0; }
|
||||||
|
if ( ! defined( $raruu ) ){ $raruu=0; }
|
||||||
|
if ( ! defined( $hcrin ) ){ $hcrin=0; }
|
||||||
|
if ( ! defined( $sarnfqa ) ){ $sarnfqa=0; }
|
||||||
|
if ( ! defined( $rardnf ) ){ $rardnf=0; }
|
||||||
|
if ( ! defined( $rarnfqa ) ){ $rarnfqa=0; }
|
||||||
|
if ( ! defined( $iuscp ) ){ $iuscp=0; }
|
||||||
|
if ( ! defined( $msefl ) ){ $msefl=0; }
|
||||||
|
if ( ! defined( $sce ) ){ $sce=0; }
|
||||||
|
if ( ! defined( $scp ) ){ $scp=0; }
|
||||||
|
if ( ! defined( $urr ) ){ $urr=0; }
|
||||||
|
|
||||||
|
#init current variables
|
||||||
|
my $receivedC=0;
|
||||||
|
my $deliveredC=0;
|
||||||
|
my $forwardedC=0;
|
||||||
|
my $deferredC=0;
|
||||||
|
my $bouncedC=0;
|
||||||
|
my $rejectedC=0;
|
||||||
|
my $rejectwC=0;
|
||||||
|
my $heldC=0;
|
||||||
|
my $discardedC=0;
|
||||||
|
my $bytesrC=0;
|
||||||
|
my $bytesdC=0;
|
||||||
|
my $sendersC=0;
|
||||||
|
my $sendinghdC=0;
|
||||||
|
my $recipientsC=0;
|
||||||
|
my $recipienthdC=0;
|
||||||
|
my $deferralcrC=0;
|
||||||
|
my $deferralhidC=0;
|
||||||
|
my $hcrnfqhC=0;
|
||||||
|
my $sardnfC=0;
|
||||||
|
my $sarnobuC=0;
|
||||||
|
my $buC=0;
|
||||||
|
my $raruuC=0;
|
||||||
|
my $hcrinC=0;
|
||||||
|
my $sarnfqaC=0;
|
||||||
|
my $rardnfC=0;
|
||||||
|
my $rarnfqaC=0;
|
||||||
|
my $iuscpC=0;
|
||||||
|
my $mseflC=0;
|
||||||
|
my $sceC=0;
|
||||||
|
my $scpC=0;
|
||||||
|
my $urrC=0;
|
||||||
|
|
||||||
|
sub newValue{
|
||||||
|
my $old=$_[0];
|
||||||
|
my $new=$_[1];
|
||||||
|
|
||||||
|
#if new is undefined, just default to 0... this should never happen
|
||||||
|
if ( !defined( $new ) ){
|
||||||
|
warn('New not defined');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sets it to 0 if old is not defined
|
||||||
|
if ( !defined( $old ) ){
|
||||||
|
warn('Old not defined');
|
||||||
|
$old=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#make sure they are both numberic and if not set to zero
|
||||||
|
if( $old !~ /^[0123456789]*$/ ){
|
||||||
|
warn('Old not numeric');
|
||||||
|
$old=0;
|
||||||
|
}
|
||||||
|
if( $new !~ /^[0123456789]*$/ ){
|
||||||
|
warn('New not numeric');
|
||||||
|
$new=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#log rotation happened
|
||||||
|
if ( $old > $new ){
|
||||||
|
return $new;
|
||||||
|
};
|
||||||
|
|
||||||
|
return $new - $old;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
my $output=`$pflogsumm /var/log/maillog`;
|
||||||
|
|
||||||
|
#holds RBL values till the end when it is compared to the old one
|
||||||
|
my $buNew=0;
|
||||||
|
|
||||||
|
|
||||||
|
#holds client host rejected values till the end when it is compared to the old one
|
||||||
|
my $chrNew=0;
|
||||||
|
|
||||||
|
# holds recipient address rejected values till the end when it is compared to the old one
|
||||||
|
my $raruuNew=0;
|
||||||
|
|
||||||
|
#holds the current values for checking later
|
||||||
|
my $current='';
|
||||||
|
|
||||||
|
my @outputA=split( /\n/, $output );
|
||||||
|
my $int=0;
|
||||||
|
while ( defined( $outputA[$int] ) ){
|
||||||
|
my $line=$outputA[$int];
|
||||||
|
|
||||||
|
$line=~s/^ *//;
|
||||||
|
$line=~s/ +/ /g;
|
||||||
|
$line=~s/\)$//;
|
||||||
|
|
||||||
|
my $handled=0;
|
||||||
|
|
||||||
|
#received line
|
||||||
|
if ( ( $line =~ /[0123456789] received$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$receivedC=$line;
|
||||||
|
$received=newValue( $received, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#delivered line
|
||||||
|
if ( ( $line =~ /[0123456789] delivered$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$deliveredC=$line;
|
||||||
|
$delivered=newValue( $delivered, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#forward line
|
||||||
|
if ( ( $line =~ /[0123456789] forwarded$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$forwardedC=$line;
|
||||||
|
$forwarded=newValue( $forwarded, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#defereed line
|
||||||
|
if ( ( $line =~ /[0123456789] deferred \(/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$deferredC=$line;
|
||||||
|
$deferred=newValue( $deferred, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bounced line
|
||||||
|
if ( ( $line =~ /[0123456789] bounced$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$bouncedC=$line;
|
||||||
|
$bounced=newValue( $bounced, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#rejected line
|
||||||
|
if ( ( $line =~ /[0123456789] rejected \(/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$rejectedC=$line;
|
||||||
|
$rejected=newValue( $rejected, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#reject warning line
|
||||||
|
if ( ( $line =~ /[0123456789] reject warnings/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$rejectwC=$line;
|
||||||
|
$rejectw=newValue( $rejectw, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#held line
|
||||||
|
if ( ( $line =~ /[0123456789] held$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$heldC=$line;
|
||||||
|
$held=newValue( $held, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#discarded line
|
||||||
|
if ( ( $line =~ /[0123456789] discarded \(/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$discardedC=$line;
|
||||||
|
$discarded=newValue( $discarded, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bytes received line
|
||||||
|
if ( ( $line =~ /[0123456789kM] bytes received$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$line=~s/k/000/;
|
||||||
|
$line=~s/M/000000/;
|
||||||
|
$bytesrC=$line;
|
||||||
|
$bytesr=newValue( $bytesr, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bytes delivered line
|
||||||
|
if ( ( $line =~ /[0123456789kM] bytes delivered$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$line=~s/k/000/;
|
||||||
|
$line=~s/M/000000/;
|
||||||
|
$bytesdC=$line;
|
||||||
|
$bytesd=newValue( $bytesd, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#senders line
|
||||||
|
if ( ( $line =~ /[0123456789] senders$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$sendersC=$line;
|
||||||
|
$senders=newValue( $senders, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sendering hosts/domains line
|
||||||
|
if ( ( $line =~ /[0123456789] sending hosts\/domains$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$sendinghdC=$line;
|
||||||
|
$sendinghd=newValue( $sendinghd, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#recipients line
|
||||||
|
if ( ( $line =~ /[0123456789] recipients$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$recipientsC=$line;
|
||||||
|
$recipients=newValue( $recipients, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#recipients line
|
||||||
|
if ( ( $line =~ /[0123456789] recipient hosts\/domains$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$recipienthdC=$line;
|
||||||
|
$recipienthd=newValue( $recipienthd, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deferrals connectios refused
|
||||||
|
if ( ( $line =~ /[0123456789] 25\: Connection refused$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$deferralcrC=$line;
|
||||||
|
$deferralcr=newValue( $deferralcr, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deferrals Host is down
|
||||||
|
if ( ( $line =~ /Host is down$/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/ .*//;
|
||||||
|
$deferralcrC=$line;
|
||||||
|
$deferralhidC=$line;
|
||||||
|
$deferralhid=newValue( $deferralhid, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Client host rejected
|
||||||
|
if ( ( $line =~ /Client host rejected/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$chrNew=$chrNew + $line;
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Helo command rejected: need fully-qualified hostname
|
||||||
|
if ( ( $line =~ /Helo command rejected\: need fully\-qualified hostname/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$hcrnfqhC=$line;
|
||||||
|
$hcrnfqh=newValue( $hcrnfqh, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Sender address rejected: Domain not found
|
||||||
|
if ( ( $line =~ /Sender address rejected\: Domain not found/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$sardnfC=$line;
|
||||||
|
$sardnf=newValue( $sardnf, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Sender address rejected: not owned by user
|
||||||
|
if ( ( $line =~ /Sender address rejected\: not owned by user/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$sarnobuC=$line;
|
||||||
|
$sarnobu=newValue( $sarnobu, $line );
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blocked using
|
||||||
|
# These lines are RBLs so there will be more than one.
|
||||||
|
# Use $buNew to add them all up.
|
||||||
|
if ( ( $line =~ /blocked using/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$buNew=$buNew + $line;
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Recipient address rejected: User unknown
|
||||||
|
if ( ( $line =~ /Recipient address rejected\: User unknown/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$raruuNew=$raruuNew + $line;
|
||||||
|
$handled=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Helo command rejected: Invalid name
|
||||||
|
if ( ( $line =~ /Helo command rejected\: Invalid name/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$hcrinC=$line;
|
||||||
|
$hcrin=newValue( $hcrin, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#Sender address rejected: need fully-qualified address
|
||||||
|
if ( ( $line =~ /Sender address rejected\: need fully-qualified address/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$sarnfqaC=$line;
|
||||||
|
$sarnfqa=newValue( $sarnfqa, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#Recipient address rejected: Domain not found
|
||||||
|
if ( ( $line =~ /Recipient address rejected\: Domain not found/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$rardnfC=$line;
|
||||||
|
$rardnf=newValue( $rardnf, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#Improper use of SMTP command pipelining
|
||||||
|
if ( ( $line =~ /Improper use of SMTP command pipelining/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$iuscpC=$line;
|
||||||
|
$iuscp=newValue( $iuscp, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#Message size exceeds fixed limit
|
||||||
|
if ( ( $line =~ /Message size exceeds fixed limit/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$mseflC=$line;
|
||||||
|
$msefl=newValue( $msefl, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#Server configuration error
|
||||||
|
if ( ( $line =~ /Server configuration error/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$sceC=$line;
|
||||||
|
$sce=newValue( $sce, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#Server configuration problem
|
||||||
|
if ( ( $line =~ /Server configuration problem/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$scpC=$line;
|
||||||
|
$scp=newValue( $scp, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
#unknown reject reason
|
||||||
|
if ( ( $line =~ /unknown reject reason/ ) && ( ! $handled ) ){
|
||||||
|
$line=~s/.*\: //g;
|
||||||
|
$urrC=$line;
|
||||||
|
$urr=newValue( $urr, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
$int++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# final client host rejected total
|
||||||
|
$chr=newValue( $chr, $chrNew );
|
||||||
|
|
||||||
|
# final RBL total
|
||||||
|
$bu=newValue( $bu, $buNew );
|
||||||
|
|
||||||
|
# final recipient address rejected total
|
||||||
|
$raruu=newValue( $raruu, $raruuNew );
|
||||||
|
|
||||||
|
my $data=$received."\n".
|
||||||
|
$delivered."\n".
|
||||||
|
$forwarded."\n".
|
||||||
|
$deferred."\n".
|
||||||
|
$bounced."\n".
|
||||||
|
$rejected."\n".
|
||||||
|
$rejectw."\n".
|
||||||
|
$held."\n".
|
||||||
|
$discarded."\n".
|
||||||
|
$bytesr."\n".
|
||||||
|
$bytesd."\n".
|
||||||
|
$senders."\n".
|
||||||
|
$sendinghd."\n".
|
||||||
|
$recipients."\n".
|
||||||
|
$recipienthd."\n".
|
||||||
|
$deferralcr."\n".
|
||||||
|
$deferralhid."\n".
|
||||||
|
$chr."\n".
|
||||||
|
$hcrnfqh."\n".
|
||||||
|
$sardnf."\n".
|
||||||
|
$sarnobu."\n".
|
||||||
|
$bu."\n".
|
||||||
|
$raruu."\n".
|
||||||
|
$hcrin."\n".
|
||||||
|
$sarnfqa."\n".
|
||||||
|
$rardnf."\n".
|
||||||
|
$rarnfqa."\n".
|
||||||
|
$iuscp."\n".
|
||||||
|
$sce."\n".
|
||||||
|
$scp."\n".
|
||||||
|
$urr."\n".
|
||||||
|
$msefl."\n";
|
||||||
|
|
||||||
|
print $data;
|
||||||
|
|
||||||
|
my $current=$receivedC."\n".
|
||||||
|
$deliveredC."\n".
|
||||||
|
$forwardedC."\n".
|
||||||
|
$deferredC."\n".
|
||||||
|
$bouncedC."\n".
|
||||||
|
$rejectedC."\n".
|
||||||
|
$rejectwC."\n".
|
||||||
|
$heldC."\n".
|
||||||
|
$discardedC."\n".
|
||||||
|
$bytesrC."\n".
|
||||||
|
$bytesdC."\n".
|
||||||
|
$sendersC."\n".
|
||||||
|
$sendinghdC."\n".
|
||||||
|
$recipientsC."\n".
|
||||||
|
$recipienthdC."\n".
|
||||||
|
$deferralcrC."\n".
|
||||||
|
$deferralhidC."\n".
|
||||||
|
$chrNew."\n".
|
||||||
|
$hcrnfqhC."\n".
|
||||||
|
$sardnfC."\n".
|
||||||
|
$sarnobuC."\n".
|
||||||
|
$buNew."\n".
|
||||||
|
$raruuNew."\n".
|
||||||
|
$hcrinC."\n".
|
||||||
|
$sarnfqaC."\n".
|
||||||
|
$rardnfC."\n".
|
||||||
|
$rarnfqaC."\n".
|
||||||
|
$iuscpC."\n".
|
||||||
|
$sceC."\n".
|
||||||
|
$scpC."\n".
|
||||||
|
$urrC."\n".
|
||||||
|
$mseflC."\n";
|
||||||
|
|
||||||
|
open(my $fh, ">", $cache) or die "Can't open '".$cache."'";
|
||||||
|
print $fh $current;
|
||||||
|
close($fh);
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#######################################
|
||||||
|
# please read DOCS to succesfully get #
|
||||||
|
# raspberry sensors into your host #
|
||||||
|
#######################################
|
||||||
|
picmd='/usr/bin/vcgencmd'
|
||||||
|
pised='/bin/sed'
|
||||||
|
getTemp='measure_temp'
|
||||||
|
getVoltsCore='measure_volts core'
|
||||||
|
getVoltsRamC='measure_volts sdram_c'
|
||||||
|
getVoltsRamI='measure_volts sdram_i'
|
||||||
|
getVoltsRamP='measure_volts sdram_p'
|
||||||
|
getFreqArm='measure_clock arm'
|
||||||
|
getFreqCore='measure_clock core'
|
||||||
|
getStatusH264='codec_enabled H264'
|
||||||
|
getStatusMPG2='codec_enabled MPG2'
|
||||||
|
getStatusWVC1='codec_enabled WVC1'
|
||||||
|
getStatusMPG4='codec_enabled MPG4'
|
||||||
|
getStatusMJPG='codec_enabled MJPG'
|
||||||
|
getStatusWMV9='codec_enabled WMV9'
|
||||||
|
|
||||||
|
$picmd $getTemp | $pised 's|[^0-9.]||g'
|
||||||
|
$picmd "$getVoltsCore" | $pised 's|[^0-9.]||g'
|
||||||
|
$picmd "$getVoltsRamC" | $pised 's|[^0-9.]||g'
|
||||||
|
$picmd "$getVoltsRamI" | $pised 's|[^0-9.]||g'
|
||||||
|
$picmd "$getVoltsRamP" | $pised 's|[^0-9.]||g'
|
||||||
|
$picmd "$getFreqArm" | $pised 's/frequency([0-9]*)=//g'
|
||||||
|
$picmd "$getFreqCore" | $pised 's/frequency([0-9]*)=//g'
|
||||||
|
$picmd "$getStatusH264" | $pised 's/H264=//g'
|
||||||
|
$picmd "$getStatusMPG2" | $pised 's/MPG2=//g'
|
||||||
|
$picmd "$getStatusWVC1" | $pised 's/WVC1=//g'
|
||||||
|
$picmd "$getStatusMPG4" | $pised 's/MPG4=//g'
|
||||||
|
$picmd "$getStatusMJPG" | $pised 's/MJPG=//g'
|
||||||
|
$picmd "$getStatusWMV9" | $pised 's/WMV9=//g'
|
||||||
|
$picmd "$getStatusH264" | $pised 's/enabled/2/g'
|
||||||
|
$picmd "$getStatusMPG2" | $pised 's/enabled/2/g'
|
||||||
|
$picmd "$getStatusWVC1" | $pised 's/enabled/2/g'
|
||||||
|
$picmd "$getStatusMPG4" | $pised 's/enabled/2/g'
|
||||||
|
$picmd "$getStatusMJPG" | $pised 's/enabled/2/g'
|
||||||
|
$picmd "$getStatusWMV9" | $pised 's/enabled/2/g'
|
||||||
|
$picmd "$getStatusH264" | $pised 's/disabled/1/g'
|
||||||
|
$picmd "$getStatusMPG2" | $pised 's/disabled/1/g'
|
||||||
|
$picmd "$getStatusWVC1" | $pised 's/disabled/1/g'
|
||||||
|
$picmd "$getStatusMPG4" | $pised 's/disabled/1/g'
|
||||||
|
$picmd "$getStatusMJPG" | $pised 's/disabled/1/g'
|
||||||
|
$picmd "$getStatusWMV9" | $pised 's/disabled/1/g'
|
||||||
@@ -0,0 +1,929 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
#Copyright (c) 2024, Zane C. Bowers-Hadley
|
||||||
|
#All rights reserved.
|
||||||
|
#
|
||||||
|
#Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
#are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
#THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
=for comment
|
||||||
|
|
||||||
|
Add this to snmpd.conf like below.
|
||||||
|
|
||||||
|
extend smart /etc/snmp/smart
|
||||||
|
|
||||||
|
Then add to root's cron tab, if you have more than a few disks.
|
||||||
|
|
||||||
|
*/5 * * * * /etc/snmp/extends/smart -u
|
||||||
|
|
||||||
|
You will also need to create the config file, which defaults to the same path as the script,
|
||||||
|
but with .config appended. So if the script is located at /etc/snmp/smart, the config file
|
||||||
|
will be /etc/snmp/extends/smart.config. Alternatively you can also specific a config via -c.
|
||||||
|
|
||||||
|
Anything starting with a # is comment. The format for variables is $variable=$value. Empty
|
||||||
|
lines are ignored. Spaces and tabes at either the start or end of a line are ignored. Any
|
||||||
|
line with out a matched variable or # are treated as a disk.
|
||||||
|
|
||||||
|
#This is a comment
|
||||||
|
cache=/var/cache/smart
|
||||||
|
smartctl=/usr/local/sbin/smartctl
|
||||||
|
useSN=0
|
||||||
|
ada0
|
||||||
|
da5 /dev/da5 -d sat
|
||||||
|
twl0,0 /dev/twl0 -d 3ware,0
|
||||||
|
twl0,1 /dev/twl0 -d 3ware,1
|
||||||
|
twl0,2 /dev/twl0 -d 3ware,2
|
||||||
|
|
||||||
|
The variables are as below.
|
||||||
|
|
||||||
|
cache = The path to the cache file to use. Default: /var/cache/smart
|
||||||
|
smartctl = The path to use for smartctl. Default: /usr/bin/env smartctl
|
||||||
|
useSN = If set to 1, it will use the disks SN for reporting instead of the device name.
|
||||||
|
1 is the default. 0 will use the device name.
|
||||||
|
|
||||||
|
A disk line is can be as simple as just a disk name under /dev/. Such as in the config above
|
||||||
|
The line "ada0" would resolve to "/dev/ada0" and would be called with no special argument. If
|
||||||
|
a line has a space in it, everything before the space is treated as the disk name and is what
|
||||||
|
used for reporting and everything after that is used as the argument to be passed to smartctl.
|
||||||
|
|
||||||
|
If you want to guess at the configuration, call it with -g and it will print out what it thinks
|
||||||
|
it should be.
|
||||||
|
|
||||||
|
|
||||||
|
Switches:
|
||||||
|
|
||||||
|
-c <config> The config file to use.
|
||||||
|
-u Update
|
||||||
|
-p Pretty print the JSON.
|
||||||
|
-Z GZip+Base64 compress the results.
|
||||||
|
|
||||||
|
-g Guess at the config and print it to STDOUT
|
||||||
|
-C Enable manual checking for guess and cciss.
|
||||||
|
-S Set useSN to 0 when using -g
|
||||||
|
-t <test> Run the specified smart self test on all the devices.
|
||||||
|
-U When calling cciss_vol_status, call it with -u.
|
||||||
|
-G <modes> Guess modes to use. This is a comma seperated list.
|
||||||
|
Default :: scan-open,cciss-vol-status
|
||||||
|
|
||||||
|
Guess Modes:
|
||||||
|
|
||||||
|
- scan :: Use "--scan" with smartctl. "scan-open" will take presidence.
|
||||||
|
|
||||||
|
- scan-open :: Call smartctl with "--scan-open".
|
||||||
|
|
||||||
|
- cciss-vol-status :: Freebsd/Linux specific and if it sees /dev/sg0(on Linux) or
|
||||||
|
/dev/ciss0(on FreebSD) it will attempt to find drives via cciss-vol-status,
|
||||||
|
and then optionally checking for disks via smrtctl if -C is given. Should be noted
|
||||||
|
though that -C will not find drives that are currently missing/failed. If -U is given,
|
||||||
|
cciss_vol_status will be called with -u.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
##
|
||||||
|
## You should not need to touch anything below here.
|
||||||
|
##
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use Getopt::Std;
|
||||||
|
use JSON;
|
||||||
|
use MIME::Base64;
|
||||||
|
use IO::Compress::Gzip qw(gzip $GzipError);
|
||||||
|
|
||||||
|
my $cache = '/var/cache/smart';
|
||||||
|
my $smartctl = '/usr/bin/env smartctl';
|
||||||
|
my @disks;
|
||||||
|
my $useSN = 1;
|
||||||
|
|
||||||
|
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
||||||
|
|
||||||
|
sub main::VERSION_MESSAGE {
|
||||||
|
print "SMART SNMP extend 0.3.2\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub main::HELP_MESSAGE {
|
||||||
|
&VERSION_MESSAGE;
|
||||||
|
print "\n" . "-u Update '" . $cache . "'\n" . '-g Guess at the config and print it to STDOUT
|
||||||
|
-c <config> The config file to use.
|
||||||
|
-p Pretty print the JSON.
|
||||||
|
-Z GZip+Base64 compress the results.
|
||||||
|
-C Enable manual checking for guess and cciss.
|
||||||
|
-S Set useSN to 0 when using -g
|
||||||
|
-t <test> Run the specified smart self test on all the devices.
|
||||||
|
-U When calling cciss_vol_status, call it with -u.
|
||||||
|
-G <modes> Guess modes to use. This is a comma seperated list.
|
||||||
|
Default :: scan-open,cciss-vol-status
|
||||||
|
|
||||||
|
|
||||||
|
Scan Modes:
|
||||||
|
|
||||||
|
- scan :: Use "--scan" with smartctl. "scan-open" will take presidence.
|
||||||
|
|
||||||
|
- scan-open :: Call smartctl with "--scan-open".
|
||||||
|
|
||||||
|
- cciss-vol-status :: Freebsd/Linux specific and if it sees /dev/sg0(on Linux) or
|
||||||
|
/dev/ciss0(on FreebSD) it will attempt to find drives via cciss-vol-status,
|
||||||
|
and then optionally checking for disks via smrtctl if -C is given. Should be noted
|
||||||
|
though that -C will not find drives that are currently missing/failed. If -U is given,
|
||||||
|
cciss_vol_status will be called with -u.
|
||||||
|
';
|
||||||
|
|
||||||
|
} ## end sub main::HELP_MESSAGE
|
||||||
|
|
||||||
|
#gets the options
|
||||||
|
my %opts = ();
|
||||||
|
getopts( 'ugc:pZhvCSGt:U', \%opts );
|
||||||
|
|
||||||
|
if ( $opts{h} ) {
|
||||||
|
&HELP_MESSAGE;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ( $opts{v} ) {
|
||||||
|
&VERSION_MESSAGE;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# figure out what scan modes to use if -g specified
|
||||||
|
#
|
||||||
|
my $scan_modes = {
|
||||||
|
'scan-open' => 0,
|
||||||
|
'scan' => 0,
|
||||||
|
'cciss_vol_status' => 0,
|
||||||
|
};
|
||||||
|
if ( $opts{g} ) {
|
||||||
|
if ( !defined( $opts{G} ) ) {
|
||||||
|
$opts{G} = 'scan-open,cciss_vol_status';
|
||||||
|
}
|
||||||
|
$opts{G} =~ s/[\ \t]//g;
|
||||||
|
my @scan_modes_split = split( /,/, $opts{G} );
|
||||||
|
foreach my $mode (@scan_modes_split) {
|
||||||
|
if ( !defined $scan_modes->{$mode} ) {
|
||||||
|
die( '"' . $mode . '" is not a recognized scan mode' );
|
||||||
|
}
|
||||||
|
$scan_modes->{$mode} = 1;
|
||||||
|
}
|
||||||
|
} ## end if ( $opts{g} )
|
||||||
|
|
||||||
|
# configure JSON for later usage
|
||||||
|
# only need to do this if actually running as in -g is not specified
|
||||||
|
my $json;
|
||||||
|
if ( !$opts{g} ) {
|
||||||
|
|
||||||
|
$json = JSON->new->allow_nonref->canonical(1);
|
||||||
|
if ( $opts{p} ) {
|
||||||
|
$json->pretty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# guess if asked
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if ( defined( $opts{g} ) ) {
|
||||||
|
|
||||||
|
#get what path to use for smartctl
|
||||||
|
$smartctl = `which smartctl`;
|
||||||
|
chomp($smartctl);
|
||||||
|
if ( $? != 0 ) {
|
||||||
|
warn("'which smartctl' failed with a exit code of $?");
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#try to touch the default cache location and warn if it can't be done
|
||||||
|
system( 'touch ' . $cache . '>/dev/null' );
|
||||||
|
if ( $? != 0 ) {
|
||||||
|
$cache = '#Could not touch ' . $cache . "You will need to manually set it\n" . "cache=?\n";
|
||||||
|
} else {
|
||||||
|
system( 'rm -f ' . $cache . '>/dev/null' );
|
||||||
|
$cache = 'cache=' . $cache . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $drive_lines = '';
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# scan-open and scan guess mode handling
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if ( $scan_modes->{'scan-open'} || $scan_modes->{'scan'} ) {
|
||||||
|
# used for checking if a disk has been found more than once
|
||||||
|
my %found_disks_names;
|
||||||
|
my @argumentsA;
|
||||||
|
|
||||||
|
# use scan-open if it is set, overriding scan if it is also set
|
||||||
|
my $mode = 'scan';
|
||||||
|
if ( $scan_modes->{'scan-open'} ) {
|
||||||
|
$mode = 'scan-open';
|
||||||
|
}
|
||||||
|
|
||||||
|
#have smartctl scan and see if it finds anythings not get found
|
||||||
|
my $scan_output = `$smartctl --$mode`;
|
||||||
|
my @scan_outputA = split( /\n/, $scan_output );
|
||||||
|
|
||||||
|
# remove non-SMART devices sometimes returned
|
||||||
|
@scan_outputA = grep( !/ses[0-9]/, @scan_outputA ); # not a disk, but may or may not have SMART attributes
|
||||||
|
@scan_outputA = grep( !/pass[0-9]/, @scan_outputA ); # very likely a duplicate and a disk under another name
|
||||||
|
@scan_outputA = grep( !/cd[0-9]/, @scan_outputA ); # CD drive
|
||||||
|
if ( $^O eq 'freebsd' ) {
|
||||||
|
@scan_outputA = grep( !/sa[0-9]/, @scan_outputA ); # tape drive
|
||||||
|
@scan_outputA = grep( !/ctl[0-9]/, @scan_outputA ); # CAM target layer
|
||||||
|
} elsif ( $^O eq 'linux' ) {
|
||||||
|
@scan_outputA = grep( !/st[0-9]/, @scan_outputA ); # SCSI tape drive
|
||||||
|
@scan_outputA = grep( !/ht[0-9]/, @scan_outputA ); # ATA tape drive
|
||||||
|
}
|
||||||
|
|
||||||
|
# make the first pass, figuring out what all we have and trimming comments
|
||||||
|
foreach my $arguments (@scan_outputA) {
|
||||||
|
my $name = $arguments;
|
||||||
|
|
||||||
|
$arguments =~ s/ \#.*//; # trim the comment out of the argument
|
||||||
|
$name =~ s/ .*//;
|
||||||
|
$name =~ s/\/dev\///;
|
||||||
|
if ( defined( $found_disks_names{$name} ) ) {
|
||||||
|
$found_disks_names{$name}++;
|
||||||
|
} else {
|
||||||
|
$found_disks_names{$name} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
push( @argumentsA, $arguments );
|
||||||
|
|
||||||
|
} ## end foreach my $arguments (@scan_outputA)
|
||||||
|
|
||||||
|
# second pass, putting the lines together
|
||||||
|
my %current_disk;
|
||||||
|
foreach my $arguments (@argumentsA) {
|
||||||
|
my $not_virt = 1;
|
||||||
|
|
||||||
|
# check to see if we have a virtual device
|
||||||
|
my @virt_check = split( /\n/, `smartctl -i $arguments 2> /dev/null` );
|
||||||
|
foreach my $virt_check_line (@virt_check) {
|
||||||
|
if ( $virt_check_line =~ /(?i)Product\:.*LOGICAL VOLUME/ ) {
|
||||||
|
$not_virt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $name = $arguments;
|
||||||
|
$name =~ s/ .*//;
|
||||||
|
$name =~ s/\/dev\///;
|
||||||
|
|
||||||
|
# only add it if not a virtual RAID drive
|
||||||
|
# HP RAID virtual disks will show up with very basical but totally useless smart data
|
||||||
|
if ($not_virt) {
|
||||||
|
if ( $found_disks_names{$name} == 0 ) {
|
||||||
|
# If no other devices, just name it after the base device.
|
||||||
|
$drive_lines = $drive_lines . $name . " " . $arguments . "\n";
|
||||||
|
} else {
|
||||||
|
# if more than one, start at zero and increment, apennding comma number to the base device name
|
||||||
|
if ( defined( $current_disk{$name} ) ) {
|
||||||
|
$current_disk{$name}++;
|
||||||
|
} else {
|
||||||
|
$current_disk{$name} = 0;
|
||||||
|
}
|
||||||
|
$drive_lines = $drive_lines . $name . "," . $current_disk{$name} . " " . $arguments . "\n";
|
||||||
|
}
|
||||||
|
} ## end if ($not_virt)
|
||||||
|
|
||||||
|
} ## end foreach my $arguments (@argumentsA)
|
||||||
|
} ## end if ( $scan_modes->{'scan-open'} || $scan_modes...)
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# scan mode handler for cciss_vol_status
|
||||||
|
# /dev/sg* devices for cciss on Linux
|
||||||
|
# /dev/ccis* devices for cciss on FreeBSD
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if ( $scan_modes->{'cciss_vol_status'} && ( $^O eq 'linux' || $^O eq 'freebsd' ) ) {
|
||||||
|
my $cciss;
|
||||||
|
if ( $^O eq 'freebsd' ) {
|
||||||
|
$cciss = 'ciss';
|
||||||
|
} elsif ( $^O eq 'linux' ) {
|
||||||
|
$cciss = 'sg';
|
||||||
|
}
|
||||||
|
|
||||||
|
my $uarg = '';
|
||||||
|
if ( $opts{U} ) {
|
||||||
|
$uarg = '-u';
|
||||||
|
}
|
||||||
|
|
||||||
|
# generate the initial device path that will be checked
|
||||||
|
my $sg_int = 0;
|
||||||
|
my $device = '/dev/' . $cciss . $sg_int;
|
||||||
|
|
||||||
|
my $sg_process = 1;
|
||||||
|
if ( -e $device ) {
|
||||||
|
my $output = `which cciss_vol_status 2> /dev/null`;
|
||||||
|
if ( $? != 0 && !$opts{C} ) {
|
||||||
|
$sg_process = 0;
|
||||||
|
$drive_lines
|
||||||
|
= $drive_lines
|
||||||
|
. "# -C not given, but "
|
||||||
|
. $device
|
||||||
|
. " exists and cciss_vol_status is not present\n"
|
||||||
|
. "# in path or 'ccis_vol_status -V "
|
||||||
|
. $device
|
||||||
|
. "' is failing\n";
|
||||||
|
} ## end if ( $? != 0 && !$opts{C} )
|
||||||
|
} ## end if ( -e $device )
|
||||||
|
my $seen_lines = {};
|
||||||
|
my $ignore_lines = {};
|
||||||
|
while ( -e $device && $sg_process ) {
|
||||||
|
my $output = `cciss_vol_status -V $uarg $device 2> /dev/null`;
|
||||||
|
if ( $? != 0 && $output eq '' && !$opts{C} ) {
|
||||||
|
# just empty here as we just want to skip it if it fails and there is no C
|
||||||
|
# warning is above
|
||||||
|
} elsif ( $? != 0 && $output eq '' && $opts{C} ) {
|
||||||
|
my $drive_count = 0;
|
||||||
|
my $continue = 1;
|
||||||
|
while ($continue) {
|
||||||
|
my $output = `$smartctl -i $device -d cciss,$drive_count 2> /dev/null`;
|
||||||
|
if ( $? != 0 ) {
|
||||||
|
$continue = 0;
|
||||||
|
} else {
|
||||||
|
my $add_it = 0;
|
||||||
|
my $id;
|
||||||
|
while ( $output =~ /(?i)Serial Number:(.*)/g ) {
|
||||||
|
$id = $1;
|
||||||
|
$id =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
if ( defined($id) && !defined( $seen_lines->{$id} ) ) {
|
||||||
|
$add_it = 1;
|
||||||
|
$seen_lines->{$id} = 1;
|
||||||
|
}
|
||||||
|
if ( $continue && $add_it ) {
|
||||||
|
$drive_lines
|
||||||
|
= $drive_lines
|
||||||
|
. $cciss . '0-'
|
||||||
|
. $drive_count . ' '
|
||||||
|
. $device
|
||||||
|
. ' -d cciss,'
|
||||||
|
. $drive_count . "\n";
|
||||||
|
}
|
||||||
|
} ## end else [ if ( $? != 0 ) ]
|
||||||
|
$drive_count++;
|
||||||
|
} ## end while ($continue)
|
||||||
|
} else {
|
||||||
|
my $drive_count = 0;
|
||||||
|
# count the connector lines, this will make sure failed are founded as well
|
||||||
|
my $seen_conectors = {};
|
||||||
|
while ( $output =~ /(connector +\d+[IA]\ +box +\d+\ +bay +\d+.*)/g ) {
|
||||||
|
my $cciss_drive_line = $1;
|
||||||
|
my $connector = $cciss_drive_line;
|
||||||
|
$connector =~ s/(.*\ bay +\d+).*/$1/;
|
||||||
|
if ( !defined( $seen_lines->{$cciss_drive_line} )
|
||||||
|
&& !defined( $seen_conectors->{$connector} )
|
||||||
|
&& !defined( $ignore_lines->{$cciss_drive_line} ) )
|
||||||
|
{
|
||||||
|
$seen_lines->{$cciss_drive_line} = 1;
|
||||||
|
$seen_conectors->{$connector} = 1;
|
||||||
|
$drive_count++;
|
||||||
|
} else {
|
||||||
|
# going to be a connector we've already seen
|
||||||
|
# which will happen when it is processing replacement drives
|
||||||
|
# so save this as a device to ignore
|
||||||
|
$ignore_lines->{$cciss_drive_line} = 1;
|
||||||
|
}
|
||||||
|
} ## end while ( $output =~ /(connector +\d+[IA]\ +box +\d+\ +bay +\d+.*)/g)
|
||||||
|
my $drive_int = 0;
|
||||||
|
while ( $drive_int < $drive_count ) {
|
||||||
|
$drive_lines
|
||||||
|
= $drive_lines
|
||||||
|
. $cciss
|
||||||
|
. $sg_int . '-'
|
||||||
|
. $drive_int . ' '
|
||||||
|
. $device
|
||||||
|
. ' -d cciss,'
|
||||||
|
. $drive_int . "\n";
|
||||||
|
|
||||||
|
$drive_int++;
|
||||||
|
} ## end while ( $drive_int < $drive_count )
|
||||||
|
} ## end else [ if ( $? != 0 && $output eq '' && !$opts{C})]
|
||||||
|
|
||||||
|
$sg_int++;
|
||||||
|
$device = '/dev/' . $cciss . $sg_int;
|
||||||
|
} ## end while ( -e $device && $sg_process )
|
||||||
|
} ## end if ( $scan_modes->{'cciss_vol_status'} && ...)
|
||||||
|
|
||||||
|
my $useSN = 1;
|
||||||
|
if ( $opts{S} ) {
|
||||||
|
$useSN = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '# scan_modes='
|
||||||
|
. $opts{G}
|
||||||
|
. "\nuseSN="
|
||||||
|
. $useSN . "\n"
|
||||||
|
. 'smartctl='
|
||||||
|
. $smartctl . "\n"
|
||||||
|
. $cache
|
||||||
|
. $drive_lines;
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
} ## end if ( defined( $opts{g} ) )
|
||||||
|
|
||||||
|
#get which config file to use
|
||||||
|
my $config = $0 . '.config';
|
||||||
|
if ( defined( $opts{c} ) ) {
|
||||||
|
$config = $opts{c};
|
||||||
|
}
|
||||||
|
|
||||||
|
#reads the config file, optionally
|
||||||
|
my $config_file = '';
|
||||||
|
open( my $readfh, "<", $config ) or die "Can't open '" . $config . "'";
|
||||||
|
read( $readfh, $config_file, 1000000 );
|
||||||
|
close($readfh);
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# parse the config file and remove comments and empty lines
|
||||||
|
#
|
||||||
|
#
|
||||||
|
my @configA = split( /\n/, $config_file );
|
||||||
|
@configA = grep( !/^$/, @configA );
|
||||||
|
@configA = grep( !/^\#/, @configA );
|
||||||
|
@configA = grep( !/^[\s\t]*$/, @configA );
|
||||||
|
my $configA_int = 0;
|
||||||
|
while ( defined( $configA[$configA_int] ) ) {
|
||||||
|
my $line = $configA[$configA_int];
|
||||||
|
chomp($line);
|
||||||
|
$line =~ s/^[\t\s]+//;
|
||||||
|
$line =~ s/[\t\s]+$//;
|
||||||
|
|
||||||
|
my ( $var, $val ) = split( /=/, $line, 2 );
|
||||||
|
|
||||||
|
my $matched;
|
||||||
|
if ( $var eq 'cache' ) {
|
||||||
|
$cache = $val;
|
||||||
|
$matched = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $var eq 'smartctl' ) {
|
||||||
|
$smartctl = $val;
|
||||||
|
$matched = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $var eq 'useSN' ) {
|
||||||
|
$useSN = $val;
|
||||||
|
$matched = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !defined($val) ) {
|
||||||
|
push( @disks, $line );
|
||||||
|
}
|
||||||
|
|
||||||
|
$configA_int++;
|
||||||
|
} ## end while ( defined( $configA[$configA_int] ) )
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# run the specified self test on all disks if asked
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if ( defined( $opts{t} ) ) {
|
||||||
|
|
||||||
|
# make sure we have something that atleast appears sane for the test name
|
||||||
|
my $valid_tesks = {
|
||||||
|
'offline' => 1,
|
||||||
|
'short' => 1,
|
||||||
|
'long' => 1,
|
||||||
|
'conveyance' => 1,
|
||||||
|
'afterselect,on' => 1,
|
||||||
|
};
|
||||||
|
if ( !defined( $valid_tesks->{ $opts{t} } ) && $opts{t} !~ /select,(\d+[\-\+]\d+|next|next\+\d+|redo\+\d+)/ ) {
|
||||||
|
print '"' . $opts{t} . "\" does not appear to be a valid test\n";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Running the SMART $opts{t} on all devices in the config...\n\n";
|
||||||
|
|
||||||
|
foreach my $line (@disks) {
|
||||||
|
my $disk;
|
||||||
|
my $name;
|
||||||
|
if ( $line =~ /\ / ) {
|
||||||
|
( $name, $disk ) = split( /\ /, $line, 2 );
|
||||||
|
} else {
|
||||||
|
$disk = $line;
|
||||||
|
$name = $line;
|
||||||
|
}
|
||||||
|
if ( $disk !~ /\// ) {
|
||||||
|
$disk = '/dev/' . $disk;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n------------------------------------------------------------------\nDoing "
|
||||||
|
. $smartctl . ' -t '
|
||||||
|
. $opts{t} . ' '
|
||||||
|
. $disk
|
||||||
|
. " ...\n\n";
|
||||||
|
print `$smartctl -t $opts{t} $disk` . "\n";
|
||||||
|
|
||||||
|
} ## end foreach my $line (@disks)
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
} ## end if ( defined( $opts{t} ) )
|
||||||
|
|
||||||
|
#if set to 1, no cache will be written and it will be printed instead
|
||||||
|
my $noWrite = 0;
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# if no -u, it means we are being called from snmped
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if ( !defined( $opts{u} ) ) {
|
||||||
|
# if the cache file exists, print it, otherwise assume one is not being used
|
||||||
|
if ( -f $cache ) {
|
||||||
|
my $old = '';
|
||||||
|
open( my $readfh, "<", $cache ) or die "Can't open '" . $cache . "'";
|
||||||
|
read( $readfh, $old, 1000000 );
|
||||||
|
close($readfh);
|
||||||
|
print $old;
|
||||||
|
exit 0;
|
||||||
|
} else {
|
||||||
|
$opts{u} = 1;
|
||||||
|
$noWrite = 1;
|
||||||
|
}
|
||||||
|
} ## end if ( !defined( $opts{u} ) )
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Process each disk
|
||||||
|
#
|
||||||
|
#
|
||||||
|
my $to_return = {
|
||||||
|
data => { disks => {}, exit_nonzero => 0, unhealthy => 0, useSN => $useSN },
|
||||||
|
version => 1,
|
||||||
|
error => 0,
|
||||||
|
errorString => '',
|
||||||
|
};
|
||||||
|
foreach my $line (@disks) {
|
||||||
|
my $disk;
|
||||||
|
my $name;
|
||||||
|
if ( $line =~ /\ / ) {
|
||||||
|
( $name, $disk ) = split( /\ /, $line, 2 );
|
||||||
|
} else {
|
||||||
|
$disk = $line;
|
||||||
|
$name = $line;
|
||||||
|
}
|
||||||
|
if ( $disk !~ /\// ) {
|
||||||
|
$disk = '/dev/' . $disk;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $output = `$smartctl -A $disk`;
|
||||||
|
my %IDs = (
|
||||||
|
'5' => 'null',
|
||||||
|
'10' => 'null',
|
||||||
|
'173' => 'null',
|
||||||
|
'177' => 'null',
|
||||||
|
'183' => 'null',
|
||||||
|
'184' => 'null',
|
||||||
|
'187' => 'null',
|
||||||
|
'188' => 'null',
|
||||||
|
'190' => 'null',
|
||||||
|
'194' => 'null',
|
||||||
|
'196' => 'null',
|
||||||
|
'197' => 'null',
|
||||||
|
'198' => 'null',
|
||||||
|
'199' => 'null',
|
||||||
|
'231' => 'null',
|
||||||
|
'232' => 'null',
|
||||||
|
'233' => 'null',
|
||||||
|
'9' => 'null',
|
||||||
|
'disk' => $disk,
|
||||||
|
'serial' => undef,
|
||||||
|
'selftest_log' => undef,
|
||||||
|
'health_pass' => 0,
|
||||||
|
max_temp => 'null',
|
||||||
|
exit => $?,
|
||||||
|
);
|
||||||
|
$IDs{'disk'} =~ s/^\/dev\///;
|
||||||
|
|
||||||
|
# if polling exited non-zero above, no reason running the rest of the checks
|
||||||
|
my $disk_id = $name;
|
||||||
|
if ( $IDs{exit} != 0 ) {
|
||||||
|
$to_return->{data}{exit_nonzero}++;
|
||||||
|
} else {
|
||||||
|
my @outputA;
|
||||||
|
|
||||||
|
if ( $output =~ /NVMe Log/ ) {
|
||||||
|
# we have an NVMe drive with annoyingly different output
|
||||||
|
my %mappings = (
|
||||||
|
'Temperature' => 194,
|
||||||
|
'Power Cycles' => 12,
|
||||||
|
'Power On Hours' => 9,
|
||||||
|
'Percentage Used' => 231,
|
||||||
|
);
|
||||||
|
foreach ( split( /\n/, $output ) ) {
|
||||||
|
if (/:/) {
|
||||||
|
my ( $key, $val ) = split(/:/);
|
||||||
|
$val =~ s/^\s+|\s+$|\D+//g;
|
||||||
|
if ( exists( $mappings{$key} ) ) {
|
||||||
|
if ( $mappings{$key} == 231 ) {
|
||||||
|
$IDs{ $mappings{$key} } = 100 - $val;
|
||||||
|
} else {
|
||||||
|
$IDs{ $mappings{$key} } = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ## end if (/:/)
|
||||||
|
} ## end foreach ( split( /\n/, $output ) )
|
||||||
|
|
||||||
|
} else {
|
||||||
|
@outputA = split( /\n/, $output );
|
||||||
|
my $outputAint = 0;
|
||||||
|
while ( defined( $outputA[$outputAint] ) ) {
|
||||||
|
my $line = $outputA[$outputAint];
|
||||||
|
$line =~ s/^ +//;
|
||||||
|
$line =~ s/ +/ /g;
|
||||||
|
|
||||||
|
if ( $line =~ /^[0123456789]+ / ) {
|
||||||
|
my @lineA = split( /\ /, $line, 10 );
|
||||||
|
my $raw = $lineA[9];
|
||||||
|
my $normalized = $lineA[3];
|
||||||
|
my $id = $lineA[0];
|
||||||
|
|
||||||
|
# Crucial SSD
|
||||||
|
# 202, Percent_Lifetime_Remain, same as 231, SSD Life Left
|
||||||
|
if ( $id == 202
|
||||||
|
&& $line =~ /Percent_Lifetime_Remain/ )
|
||||||
|
{
|
||||||
|
$IDs{231} = $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
# single int raw values
|
||||||
|
if ( ( $id == 5 )
|
||||||
|
|| ( $id == 10 )
|
||||||
|
|| ( $id == 173 )
|
||||||
|
|| ( $id == 183 )
|
||||||
|
|| ( $id == 184 )
|
||||||
|
|| ( $id == 187 )
|
||||||
|
|| ( $id == 196 )
|
||||||
|
|| ( $id == 197 )
|
||||||
|
|| ( $id == 198 )
|
||||||
|
|| ( $id == 199 ) )
|
||||||
|
{
|
||||||
|
my @rawA = split( /\ /, $raw );
|
||||||
|
$IDs{$id} = $rawA[0];
|
||||||
|
} ## end if ( ( $id == 5 ) || ( $id == 10 ) || ( $id...))
|
||||||
|
|
||||||
|
# single int normalized values
|
||||||
|
if ( ( $id == 177 )
|
||||||
|
|| ( $id == 230 )
|
||||||
|
|| ( $id == 231 )
|
||||||
|
|| ( $id == 232 )
|
||||||
|
|| ( $id == 233 ) )
|
||||||
|
{
|
||||||
|
# annoying non-standard disk
|
||||||
|
# WDC WDS500G2B0A
|
||||||
|
# 230 Media_Wearout_Indicator 0x0032 100 100 --- Old_age Always - 0x002e000a002e
|
||||||
|
# 232 Available_Reservd_Space 0x0033 100 100 004 Pre-fail Always - 100
|
||||||
|
# 233 NAND_GB_Written_TLC 0x0032 100 100 --- Old_age Always - 9816
|
||||||
|
|
||||||
|
if ( $id == 230
|
||||||
|
&& $line =~ /Media_Wearout_Indicator/ )
|
||||||
|
{
|
||||||
|
$IDs{233} = int($normalized);
|
||||||
|
} elsif ( $id == 232
|
||||||
|
&& $line =~ /Available_Reservd_Space/ )
|
||||||
|
{
|
||||||
|
$IDs{232} = int($normalized);
|
||||||
|
} else {
|
||||||
|
# only set 233 if it has not been set yet
|
||||||
|
# if it was set already then the above did it and we don't want
|
||||||
|
# to overwrite it
|
||||||
|
if ( $id == 233 && $IDs{233} eq "null" ) {
|
||||||
|
$IDs{$id} = int($normalized);
|
||||||
|
} elsif ( $id != 233 ) {
|
||||||
|
$IDs{$id} = int($normalized);
|
||||||
|
}
|
||||||
|
} ## end else [ if ( $id == 230 && $line =~ /Media_Wearout_Indicator/)]
|
||||||
|
} ## end if ( ( $id == 177 ) || ( $id == 230 ) || (...))
|
||||||
|
|
||||||
|
# 9, power on hours
|
||||||
|
if ( $id == 9 ) {
|
||||||
|
my @runtime = split( /[\ h]/, $raw );
|
||||||
|
$IDs{$id} = $runtime[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
# 188, Command_Timeout
|
||||||
|
if ( $id == 188 ) {
|
||||||
|
my $total = 0;
|
||||||
|
my @rawA = split( /\ /, $raw );
|
||||||
|
my $rawAint = 0;
|
||||||
|
while ( defined( $rawA[$rawAint] ) ) {
|
||||||
|
$total = $total + $rawA[$rawAint];
|
||||||
|
$rawAint++;
|
||||||
|
}
|
||||||
|
$IDs{$id} = $total;
|
||||||
|
} ## end if ( $id == 188 )
|
||||||
|
|
||||||
|
# 190, airflow temp
|
||||||
|
# 194, temp
|
||||||
|
if ( ( $id == 190 )
|
||||||
|
|| ( $id == 194 ) )
|
||||||
|
{
|
||||||
|
my ($temp) = split( /\ /, $raw );
|
||||||
|
$IDs{$id} = $temp;
|
||||||
|
}
|
||||||
|
} ## end if ( $line =~ /^[0123456789]+ / )
|
||||||
|
|
||||||
|
# SAS Wrapping
|
||||||
|
# Section by Cameron Munroe (munroenet[at]gmail.com)
|
||||||
|
|
||||||
|
# Elements in Grown Defect List.
|
||||||
|
# Marking as 5 Reallocated_Sector_Ct
|
||||||
|
if ( $line =~ "Elements in grown defect list:" ) {
|
||||||
|
|
||||||
|
my @lineA = split( /\ /, $line, 10 );
|
||||||
|
my $raw = $lineA[5];
|
||||||
|
|
||||||
|
# Reallocated Sector Count ID
|
||||||
|
$IDs{5} = $raw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Current Drive Temperature
|
||||||
|
# Marking as 194 Temperature_Celsius
|
||||||
|
if ( $line =~ "Current Drive Temperature:" ) {
|
||||||
|
|
||||||
|
my @lineA = split( /\ /, $line, 10 );
|
||||||
|
my $raw = $lineA[3];
|
||||||
|
|
||||||
|
# Temperature C ID
|
||||||
|
$IDs{194} = $raw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# End of SAS Wrapper
|
||||||
|
|
||||||
|
$outputAint++;
|
||||||
|
} ## end while ( defined( $outputA[$outputAint] ) )
|
||||||
|
} ## end else [ if ( $output =~ /NVMe Log/ ) ]
|
||||||
|
|
||||||
|
#get the selftest logs
|
||||||
|
$output = `$smartctl -l selftest $disk`;
|
||||||
|
@outputA = split( /\n/, $output );
|
||||||
|
my @completed = grep( /Completed/, @outputA );
|
||||||
|
$IDs{'completed'} = scalar @completed;
|
||||||
|
my @interrupted = grep( /Interrupted/, @outputA );
|
||||||
|
$IDs{'interrupted'} = scalar @interrupted;
|
||||||
|
my @read_failure = grep( /read failure/, @outputA );
|
||||||
|
$IDs{'read_failure'} = scalar @read_failure;
|
||||||
|
my @read_failure2 = grep( /Failed in segment/, @outputA );
|
||||||
|
$IDs{'read_failure'} = $IDs{'read_failure'} + scalar @read_failure2;
|
||||||
|
my @unknown_failure = grep( /unknown failure/, @outputA );
|
||||||
|
$IDs{'unknown_failure'} = scalar @unknown_failure;
|
||||||
|
my @extended = grep( /\d.*\ ([Ee]xtended|[Ll]ong).*(?![Dd]uration)/, @outputA );
|
||||||
|
$IDs{'extended'} = scalar @extended;
|
||||||
|
my @short = grep( /[Ss]hort/, @outputA );
|
||||||
|
$IDs{'short'} = scalar @short;
|
||||||
|
my @conveyance = grep( /[Cc]onveyance/, @outputA );
|
||||||
|
$IDs{'conveyance'} = scalar @conveyance;
|
||||||
|
my @selective = grep( /[Ss]elective/, @outputA );
|
||||||
|
$IDs{'selective'} = scalar @selective;
|
||||||
|
my @offline = grep( /(\d|[Bb]ackground|[Ff]oreground)+\ +[Oo]ffline/, @outputA );
|
||||||
|
$IDs{'offline'} = scalar @offline;
|
||||||
|
|
||||||
|
# if we have logs, actually grab the log output
|
||||||
|
if ( $IDs{'completed'} > 0
|
||||||
|
|| $IDs{'interrupted'} > 0
|
||||||
|
|| $IDs{'read_failure'} > 0
|
||||||
|
|| $IDs{'extended'} > 0
|
||||||
|
|| $IDs{'short'} > 0
|
||||||
|
|| $IDs{'conveyance'} > 0
|
||||||
|
|| $IDs{'selective'} > 0
|
||||||
|
|| $IDs{'offline'} > 0 )
|
||||||
|
{
|
||||||
|
my @headers = grep( /(Num\ +Test.*LBA| Description .*[Hh]ours)/, @outputA );
|
||||||
|
|
||||||
|
my @log_lines;
|
||||||
|
push( @log_lines, @extended, @short, @conveyance, @selective, @offline );
|
||||||
|
$IDs{'selftest_log'} = join( "\n", @headers, sort(@log_lines) );
|
||||||
|
} ## end if ( $IDs{'completed'} > 0 || $IDs{'interrupted'...})
|
||||||
|
|
||||||
|
# get the drive serial number, if needed
|
||||||
|
$disk_id = $name;
|
||||||
|
$output = `$smartctl -i $disk`;
|
||||||
|
# generally upper case, HP branded drives seem to report with lower case n
|
||||||
|
while ( $output =~ /(?i)Serial Number:(.*)/g ) {
|
||||||
|
$IDs{'serial'} = $1;
|
||||||
|
$IDs{'serial'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
if ($useSN) {
|
||||||
|
$disk_id = $IDs{'serial'};
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( $output =~ /(?i)Model Family:(.*)/g ) {
|
||||||
|
$IDs{'model_family'} = $1;
|
||||||
|
$IDs{'model_family'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( $output =~ /(?i)Device Model:(.*)/g ) {
|
||||||
|
$IDs{'device_model'} = $1;
|
||||||
|
$IDs{'device_model'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( $output =~ /(?i)Model Number:(.*)/g ) {
|
||||||
|
$IDs{'model_number'} = $1;
|
||||||
|
$IDs{'model_number'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( $output =~ /(?i)Firmware Version:(.*)/g ) {
|
||||||
|
$IDs{'fw_version'} = $1;
|
||||||
|
$IDs{'fw_version'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
# mainly HP drives
|
||||||
|
while ( $output =~ /(?i)Vendor:(.*)/g ) {
|
||||||
|
$IDs{'vendor'} = $1;
|
||||||
|
$IDs{'vendor'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
# mainly HP drives
|
||||||
|
while ( $output =~ /(?i)Product:(.*)/g ) {
|
||||||
|
$IDs{'product'} = $1;
|
||||||
|
$IDs{'product'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
# mainly HP drives
|
||||||
|
while ( $output =~ /(?i)Revision:(.*)/g ) {
|
||||||
|
$IDs{'revision'} = $1;
|
||||||
|
$IDs{'revision'} =~ s/^\s+|\s+$//g;
|
||||||
|
}
|
||||||
|
|
||||||
|
# figure out what to use for the max temp, if there is one
|
||||||
|
if ( $IDs{'190'} =~ /^\d+$/ ) {
|
||||||
|
$IDs{max_temp} = $IDs{'190'};
|
||||||
|
} elsif ( $IDs{'194'} =~ /^\d+$/ ) {
|
||||||
|
$IDs{max_temp} = $IDs{'194'};
|
||||||
|
}
|
||||||
|
if ( $IDs{'194'} =~ /^\d+$/ && defined( $IDs{max_temp} ) && $IDs{'194'} > $IDs{max_temp} ) {
|
||||||
|
$IDs{max_temp} = $IDs{'194'};
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = `$smartctl -H $disk`;
|
||||||
|
if ( $output =~ /SMART\ overall\-health\ self\-assessment\ test\ result\:\ PASSED/ ) {
|
||||||
|
$IDs{'health_pass'} = 1;
|
||||||
|
} elsif ( $output =~ /SMART\ Health\ Status\:\ OK/ ) {
|
||||||
|
$IDs{'health_pass'} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$IDs{'health_pass'} ) {
|
||||||
|
$to_return->{data}{unhealthy}++;
|
||||||
|
}
|
||||||
|
} ## end else [ if ( $IDs{exit} != 0 ) ]
|
||||||
|
|
||||||
|
# only bother to save this if useSN is not being used
|
||||||
|
if ( !$useSN ) {
|
||||||
|
$to_return->{data}{disks}{$disk_id} = \%IDs;
|
||||||
|
} elsif ( $IDs{exit} == 0 && defined($disk_id) ) {
|
||||||
|
$to_return->{data}{disks}{$disk_id} = \%IDs;
|
||||||
|
}
|
||||||
|
|
||||||
|
# smartctl will in some cases exit zero when it can't pull data for cciss
|
||||||
|
# so if we get a zero exit, but no serial then it means something errored
|
||||||
|
# and the device is likely dead
|
||||||
|
if ( $IDs{exit} == 0 && !defined( $IDs{serial} ) ) {
|
||||||
|
$to_return->{data}{unhealthy}++;
|
||||||
|
}
|
||||||
|
} ## end foreach my $line (@disks)
|
||||||
|
|
||||||
|
my $toReturn = $json->encode($to_return);
|
||||||
|
|
||||||
|
if ( !$opts{p} ) {
|
||||||
|
$toReturn = $toReturn . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $opts{Z} ) {
|
||||||
|
my $toReturnCompressed;
|
||||||
|
gzip \$toReturn => \$toReturnCompressed;
|
||||||
|
my $compressed = encode_base64($toReturnCompressed);
|
||||||
|
$compressed =~ s/\n//g;
|
||||||
|
$compressed = $compressed . "\n";
|
||||||
|
if ( length($compressed) < length($toReturn) ) {
|
||||||
|
$toReturn = $compressed;
|
||||||
|
}
|
||||||
|
} ## end if ( $opts{Z} )
|
||||||
|
|
||||||
|
if ( !$noWrite ) {
|
||||||
|
open( my $writefh, ">", $cache ) or die "Can't open '" . $cache . "'";
|
||||||
|
print $writefh $toReturn;
|
||||||
|
close($writefh);
|
||||||
|
} else {
|
||||||
|
print $toReturn;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
smartctl=/usr/sbin/smartctl
|
||||||
|
cache=/var/cache/smart
|
||||||
|
sda
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
################################################################
|
||||||
|
# Instructions: #
|
||||||
|
# 1. copy this script to /etc/snmp/ and make it executable: #
|
||||||
|
# chmod +x ups-nut.sh #
|
||||||
|
# 2. make sure UPS_NAME below matches the name of your UPS #
|
||||||
|
# 3. edit your snmpd.conf to include this line: #
|
||||||
|
# extend ups-nut /etc/snmp/ups-nut.sh #
|
||||||
|
# 4. restart snmpd on the host #
|
||||||
|
# 5. activate the app for the desired host in LibreNMS #
|
||||||
|
################################################################
|
||||||
|
UPS_NAME="${1:-APCUPS}"
|
||||||
|
|
||||||
|
PATH=$PATH:/usr/bin:/bin
|
||||||
|
TMP=$(upsc $UPS_NAME 2>/dev/null)
|
||||||
|
|
||||||
|
for value in "battery\.charge: [0-9.]+" "battery\.(runtime\.)?low: [0-9]+" "battery\.runtime: [0-9]+" "battery\.voltage: [0-9.]+" "battery\.voltage\.nominal: [0-9]+" "input\.voltage\.nominal: [0-9.]+" "input\.voltage: [0-9.]+" "ups\.load: [0-9.]+"
|
||||||
|
do
|
||||||
|
OUT=$(echo "$TMP" | grep -Eo "$value" | awk '{print $2}' | LANG=C sort | head -n 1)
|
||||||
|
if [ -n "$OUT" ]; then
|
||||||
|
echo "$OUT"
|
||||||
|
else
|
||||||
|
echo "Unknown"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for value in "ups\.status:[A-Z ]{0,}OL" "ups\.status:[A-Z ]{0,}OB" "ups\.status:[A-Z ]{0,}LB" "ups\.status:[A-Z ]{0,}HB" "ups\.status:[A-Z ]{0,}RB" "ups\.status:[A-Z ]{0,}CHRG" "ups\.status:[A-Z ]{0,}DISCHRG" "ups\.status:[A-Z ]{0,}BYPASS" "ups\.status:[A-Z ]{0,}CAL" "ups\.status:[A-Z ]{0,}OFF" "ups\.status:[A-Z ]{0,}OVER" "ups\.status:[A-Z ]{0,}TRIM" "ups\.status:[A-Z ]{0,}BOOST" "ups\.status:[A-Z ]{0,}FSD" "ups\.alarm:[A-Z ]"
|
||||||
|
do
|
||||||
|
UNKNOWN=$(echo "$TMP" | grep -Eo "ups\.status:")
|
||||||
|
if [ -z "$UNKNOWN" ]; then
|
||||||
|
echo "Unknown"
|
||||||
|
else
|
||||||
|
OUT=$(echo "$TMP" | grep -Eo "$value")
|
||||||
|
if [ -n "$OUT" ]; then
|
||||||
|
echo "1"
|
||||||
|
else
|
||||||
|
echo "0"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
UPSTEMP="ups\.temperature: [0-9.]+"
|
||||||
|
OUT=$(echo "$TMP" | grep -Eo "$UPSTEMP" | awk '{print $2}' | LANG=C sort | head -n 1)
|
||||||
|
[ -n "$OUT" ] && echo "$OUT" || echo "Unknown"
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# PFV NFS tuning sysctl overrides
|
||||||
|
#
|
||||||
|
# Applied AFTER tuned via pfv-nfs-tuning.service (systemd oneshot).
|
||||||
|
# These override tuned's network-throughput/virtual-host 16MB TCP buffer
|
||||||
|
# caps with 128MB for high-BDP NFS over 1-4 GbE LACP links.
|
||||||
|
#
|
||||||
|
# Install on ALL Proxmox hosts:
|
||||||
|
# cp 99-pfv-nfs.conf /etc/sysctl.d/99-pfv-nfs.conf
|
||||||
|
# cp pfv-nfs-tuning.service /etc/systemd/system/pfv-nfs-tuning.service
|
||||||
|
# systemctl daemon-reload && systemctl enable --now pfv-nfs-tuning.service
|
||||||
|
#
|
||||||
|
# Created: 2026-07-31
|
||||||
|
# Deployed: tsys1, tsys3, tsys4, tsys5, tsys6, tsys7, tsys9
|
||||||
|
|
||||||
|
net.core.rmem_max = 134217728
|
||||||
|
net.core.wmem_max = 134217728
|
||||||
|
net.core.rmem_default = 26214400
|
||||||
|
net.core.wmem_default = 26214400
|
||||||
|
net.core.netdev_max_backlog = 250000
|
||||||
|
net.core.somaxconn = 65535
|
||||||
|
net.ipv4.tcp_rmem = 4096 87380 134217728
|
||||||
|
net.ipv4.tcp_wmem = 4096 65536 134217728
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 4096
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# Known Element Enterprises Customized Config File
|
||||||
|
# auditd
|
||||||
|
# Initial version 2025-06-27
|
||||||
|
#
|
||||||
|
|
||||||
|
local_events = yes
|
||||||
|
write_logs = yes
|
||||||
|
log_file = /var/log/audit/audit.log
|
||||||
|
log_group = adm
|
||||||
|
log_format = ENRICHED
|
||||||
|
flush = INCREMENTAL_ASYNC
|
||||||
|
freq = 50
|
||||||
|
max_log_file = 8
|
||||||
|
num_logs = 5
|
||||||
|
priority_boost = 4
|
||||||
|
name_format = NONE
|
||||||
|
max_log_file_action = keep_logs
|
||||||
|
space_left = 75
|
||||||
|
space_left_action = email
|
||||||
|
action_mail_acct = root
|
||||||
|
|
||||||
|
admin_space_left_action = halt
|
||||||
|
disk_full_action = SUSPEND
|
||||||
|
disk_error_action = SUSPEND
|
||||||
|
admin_space_left = 50
|
||||||
|
|
||||||
|
verify_email = yes
|
||||||
|
use_libwrap = yes
|
||||||
|
tcp_listen_queue = 5
|
||||||
|
tcp_max_per_addr = 1
|
||||||
|
tcp_client_max_idle = 0
|
||||||
|
transport = TCP
|
||||||
|
distribute_network = no
|
||||||
|
q_depth = 2000
|
||||||
|
overflow_action = SYSLOG
|
||||||
|
max_restarts = 10
|
||||||
|
plugin_dir = /etc/audit/plugins.d
|
||||||
|
end_of_event_timeout = 2
|
||||||
|
##tcp_client_ports = 1024-65535
|
||||||
|
##tcp_listen_port = 60
|
||||||
|
|
||||||
|
##krb5_key_file = /etc/audit/audit.key
|
||||||
|
krb5_principal = auditd
|
||||||
|
|
||||||
|
##name = mydomain
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
This system is the property of Known Element Enterprises LLC.
|
||||||
|
|
||||||
|
Authorized uses only. All activity may be monitored and reported.
|
||||||
|
|
||||||
|
All activities subject to monitoring/recording/review in real time and/or at a later time.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
This system is the property of Known Element Enterprises LLC.
|
||||||
|
|
||||||
|
Authorized uses only. All activity may be monitored and reported.
|
||||||
|
|
||||||
|
All activities subject to monitoring/recording/review in real time and/or at a later time.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
This system is the property of Known Element Enterprises LLC.
|
||||||
|
|
||||||
|
Authorized uses only. All activity may be monitored and reported.
|
||||||
|
|
||||||
|
All activities subject to monitoring/recording/review in real time and/or at a later time.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#/etc/cockpit/disallowed-users
|
||||||
|
# List of users which are not allowed to login to Cockpit
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
|
||||||
|
|
||||||
|
send host-name = gethostname();
|
||||||
|
request subnet-mask, broadcast-address, time-offset, routers,
|
||||||
|
domain-name, host-name,
|
||||||
|
domain-name-servers, domain-search, ntp-servers,
|
||||||
|
rfc3442-classless-static-routes;
|
||||||
|
|
||||||
|
# Pin DNS and NTP to the redundant pfv-netinfra-01/02 pair regardless of what
|
||||||
|
# the DHCP server advertises, so every host on this build uses the same
|
||||||
|
# authoritative recursive resolvers and time sources.
|
||||||
|
supersede domain-name-servers 192.168.3.252, 192.168.3.253;
|
||||||
|
supersede domain-search "knel.net";
|
||||||
|
supersede ntp-servers 192.168.3.252, 192.168.3.253;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# see "man logrotate" for details
|
||||||
|
|
||||||
|
# global options do not affect preceding include directives
|
||||||
|
|
||||||
|
# rotate log files weekly
|
||||||
|
weekly
|
||||||
|
|
||||||
|
# keep 4 weeks worth of backlogs
|
||||||
|
rotate 4
|
||||||
|
|
||||||
|
# create new (empty) log files after rotating old ones
|
||||||
|
create 0640 root utmp
|
||||||
|
|
||||||
|
# use date as a suffix of the rotated file
|
||||||
|
#dateext
|
||||||
|
|
||||||
|
# uncomment this if you want your log files compressed
|
||||||
|
#compress
|
||||||
|
|
||||||
|
# packages drop log rotation information into this directory
|
||||||
|
include /etc/logrotate.d
|
||||||
|
|
||||||
|
# system-specific logs may also be configured here.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install cramfs /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install dccp /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install freevxfs /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install hfs /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install hfsplus /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install jffs2 /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install rds /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install sctp /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install squashfs /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install tipc /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install udf /bin/true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
install usb-storage /bin/true
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
driftfile /var/lib/ntp/ntp.drift
|
||||||
|
leapfile /usr/share/zoneinfo/leap-seconds.list
|
||||||
|
|
||||||
|
# Redundant upstream time sources: pfv-netinfra-01/02 (Technitium/Pi-hole hosts
|
||||||
|
# also serving NTP). IPs are used (not hostnames) because the knel.net name for
|
||||||
|
# these hosts resolves to a Tailscale CGNAT address, not the LAN address, and
|
||||||
|
# because NTP must come up before DNS is available. iburst speeds initial sync.
|
||||||
|
server 192.168.3.252 iburst
|
||||||
|
server 192.168.3.253 iburst
|
||||||
|
|
||||||
|
# Hardened client: sync from the configured servers but never serve time to
|
||||||
|
# anyone else. Note: `interface listen 127.0.0.1` must NOT be used here — it
|
||||||
|
# binds ntpd to loopback, making outbound queries carry a 127.0.0.1 source
|
||||||
|
# address that upstream servers cannot reply to (symptoms: peers stuck in
|
||||||
|
# .INIT. with reach 0). Use restrict rules to control access instead.
|
||||||
|
restrict default ignore
|
||||||
|
restrict 127.0.0.1
|
||||||
|
restrict ::1
|
||||||
|
restrict 192.168.3.252 nomodify notrap nopeer
|
||||||
|
restrict 192.168.3.253 nomodify notrap nopeer
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Uncomment to start SNMP subagent and enable CDP, SONMP and EDP protocol
|
||||||
|
DAEMON_ARGS="-x -c -s -e"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# Managed by KNELServerBuild — do not edit; changes will be overwritten.
|
||||||
|
#
|
||||||
|
# Redundant recursive DNS via pfv-netinfra-01/02 (Technitium + Pi-hole).
|
||||||
|
# IPs are used (required: nameserver directives must be addresses, and the
|
||||||
|
# knel.net name for these hosts resolves to a Tailscale CGNAT address rather
|
||||||
|
# than the LAN address). If the primary is unreachable, glibc's resolver
|
||||||
|
# automatically falls through to the secondary.
|
||||||
|
domain knel.net
|
||||||
|
search knel.net
|
||||||
|
nameserver 192.168.3.252
|
||||||
|
nameserver 192.168.3.253
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# See man 5 aliases for format
|
||||||
|
postmaster: root
|
||||||
|
root: coo@turnsys.com
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/.*/ tsysrootaccount@knel.net
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Debian-snmp ALL = NOPASSWD: /bin/cat
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
##########################################################################
|
||||||
|
# snmpd.conf
|
||||||
|
# Created by CNW on 11/3/2018 via snmpconf wizard and manual post tweaks
|
||||||
|
###########################################################################
|
||||||
|
# SECTION: Monitor Various Aspects of the Running Host
|
||||||
|
#
|
||||||
|
|
||||||
|
# disk: Check for disk space usage of a partition.
|
||||||
|
# The agent can check the amount of available disk space, and make
|
||||||
|
# sure it is above a set limit.
|
||||||
|
#
|
||||||
|
load 3 3 3
|
||||||
|
rocommunity kn3lmgmt
|
||||||
|
sysservices 76
|
||||||
|
|
||||||
|
#syslocation Rack, Room, Building, City, Country [Lat, Lon]
|
||||||
|
syslocation R4, Server Room, SITER, Pflugerville, United States
|
||||||
|
syscontact coo@turnsys.com
|
||||||
|
|
||||||
|
#NTP
|
||||||
|
extend ntp-client /usr/lib/check_mk_agent/local/ntp-client
|
||||||
|
|
||||||
|
#SMTP
|
||||||
|
extend mailq /usr/lib/check_mk_agent/local/postfix-queues
|
||||||
|
extend postfixdetailed /usr/lib/check_mk_agent/local/postfixdetailed
|
||||||
|
|
||||||
|
#OS Distribution Detection
|
||||||
|
extend distro /usr/local/bin/distro
|
||||||
|
extend osupdate /usr/lib/check_mk_agent/local/os-updates.sh
|
||||||
|
|
||||||
|
#Hardware Detection
|
||||||
|
extend manufacturer /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/sys_vendor
|
||||||
|
extend hardware /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/product_name
|
||||||
|
extend serial /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/product_serial
|
||||||
|
|
||||||
|
#SMART
|
||||||
|
extend smart /usr/lib/check_mk_agent/local/smart
|
||||||
|
|
||||||
|
#Temperature
|
||||||
|
pass_persist .1.3.6.1.4.1.9.9.13.1.3 /usr/local/bin/temper-snmp
|
||||||
|
|
||||||
|
# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX
|
||||||
|
# smuxpeer .1.3.6.1.4.1.674.10892.1
|
||||||
|
|
||||||
|
# LLDP collection
|
||||||
|
master agentx
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
##########################################################################
|
||||||
|
# snmpd.conf
|
||||||
|
# Created by CNW on 11/3/2018 via snmpconf wizard and manual post tweaks
|
||||||
|
###########################################################################
|
||||||
|
# SECTION: Monitor Various Aspects of the Running Host
|
||||||
|
#
|
||||||
|
|
||||||
|
# disk: Check for disk space usage of a partition.
|
||||||
|
# The agent can check the amount of available disk space, and make
|
||||||
|
# sure it is above a set limit.
|
||||||
|
#
|
||||||
|
load 3 3 3
|
||||||
|
rocommunity kn3lmgmt
|
||||||
|
sysservices 76
|
||||||
|
|
||||||
|
#syslocation Rack, Room, Building, City, Country [Lat, Lon]
|
||||||
|
syslocation SITER, Pflugerville, United States
|
||||||
|
syscontact coo@turnsys.com
|
||||||
|
|
||||||
|
#NTP
|
||||||
|
extend ntp-client /usr/lib/check_mk_agent/local/ntp-client
|
||||||
|
|
||||||
|
#SMTP
|
||||||
|
extend mailq /usr/lib/check_mk_agent/local/postfix-queues
|
||||||
|
extend postfixdetailed /usr/lib/check_mk_agent/local/postfixdetailed
|
||||||
|
|
||||||
|
#OS Distribution Detection
|
||||||
|
extend distro /usr/local/bin/distro
|
||||||
|
extend osupdate /usr/lib/check_mk_agent/local/os-updates.sh
|
||||||
|
|
||||||
|
|
||||||
|
#Hardware Detection
|
||||||
|
extend hardware /usr/bin/sudo /usr/bin/cat /sys/firmware/devicetree/base/model
|
||||||
|
extend serial /usr/bin/sudo /usr/bin/cat /sys/firmware/devicetree/base/serial-number
|
||||||
|
|
||||||
|
# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX
|
||||||
|
# smuxpeer .1.3.6.1.4.1.674.10892.1
|
||||||
|
|
||||||
|
# LLDP collection
|
||||||
|
master agentx
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
##########################################################################
|
||||||
|
# snmpd.conf
|
||||||
|
# Created by CNW on 11/3/2018 via snmpconf wizard and manual post tweaks
|
||||||
|
###########################################################################
|
||||||
|
# SECTION: Monitor Various Aspects of the Running Host
|
||||||
|
#
|
||||||
|
|
||||||
|
# disk: Check for disk space usage of a partition.
|
||||||
|
# The agent can check the amount of available disk space, and make
|
||||||
|
# sure it is above a set limit.
|
||||||
|
#
|
||||||
|
load 3 3 3
|
||||||
|
rocommunity kn3lmgmt
|
||||||
|
sysservices 76
|
||||||
|
|
||||||
|
#syslocation Rack, Room, Building, City, Country [Lat, Lon]
|
||||||
|
syslocation R4, Server Room, SITER, Pflugerville, United States
|
||||||
|
syscontact coo@turnsys.com
|
||||||
|
|
||||||
|
#NTP
|
||||||
|
extend ntp-client /usr/lib/check_mk_agent/local/ntp-client
|
||||||
|
|
||||||
|
#SMTP
|
||||||
|
extend mailq /usr/lib/check_mk_agent/local/postfix-queues
|
||||||
|
extend postfixdetailed /usr/lib/check_mk_agent/local/postfixdetailed
|
||||||
|
|
||||||
|
#OS Distribution Detection
|
||||||
|
extend distro /usr/local/bin/distro
|
||||||
|
extend osupdate /usr/lib/check_mk_agent/local/os-updates.sh
|
||||||
|
|
||||||
|
# Socket statistics
|
||||||
|
extend ss /usr/lib/check_mk_agent/local/ss.py
|
||||||
|
|
||||||
|
#Hardware Detection
|
||||||
|
# (uncomment for x86 platforms)
|
||||||
|
extend manufacturer /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/sys_vendor
|
||||||
|
extend hardware /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/product_name
|
||||||
|
extend serial /usr/bin/sudo /usr/bin/cat /sys/devices/virtual/dmi/id/product_serial
|
||||||
|
|
||||||
|
# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX
|
||||||
|
# smuxpeer .1.3.6.1.4.1.674.10892.1
|
||||||
|
|
||||||
|
# LLDP collection
|
||||||
|
master agentx
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHaBNuLS+GYGRPc9wne63Ocr+R+/Q01Y9V0FTv0RnG3
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPyMR0lFgiMKhQJ5aqy68nR0BQp1cNzi/wIThyuTV4a8 tsyscto@ultix-control
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHaBNuLS+GYGRPc9wne63Ocr+R+/Q01Y9V0FTv0RnG3
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPyMR0lFgiMKhQJ5aqy68nR0BQp1cNzi/wIThyuTV4a8 tsyscto@ultix-control
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Restrict key exchange, cipher, and MAC algorithms, as per sshaudit.com
|
||||||
|
# hardening guide.
|
||||||
|
KexAlgorithms sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,gss-curve25519-sha256-,diffie-hellman-group16-sha512,gss-group16-sha512-,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256
|
||||||
|
|
||||||
|
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-gcm@openssh.com,aes128-ctr
|
||||||
|
|
||||||
|
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com
|
||||||
|
|
||||||
|
HostKeyAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256
|
||||||
|
|
||||||
|
RequiredRSASize 3072
|
||||||
|
|
||||||
|
CASignatureAlgorithms sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256
|
||||||
|
|
||||||
|
GSSAPIKexAlgorithms gss-curve25519-sha256-,gss-group16-sha512-
|
||||||
|
|
||||||
|
HostbasedAcceptedAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-256
|
||||||
|
|
||||||
|
PubkeyAcceptedAlgorithms sk-ssh-ed25519-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,ssh-ed25519,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-256
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Include /etc/ssh/sshd_config.d/*.conf
|
||||||
|
HostKey /etc/ssh/ssh_host_rsa_key
|
||||||
|
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||||
|
KbdInteractiveAuthentication no
|
||||||
|
PrintMotd no
|
||||||
|
PasswordAuthentication no
|
||||||
|
AllowTcpForwarding no
|
||||||
|
X11Forwarding no
|
||||||
|
ChallengeResponseAuthentication no
|
||||||
|
AcceptEnv LANG LC_*
|
||||||
|
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||||
|
UsePAM yes
|
||||||
|
Banner /etc/issue.net
|
||||||
|
MaxAuthTries 2
|
||||||
|
MaxStartups 10:30:100
|
||||||
|
PermitRootLogin prohibit-password
|
||||||
|
ClientAliveInterval 300
|
||||||
|
ClientAliveCountMax 3
|
||||||
|
AllowUsers root localuser subodev
|
||||||
|
LoginGraceTime 60
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
module(load="imuxsock") # provides support for local system logging
|
||||||
|
module(load="imklog") # provides kernel logging support
|
||||||
|
#module(load="immark") # provides --MARK-- message capability
|
||||||
|
|
||||||
|
*.* @tsys-librenms.knel.net:514
|
||||||
|
:omusrmsg:EOF
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
[Journal]
|
||||||
|
#Compress=yes
|
||||||
|
#Seal=yes
|
||||||
|
#SplitMode=uid
|
||||||
|
#SyncIntervalSec=5m
|
||||||
|
#RateLimitIntervalSec=30s
|
||||||
|
#RateLimitBurst=10000
|
||||||
|
#SystemMaxUse=
|
||||||
|
#SystemKeepFree=
|
||||||
|
#SystemMaxFileSize=
|
||||||
|
#SystemMaxFiles=100
|
||||||
|
#RuntimeMaxUse=
|
||||||
|
#RuntimeKeepFree=
|
||||||
|
#RuntimeMaxFileSize=
|
||||||
|
#RuntimeMaxFiles=100
|
||||||
|
#MaxRetentionSec=
|
||||||
|
#MaxFileSec=1month
|
||||||
|
#ForwardToSyslog=yes
|
||||||
|
#ForwardToKMsg=no
|
||||||
|
#ForwardToConsole=no
|
||||||
|
#ForwardToWall=yes
|
||||||
|
#TTYPath=/dev/console
|
||||||
|
#MaxLevelStore=debug
|
||||||
|
#MaxLevelSyslog=debug
|
||||||
|
#MaxLevelKMsg=notice
|
||||||
|
#MaxLevelConsole=info
|
||||||
|
#MaxLevelWall=emerg
|
||||||
|
#LineMax=48K
|
||||||
|
#ReadKMsg=yes
|
||||||
|
#Audit=no
|
||||||
|
Storage=persistent
|
||||||
@@ -0,0 +1,258 @@
|
|||||||
|
# ~/.zshrc file for zsh interactive shells.
|
||||||
|
# see /usr/share/doc/zsh/examples/zshrc for examples
|
||||||
|
|
||||||
|
setopt autocd # change directory just by typing its name
|
||||||
|
#setopt correct # auto correct mistakes
|
||||||
|
setopt interactivecomments # allow comments in interactive mode
|
||||||
|
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
|
||||||
|
setopt nonomatch # hide error message if there is no match for the pattern
|
||||||
|
setopt notify # report the status of background jobs immediately
|
||||||
|
setopt numericglobsort # sort filenames numerically when it makes sense
|
||||||
|
setopt promptsubst # enable command substitution in prompt
|
||||||
|
|
||||||
|
WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
|
||||||
|
|
||||||
|
# hide EOL sign ('%')
|
||||||
|
PROMPT_EOL_MARK=""
|
||||||
|
|
||||||
|
# configure key keybindings
|
||||||
|
bindkey -v # emacs key bindings
|
||||||
|
bindkey ' ' magic-space # do history expansion on space
|
||||||
|
bindkey '^U' backward-kill-line # ctrl + U
|
||||||
|
bindkey '^[[3;5~' kill-word # ctrl + Supr
|
||||||
|
bindkey '^[[3~' delete-char # delete
|
||||||
|
bindkey '^[[1;5C' forward-word # ctrl + ->
|
||||||
|
bindkey '^[[1;5D' backward-word # ctrl + <-
|
||||||
|
bindkey '^[[5~' beginning-of-buffer-or-history # page up
|
||||||
|
bindkey '^[[6~' end-of-buffer-or-history # page down
|
||||||
|
bindkey '^[[H' beginning-of-line # home
|
||||||
|
bindkey '^[[F' end-of-line # end
|
||||||
|
bindkey '^[[Z' undo # shift + tab undo last action
|
||||||
|
|
||||||
|
# enable completion features
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit -d ~/.cache/zcompdump
|
||||||
|
zstyle ':completion:*:*:*:*:*' menu select
|
||||||
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
|
zstyle ':completion:*' completer _expand _complete
|
||||||
|
zstyle ':completion:*' format 'Completing %d'
|
||||||
|
zstyle ':completion:*' group-name ''
|
||||||
|
zstyle ':completion:*' list-colors ''
|
||||||
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
||||||
|
zstyle ':completion:*' rehash true
|
||||||
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
|
zstyle ':completion:*' use-compctl false
|
||||||
|
zstyle ':completion:*' verbose true
|
||||||
|
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||||
|
|
||||||
|
# History configurations
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
|
HISTSIZE=10000
|
||||||
|
SAVEHIST=200000
|
||||||
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
#setopt share_history # share command history data
|
||||||
|
|
||||||
|
# force zsh to show the complete history
|
||||||
|
alias history="history 0"
|
||||||
|
|
||||||
|
# configure `time` format
|
||||||
|
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
|
||||||
|
|
||||||
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
|
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||||
|
|
||||||
|
# set variable identifying the chroot you work in (used in the prompt below)
|
||||||
|
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||||
|
debian_chroot=$(cat /etc/debian_chroot)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||||
|
case "$TERM" in
|
||||||
|
xterm-color|*-256color) color_prompt=yes;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||||
|
# off by default to not distract the user: the focus in a terminal window
|
||||||
|
# should be on the output of commands, not on the prompt
|
||||||
|
force_color_prompt=yes
|
||||||
|
|
||||||
|
if [ -n "$force_color_prompt" ]; then
|
||||||
|
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||||
|
# We have color support; assume it's compliant with Ecma-48
|
||||||
|
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||||
|
# a case would tend to support setf rather than setaf.)
|
||||||
|
color_prompt=yes
|
||||||
|
else
|
||||||
|
color_prompt=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
configure_prompt() {
|
||||||
|
prompt_symbol=㉿
|
||||||
|
# Skull emoji for root terminal
|
||||||
|
#[ "$EUID" -eq 0 ] && prompt_symbol=💀
|
||||||
|
case "$PROMPT_ALTERNATIVE" in
|
||||||
|
twoline)
|
||||||
|
PROMPT=$'%F{%(#.blue.green)}┌──${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n'$prompt_symbol$'%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
|
||||||
|
# Right-side prompt with exit codes and background processes
|
||||||
|
#RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
|
||||||
|
;;
|
||||||
|
oneline)
|
||||||
|
PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
|
||||||
|
RPROMPT=
|
||||||
|
;;
|
||||||
|
backtrack)
|
||||||
|
PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
|
||||||
|
RPROMPT=
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
unset prompt_symbol
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following block is surrounded by two delimiters.
|
||||||
|
# These delimiters must not be modified. Thanks.
|
||||||
|
# START KALI CONFIG VARIABLES
|
||||||
|
PROMPT_ALTERNATIVE=twoline
|
||||||
|
NEWLINE_BEFORE_PROMPT=yes
|
||||||
|
# STOP KALI CONFIG VARIABLES
|
||||||
|
|
||||||
|
if [ "$color_prompt" = yes ]; then
|
||||||
|
# override default virtualenv indicator in prompt
|
||||||
|
VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
|
|
||||||
|
configure_prompt
|
||||||
|
|
||||||
|
# enable syntax-highlighting
|
||||||
|
if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
|
||||||
|
. /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
|
||||||
|
ZSH_HIGHLIGHT_STYLES[default]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[unknown-token]=underline
|
||||||
|
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
|
||||||
|
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
|
||||||
|
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
|
||||||
|
ZSH_HIGHLIGHT_STYLES[path]=bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
|
||||||
|
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
|
||||||
|
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
|
||||||
|
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
|
||||||
|
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
|
||||||
|
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
|
||||||
|
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
|
||||||
|
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
|
||||||
|
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[assign]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[named-fd]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
|
||||||
|
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
|
||||||
|
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
|
||||||
|
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
|
||||||
|
fi
|
||||||
|
unset color_prompt force_color_prompt
|
||||||
|
|
||||||
|
toggle_oneline_prompt(){
|
||||||
|
if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
|
||||||
|
PROMPT_ALTERNATIVE=twoline
|
||||||
|
else
|
||||||
|
PROMPT_ALTERNATIVE=oneline
|
||||||
|
fi
|
||||||
|
configure_prompt
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
zle -N toggle_oneline_prompt
|
||||||
|
bindkey ^P toggle_oneline_prompt
|
||||||
|
|
||||||
|
# If this is an xterm set the title to user@host:dir
|
||||||
|
case "$TERM" in
|
||||||
|
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
|
||||||
|
TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
precmd() {
|
||||||
|
# Print the previously configured title
|
||||||
|
print -Pnr -- "$TERM_TITLE"
|
||||||
|
|
||||||
|
# Print a new line before the prompt, but only if it is not the first line
|
||||||
|
if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
|
||||||
|
if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
|
||||||
|
_NEW_LINE_BEFORE_PROMPT=1
|
||||||
|
else
|
||||||
|
print ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# enable color support of ls, less and man, and also add handy aliases
|
||||||
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
|
export LS_COLORS="$LS_COLORS:ow=30;44:" # fix ls color for folders with 777 permissions
|
||||||
|
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
#alias dir='dir --color=auto'
|
||||||
|
#alias vdir='vdir --color=auto'
|
||||||
|
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias diff='diff --color=auto'
|
||||||
|
alias ip='ip --color=auto'
|
||||||
|
|
||||||
|
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
|
||||||
|
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
|
||||||
|
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
|
||||||
|
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
|
||||||
|
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
|
||||||
|
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
|
||||||
|
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
|
||||||
|
|
||||||
|
# Take advantage of $LS_COLORS for completion as well
|
||||||
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# some more ls aliases
|
||||||
|
alias ll='ls -l'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
|
|
||||||
|
# enable auto-suggestions based on the history
|
||||||
|
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
|
||||||
|
. /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
# change suggestion color
|
||||||
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# enable command-not-found if installed
|
||||||
|
if [ -f /etc/zsh_command_not_found ]; then
|
||||||
|
. /etc/zsh_command_not_found
|
||||||
|
fi
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# PFV NFS tuning service
|
||||||
|
#
|
||||||
|
# Systemd oneshot that runs AFTER tuned.service to apply TCP buffer
|
||||||
|
# overrides. The tuned daemon's profiles (network-throughput for storage
|
||||||
|
# hosts, virtual-host for compute hosts) set 16MB TCP buffer caps which
|
||||||
|
# are too small for high-BDP NFS over LACP links. This service force-
|
||||||
|
# applies 128MB buffers after tuned has finished its configuration.
|
||||||
|
#
|
||||||
|
# Install:
|
||||||
|
# cp pfv-nfs-tuning.service /etc/systemd/system/pfv-nfs-tuning.service
|
||||||
|
# systemctl daemon-reload
|
||||||
|
# systemctl enable --now pfv-nfs-tuning.service
|
||||||
|
#
|
||||||
|
# Created: 2026-07-31
|
||||||
|
# Deployed: all 7 Proxmox hosts (tsys1/3/4/5/6/7/9)
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=PFV NFS tuning (override tuned TCP buffer caps)
|
||||||
|
After=tuned.service
|
||||||
|
Requires=tuned.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/sbin/sysctl -p /etc/sysctl.d/99-pfv-nfs.conf
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#magic to detect main int
|
||||||
|
echo "Determining management interface..."
|
||||||
|
#export MAIN_INT=$(brctl show $(netstat -rn|grep 0.0.0.0|head -n1|awk '{print $NF}') | awk '{print $NF}'|tail -1|awk -F '.' '{print $1}')
|
||||||
|
MAIN_INT=$(brctl show|grep vmbr0|awk '{print $NF}'|awk -F '.' '{print $1}')
|
||||||
|
export MAIN_INT
|
||||||
|
|
||||||
|
echo "Management interface is: $MAIN_INT"
|
||||||
|
|
||||||
|
#fix the issue
|
||||||
|
echo "Fixing management interface..."
|
||||||
|
ethtool -K "$MAIN_INT" tso off
|
||||||
|
ethtool -K "$MAIN_INT" gro off
|
||||||
|
ethtool -K "$MAIN_INT" gso off
|
||||||
|
ethtool -K "$MAIN_INT" tx off
|
||||||
|
ethtool -K "$MAIN_INT" rx off
|
||||||
|
|
||||||
|
#https://forum.proxmox.com/threads/e1000-driver-hang.58284/
|
||||||
|
#https://serverfault.com/questions/616485/e1000e-reset-adapter-unexpectedly-detected-hardware-unit-hang
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#curl -s http://dl.turnsys.net/omsa.sh|/bin/bash
|
||||||
|
|
||||||
|
gpg --keyserver hkp://pool.sks-keyservers.net:80 --recv-key 1285491434D8786F
|
||||||
|
gpg -a --export 1285491434D8786F | apt-key add -
|
||||||
|
echo "deb https://linux.dell.com/repo/community/openmanage/930/bionic bionic main" > /etc/apt/sources.list.d/linux.dell.com.sources.list
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman-curl-client-transport1_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman-client4_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman1_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman-server1_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/s/sblim-sfcc/libcimcclient0_2.2.8-0ubuntu2_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/openwsman_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/multiverse/c/cim-schema/cim-schema_2.48.0-0ubuntu1_all.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/s/sblim-sfc-common/libsfcutil0_1.0.1-0ubuntu4_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/multiverse/s/sblim-sfcb/sfcb_1.4.9-0ubuntu5_amd64.deb
|
||||||
|
wget https://archive.ubuntu.com/ubuntu/pool/universe/s/sblim-cmpi-devel/libcmpicppimpl0_2.0.3-0ubuntu2_amd64.deb
|
||||||
|
dpkg -i libwsman-curl-client-transport1_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
dpkg -i libwsman-client4_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
dpkg -i libwsman1_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
dpkg -i libwsman-server1_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
dpkg -i libcimcclient0_2.2.8-0ubuntu2_amd64.deb
|
||||||
|
dpkg -i openwsman_2.6.5-0ubuntu3_amd64.deb
|
||||||
|
dpkg -i cim-schema_2.48.0-0ubuntu1_all.deb
|
||||||
|
dpkg -i libsfcutil0_1.0.1-0ubuntu4_amd64.deb
|
||||||
|
dpkg -i sfcb_1.4.9-0ubuntu5_amd64.deb
|
||||||
|
dpkg -i libcmpicppimpl0_2.0.3-0ubuntu2_amd64.deb
|
||||||
|
|
||||||
|
apt update
|
||||||
|
apt -y install srvadmin-all
|
||||||
|
touch /opt/dell/srvadmin/lib64/openmanage/IGNORE_GENERATION
|
||||||
|
|
||||||
|
#logout,login, then run
|
||||||
|
# srvadmin-services.sh enable && srvadmin-services.sh start
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Script to set performance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cpufreq-set -r -g performance
|
||||||
|
cpupower frequency-set --governor performance
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# auth-cloudron-ldap.sh — placeholder module (Cloudron LDAP auth integration).
|
||||||
|
# Intentionally empty; populated when the auth stack is deployed.
|
||||||
|
true
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
export AGENTS_PATH
|
||||||
|
AGENTS_PATH="$PROJECT_ROOT_PATH/provisioning/Agents"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
print_info "Setting up librenms agent..."
|
||||||
|
|
||||||
|
cat "$AGENTS_PATH/librenms/distro" > /usr/local/bin/distro
|
||||||
|
chmod +x /usr/local/bin/distro
|
||||||
|
|
||||||
|
if [ ! -d /usr/lib/check_mk_agent ]; then
|
||||||
|
mkdir -p /usr/lib/check_mk_agent
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /usr/lib/check_mk_agent/plugins ]; then
|
||||||
|
mkdir -p /usr/lib/check_mk_agent/plugins
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /usr/lib/check_mk_agent/local ]; then
|
||||||
|
mkdir -p /usr/lib/check_mk_agent/local
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "$AGENTS_PATH/librenms/check_mk_agent" > /usr/bin/check_mk_agent
|
||||||
|
chmod +x /usr/bin/check_mk_agent
|
||||||
|
|
||||||
|
cat "$AGENTS_PATH/librenms/check_mk@.service" > /etc/systemd/system/check_mk@.service
|
||||||
|
cat "$AGENTS_PATH/librenms/check_mk.socket" > /etc/systemd/system/check_mk.socket
|
||||||
|
|
||||||
|
systemctl enable check_mk.socket
|
||||||
|
systemctl start check_mk.socket
|
||||||
|
|
||||||
|
#Modules commented out below, we will roll out on systems that use them, most of the fleet doesn't use those modules
|
||||||
|
|
||||||
|
cat "$AGENTS_PATH/librenms/dmi.sh" > /usr/lib/check_mk_agent/local/dmi.sh
|
||||||
|
cat "$AGENTS_PATH/librenms/dpkg.sh" > /usr/lib/check_mk_agent/local/dpkg.sh
|
||||||
|
#cat "$AGENTS_PATH/librenms/mysql.sh" > /usr/lib/check_mk_agent/local/mysql.sh
|
||||||
|
cat "$AGENTS_PATH/librenms/ntp-client" > /usr/lib/check_mk_agent/local/ntp-client
|
||||||
|
#cat "$AGENTS_PATH/librenms/ntp-server.sh" > /usr/lib/check_mk_agent/local/ntp-server.sh
|
||||||
|
cat "$AGENTS_PATH/librenms/os-updates.sh" > /usr/lib/check_mk_agent/local/os-updates.sh
|
||||||
|
cat "$AGENTS_PATH/librenms/postfixdetailed" > /usr/lib/check_mk_agent/local/postfixdetailed
|
||||||
|
cat "$AGENTS_PATH/librenms/postfix-queues" > /usr/lib/check_mk_agent/local/postfix-queues
|
||||||
|
#cat "$AGENTS_PATH/librenms/smart.sh" > /usr/lib/check_mk_agent/local/smart
|
||||||
|
#cat "$AGENTS_PATH/librenms/smart.sh.config" > /usr/lib/check_mk_agent/local/smart.config
|
||||||
|
|
||||||
|
chmod +x /usr/lib/check_mk_agent/local/*
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC2103 # legacy R&D build script; cd/cd- sequence is intentional
|
||||||
|
|
||||||
|
#Made from instructions at https://www.tunetheweb.com/performance/http2/
|
||||||
|
|
||||||
|
OPENSSL_URL_BASE="https://www.openssl.org/source/"
|
||||||
|
OPENSSL_FILE="openssl-1.1.0h.tar.gz"
|
||||||
|
|
||||||
|
NGHTTP_URL_BASE="https://github.com/nghttp2/nghttp2/releases/download/v1.31.0/"
|
||||||
|
NGHTTP_FILE="nghttp2-1.31.0.tar.gz"
|
||||||
|
|
||||||
|
APR_URL_BASE="https://archive.apache.org/dist/apr/"
|
||||||
|
APR_FILE="apr-1.6.3.tar.gz"
|
||||||
|
|
||||||
|
APR_UTIL_URL_BASE="https://archive.apache.org/dist/apr/"
|
||||||
|
APR_UTIL_FILE="apr-util-1.6.1.tar.gz"
|
||||||
|
|
||||||
|
APACHE_URL_BASE="https://archive.apache.org/dist/httpd/"
|
||||||
|
APACHE_FILE="httpd-2.4.33.tar.gz"
|
||||||
|
|
||||||
|
CURL_URL_BASE="https://curl.haxx.se/download/"
|
||||||
|
CURL_FILE="curl-7.60.0.tar.gz"
|
||||||
|
|
||||||
|
|
||||||
|
#Download and install latest version of openssl
|
||||||
|
wget $OPENSSL_URL_BASE/$OPENSSL_FILE
|
||||||
|
tar xzf $OPENSSL_FILE
|
||||||
|
cd openssl-1.1.0h || exit
|
||||||
|
./config enable-weak-ssl-ciphers shared zlib-dynamic -DOPENSSL_TLS_SECURITY_LEVEL=0 --prefix=/usr/local/custom-ssl/openssl-1.1.0h ; make ; make install
|
||||||
|
ln -s /usr/local/custom-ssl/openssl-1.1.0h /usr/local/openssl
|
||||||
|
cd - || exit
|
||||||
|
|
||||||
|
#Download and install nghttp2 (needed for mod_http2).
|
||||||
|
wget $NGHTTP_URL_BASE/$NGHTTP_FILE
|
||||||
|
tar xzf $NGHTTP_FILE
|
||||||
|
cd nghttp2-1.31.0 || exit
|
||||||
|
./configure --prefix=/usr/local/custom-ssl/nghttp ; make ; make install
|
||||||
|
cd - || exit
|
||||||
|
|
||||||
|
#Updated ldconfig so curl build
|
||||||
|
|
||||||
|
cat <<custom-ssl > /etc/ld.so.conf.d/custom-ssl.conf
|
||||||
|
/usr/local/custom-ssl/openssl-1.1.0h/lib
|
||||||
|
/usr/local/custom-ssl/nghttp/lib
|
||||||
|
custom-ssl
|
||||||
|
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
#Download and install curl
|
||||||
|
wget $CURL_URL_BASE/$CURL_FILE
|
||||||
|
tar xzf curl-7.60.0.tar.gz
|
||||||
|
cd curl-7.60.0 || exit
|
||||||
|
./configure --prefix=/usr/local/custom-ssl/curl --with-nghttp2=/usr/local/custom-ssl/nghttp/ --with-ssl=/usr/local/custom-ssl/openssl-1.1.0h/ ; make ; make install
|
||||||
|
cd - || exit
|
||||||
|
|
||||||
|
|
||||||
|
#Download and install latest apr
|
||||||
|
wget $APR_URL_BASE/$APR_FILE
|
||||||
|
tar xzf $APR_FILE
|
||||||
|
cd apr-1.6.3 || exit
|
||||||
|
./configure --prefix=/usr/local/custom-ssl/apr ; make ; make install
|
||||||
|
cd - || exit
|
||||||
|
|
||||||
|
#Download and install latest apr-util
|
||||||
|
wget $APR_UTIL_URL_BASE/$APR_UTIL_FILE
|
||||||
|
tar xzf apr-util-1.6.1.tar.gz
|
||||||
|
cd apr-util-1.6.1 || exit
|
||||||
|
./configure --prefix=/usr/local/custom-ssl/apr-util --with-apr=/usr/local/custom-ssl/apr ; make; make install
|
||||||
|
cd - || exit
|
||||||
|
|
||||||
|
#Download and install apache
|
||||||
|
wget $APACHE_URL_BASE/$APACHE_FILE
|
||||||
|
tar xzf httpd-2.4.33.tar.gz
|
||||||
|
cd httpd-2.4.33 || exit
|
||||||
|
cp -r ../apr-1.6.3 srclib/apr
|
||||||
|
cp -r ../apr-util-1.6.1 srclib/apr-util
|
||||||
|
./configure --prefix=/usr/local/custom-ssl/apache --with-ssl=/usr/local/custom-ssl/openssl-1.1.0h/ --with-pcre=/usr/bin/pcre-config --enable-unique-id --enable-ssl --enable-so --with-included-apr --enable-http2 --with-nghttp2=/usr/local/custom-ssl/nghttp/
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
ln -s /usr/local/custom-ssl/apache /usr/local/apache
|
||||||
|
cd - || exit
|
||||||
|
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# TSYS Security Hardening - Two-Factor Authentication
|
||||||
|
# Implements 2FA for SSH, Cockpit, and Webmin services
|
||||||
|
# Uses Google Authenticator (TOTP) for time-based tokens
|
||||||
|
|
||||||
|
|
||||||
|
#####
|
||||||
|
#Core framework functions...
|
||||||
|
#####
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# 2FA Configuration
|
||||||
|
BACKUP_DIR="/root/backup/2fa"
|
||||||
|
PAM_CONFIG_DIR="/etc/pam.d"
|
||||||
|
SSH_CONFIG="/etc/ssh/sshd_config"
|
||||||
|
COCKPIT_CONFIG="/etc/cockpit/cockpit.conf"
|
||||||
|
|
||||||
|
# Create backup directory
|
||||||
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
|
||||||
|
print_info "TSYS Two-Factor Authentication Setup"
|
||||||
|
|
||||||
|
# Backup existing configurations
|
||||||
|
function backup_configs() {
|
||||||
|
print_info "Creating backup of existing configurations..."
|
||||||
|
|
||||||
|
# Backup SSH configuration
|
||||||
|
if [[ -f "$SSH_CONFIG" ]]; then
|
||||||
|
cp "$SSH_CONFIG" "$BACKUP_DIR/sshd_config.bak"
|
||||||
|
print_info "SSH config backed up"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup PAM configurations
|
||||||
|
if [[ -d "$PAM_CONFIG_DIR" ]]; then
|
||||||
|
cp -r "$PAM_CONFIG_DIR" "$BACKUP_DIR/pam.d.bak"
|
||||||
|
print_info "PAM configs backed up"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup Cockpit configuration if exists
|
||||||
|
if [[ -f "$COCKPIT_CONFIG" ]]; then
|
||||||
|
cp "$COCKPIT_CONFIG" "$BACKUP_DIR/cockpit.conf.bak"
|
||||||
|
print_info "Cockpit config backed up"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_info "Backup completed: $BACKUP_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install required packages
|
||||||
|
function install_2fa_packages() {
|
||||||
|
print_info "Installing 2FA packages..."
|
||||||
|
|
||||||
|
# Update package cache
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
# Install Google Authenticator PAM module
|
||||||
|
# Install QR code generator for terminal display
|
||||||
|
apt-get install -y libpam-google-authenticator qrencode
|
||||||
|
|
||||||
|
print_info "2FA packages installed successfully"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure SSH for 2FA
|
||||||
|
function configure_ssh_2fa() {
|
||||||
|
print_info "Configuring SSH for 2FA..."
|
||||||
|
|
||||||
|
# Configure SSH daemon
|
||||||
|
print_info "Updating SSH configuration..."
|
||||||
|
|
||||||
|
# Enable challenge-response authentication
|
||||||
|
if ! grep -q "^ChallengeResponseAuthentication yes" "$SSH_CONFIG"; then
|
||||||
|
sed -i 's/^ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/' "$SSH_CONFIG" || \
|
||||||
|
echo "ChallengeResponseAuthentication yes" >> "$SSH_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "^KbdInteractiveAuthentication yes" "$SSH_CONFIG"; then
|
||||||
|
sed -i 's/^KbdInteractiveAuthentication.*/KbdInteractiveAuthentication yes/' "$SSH_CONFIG" || \
|
||||||
|
echo "KbdInteractiveAuthentication yes" >> "$SSH_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable PAM authentication
|
||||||
|
if ! grep -q "^UsePAM yes" "$SSH_CONFIG"; then
|
||||||
|
sed -i 's/^UsePAM.*/UsePAM yes/' "$SSH_CONFIG" || \
|
||||||
|
echo "UsePAM yes" >> "$SSH_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure authentication methods (key + 2FA)
|
||||||
|
if ! grep -q "^AuthenticationMethods" "$SSH_CONFIG"; then
|
||||||
|
echo "AuthenticationMethods publickey,keyboard-interactive" >> "$SSH_CONFIG"
|
||||||
|
else
|
||||||
|
sed -i 's/^AuthenticationMethods.*/AuthenticationMethods publickey,keyboard-interactive/' "$SSH_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_info "SSH configuration updated"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure PAM for 2FA
|
||||||
|
function configure_pam_2fa() {
|
||||||
|
print_info "Configuring PAM for 2FA..."
|
||||||
|
|
||||||
|
# Create backup of original PAM SSH config
|
||||||
|
cp "$PAM_CONFIG_DIR/sshd" "$PAM_CONFIG_DIR/sshd.bak.$(date +%Y%m%d)"
|
||||||
|
|
||||||
|
# Configure PAM to use Google Authenticator
|
||||||
|
cat > "$PAM_CONFIG_DIR/sshd" << 'EOF'
|
||||||
|
# PAM configuration for SSH with 2FA
|
||||||
|
# Standard Un*x authentication
|
||||||
|
@include common-auth
|
||||||
|
|
||||||
|
# Google Authenticator 2FA
|
||||||
|
auth required pam_google_authenticator.so nullok
|
||||||
|
|
||||||
|
# Standard Un*x authorization
|
||||||
|
@include common-account
|
||||||
|
|
||||||
|
# SELinux needs to be the first session rule
|
||||||
|
session required pam_selinux.so close
|
||||||
|
session required pam_loginuid.so
|
||||||
|
|
||||||
|
# Standard Un*x session setup and teardown
|
||||||
|
@include common-session
|
||||||
|
|
||||||
|
# Print the message of the day upon successful login
|
||||||
|
session optional pam_motd.so motd=/run/motd.dynamic
|
||||||
|
session optional pam_motd.so noupdate
|
||||||
|
|
||||||
|
# Print the status of the user's mailbox upon successful login
|
||||||
|
session optional pam_mail.so standard noenv
|
||||||
|
|
||||||
|
# Set up user limits from /etc/security/limits.conf
|
||||||
|
session required pam_limits.so
|
||||||
|
|
||||||
|
# SELinux needs to intervene at login time
|
||||||
|
session required pam_selinux.so open
|
||||||
|
|
||||||
|
# Standard Un*x password updating
|
||||||
|
@include common-password
|
||||||
|
EOF
|
||||||
|
|
||||||
|
print_info "PAM configuration updated for SSH 2FA"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure Cockpit for 2FA
|
||||||
|
function configure_cockpit_2fa() {
|
||||||
|
print_info "Configuring Cockpit for 2FA..."
|
||||||
|
|
||||||
|
# Create Cockpit config directory if it doesn't exist
|
||||||
|
mkdir -p "$(dirname "$COCKPIT_CONFIG")"
|
||||||
|
|
||||||
|
# Configure Cockpit to use PAM with 2FA
|
||||||
|
cat > "$COCKPIT_CONFIG" << 'EOF'
|
||||||
|
[WebService]
|
||||||
|
# Enable 2FA for Cockpit web interface
|
||||||
|
LoginTitle = TSYS Server Management
|
||||||
|
LoginTo = 300
|
||||||
|
RequireHost = true
|
||||||
|
|
||||||
|
[Session]
|
||||||
|
# Use PAM for authentication (includes 2FA)
|
||||||
|
Banner = /etc/cockpit/issue.cockpit
|
||||||
|
IdleTimeout = 15
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Create PAM configuration for Cockpit
|
||||||
|
cat > "$PAM_CONFIG_DIR/cockpit" << 'EOF'
|
||||||
|
# PAM configuration for Cockpit with 2FA
|
||||||
|
auth requisite pam_nologin.so
|
||||||
|
auth required pam_env.so
|
||||||
|
auth required pam_faillock.so preauth
|
||||||
|
auth sufficient pam_unix.so try_first_pass
|
||||||
|
auth required pam_google_authenticator.so nullok
|
||||||
|
auth required pam_faillock.so authfail
|
||||||
|
auth required pam_deny.so
|
||||||
|
|
||||||
|
account required pam_nologin.so
|
||||||
|
account include system-auth
|
||||||
|
account required pam_faillock.so
|
||||||
|
|
||||||
|
session required pam_selinux.so close
|
||||||
|
session required pam_loginuid.so
|
||||||
|
session optional pam_keyinit.so force revoke
|
||||||
|
session include system-auth
|
||||||
|
session required pam_selinux.so open
|
||||||
|
session optional pam_motd.so
|
||||||
|
EOF
|
||||||
|
|
||||||
|
print_info "Cockpit 2FA configuration completed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure Webmin for 2FA (if installed)
|
||||||
|
function configure_webmin_2fa() {
|
||||||
|
print_info "Checking for Webmin installation..."
|
||||||
|
|
||||||
|
local webmin_config="/etc/webmin/miniserv.conf"
|
||||||
|
|
||||||
|
if [[ -f "$webmin_config" ]]; then
|
||||||
|
print_info "Webmin found, configuring 2FA..."
|
||||||
|
|
||||||
|
# Stop webmin service
|
||||||
|
systemctl stop webmin || true
|
||||||
|
|
||||||
|
# Enable 2FA in Webmin configuration. `sed -i ... || echo` would never
|
||||||
|
# append, because sed returns 0 even when it matches nothing; guard with
|
||||||
|
# grep so the directive is added when absent and updated when present.
|
||||||
|
if grep -q '^twofactor_provider=' "$webmin_config"; then
|
||||||
|
sed -i 's/^twofactor_provider=.*/twofactor_provider=totp/' "$webmin_config"
|
||||||
|
else
|
||||||
|
echo "twofactor_provider=totp" >> "$webmin_config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable 2FA requirement
|
||||||
|
if grep -q '^twofactor=' "$webmin_config"; then
|
||||||
|
sed -i 's/^twofactor=.*/twofactor=1/' "$webmin_config"
|
||||||
|
else
|
||||||
|
echo "twofactor=1" >> "$webmin_config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start webmin service
|
||||||
|
systemctl start webmin || true
|
||||||
|
|
||||||
|
print_info "Webmin 2FA configuration completed"
|
||||||
|
else
|
||||||
|
print_info "Webmin not found, skipping configuration"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setup 2FA for users
|
||||||
|
function setup_user_2fa() {
|
||||||
|
print_info "Setting up 2FA for system users..."
|
||||||
|
|
||||||
|
local users=("localuser" "root")
|
||||||
|
|
||||||
|
for user in "${users[@]}"; do
|
||||||
|
if id "$user" &>/dev/null; then
|
||||||
|
print_info "Setting up 2FA for user: $user"
|
||||||
|
|
||||||
|
local user_home
|
||||||
|
user_home="$(getent passwd "$user" | cut -d: -f6)"
|
||||||
|
if [[ -z "$user_home" ]]; then
|
||||||
|
print_info "No home directory for $user, skipping"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create 2FA setup script for user
|
||||||
|
cat > "/tmp/setup-2fa-$user.sh" << 'EOF'
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Setting up Google Authenticator for user: $USER"
|
||||||
|
echo "Please follow the prompts to configure 2FA:"
|
||||||
|
echo "1. Answer 'y' to update your time-based token"
|
||||||
|
echo "2. Scan the QR code with your authenticator app"
|
||||||
|
echo "3. Save the backup codes in a secure location"
|
||||||
|
echo "4. Answer 'y' to the remaining questions for security"
|
||||||
|
echo ""
|
||||||
|
google-authenticator -t -d -f -r 3 -R 30 -W
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x "/tmp/setup-2fa-$user.sh"
|
||||||
|
|
||||||
|
# Instructions for user setup
|
||||||
|
cat > "$user_home/2fa-setup-instructions.txt" << EOF
|
||||||
|
TSYS Two-Factor Authentication Setup Instructions
|
||||||
|
==============================================
|
||||||
|
|
||||||
|
Your system has been configured for 2FA. To complete setup:
|
||||||
|
|
||||||
|
1. Install an authenticator app on your phone:
|
||||||
|
- Google Authenticator
|
||||||
|
- Authy
|
||||||
|
- Microsoft Authenticator
|
||||||
|
|
||||||
|
2. Run the setup command:
|
||||||
|
sudo /tmp/setup-2fa-$user.sh
|
||||||
|
|
||||||
|
3. Follow the prompts:
|
||||||
|
- Scan the QR code with your app
|
||||||
|
- Save the backup codes securely
|
||||||
|
- Answer 'y' to security questions
|
||||||
|
|
||||||
|
4. Test your setup:
|
||||||
|
- SSH to the server
|
||||||
|
- Enter your 6-digit code when prompted
|
||||||
|
|
||||||
|
IMPORTANT: Save backup codes in a secure location!
|
||||||
|
Without them, you may be locked out if you lose your phone.
|
||||||
|
|
||||||
|
For support, contact your system administrator.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chown "$user:$user" "$user_home/2fa-setup-instructions.txt"
|
||||||
|
print_info "2FA setup prepared for user: $user"
|
||||||
|
else
|
||||||
|
print_info "User $user not found, skipping"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restart services
|
||||||
|
function restart_services() {
|
||||||
|
print_info "Restarting services..."
|
||||||
|
|
||||||
|
# Test SSH configuration
|
||||||
|
if sshd -t; then
|
||||||
|
systemctl restart sshd
|
||||||
|
print_info "SSH service restarted"
|
||||||
|
else
|
||||||
|
print_error "SSH configuration test failed"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart Cockpit if installed
|
||||||
|
if systemctl is-enabled cockpit.socket &>/dev/null; then
|
||||||
|
systemctl restart cockpit.socket
|
||||||
|
print_info "Cockpit service restarted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart Webmin if installed
|
||||||
|
if systemctl is-enabled webmin &>/dev/null; then
|
||||||
|
systemctl restart webmin
|
||||||
|
print_info "Webmin service restarted"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Validation and testing
|
||||||
|
function validate_2fa_setup() {
|
||||||
|
print_info "Validating 2FA setup..."
|
||||||
|
|
||||||
|
# Check if Google Authenticator is installed
|
||||||
|
if command -v google-authenticator &>/dev/null; then
|
||||||
|
print_info "Google Authenticator installed"
|
||||||
|
else
|
||||||
|
print_error "Google Authenticator not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check SSH configuration
|
||||||
|
if grep -q "AuthenticationMethods publickey,keyboard-interactive" "$SSH_CONFIG"; then
|
||||||
|
print_info "SSH 2FA configuration valid"
|
||||||
|
else
|
||||||
|
print_error "SSH 2FA configuration invalid"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check PAM configuration
|
||||||
|
if grep -q "pam_google_authenticator.so" "$PAM_CONFIG_DIR/sshd"; then
|
||||||
|
print_info "PAM 2FA configuration valid"
|
||||||
|
else
|
||||||
|
print_error "PAM 2FA configuration invalid"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check service status
|
||||||
|
if systemctl is-active sshd &>/dev/null; then
|
||||||
|
print_info "SSH service is running"
|
||||||
|
else
|
||||||
|
print_error "SSH service is not running"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_info "2FA validation completed successfully"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display final instructions
|
||||||
|
function show_final_instructions() {
|
||||||
|
print_info "2FA Setup Completed"
|
||||||
|
|
||||||
|
print_info "Two-Factor Authentication has been configured for:"
|
||||||
|
print_info "- SSH (requires key + 2FA token)"
|
||||||
|
print_info "- Cockpit web interface"
|
||||||
|
if [[ -f "/etc/webmin/miniserv.conf" ]]; then
|
||||||
|
print_info "- Webmin administration panel"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_info "IMPORTANT: Complete user setup immediately!"
|
||||||
|
print_info "1. Check /home/*/2fa-setup-instructions.txt for user setup"
|
||||||
|
print_info "2. Run setup scripts for each user"
|
||||||
|
print_info "3. Test 2FA before logging out"
|
||||||
|
|
||||||
|
print_info "Backup location: $BACKUP_DIR"
|
||||||
|
print_info "To disable 2FA, restore configurations from backup"
|
||||||
|
|
||||||
|
print_info "2FA setup completed successfully!"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main execution
|
||||||
|
function main() {
|
||||||
|
# Check if running as root
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
print_error "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute setup steps
|
||||||
|
backup_configs
|
||||||
|
install_2fa_packages
|
||||||
|
configure_ssh_2fa
|
||||||
|
configure_pam_2fa
|
||||||
|
configure_cockpit_2fa
|
||||||
|
configure_webmin_2fa
|
||||||
|
setup_user_2fa
|
||||||
|
restart_services
|
||||||
|
validate_2fa_setup
|
||||||
|
show_final_instructions
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run main function
|
||||||
|
main "$@"
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#####
|
||||||
|
#Core framework functions...
|
||||||
|
#####
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
export CONFIGFILES_PATH
|
||||||
|
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/provisioning/ConfigFiles"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Material herein Sourced from
|
||||||
|
|
||||||
|
# https://cisofy.com/documentation/lynis/
|
||||||
|
# https://jbcsec.com/configure-linux-ssh/
|
||||||
|
# https://opensource.com/article/20/5/linux-security-lynis
|
||||||
|
# https://forum.greenbone.net/t/ssh-authentication/13536
|
||||||
|
|
||||||
|
# openvas
|
||||||
|
|
||||||
|
#lynis
|
||||||
|
|
||||||
|
#Auditd
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/AuditD/auditd.conf" > /etc/audit/auditd.conf
|
||||||
|
|
||||||
|
# Systemd
|
||||||
|
cat "$CONFIGFILES_PATH/Systemd/journald.conf" > /etc/systemd/journald.conf
|
||||||
|
|
||||||
|
# logrotate
|
||||||
|
cat "$CONFIGFILES_PATH/Logrotate/logrotate.conf" > /etc/logrotate.conf
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Sourced from https://wiki.debian.org/UnattendedUpgrades
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#Core framework functions...
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
export CONFIGFILES_PATH
|
||||||
|
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/provisioning/ConfigFiles"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
# Core script code begins here
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
# Sourced from
|
||||||
|
|
||||||
|
# https://complianceascode.readthedocs.io/en/latest/manual/developer/01_introduction.html
|
||||||
|
# https://github.com/ComplianceAsCode/content
|
||||||
|
# https://github.com/ComplianceAsCode
|
||||||
|
|
||||||
|
#apparmor
|
||||||
|
#enforcing
|
||||||
|
#enabled in bootloader config
|
||||||
|
|
||||||
|
#aide
|
||||||
|
|
||||||
|
#auditd
|
||||||
|
|
||||||
|
#disable auto mounting
|
||||||
|
#disable usb storage
|
||||||
|
|
||||||
|
|
||||||
|
#motd
|
||||||
|
#remote login warning banner
|
||||||
|
|
||||||
|
#Ensure time sync is working
|
||||||
|
#systemd-timesync
|
||||||
|
#ntp
|
||||||
|
#chrony
|
||||||
|
|
||||||
|
#password complexity
|
||||||
|
#password expiration warning
|
||||||
|
#password expiration time
|
||||||
|
#password hashing algo
|
||||||
|
|
||||||
|
#fix grub perms
|
||||||
|
|
||||||
|
if [ "$IS_RASPI" = 0 ] ; then
|
||||||
|
|
||||||
|
chown root:root /boot/grub/grub.cfg
|
||||||
|
chmod og-rwx /boot/grub/grub.cfg
|
||||||
|
chmod 0400 /boot/grub/grub.cfg
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#disable auto mounting
|
||||||
|
systemctl --now disable autofs || true
|
||||||
|
apt-get -y --purge remove autofs || true
|
||||||
|
|
||||||
|
#disable usb storage
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/usb_storage.conf" > /etc/modprobe.d/usb_storage.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/dccp.conf" > /etc/modprobe.d/dccp.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/rds.conf" > /etc/modprobe.d/rds.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/sctp.conf" > /etc/modprobe.d/sctp.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/tipc.conf" > /etc/modprobe.d/tipc.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/cramfs.conf" > /etc/modprobe.d/cramfs.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/freevxfs.conf" > /etc/modprobe.d/freevxfs.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/hfs.conf" > /etc/modprobe.d/hfs.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/hfsplus.conf" > /etc/modprobe.d/hfsplus.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/jffs2.conf" > /etc/modprobe.d/jffs2.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/squashfs.conf" > /etc/modprobe.d/squashfs.conf
|
||||||
|
cat "$CONFIGFILES_PATH/ModProbe/udf.conf" > /etc/modprobe.d/udf.conf
|
||||||
|
|
||||||
|
#banners
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/BANNERS/issue" > /etc/issue
|
||||||
|
cat "$CONFIGFILES_PATH/BANNERS/issue.net" > /etc/issue.net
|
||||||
|
cat "$CONFIGFILES_PATH/BANNERS/motd" > /etc/motd
|
||||||
|
|
||||||
|
#Cron perms
|
||||||
|
|
||||||
|
if [ -f /etc/cron.deny ]; then
|
||||||
|
rm /etc/cron.deny || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch /etc/cron.allow
|
||||||
|
chmod g-wx,o-rwx /etc/cron.allow
|
||||||
|
chown root:root /etc/cron.allow
|
||||||
|
|
||||||
|
chmod og-rwx /etc/crontab
|
||||||
|
chmod og-rwx /etc/cron.hourly/
|
||||||
|
chmod og-rwx /etc/cron.daily/
|
||||||
|
chmod og-rwx /etc/cron.weekly/
|
||||||
|
chmod og-rwx /etc/cron.monthly/
|
||||||
|
chown root:root /etc/cron.d/
|
||||||
|
chmod og-rwx /etc/cron.d/
|
||||||
|
|
||||||
|
# At perms
|
||||||
|
|
||||||
|
rm -f /etc/at.deny || true
|
||||||
|
touch /etc/at.allow
|
||||||
|
chmod g-wx,o-rwx /etc/at.allow
|
||||||
|
chown root:root /etc/at.allow
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#Core framework functions...
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
export CONFIGFILES_PATH
|
||||||
|
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/provisioning/ConfigFiles"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
# Core script code begins here
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
export SUBODEV_CHECK
|
||||||
|
SUBODEV_CHECK="$(getent passwd | grep -c subodev || true)"
|
||||||
|
|
||||||
|
export LOCALUSER_CHECK
|
||||||
|
LOCALUSER_CHECK="$(getent passwd | grep -c localuser || true)"
|
||||||
|
|
||||||
|
export ROOT_SSH_DIR
|
||||||
|
ROOT_SSH_DIR="/root/.ssh"
|
||||||
|
|
||||||
|
export LOCALUSER_SSH_DIR
|
||||||
|
LOCALUSER_SSH_DIR="/home/localuser/.ssh"
|
||||||
|
|
||||||
|
export SUBODEV_SSH_DIR
|
||||||
|
SUBODEV_SSH_DIR="/home/subodev/.ssh"
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -d $ROOT_SSH_DIR ]; then
|
||||||
|
mkdir /root/.ssh/
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/SSH/AuthorizedKeys/root-ssh-authorized-keys" >/root/.ssh/authorized_keys
|
||||||
|
chmod 400 /root/.ssh/authorized_keys
|
||||||
|
chown root: /root/.ssh/authorized_keys
|
||||||
|
|
||||||
|
if [ "$LOCALUSER_CHECK" -gt 0 ]; then
|
||||||
|
if [ ! -d $LOCALUSER_SSH_DIR ]; then
|
||||||
|
mkdir -p /home/localuser/.ssh/
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/SSH/AuthorizedKeys/localuser-ssh-authorized-keys" >/home/localuser/.ssh/authorized_keys
|
||||||
|
chown localuser /home/localuser/.ssh/authorized_keys &&
|
||||||
|
chmod 400 /home/localuser/.ssh/authorized_keys
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SUBODEV_CHECK" = 1 ]; then
|
||||||
|
|
||||||
|
if [ ! -d $SUBODEV_SSH_DIR ]; then
|
||||||
|
mkdir /home/subodev/.ssh/
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/SSH/AuthorizedKeys/localuser-ssh-authorized-keys" >/home/subodev/.ssh/authorized_keys
|
||||||
|
chmod 400 /home/subodev/.ssh/authorized_keys &&
|
||||||
|
chown subodev: /home/subodev/.ssh/authorized_keys
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DEV_WORKSTATION_CHECK
|
||||||
|
DEV_WORKSTATION_CHECK="$(hostname | grep -Ec 'subopi-dev|CharlesDevServer' || true)"
|
||||||
|
|
||||||
|
if [ "$DEV_WORKSTATION_CHECK" -eq 0 ]; then
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/SSH/Configs/tsys-sshd-config" >/etc/ssh/sshd_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#Don't deploy this config to a ubuntu server, it breaks openssh server. Works on kali/debian.
|
||||||
|
|
||||||
|
export UBUNTU_CHECK
|
||||||
|
UBUNTU_CHECK="$(distro | grep -c Ubuntu||true)"
|
||||||
|
|
||||||
|
if [ "$UBUNTU_CHECK" -ne 1 ]; then
|
||||||
|
cat "$CONFIGFILES_PATH/SSH/Configs/ssh-audit-hardening.conf" >/etc/ssh/sshd_config.d/ssh-audit_hardening.conf
|
||||||
|
chmod og-rwx /etc/ssh/sshd_config.d/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Perms on sshd_config
|
||||||
|
chmod og-rwx /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
#todo
|
||||||
|
|
||||||
|
# only strong MAC algos are used
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#Core framework functions...
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
# Core script code begins here
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
# We don't want to run this on the wazuh server, otherwise bad things happen...
|
||||||
|
|
||||||
|
export TSYS_NSM_CHECK
|
||||||
|
TSYS_NSM_CHECK="$(hostname |grep -c tsys-nsm ||true)"
|
||||||
|
|
||||||
|
if [ "$TSYS_NSM_CHECK" -eq 0 ]; then
|
||||||
|
|
||||||
|
if [ -f /usr/share/keyrings/wazuh.gpg ]; then
|
||||||
|
rm -f /usr/share/keyrings/wazuh.gpg
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import
|
||||||
|
chmod 644 /usr/share/keyrings/wazuh.gpg
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" > /etc/apt/sources.list.d/wazuh.list
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
WAZUH_MANAGER="tsys-nsm.knel.net" apt-get -y install wazuh-agent
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable wazuh-agent
|
||||||
|
systemctl start wazuh-agent || true
|
||||||
|
|
||||||
|
echo "wazuh-agent hold" | dpkg --set-selections
|
||||||
|
|
||||||
|
fi
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
export DL_ROOT
|
||||||
|
DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function LocalHelp()
|
||||||
|
{
|
||||||
|
echo "$0 is <description here>"
|
||||||
|
echo "$0 takes <num> arguments: "
|
||||||
|
echo "1) <stuff>"
|
||||||
|
echo "2) <other stuff>"
|
||||||
|
echo "<additional info on arguments...>:"
|
||||||
|
echo "<put>"
|
||||||
|
echo "<stuff>"
|
||||||
|
echo "<here>"
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function PreflightCheck()
|
||||||
|
{
|
||||||
|
|
||||||
|
export curr_user="$USER"
|
||||||
|
export user_check
|
||||||
|
|
||||||
|
user_check="$(echo "$curr_user" | grep -c root)"
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$user_check" -ne 1 ]; then
|
||||||
|
print_error "Must run as root."
|
||||||
|
error_out
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "All checks passed...."
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# shellcheck shell=bash disable=SC2148 # sourced function file (no shebang by design)
|
||||||
|
function pi-detect()
|
||||||
|
{
|
||||||
|
print_info Now running "${FUNCNAME[0]}"....
|
||||||
|
if [ -f /sys/firmware/devicetree/base/model ] ; then
|
||||||
|
export IS_RASPI="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /sys/firmware/devicetree/base/model ] ; then
|
||||||
|
export IS_RASPI="0"
|
||||||
|
fi
|
||||||
|
print_info Completed running "${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
@@ -0,0 +1,431 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
#####
|
||||||
|
#Core framework functions...
|
||||||
|
#####
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export PROJECT_ROOT_PATH
|
||||||
|
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||||
|
|
||||||
|
export GIT_VENDOR_PATH_ROOT
|
||||||
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
||||||
|
|
||||||
|
export KNELShellFrameworkRoot
|
||||||
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
||||||
|
|
||||||
|
export CONFIGFILES_PATH
|
||||||
|
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/provisioning/ConfigFiles"
|
||||||
|
|
||||||
|
export MODULES_PATH
|
||||||
|
MODULES_PATH="$PROJECT_ROOT_PATH/provisioning/Modules"
|
||||||
|
|
||||||
|
export SCRIPTS_PATH
|
||||||
|
SCRIPTS_PATH="$PROJECT_ROOT_PATH/provisioning/scripts"
|
||||||
|
|
||||||
|
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
|
||||||
|
|
||||||
|
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
|
||||||
|
source "$framework_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
|
||||||
|
source "$project_include_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Start actual script logic here...
|
||||||
|
|
||||||
|
#################
|
||||||
|
#Global variables
|
||||||
|
#################
|
||||||
|
|
||||||
|
apt-get -y install git sudo dmidecode curl
|
||||||
|
|
||||||
|
export UBUNTU_CHECK
|
||||||
|
UBUNTU_CHECK="$(distro | grep -c Ubuntu || true)"
|
||||||
|
|
||||||
|
export IS_PHYSICAL_HOST
|
||||||
|
IS_PHYSICAL_HOST="$(/usr/sbin/dmidecode -t System | grep -c Dell || true)"
|
||||||
|
|
||||||
|
export SUBODEV_CHECK
|
||||||
|
SUBODEV_CHECK="$(getent passwd | grep -c subodev || true)"
|
||||||
|
|
||||||
|
export LOCALUSER_CHECK
|
||||||
|
LOCALUSER_CHECK="$(getent passwd | grep -c localuser || true)"
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Support functions
|
||||||
|
#######################
|
||||||
|
|
||||||
|
function global-oam() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}...."
|
||||||
|
|
||||||
|
cat "$SCRIPTS_PATH/up2date.sh" >/usr/local/bin/up2date.sh && chmod +x /usr/local/bin/up2date.sh
|
||||||
|
|
||||||
|
bash "$MODULES_PATH/OAM/oam-librenms.sh"
|
||||||
|
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function global-systemServiceConfigurationFiles() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}...."
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/ZSH/tsys-zshrc" >/etc/zshrc
|
||||||
|
cat "$CONFIGFILES_PATH/SMTP/aliases" >/etc/aliases
|
||||||
|
cat "$CONFIGFILES_PATH/Syslog/rsyslog.conf" >/etc/rsyslog.conf
|
||||||
|
|
||||||
|
newaliases
|
||||||
|
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function global-installPackages() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}...."
|
||||||
|
|
||||||
|
# Setup webmin repo, used for RBAC/2fa PAM
|
||||||
|
|
||||||
|
curl https://raw.githubusercontent.com/webmin/webmin/master/webmin-setup-repo.sh >/tmp/webmin-setup.sh
|
||||||
|
sh /tmp/webmin-setup.sh -f && rm -f /tmp/webmin-setup.sh
|
||||||
|
|
||||||
|
# Setup tailscale
|
||||||
|
|
||||||
|
curl -fsSL https://tailscale.com/install.sh | sh
|
||||||
|
|
||||||
|
#
|
||||||
|
#Patch the system
|
||||||
|
#
|
||||||
|
|
||||||
|
/usr/local/bin/up2date.sh
|
||||||
|
|
||||||
|
#Remove stuff we don't want
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" \
|
||||||
|
&& apt-get -qq --yes --purge \
|
||||||
|
remove \
|
||||||
|
systemd-timesyncd \
|
||||||
|
chrony \
|
||||||
|
telnet \
|
||||||
|
inetutils-telnet \
|
||||||
|
wpasupplicant \
|
||||||
|
modemmanager \
|
||||||
|
nano \
|
||||||
|
multipath-tools \
|
||||||
|
|| true
|
||||||
|
|
||||||
|
apt-get -y --purge autoremove
|
||||||
|
|
||||||
|
# add stuff we want
|
||||||
|
|
||||||
|
print_info ""Now installing all the packages...""
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND="noninteractive" apt-get -qq --yes -o Dpkg::Options::="--force-confold" install \
|
||||||
|
virt-what \
|
||||||
|
auditd \
|
||||||
|
audispd-plugins \
|
||||||
|
cloud-guest-utils \
|
||||||
|
aide \
|
||||||
|
htop \
|
||||||
|
snmpd \
|
||||||
|
ncdu \
|
||||||
|
iftop \
|
||||||
|
iotop \
|
||||||
|
cockpit \
|
||||||
|
cockpit-bridge \
|
||||||
|
cockpit-doc \
|
||||||
|
cockpit-networkmanager \
|
||||||
|
cockpit-packagekit \
|
||||||
|
cockpit-pcp \
|
||||||
|
cockpit-sosreport \
|
||||||
|
cockpit-storaged \
|
||||||
|
cockpit-system \
|
||||||
|
cockpit-ws \
|
||||||
|
nethogs \
|
||||||
|
sysstat \
|
||||||
|
ngrep \
|
||||||
|
acct \
|
||||||
|
lsb-release \
|
||||||
|
screen \
|
||||||
|
tailscale \
|
||||||
|
tmux \
|
||||||
|
vim \
|
||||||
|
command-not-found \
|
||||||
|
lldpd \
|
||||||
|
ansible-core \
|
||||||
|
net-tools \
|
||||||
|
dos2unix \
|
||||||
|
gpg \
|
||||||
|
molly-guard \
|
||||||
|
lshw \
|
||||||
|
fzf \
|
||||||
|
ripgrep \
|
||||||
|
sudo \
|
||||||
|
mailutils \
|
||||||
|
clamav \
|
||||||
|
sl \
|
||||||
|
logwatch \
|
||||||
|
git \
|
||||||
|
net-tools \
|
||||||
|
tshark \
|
||||||
|
tcpdump \
|
||||||
|
lynis \
|
||||||
|
glances \
|
||||||
|
zsh \
|
||||||
|
zsh-autosuggestions \
|
||||||
|
zsh-syntax-highlighting \
|
||||||
|
fonts-powerline \
|
||||||
|
webmin \
|
||||||
|
usermin \
|
||||||
|
ntpsec \
|
||||||
|
ntpsec-ntpdate \
|
||||||
|
tuned \
|
||||||
|
cockpit \
|
||||||
|
iptables \
|
||||||
|
netfilter-persistent \
|
||||||
|
iptables-persistent \
|
||||||
|
pflogsumm \
|
||||||
|
postfix
|
||||||
|
|
||||||
|
export KALI_CHECK
|
||||||
|
KALI_CHECK="$(distro | grep -c kali || true)"
|
||||||
|
|
||||||
|
export VIRT_TYPE
|
||||||
|
VIRT_TYPE="$(virt-what)"
|
||||||
|
|
||||||
|
export IS_VIRT_GUEST
|
||||||
|
IS_VIRT_GUEST="$(echo "$VIRT_TYPE" | grep -Ec 'hyperv|kvm' || true)"
|
||||||
|
|
||||||
|
export IS_KVM_GUEST
|
||||||
|
IS_KVM_GUEST="$(echo "$VIRT_TYPE" | grep -c 'kvm' || true)"
|
||||||
|
|
||||||
|
if [[ $IS_KVM_GUEST = 1 ]]; then
|
||||||
|
apt -y install qemu-guest-agent
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $KALI_CHECK -eq 0 ]];then
|
||||||
|
DEBIAN_FRONTEND="noninteractive" apt-get -qq --yes -o Dpkg::Options::="--force-confold" install \
|
||||||
|
latencytop \
|
||||||
|
cockpit-tests || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $IS_PHYSICAL_HOST -gt 0 ]]; then
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes -o Dpkg::Options::="--force-confold" install \
|
||||||
|
i7z \
|
||||||
|
thermald \
|
||||||
|
cpufrequtils \
|
||||||
|
linux-cpupower
|
||||||
|
# power-profiles-daemon
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Secrets agents
|
||||||
|
############################
|
||||||
|
|
||||||
|
# bitwarden cli
|
||||||
|
|
||||||
|
# vault cli
|
||||||
|
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function global-postPackageConfiguration() {
|
||||||
|
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
|
||||||
|
systemctl --now enable auditd
|
||||||
|
|
||||||
|
systemctl stop postfix
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/SMTP/postfix_generic" >/etc/postfix/generic
|
||||||
|
postmap /etc/postfix/generic
|
||||||
|
|
||||||
|
postconf -e "inet_protocols = ipv4"
|
||||||
|
postconf -e "inet_interfaces = 127.0.0.1"
|
||||||
|
postconf -e "mydestination= 127.0.0.1"
|
||||||
|
postconf -e "relayhost = tsys-cloudron.knel.net"
|
||||||
|
postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"
|
||||||
|
# smtp_generic_maps = hash:/etc/postfix/generic
|
||||||
|
|
||||||
|
systemctl restart postfix
|
||||||
|
|
||||||
|
#This is under test/dev and may fail
|
||||||
|
echo "hi from root to root" | mail -s "hi directly to root from $(hostname)" root
|
||||||
|
|
||||||
|
chsh -s "$(which zsh)" root
|
||||||
|
|
||||||
|
if [ "$LOCALUSER_CHECK" -gt 0 ]; then
|
||||||
|
chsh -s "$(which zsh)" localuser
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SUBODEV_CHECK" -gt 0 ]; then
|
||||||
|
chsh -s "$(which zsh)" subodev
|
||||||
|
fi
|
||||||
|
|
||||||
|
###Post package deployment bits
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/DHCP/dhclient.conf" >/etc/dhcp/dhclient.conf
|
||||||
|
|
||||||
|
# Authoritative recursive DNS via the redundant pfv-netinfra-01/02 pair.
|
||||||
|
# Replace whatever is at /etc/resolv.conf (including a systemd-resolved or
|
||||||
|
# NetworkManager symlink) with the managed static file so every lookup goes
|
||||||
|
# to our servers and nothing else rewrites it behind our backs.
|
||||||
|
rm -f /etc/resolv.conf
|
||||||
|
cat "$CONFIGFILES_PATH/Resolv/resolv.conf" >/etc/resolv.conf
|
||||||
|
chmod 644 /etc/resolv.conf
|
||||||
|
|
||||||
|
systemctl stop snmpd && /etc/init.d/snmpd stop
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/SNMP/snmp-sudo.conf" >/etc/sudoers.d/Debian-snmp
|
||||||
|
sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service
|
||||||
|
|
||||||
|
pi-detect
|
||||||
|
|
||||||
|
if [ "$IS_RASPI" = 1 ]; then
|
||||||
|
cat "$CONFIGFILES_PATH/SNMP/snmpd-rpi.conf" >/etc/snmp/snmpd.conf || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$IS_PHYSICAL_HOST" = 1 ]; then
|
||||||
|
cat "$CONFIGFILES_PATH/SNMP/snmpd-physicalhost.conf" >/etc/snmp/snmpd.conf || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$IS_VIRT_GUEST" = 1 ]; then
|
||||||
|
cat "$CONFIGFILES_PATH/SNMP/snmpd.conf" >/etc/snmp/snmpd.conf || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl daemon-reload && systemctl restart snmpd && /etc/init.d/snmpd restart
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/NetworkDiscovery/lldpd" >/etc/default/lldpd
|
||||||
|
systemctl restart lldpd
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/Cockpit/disallowed-users" >/etc/cockpit/disallowed-users
|
||||||
|
systemctl restart cockpit
|
||||||
|
|
||||||
|
export LIBRENMS_CHECK
|
||||||
|
LIBRENMS_CHECK="$(hostname | grep -c tsys-librenms || true)"
|
||||||
|
|
||||||
|
if [ "$LIBRENMS_CHECK" -eq 0 ]; then
|
||||||
|
DEBIAN_FRONTEND="noninteractive" apt-get -qq --yes -o Dpkg::Options::="--force-confold" install rsyslog
|
||||||
|
systemctl stop rsyslog
|
||||||
|
systemctl start rsyslog
|
||||||
|
fi
|
||||||
|
|
||||||
|
export NTP_SERVER_CHECK
|
||||||
|
NTP_SERVER_CHECK="$(hostname | grep -Ec 'pfv-netboot|pfvsvrpi|pfv-netinfra' || true)"
|
||||||
|
|
||||||
|
if [ "$NTP_SERVER_CHECK" -eq 0 ]; then
|
||||||
|
|
||||||
|
cat "$CONFIGFILES_PATH/NTP/ntp.conf" >/etc/ntpsec/ntp.conf
|
||||||
|
systemctl restart ntpsec.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl stop postfix
|
||||||
|
systemctl start postfix
|
||||||
|
|
||||||
|
/usr/sbin/accton on
|
||||||
|
|
||||||
|
if [ "$IS_PHYSICAL_HOST" -gt 0 ]; then
|
||||||
|
cpufreq-set -r -g performance
|
||||||
|
cpupower frequency-set --governor performance
|
||||||
|
|
||||||
|
# Potentially merge the below if needed.
|
||||||
|
# power-profiles-daemon
|
||||||
|
# powerprofilesctl set performance
|
||||||
|
#tsys1# systemctl enable power-profiles-daemon
|
||||||
|
#tsys1# systemctl start power-profiles-daemon
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$IS_VIRT_GUEST" = 1 ]; then
|
||||||
|
tuned-adm profile virtual-guest
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# Run various modules
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# Security Hardening
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
# SSH
|
||||||
|
|
||||||
|
function secharden-ssh() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
|
||||||
|
bash "$MODULES_PATH/Security/secharden-ssh.sh"
|
||||||
|
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function secharden-wazuh() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
bash "$MODULES_PATH/Security/secharden-wazuh.sh"
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function secharden-2fa() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
bash "$MODULES_PATH/Security/secharden-2fa.sh"
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function secharden-scap-stig() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
bash "$MODULES_PATH/Security/secharden-scap-stig.sh"
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function secharden-agents() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
bash "$MODULES_PATH/Security/secharden-audit-agents.sh"
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function secharden-auto-upgrades() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
#curl --silent ${DL_ROOT}/Modules/Security/secharden-ssh.sh|$(which bash)
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# Authentication
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
function auth-cloudron-ldap() {
|
||||||
|
print_info "Now running ${FUNCNAME[0]}"
|
||||||
|
#curl --silent ${DL_ROOT}/Modules/Auth/auth-cloudron-ldap.sh|$(which bash)
|
||||||
|
print_info "Completed running ${FUNCNAME[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# RUn the various functions in the correct order
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
echo >"$LOGFILENAME"
|
||||||
|
|
||||||
|
print_info "Execution starting at $CURRENT_TIMESTAMP..."
|
||||||
|
|
||||||
|
PreflightCheck
|
||||||
|
global-oam
|
||||||
|
global-installPackages
|
||||||
|
global-systemServiceConfigurationFiles
|
||||||
|
global-postPackageConfiguration
|
||||||
|
|
||||||
|
secharden-ssh
|
||||||
|
secharden-wazuh
|
||||||
|
secharden-scap-stig
|
||||||
|
secharden-2fa
|
||||||
|
#secharden-agents
|
||||||
|
#secharden-auto-upgrades
|
||||||
|
|
||||||
|
#auth-cloudron-ldap
|
||||||
|
|
||||||
|
print_info "Execution ended at $CURRENT_TIMESTAMP..."
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# shellcheck shell=bash disable=SC2148 # sourced .bashrc profile fragment
|
||||||
|
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||||
|
tmux a -t default || exec tmux new -s default && exit;
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# shellcheck shell=bash disable=SC2148 # sourced .bashrc profile fragment
|
||||||
|
export HISTTIMEFORMAT="%m/%d/%Y %T "
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rm -f /etc/apt/sources.list.d/*
|
||||||
|
echo "deb https://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list
|
||||||
|
wget https://download.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
|
||||||
|
apt update && apt -y full-upgrade
|
||||||
|
apt-get -y install ifupdown2 ipmitool ethtool net-tools lshw
|
||||||
|
|
||||||
|
#curl -s http://dl.turnsys.net/newSrv.sh|/bin/bash
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Running apt-get update"
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes update
|
||||||
|
|
||||||
|
echo "Running apt-get dist-upgrade"
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes dist-upgrade
|
||||||
|
|
||||||
|
echo "Running apt-get upgrade"
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes upgrade
|
||||||
|
|
||||||
|
|
||||||
|
echo "Running apt-get purge"
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --purge autoremove --yes
|
||||||
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq autoclean --yes
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<!-- Discourse: https://community.turnsys.com/t/298 -->
|
||||||
|
<!-- Redmine: https://projects.knownelement.com/issues/314 -->
|
||||||
|
|
||||||
|
# Session Handoff: 2026-08-11/12 OAM
|
||||||
|
|
||||||
|
**Full handoff lives in Redmine #314** (session summary note, 2026-08-12).
|
||||||
|
**OAM coverage matrix:** Discourse [#309](https://community.turnsys.com/t/309).
|
||||||
|
**Architecture rules:** Discourse [#303](https://community.turnsys.com/t/303).
|
||||||
|
**Open questions:** `questions-v2.md` in this repo.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# awx/README.md
|
||||||
|
|
||||||
|
> **Documentation moved to Discourse — the canonical source of truth.**
|
||||||
|
>
|
||||||
|
> **Ansible AWX deployment on k3s**
|
||||||
|
>
|
||||||
|
> **Read it here:** https://community.turnsys.com/t/302
|
||||||
|
>
|
||||||
|
> *Migrated 2026-08-06. This file is kept as a pointer for git-browsing context.
|
||||||
|
> Do not update content here — edit the Discourse wiki topic instead.*
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
# AWX namespace
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: awx
|
||||||
|
---
|
||||||
|
# Admin password secret — the password is 'REDACTED_PASSWORD' (fleet standard)
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: awx-admin-password
|
||||||
|
namespace: awx
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
password: REDACTED_PASSWORD
|
||||||
|
---
|
||||||
|
# AWX Custom Resource — single instance, LoadBalancer service
|
||||||
|
apiVersion: awx.ansible.com/v1beta1
|
||||||
|
kind: AWX
|
||||||
|
metadata:
|
||||||
|
name: tsys-awx
|
||||||
|
namespace: awx
|
||||||
|
spec:
|
||||||
|
service_type: LoadBalancer
|
||||||
|
ingress_type: none
|
||||||
|
|
||||||
|
admin_user: admin
|
||||||
|
admin_password_secret: awx-admin-password
|
||||||
|
|
||||||
|
# PostgreSQL — bundled, stored on local disk via PVC (k3s local-path)
|
||||||
|
postgres_storage_class: local-path
|
||||||
|
postgres_storage_requirements:
|
||||||
|
requests:
|
||||||
|
storage: 8Gi
|
||||||
|
postgres_resource_requirements:
|
||||||
|
requests:
|
||||||
|
memory: 1Gi
|
||||||
|
|
||||||
|
# Resource limits — fit within 12 GB host RAM
|
||||||
|
web_resource_requirements:
|
||||||
|
requests:
|
||||||
|
memory: 1Gi
|
||||||
|
task_resource_requirements:
|
||||||
|
requests:
|
||||||
|
memory: 1Gi
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
###############################################################################
|
||||||
|
# deploy-awx.sh — Deploy AWX Operator + instance on k3s.
|
||||||
|
#
|
||||||
|
# Prerequisites: k3s must be installed and running (install-k3s.sh).
|
||||||
|
# Intended to run ON the target VM (tsys-awx.knel.net) as root or via sudo.
|
||||||
|
#
|
||||||
|
# Usage: sudo bash deploy-awx.sh
|
||||||
|
###############################################################################
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
|
||||||
|
|
||||||
|
OPERATOR_VERSION="${OPERATOR_VERSION:-2.19.1}"
|
||||||
|
|
||||||
|
echo "=========================================================="
|
||||||
|
echo " AWX Operator deployment — version ${OPERATOR_VERSION}"
|
||||||
|
echo "=========================================================="
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Step 1: Create namespace
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
echo ""
|
||||||
|
echo "=== Step 1: Create namespace ==="
|
||||||
|
kubectl apply -f "${SCRIPT_DIR}/namespace.yaml"
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Step 2: Deploy AWX Operator
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
echo ""
|
||||||
|
echo "=== Step 2: Deploy AWX Operator ${OPERATOR_VERSION} ==="
|
||||||
|
|
||||||
|
# Clone the operator to get kustomize manifests
|
||||||
|
OPERATOR_DIR="/tmp/awx-operator-${OPERATOR_VERSION}"
|
||||||
|
rm -rf "${OPERATOR_DIR}"
|
||||||
|
git clone --branch "${OPERATOR_VERSION}" --depth 1 \
|
||||||
|
"https://github.com/ansible/awx-operator.git" "${OPERATOR_DIR}" 2>&1 | tail -3
|
||||||
|
|
||||||
|
# The operator's default namespace is 'awx' — matches our setup
|
||||||
|
# Apply the operator via kustomize (config/default has the full manifest set)
|
||||||
|
kubectl apply -k "${OPERATOR_DIR}/config/default" 2>&1 || {
|
||||||
|
echo "kustomize apply failed, trying raw manifests..."
|
||||||
|
kubectl apply -f "https://raw.githubusercontent.com/ansible/awx-operator/${OPERATOR_VERSION}/deploy/awx-operator.yaml"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fix kube-rbac-proxy image (gcr.io/kubebuilder/kube-rbac-proxy was removed;
|
||||||
|
# quay.io/brancz/kube-rbac-proxy is the maintained replacement)
|
||||||
|
echo ""
|
||||||
|
echo "=== Patching kube-rbac-proxy image ==="
|
||||||
|
kubectl set image deployment/awx-operator-controller-manager -n awx \
|
||||||
|
kube-rbac-proxy=quay.io/brancz/kube-rbac-proxy:v0.15.0 2>&1 || true
|
||||||
|
|
||||||
|
# Scale down any old replicasets that still reference the broken image
|
||||||
|
for rs in $(kubectl -n awx get rs -l control-plane=controller-manager -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' 2>/dev/null); do
|
||||||
|
img=$(kubectl -n awx get rs "${rs}" -o jsonpath='{.spec.template.spec.containers[?(@.name=="kube-rbac-proxy")].image}' 2>/dev/null)
|
||||||
|
if [[ "${img}" == *"gcr.io/kubebuilder"* ]]; then
|
||||||
|
echo "Scaling down old RS ${rs} (has broken gcr.io image)"
|
||||||
|
kubectl -n awx scale rs "${rs}" --replicas=0 2>&1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Waiting for AWX Operator deployment to be ready..."
|
||||||
|
kubectl -n awx wait --for=condition=Available deployment/awx-operator-controller-manager \
|
||||||
|
--timeout=300s 2>&1 || {
|
||||||
|
echo "Operator not ready yet — checking status..."
|
||||||
|
kubectl -n awx get pods
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Step 3: Deploy AWX instance
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
echo ""
|
||||||
|
echo "=== Step 3: Deploy AWX instance ==="
|
||||||
|
kubectl apply -f "${SCRIPT_DIR}/awx-instance.yaml"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "AWX instance created. Operator will now reconcile."
|
||||||
|
echo "This typically takes 5-10 minutes for the first deployment."
|
||||||
|
echo ""
|
||||||
|
echo "Monitor progress with:"
|
||||||
|
echo " kubectl -n awx get awx tsys-awx -o jsonpath='{.status.conditions}' | jq ."
|
||||||
|
echo " kubectl -n awx get pods -w"
|
||||||
|
echo " kubectl -n awx logs deployment/awx-operator-controller-manager -f"
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
###############################################################################
|
||||||
|
# install-k3s.sh — Install k3s single-node on the tsys-awx VM.
|
||||||
|
#
|
||||||
|
# Intended to run ON the target VM (tsys-awx.knel.net) as root or via sudo.
|
||||||
|
# Installs k3s without Traefik (we use NodePort/LoadBalancer directly).
|
||||||
|
#
|
||||||
|
# Usage: sudo bash install-k3s.sh
|
||||||
|
###############################################################################
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
NODE_NAME="${NODE_NAME:-tsys-awx}"
|
||||||
|
|
||||||
|
echo "=========================================================="
|
||||||
|
echo " k3s single-node install — ${NODE_NAME}"
|
||||||
|
echo "=========================================================="
|
||||||
|
|
||||||
|
if command -v k3s >/dev/null 2>&1 && k3s kubectl get nodes >/dev/null 2>&1; then
|
||||||
|
echo "k3s already installed and running. Skipping."
|
||||||
|
k3s kubectl get nodes
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Installing k3s (this takes 1-2 minutes) ==="
|
||||||
|
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik --write-kubeconfig-mode=644" sh -
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Waiting for k3s node to be Ready ==="
|
||||||
|
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
if k3s kubectl get nodes 2>/dev/null | grep -q ' Ready'; then
|
||||||
|
echo "Node is Ready!"
|
||||||
|
k3s kubectl get nodes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo " waiting... (${i}/30)"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== k3s install complete ==="
|
||||||
|
echo "kubeconfig: /etc/rancher/k3s/k3s.yaml"
|
||||||
|
echo "kubectl: k3s kubectl (or set KUBECONFIG=/etc/rancher/k3s/k3s.yaml)"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# AWX Operator namespace
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: awx
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
###############################################################################
|
||||||
|
# verify-awx.sh — Verify AWX deployment status and access.
|
||||||
|
#
|
||||||
|
# Intended to run ON the target VM (tsys-awx.knel.net).
|
||||||
|
# Usage: bash verify-awx.sh
|
||||||
|
###############################################################################
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
|
||||||
|
|
||||||
|
echo "=========================================================="
|
||||||
|
echo " AWX Deployment Verification — $(date)"
|
||||||
|
echo "=========================================================="
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 1. k3s node ==="
|
||||||
|
kubectl get nodes
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 2. AWX pods ==="
|
||||||
|
kubectl -n awx get pods
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 3. AWX CR status ==="
|
||||||
|
kubectl -n awx get awx tsys-awx -o jsonpath='{range .status.conditions[*]}{.type}: {.message}{"\n"}{end}' 2>/dev/null || echo "AWX CR not found"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 4. Services ==="
|
||||||
|
kubectl -n awx get svc
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 5. LoadBalancer / NodePort access ==="
|
||||||
|
LB_IP=$(kubectl -n awx get svc tsys-awx-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || echo "")
|
||||||
|
LB_HOST=$(kubectl -n awx get svc tsys-awx-service -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo "")
|
||||||
|
NODE_PORT=$(kubectl -n awx get svc tsys-awx-service -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
if [ -n "${LB_IP}" ]; then
|
||||||
|
echo "LoadBalancer IP: ${LB_IP}"
|
||||||
|
ACCESS_URL="http://${LB_IP}"
|
||||||
|
elif [ -n "${LB_HOST}" ]; then
|
||||||
|
echo "LoadBalancer hostname: ${LB_HOST}"
|
||||||
|
ACCESS_URL="http://${LB_HOST}"
|
||||||
|
elif [ -n "${NODE_PORT}" ]; then
|
||||||
|
echo "NodePort: ${NODE_PORT}"
|
||||||
|
ACCESS_URL="http://$(hostname -I | awk '{print $1}'):${NODE_PORT}"
|
||||||
|
else
|
||||||
|
echo "Service not ready yet"
|
||||||
|
ACCESS_URL=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 6. Admin password ==="
|
||||||
|
ADMIN_PASS=$(kubectl -n awx get secret awx-admin-password -o jsonpath='{.data.password}' 2>/dev/null | base64 -d 2>/dev/null || echo "")
|
||||||
|
if [ -n "${ADMIN_PASS}" ]; then
|
||||||
|
echo "User: admin"
|
||||||
|
echo "Password: ${ADMIN_PASS}"
|
||||||
|
else
|
||||||
|
echo "Admin password secret not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== 7. HTTP check ==="
|
||||||
|
if [ -n "${ACCESS_URL}" ]; then
|
||||||
|
echo "Testing ${ACCESS_URL}..."
|
||||||
|
HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 "${ACCESS_URL}" 2>/dev/null || echo "failed")
|
||||||
|
echo "HTTP response: ${HTTP_CODE}"
|
||||||
|
if [ "${HTTP_CODE}" = "200" ] || [ "${HTTP_CODE}" = "302" ] || [ "${HTTP_CODE}" = "301" ]; then
|
||||||
|
echo "✓ AWX is accessible at ${ACCESS_URL}"
|
||||||
|
else
|
||||||
|
echo "✗ AWX not yet responding (HTTP ${HTTP_CODE})"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=========================================================="
|
||||||
|
if [ -n "${ACCESS_URL}" ]; then
|
||||||
|
echo " AWX Access URL: ${ACCESS_URL}"
|
||||||
|
fi
|
||||||
|
echo "=========================================================="
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
# bootstrap-all.sh — push agent SSH key + passwordless sudo to remaining systems.
|
||||||
|
#
|
||||||
|
# SSH is the ONLY approved access channel (see AGENTS.md "Access-channel
|
||||||
|
# policy: SSH only"). This script reaches systems that still allow password
|
||||||
|
# auth over sshd. Systems that reject password auth (publickey-only) cannot
|
||||||
|
# be reached this way — see the CONSOLE-ONLY section printed at the end.
|
||||||
|
#
|
||||||
|
# Two escalation methods:
|
||||||
|
# sudo → Ubuntu-style systems (no root pw; localuser has sudo)
|
||||||
|
# su → Debian-style systems (root has a password)
|
||||||
|
#
|
||||||
|
# Passes AGENT_USER so agent-bootstrap.sh targets the correct unprivileged
|
||||||
|
# user. You enter passwords interactively. Idempotent: safe to re-run.
|
||||||
|
#
|
||||||
|
# Verified state (access-matrix.sh, 2026-08-10): 68/70 non-excluded systems
|
||||||
|
# at intended access state. Only tsys-siem remains below.
|
||||||
|
set -u
|
||||||
|
cd "$(dirname "$0")" || exit 1
|
||||||
|
|
||||||
|
SCRIPT=agent-bootstrap.sh
|
||||||
|
SSH_OPTS=(-o StrictHostKeyChecking=accept-new -o ConnectTimeout=10)
|
||||||
|
|
||||||
|
run_with_sudo() {
|
||||||
|
local name="$1" ip="$2" user="$3" agent_user="${4:-localuser}"
|
||||||
|
echo "========================================"
|
||||||
|
echo " $name ($ip) — $user (sudo, agent=${agent_user})"
|
||||||
|
echo "========================================"
|
||||||
|
scp "${SSH_OPTS[@]}" "$SCRIPT" "${user}@${ip}:/tmp/" \
|
||||||
|
&& ssh -t "${SSH_OPTS[@]}" "${user}@${ip}" "sudo AGENT_USER=${agent_user} bash /tmp/$SCRIPT" \
|
||||||
|
&& echo " -> $name DONE" \
|
||||||
|
|| echo " -> $name FAILED"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
run_with_su() {
|
||||||
|
local name="$1" ip="$2" user="$3" agent_user="${4:-localuser}"
|
||||||
|
echo "========================================"
|
||||||
|
echo " $name ($ip) — $user (su, agent=${agent_user})"
|
||||||
|
echo "========================================"
|
||||||
|
scp "${SSH_OPTS[@]}" "$SCRIPT" "${user}@${ip}:/tmp/" \
|
||||||
|
&& ssh -t "${SSH_OPTS[@]}" "${user}@${ip}" "su -c 'AGENT_USER=${agent_user} bash /tmp/$SCRIPT'" \
|
||||||
|
&& echo " -> $name DONE" \
|
||||||
|
|| echo " -> $name FAILED"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
# All password-auth-reachable systems have been bootstrapped.
|
||||||
|
# Verified state (access-matrix.sh, 2026-08-10): 69/70 non-excluded systems
|
||||||
|
# at intended access state. The only remaining NOKEY (stlp-3dscanner) is
|
||||||
|
# deferred to [#417] and requires a rename + bring-online first — out of
|
||||||
|
# scope here. Run `access-matrix.sh` to re-verify at any time.
|
||||||
|
echo "All password-auth-reachable systems are bootstrapped."
|
||||||
|
echo "Remaining gap: stlp-3dscanner (deferred to [#417])."
|
||||||
|
echo "Run access-matrix.sh to re-verify."
|
||||||
|
echo "Deferred (separate ticket):"
|
||||||
|
echo " stlp-3dscanner — rename + bring online first [#417]"
|
||||||
|
echo "========================================"
|
||||||
|
echo "By design (leave alone):"
|
||||||
|
echo " sectestbed-sandbox — 2FA enforced"
|
||||||
|
echo "========================================"
|
||||||
|
echo "Excluded by policy (no SSH access):"
|
||||||
|
echo " pfv-bms (API), tsys-cloudron (prod revenue),"
|
||||||
|
echo " tsys-ucs-01/02 (API-managed), tsys-umbrel (treasury)"
|
||||||
|
echo "========================================"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user