@ebowwa/hetzner-mcp 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/package.json +3 -5
  2. package/bun.lock +0 -250
  3. package/dist/lib/hetzner/bootstrap/kernel-hardening.test.js +0 -181
  4. package/lmdb.db +0 -0
  5. package/lmdb.db-lock +0 -0
  6. package/src/index.js +0 -2034
  7. package/src/index.ts +0 -2295
  8. package/src/lib/hetzner/actions.ts +0 -1056
  9. package/src/lib/hetzner/auth.ts +0 -37
  10. package/src/lib/hetzner/bootstrap/cloud-init.ts +0 -394
  11. package/src/lib/hetzner/bootstrap/firewall.ts +0 -342
  12. package/src/lib/hetzner/bootstrap/genesis.ts +0 -518
  13. package/src/lib/hetzner/bootstrap/index.ts +0 -71
  14. package/src/lib/hetzner/bootstrap/kernel-hardening.test.ts +0 -230
  15. package/src/lib/hetzner/bootstrap/kernel-hardening.ts +0 -272
  16. package/src/lib/hetzner/bootstrap/security-audit.ts +0 -124
  17. package/src/lib/hetzner/bootstrap/ssh-hardening.ts +0 -192
  18. package/src/lib/hetzner/client.ts +0 -177
  19. package/src/lib/hetzner/config.ts +0 -5
  20. package/src/lib/hetzner/errors.ts +0 -371
  21. package/src/lib/hetzner/index.ts +0 -56
  22. package/src/lib/hetzner/pricing.ts +0 -422
  23. package/src/lib/hetzner/schemas.ts +0 -765
  24. package/src/lib/hetzner/server-status.ts +0 -81
  25. package/src/lib/hetzner/servers.ts +0 -568
  26. package/src/lib/hetzner/ssh-keys.ts +0 -122
  27. package/src/lib/hetzner/ssh-setup.ts +0 -218
  28. package/src/lib/hetzner/types.ts +0 -419
  29. package/src/lib/hetzner/volumes.ts +0 -229
  30. package/src/lib/resources.ts +0 -156
  31. package/src/lib/ssh/flags.ts +0 -578
  32. package/src/lib/ssh/index.ts +0 -5
  33. package/src/lib/terminal/client.ts +0 -55
  34. package/src/lib/terminal/config.ts +0 -489
  35. package/src/lib/terminal/error.ts +0 -13
  36. package/src/lib/terminal/exec.ts +0 -128
  37. package/src/lib/terminal/files.ts +0 -636
  38. package/src/lib/terminal/index.ts +0 -71
  39. package/src/lib/terminal/pool.ts +0 -662
  40. package/src/lib/terminal/scp.ts +0 -109
  41. package/src/lib/terminal/tmux-exec.ts +0 -96
  42. package/src/lib/terminal/tmux.ts +0 -711
  43. package/src/lib/terminal/types.ts +0 -19
  44. package/tsconfig.json +0 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebowwa/hetzner-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Hetzner VPS management MCP server (environments, SSH, tmux, volumes)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "bin": {
15
- "hetzner-mcp": "./dist/index.js"
15
+ "hetzner-mcp": "dist/index.js"
16
16
  },
17
17
  "scripts": {
18
18
  "build": "tsc",
@@ -42,7 +42,5 @@
42
42
  "tmux"
43
43
  ],
44
44
  "author": "ebowwa",
45
- "license": "MIT",
46
- "private": false,
47
- "access": "public"
45
+ "license": "MIT"
48
46
  }
package/bun.lock DELETED
@@ -1,250 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "configVersion": 1,
4
- "workspaces": {
5
- "": {
6
- "name": "@ebowwa/hetzner-mcp",
7
- "dependencies": {
8
- "@ebowwa/codespaces-types": "^1.1.0",
9
- "@ebowwa/ssh": "^0.1.0",
10
- "@modelcontextprotocol/sdk": "^1.26.0",
11
- "node-ssh": "^13.2.1",
12
- "zod": "^4.3.6",
13
- },
14
- "devDependencies": {
15
- "@types/bun": "latest",
16
- "@types/node": "^22.10.2",
17
- "typescript": "^5.7.2",
18
- },
19
- },
20
- },
21
- "packages": {
22
- "@ebowwa/codespaces-types": ["@ebowwa/codespaces-types@1.1.0", "", { "dependencies": { "zod": "^3.22.4" } }, "sha512-PVQgvv9cpQyaGhBVmVQMW5PbKErebLDU6OUOVegY6G+Rf6rV7saNkJue/1a5+OrSNaLgtobvv02C/4ZCeDANDA=="],
23
-
24
- "@ebowwa/ssh": ["@ebowwa/ssh@0.1.0", "", {}, "sha512-HhX+FootYWGxlA8wuOL/EAAx4KTkg2/WwiroMCispmODkbIud1bnY0EQFN/3RSP6u+KfHxBQClZ6kMqsqfKjJQ=="],
25
-
26
- "@hono/node-server": ["@hono/node-server@1.19.9", "", { "peerDependencies": { "hono": "^4" } }, "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw=="],
27
-
28
- "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.26.0", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-Y5RmPncpiDtTXDbLKswIJzTqu2hyBKxTNsgKqKclDbhIgg1wgtf1fRuvxgTnRfcnxtvvgbIEcqUOzZrJ6iSReg=="],
29
-
30
- "@types/bun": ["@types/bun@1.3.8", "", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="],
31
-
32
- "@types/node": ["@types/node@22.19.10", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-tF5VOugLS/EuDlTBijk0MqABfP8UxgYazTLo3uIn3b4yJgg26QRbVYJYsDtHrjdDUIRfP70+VfhTTc+CE1yskw=="],
33
-
34
- "accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
35
-
36
- "ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="],
37
-
38
- "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="],
39
-
40
- "asn1": ["asn1@0.2.6", "", { "dependencies": { "safer-buffer": "~2.1.0" } }, "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ=="],
41
-
42
- "bcrypt-pbkdf": ["bcrypt-pbkdf@1.0.2", "", { "dependencies": { "tweetnacl": "^0.14.3" } }, "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w=="],
43
-
44
- "body-parser": ["body-parser@2.2.2", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.3", "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" } }, "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA=="],
45
-
46
- "buildcheck": ["buildcheck@0.0.7", "", {}, "sha512-lHblz4ahamxpTmnsk+MNTRWsjYKv965MwOrSJyeD588rR3Jcu7swE+0wN5F+PbL5cjgu/9ObkhfzEPuofEMwLA=="],
47
-
48
- "bun-types": ["bun-types@1.3.8", "", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="],
49
-
50
- "bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
51
-
52
- "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
53
-
54
- "call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
55
-
56
- "content-disposition": ["content-disposition@1.0.1", "", {}, "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q=="],
57
-
58
- "content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="],
59
-
60
- "cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="],
61
-
62
- "cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="],
63
-
64
- "cors": ["cors@2.8.6", "", { "dependencies": { "object-assign": "^4", "vary": "^1" } }, "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw=="],
65
-
66
- "cpu-features": ["cpu-features@0.0.10", "", { "dependencies": { "buildcheck": "~0.0.6", "nan": "^2.19.0" } }, "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA=="],
67
-
68
- "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
69
-
70
- "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
71
-
72
- "depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
73
-
74
- "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
75
-
76
- "ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
77
-
78
- "encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
79
-
80
- "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
81
-
82
- "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
83
-
84
- "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
85
-
86
- "escape-html": ["escape-html@1.0.3", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="],
87
-
88
- "etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
89
-
90
- "eventsource": ["eventsource@3.0.7", "", { "dependencies": { "eventsource-parser": "^3.0.1" } }, "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA=="],
91
-
92
- "eventsource-parser": ["eventsource-parser@3.0.6", "", {}, "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg=="],
93
-
94
- "express": ["express@5.2.1", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "depd": "^2.0.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw=="],
95
-
96
- "express-rate-limit": ["express-rate-limit@8.2.1", "", { "dependencies": { "ip-address": "10.0.1" }, "peerDependencies": { "express": ">= 4.11" } }, "sha512-PCZEIEIxqwhzw4KF0n7QF4QqruVTcF73O5kFKUnGOyjbCCgizBBiFaYpd/fnBLUMPw/BWw9OsiN7GgrNYr7j6g=="],
97
-
98
- "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
99
-
100
- "fast-uri": ["fast-uri@3.1.0", "", {}, "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA=="],
101
-
102
- "finalhandler": ["finalhandler@2.1.1", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA=="],
103
-
104
- "forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="],
105
-
106
- "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="],
107
-
108
- "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
109
-
110
- "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
111
-
112
- "get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
113
-
114
- "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
115
-
116
- "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
117
-
118
- "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
119
-
120
- "hono": ["hono@4.11.8", "", {}, "sha512-eVkB/CYCCei7K2WElZW9yYQFWssG0DhaDhVvr7wy5jJ22K+ck8fWW0EsLpB0sITUTvPnc97+rrbQqIr5iqiy9Q=="],
121
-
122
- "http-errors": ["http-errors@2.0.1", "", { "dependencies": { "depd": "~2.0.0", "inherits": "~2.0.4", "setprototypeof": "~1.2.0", "statuses": "~2.0.2", "toidentifier": "~1.0.1" } }, "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ=="],
123
-
124
- "iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
125
-
126
- "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
127
-
128
- "ip-address": ["ip-address@10.0.1", "", {}, "sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA=="],
129
-
130
- "ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="],
131
-
132
- "is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="],
133
-
134
- "is-stream": ["is-stream@2.0.1", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="],
135
-
136
- "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
137
-
138
- "jose": ["jose@6.1.3", "", {}, "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ=="],
139
-
140
- "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
141
-
142
- "json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="],
143
-
144
- "make-dir": ["make-dir@3.1.0", "", { "dependencies": { "semver": "^6.0.0" } }, "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw=="],
145
-
146
- "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
147
-
148
- "media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="],
149
-
150
- "merge-descriptors": ["merge-descriptors@2.0.0", "", {}, "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g=="],
151
-
152
- "mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
153
-
154
- "mime-types": ["mime-types@3.0.2", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A=="],
155
-
156
- "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
157
-
158
- "nan": ["nan@2.25.0", "", {}, "sha512-0M90Ag7Xn5KMLLZ7zliPWP3rT90P6PN+IzVFS0VqmnPktBk3700xUVv8Ikm9EUaUE5SDWdp/BIxdENzVznpm1g=="],
159
-
160
- "negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
161
-
162
- "node-ssh": ["node-ssh@13.2.1", "", { "dependencies": { "is-stream": "^2.0.0", "make-dir": "^3.1.0", "sb-promise-queue": "^2.1.0", "sb-scandir": "^3.1.0", "shell-escape": "^0.2.0", "ssh2": "^1.14.0" } }, "sha512-rfl4GWMygQfzlExPkQ2LWyya5n2jOBm5vhEnup+4mdw7tQhNpJWbP5ldr09Jfj93k5SfY5lxcn8od5qrQ/6mBg=="],
163
-
164
- "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
165
-
166
- "object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
167
-
168
- "on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
169
-
170
- "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
171
-
172
- "parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="],
173
-
174
- "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
175
-
176
- "path-to-regexp": ["path-to-regexp@8.3.0", "", {}, "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA=="],
177
-
178
- "pkce-challenge": ["pkce-challenge@5.0.1", "", {}, "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ=="],
179
-
180
- "proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="],
181
-
182
- "qs": ["qs@6.14.1", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ=="],
183
-
184
- "range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="],
185
-
186
- "raw-body": ["raw-body@3.0.2", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.7.0", "unpipe": "~1.0.0" } }, "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA=="],
187
-
188
- "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="],
189
-
190
- "router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="],
191
-
192
- "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
193
-
194
- "sb-promise-queue": ["sb-promise-queue@2.1.1", "", {}, "sha512-qXfdcJQMxMljxmPprn4Q4hl3pJmoljSCzUvvEBa9Kscewnv56n0KqrO6yWSrGLOL9E021wcGdPa39CHGKA6G0w=="],
195
-
196
- "sb-scandir": ["sb-scandir@3.1.1", "", { "dependencies": { "sb-promise-queue": "^2.1.0" } }, "sha512-Q5xiQMtoragW9z8YsVYTAZcew+cRzdVBefPbb9theaIKw6cBo34WonP9qOCTKgyAmn/Ch5gmtAxT/krUgMILpA=="],
197
-
198
- "semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
199
-
200
- "send": ["send@1.2.1", "", { "dependencies": { "debug": "^4.4.3", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", "http-errors": "^2.0.1", "mime-types": "^3.0.2", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", "statuses": "^2.0.2" } }, "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ=="],
201
-
202
- "serve-static": ["serve-static@2.2.1", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw=="],
203
-
204
- "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
205
-
206
- "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
207
-
208
- "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
209
-
210
- "shell-escape": ["shell-escape@0.2.0", "", {}, "sha512-uRRBT2MfEOyxuECseCZd28jC1AJ8hmqqneWQ4VWUTgCAFvb3wKU1jLqj6egC4Exrr88ogg3dp+zroH4wJuaXzw=="],
211
-
212
- "side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="],
213
-
214
- "side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="],
215
-
216
- "side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="],
217
-
218
- "side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="],
219
-
220
- "ssh2": ["ssh2@1.17.0", "", { "dependencies": { "asn1": "^0.2.6", "bcrypt-pbkdf": "^1.0.2" }, "optionalDependencies": { "cpu-features": "~0.0.10", "nan": "^2.23.0" } }, "sha512-wPldCk3asibAjQ/kziWQQt1Wh3PgDFpC0XpwclzKcdT1vql6KeYxf5LIt4nlFkUeR8WuphYMKqUA56X4rjbfgQ=="],
221
-
222
- "statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="],
223
-
224
- "toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],
225
-
226
- "tweetnacl": ["tweetnacl@0.14.5", "", {}, "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="],
227
-
228
- "type-is": ["type-is@2.0.1", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="],
229
-
230
- "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
231
-
232
- "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
233
-
234
- "unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
235
-
236
- "vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
237
-
238
- "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
239
-
240
- "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
241
-
242
- "zod": ["zod@4.3.6", "", {}, "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="],
243
-
244
- "zod-to-json-schema": ["zod-to-json-schema@3.25.1", "", { "peerDependencies": { "zod": "^3.25 || ^4" } }, "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA=="],
245
-
246
- "@ebowwa/codespaces-types/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
247
-
248
- "bun-types/@types/node": ["@types/node@20.19.32", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-Ez8QE4DMfhjjTsES9K2dwfV258qBui7qxUsoaixZDiTzbde4U12e1pXGNu/ECsUIOi5/zoCxAQxIhQnaUQ2VvA=="],
249
- }
250
- }
@@ -1,181 +0,0 @@
1
- /**
2
- * Kernel Hardening Module Tests
3
- *
4
- * Tests for kernel hardening cloud-init components.
5
- */
6
- import { test, expect } from "bun:test";
7
- import { kernelHardeningPackages, kernelHardeningWriteFiles, kernelHardeningRunCmd, } from "./kernel-hardening";
8
- test("kernelHardeningPackages returns empty array (no packages needed)", () => {
9
- const packages = kernelHardeningPackages();
10
- expect(packages).toBeArray();
11
- expect(packages).toHaveLength(0);
12
- });
13
- test("kernelHardeningWriteFiles returns sysctl configuration", () => {
14
- const writeFiles = kernelHardeningWriteFiles();
15
- expect(writeFiles).toBeArray();
16
- expect(writeFiles.length).toBeGreaterThan(0);
17
- // Check for key file path
18
- const filesContent = writeFiles.join("\n");
19
- expect(filesContent).toContain("/etc/sysctl.d/99-security-hardening.conf");
20
- expect(filesContent).toContain("owner: root:root");
21
- expect(filesContent).toContain("permissions: '0644'");
22
- // Check for key security settings
23
- expect(filesContent).toContain("net.ipv4.conf.all.rp_filter = 1");
24
- expect(filesContent).toContain("net.ipv4.tcp_syncookies = 1");
25
- expect(filesContent).toContain("kernel.randomize_va_space = 2");
26
- expect(filesContent).toContain("fs.suid_dumpable = 0");
27
- expect(filesContent).toContain("fs.protected_hardlinks = 1");
28
- expect(filesContent).toContain("fs.protected_symlinks = 1");
29
- // Check for 2026 best practices
30
- expect(filesContent).toContain("kernel.dmesg_restrict = 1");
31
- expect(filesContent).toContain("kernel.yama.ptrace_scope = 2");
32
- expect(filesContent).toContain("kernel.unprivileged_bpf_disabled = 1");
33
- });
34
- test("kernelHardeningWriteFiles includes all security categories", () => {
35
- const writeFiles = kernelHardeningWriteFiles();
36
- const filesContent = writeFiles.join("\n");
37
- // 1. IP Spoofing Protection
38
- expect(filesContent).toContain("rp_filter");
39
- expect(filesContent).toContain("log_martians");
40
- expect(filesContent).toContain("accept_redirects");
41
- expect(filesContent).toContain("secure_redirects");
42
- expect(filesContent).toContain("send_redirects");
43
- // 2. SYN Flood Protection
44
- expect(filesContent).toContain("tcp_syncookies");
45
- expect(filesContent).toContain("tcp_tw_reuse");
46
- expect(filesContent).toContain("tcp_max_syn_backlog");
47
- expect(filesContent).toContain("tcp_synack_retries");
48
- expect(filesContent).toContain("tcp_syn_retries");
49
- // 3. Network Stack Hardening
50
- expect(filesContent).toContain("icmp_echo_ignore_broadcasts");
51
- expect(filesContent).toContain("icmp_ignore_bogus_error_responses");
52
- expect(filesContent).toContain("tcp_timestamps");
53
- expect(filesContent).toContain("tcp_sack");
54
- // 4. Core Dump Restrictions
55
- expect(filesContent).toContain("suid_dumpable");
56
- expect(filesContent).toContain("core_pattern");
57
- // 5. Memory Protection (ASLR)
58
- expect(filesContent).toContain("randomize_va_space");
59
- // 6. Filesystem Protection
60
- expect(filesContent).toContain("protected_hardlinks");
61
- expect(filesContent).toContain("protected_symlinks");
62
- expect(filesContent).toContain("protected_fifos");
63
- expect(filesContent).toContain("protected_regular");
64
- // 7. Network Behavior Tuning
65
- expect(filesContent).toContain("tcp_fastopen");
66
- expect(filesContent).toContain("accept_source_route");
67
- expect(filesContent).toContain("tcp_window_scaling");
68
- // 8. Security-Related Kernel Parameters
69
- expect(filesContent).toContain("kernel.sysrq");
70
- expect(filesContent).toContain("kernel.kexec_load");
71
- expect(filesContent).toContain("user.max_user_namespaces");
72
- expect(filesContent).toContain("kernel.unprivileged_bpf_disabled");
73
- // 9. Additional Hardening (2026)
74
- expect(filesContent).toContain("kernel.dmesg_restrict");
75
- expect(filesContent).toContain("kernel.yama.ptrace_scope");
76
- // 10. Performance Tuning
77
- expect(filesContent).toContain("nf_conntrack_max");
78
- expect(filesContent).toContain("tcp_keepalive_time");
79
- expect(filesContent).toContain("tcp_keepalive_intvl");
80
- expect(filesContent).toContain("tcp_keepalive_probes");
81
- });
82
- test("kernelHardeningRunCmd returns activation commands", () => {
83
- const runCmd = kernelHardeningRunCmd();
84
- expect(runCmd).toBeArray();
85
- expect(runCmd.length).toBeGreaterThan(0);
86
- const cmdContent = runCmd.join("\n");
87
- // Check for sysctl application
88
- expect(cmdContent).toContain("sysctl --system");
89
- // Check for logging
90
- expect(cmdContent).toContain("/var/log/kernel-hardening.log");
91
- // Check for summary display
92
- expect(cmdContent).toContain("Kernel Hardening Applied (2026)");
93
- expect(cmdContent).toContain("IP Spoof Protection:");
94
- expect(cmdContent).toContain("SYN Cookies:");
95
- expect(cmdContent).toContain("ASLR Level:");
96
- expect(cmdContent).toContain("SUID Core Dumps:");
97
- expect(cmdContent).toContain("Hard Links Protected:");
98
- expect(cmdContent).toContain("Ptrace Scope:");
99
- });
100
- test("kernelHardeningRunCmd includes verification commands", () => {
101
- const runCmd = kernelHardeningRunCmd();
102
- const cmdContent = runCmd.join("\n");
103
- // Check for sysctl commands to verify settings
104
- expect(cmdContent).toContain("sysctl -n net.ipv4.conf.all.rp_filter");
105
- expect(cmdContent).toContain("sysctl -n net.ipv4.tcp_syncookies");
106
- expect(cmdContent).toContain("sysctl -n kernel.randomize_va_space");
107
- expect(cmdContent).toContain("sysctl -n fs.suid_dumpable");
108
- expect(cmdContent).toContain("sysctl -n fs.protected_hardlinks");
109
- expect(cmdContent).toContain("sysctl -n kernel.yama.ptrace_scope");
110
- });
111
- test("kernel hardening settings match CIS benchmarks", () => {
112
- const writeFiles = kernelHardeningWriteFiles();
113
- const filesContent = writeFiles.join("\n");
114
- // CIS Benchmark 1.5.1: Ensure core dumps are restricted
115
- expect(filesContent).toContain("fs.suid_dumpable = 0");
116
- // CIS Benchmark 3.3.1: Ensure IP forwarding is disabled (not set by default)
117
- // We don't set this as it may be needed for container workloads
118
- // CIS Benchmark 3.3.2: Ensure send redirects is disabled
119
- expect(filesContent).toContain("net.ipv4.conf.all.send_redirects = 0");
120
- // CIS Benchmark 3.3.3: Ensure ICMP redirects are not accepted
121
- expect(filesContent).toContain("net.ipv4.conf.all.accept_redirects = 0");
122
- // CIS Benchmark 3.3.4: Ensure secure ICMP redirects are not accepted
123
- expect(filesContent).toContain("net.ipv4.conf.all.secure_redirects = 0");
124
- // CIS Benchmark 3.3.5: Ensure suspicious packets are logged
125
- expect(filesContent).toContain("net.ipv4.conf.all.log_martians = 1");
126
- // CIS Benchmark 3.3.6: Ensure broadcast ICMP requests are ignored
127
- expect(filesContent).toContain("net.ipv4.icmp_echo_ignore_broadcasts = 1");
128
- // CIS Benchmark 3.3.7: Ensure bogus ICMP responses are ignored
129
- expect(filesContent).toContain("net.ipv4.icmp_ignore_bogus_error_responses = 1");
130
- // CIS Benchmark 3.3.8: Ensure Reverse Path Filtering is enabled
131
- expect(filesContent).toContain("net.ipv4.conf.all.rp_filter = 1");
132
- // CIS Benchmark 3.3.9: Ensure TCP SYN Cookies is enabled
133
- expect(filesContent).toContain("net.ipv4.tcp_syncookies = 1");
134
- // CIS Benchmark 3.3.10: Ensure IPv6 is disabled (optional, commented out)
135
- // We don't disable IPv6 by default as it may be needed
136
- // CIS Benchmark 1.5.2: Ensure address space layout randomization (ASLR) is enabled
137
- expect(filesContent).toContain("kernel.randomize_va_space = 2");
138
- // CIS Benchmark 1.5.3: Ensure prelink is disabled (package removal, not in sysctl)
139
- // Not applicable to sysctl configuration
140
- // CIS Benchmark 1.5.4: Ensure core dump backtraces are disabled
141
- expect(filesContent).toContain("fs.suid_dumpable = 0");
142
- });
143
- test("kernel hardening includes 2026 best practices", () => {
144
- const writeFiles = kernelHardeningWriteFiles();
145
- const filesContent = writeFiles.join("\n");
146
- // Modern kernel hardening (2026)
147
- expect(filesContent).toContain("kernel.dmesg_restrict = 1");
148
- expect(filesContent).toContain("kernel.yama.ptrace_scope = 2");
149
- expect(filesContent).toContain("kernel.unprivileged_bpf_disabled = 1");
150
- expect(filesContent).toContain("user.max_user_namespaces = 0");
151
- expect(filesContent).toContain("kernel.kexec_load = 0");
152
- // Filesystem hard links/symlinks protection (TOCTOU prevention)
153
- expect(filesContent).toContain("fs.protected_hardlinks = 1");
154
- expect(filesContent).toContain("fs.protected_symlinks = 1");
155
- expect(filesContent).toContain("fs.protected_fifos = 2");
156
- expect(filesContent).toContain("fs.protected_regular = 2");
157
- // Performance tuning with security in mind
158
- expect(filesContent).toContain("net.netfilter.nf_conntrack_max = 262144");
159
- expect(filesContent).toContain("net.ipv4.tcp_keepalive_time = 600");
160
- });
161
- test("kernel hardening has proper documentation headers", () => {
162
- const writeFiles = kernelHardeningWriteFiles();
163
- const filesContent = writeFiles.join("\n");
164
- // Check for documentation and headers
165
- expect(filesContent).toContain("Kernel Security Hardening Configuration");
166
- expect(filesContent).toContain("2026 best practices");
167
- expect(filesContent).toContain("CIS Benchmark");
168
- expect(filesContent).toContain("NIST");
169
- // Check for section headers
170
- expect(filesContent).toContain("IP SPOOFING PROTECTION");
171
- expect(filesContent).toContain("SYN FLOOD PROTECTION");
172
- expect(filesContent).toContain("NETWORK STACK HARDENING");
173
- expect(filesContent).toContain("CORE DUMP RESTRICTIONS");
174
- expect(filesContent).toContain("MEMORY PROTECTION (ASLR)");
175
- expect(filesContent).toContain("FILESYSTEM PROTECTION");
176
- expect(filesContent).toContain("NETWORK BEHAVIOR TUNING");
177
- expect(filesContent).toContain("SECURITY-RELATED KERNEL PARAMETERS");
178
- expect(filesContent).toContain("ADDITIONAL HARDENING (2026)");
179
- expect(filesContent).toContain("PERFORMANCE TUNING");
180
- });
181
- //# sourceMappingURL=kernel-hardening.test.js.map
package/lmdb.db DELETED
Binary file
package/lmdb.db-lock DELETED
Binary file