yakmesh 2.8.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +637 -0
- package/CONTRIBUTING.md +42 -0
- package/Caddyfile +77 -0
- package/README.md +119 -29
- package/adapters/adapter-mlv-bible/README.md +124 -0
- package/adapters/adapter-mlv-bible/index.js +400 -0
- package/adapters/chat-mod-adapter.js +532 -0
- package/adapters/content-adapter.js +273 -0
- package/content/api.js +50 -41
- package/content/index.js +2 -2
- package/content/store.js +355 -173
- package/dashboard/index.html +19 -3
- package/database/replication.js +117 -37
- package/docs/CRYPTO-AGILITY.md +204 -0
- package/docs/MTLS-RESEARCH.md +367 -0
- package/docs/NAMCHE-SPEC.md +681 -0
- package/docs/PEERQUANTA-YAKMESH-INTEGRATION.md +407 -0
- package/docs/PRECISION-DISCLOSURE.md +96 -0
- package/docs/README.md +76 -0
- package/docs/ROADMAP-2.4.0.md +447 -0
- package/docs/ROADMAP-2.5.0.md +244 -0
- package/docs/SECURITY-AUDIT-REPORT.md +306 -0
- package/docs/SST-INTEGRATION.md +712 -0
- package/docs/STEADYWATCH-IMPLEMENTATION.md +303 -0
- package/docs/TERNARY-AUDIT-REPORT.md +247 -0
- package/docs/TME-FAQ.md +221 -0
- package/docs/WHITEPAPER.md +623 -0
- package/docs/adapters.html +1001 -0
- package/docs/advanced-systems.html +1045 -0
- package/docs/annex.html +1046 -0
- package/docs/api.html +970 -0
- package/docs/business/response-templates.md +160 -0
- package/docs/c2c.html +1225 -0
- package/docs/cli.html +1332 -0
- package/docs/configuration.html +1248 -0
- package/docs/darshan.html +1085 -0
- package/docs/dharma.html +966 -0
- package/docs/docs-bundle.html +1075 -0
- package/docs/docs.css +3120 -0
- package/docs/docs.js +556 -0
- package/docs/doko.html +969 -0
- package/docs/geo-proof.html +858 -0
- package/docs/getting-started.html +840 -0
- package/docs/gumba-tutorial.html +1144 -0
- package/docs/gumba.html +1098 -0
- package/docs/index.html +914 -0
- package/docs/jhilke.html +1312 -0
- package/docs/karma.html +1100 -0
- package/docs/katha.html +1037 -0
- package/docs/lama.html +978 -0
- package/docs/mandala.html +1067 -0
- package/docs/mani.html +964 -0
- package/docs/mantra.html +967 -0
- package/docs/mesh.html +1409 -0
- package/docs/nakpak.html +869 -0
- package/docs/namche.html +928 -0
- package/docs/nav-order.json +53 -0
- package/docs/prahari.html +1043 -0
- package/docs/prism-bash.min.js +1 -0
- package/docs/prism-javascript.min.js +1 -0
- package/docs/prism-json.min.js +1 -0
- package/docs/prism-tomorrow.min.css +1 -0
- package/docs/prism.min.js +1 -0
- package/docs/privacy.html +699 -0
- package/docs/quick-reference.html +1181 -0
- package/docs/sakshi.html +1402 -0
- package/docs/sandboxing.md +386 -0
- package/docs/seva.html +911 -0
- package/docs/sherpa.html +871 -0
- package/docs/studio.html +860 -0
- package/docs/stupa.html +995 -0
- package/docs/tailwind.min.css +2 -0
- package/docs/tattva.html +1332 -0
- package/docs/terms.html +686 -0
- package/docs/time-server-deployment.md +166 -0
- package/docs/time-sources.html +1392 -0
- package/docs/tivra.html +1127 -0
- package/docs/trademark-policy.html +686 -0
- package/docs/tribhuj.html +1183 -0
- package/docs/trust-security.html +1029 -0
- package/docs/tutorials/backup-recovery.html +654 -0
- package/docs/tutorials/dashboard.html +604 -0
- package/docs/tutorials/domain-setup.html +605 -0
- package/docs/tutorials/host-website.html +456 -0
- package/docs/tutorials/mesh-network.html +505 -0
- package/docs/tutorials/mobile-access.html +445 -0
- package/docs/tutorials/privacy.html +467 -0
- package/docs/tutorials/raspberry-pi.html +600 -0
- package/docs/tutorials/security-basics.html +539 -0
- package/docs/tutorials/share-files.html +431 -0
- package/docs/tutorials/troubleshooting.html +637 -0
- package/docs/tutorials/trust-karma.html +419 -0
- package/docs/tutorials/yak-protocol.html +456 -0
- package/docs/tutorials.html +1034 -0
- package/docs/vani.html +1270 -0
- package/docs/webserver.html +809 -0
- package/docs/yak-protocol.html +940 -0
- package/docs/yak-timeserver-design.md +475 -0
- package/docs/yakapp.html +1015 -0
- package/docs/ypc27.html +1069 -0
- package/docs/yurt.html +1344 -0
- package/embedded-docs/bundle.js +334 -74
- package/gossip/protocol.js +247 -27
- package/identity/key-resolver.js +262 -0
- package/identity/machine-seed.js +632 -0
- package/identity/node-key.js +669 -368
- package/identity/tribhuj-ratchet.js +506 -0
- package/knowledge-base.js +37 -8
- package/launcher/yakmesh.bat +62 -0
- package/launcher/yakmesh.sh +70 -0
- package/mesh/annex.js +462 -108
- package/mesh/beacon-broadcast.js +113 -1
- package/mesh/darshan.js +1718 -0
- package/mesh/gumba.js +1567 -0
- package/mesh/jhilke.js +651 -0
- package/mesh/katha.js +1012 -0
- package/mesh/nakpak-routing.js +8 -5
- package/mesh/network.js +724 -34
- package/mesh/pulse-sync.js +4 -1
- package/mesh/rate-limiter.js +127 -15
- package/mesh/seva.js +526 -0
- package/mesh/sherpa-discovery.js +89 -8
- package/mesh/sybil-defense.js +19 -5
- package/mesh/temporal-encoder.js +4 -3
- package/mesh/vani.js +1364 -0
- package/mesh/yurt.js +1340 -0
- package/models/entropy-sentinel.onnx +0 -0
- package/models/karma-trust.onnx +0 -0
- package/models/manifest.json +43 -0
- package/models/sakshi-anomaly.onnx +0 -0
- package/oracle/code-proof-protocol.js +7 -6
- package/oracle/codebase-lock.js +257 -28
- package/oracle/index.js +74 -15
- package/oracle/ma902-snmp.js +678 -0
- package/oracle/module-sealer.js +5 -3
- package/oracle/network-identity.js +16 -0
- package/oracle/packet-checksum.js +201 -0
- package/oracle/sst.js +579 -0
- package/oracle/ternary-144t.js +714 -0
- package/oracle/ternary-ml.js +481 -0
- package/oracle/time-api.js +239 -0
- package/oracle/time-source.js +137 -47
- package/oracle/validation-oracle-hardened.js +1111 -1071
- package/oracle/validation-oracle.js +4 -2
- package/oracle/ypc27.js +211 -0
- package/package.json +20 -3
- package/protocol/yak-handler.js +35 -9
- package/protocol/yak-protocol.js +28 -13
- package/reference/cpp/yakmesh_mceliece_shard.cpp +168 -0
- package/reference/cpp/yakmesh_ypc27.cpp +179 -0
- package/sbom.json +87 -0
- package/scripts/security-audit.mjs +264 -0
- package/scripts/update-docs-nav.js +194 -0
- package/scripts/update-docs-sidebar.cjs +164 -0
- package/security/crypto-config.js +4 -3
- package/security/dharma-moderation.js +517 -0
- package/security/doko-identity.js +193 -143
- package/security/domain-consensus.js +86 -85
- package/security/fs-hardening.js +620 -0
- package/security/hardware-attestation.js +5 -3
- package/security/hybrid-trust.js +227 -87
- package/security/karma-rate-limiter.js +692 -0
- package/security/khata-protocol.js +22 -21
- package/security/khata-trust-integration.js +277 -150
- package/security/memory-safety.js +635 -0
- package/security/mesh-auth.js +11 -10
- package/security/mesh-revocation.js +373 -5
- package/security/namche-gateway.js +298 -69
- package/security/sakshi.js +460 -3
- package/security/sangha.js +770 -0
- package/security/secure-config.js +473 -0
- package/security/silicon-parity.js +13 -10
- package/security/steadywatch.js +1142 -0
- package/security/strike-system.js +32 -3
- package/security/temporal-signing.js +488 -0
- package/security/trit-commitment.js +464 -0
- package/server/crypto/annex.js +247 -0
- package/server/darshan-api.js +343 -0
- package/server/index.js +3259 -362
- package/server/komm-api.js +668 -0
- package/utils/accel.js +2273 -0
- package/utils/ternary-id.js +79 -0
- package/utils/verify-worker.js +57 -0
- package/webserver/index.js +95 -5
- package/assets/yakmesh-logo.png +0 -0
- package/assets/yakmesh-logo.svg +0 -80
- package/assets/yakmesh-logo2.png +0 -0
- package/assets/yakmesh-logo2sm.png +0 -0
- package/assets/ymsm.png +0 -0
- package/website/assets/silhouettes/adapters.svg +0 -107
- package/website/assets/silhouettes/api-endpoints.svg +0 -115
- package/website/assets/silhouettes/atomic-clock.svg +0 -83
- package/website/assets/silhouettes/base-camp.svg +0 -81
- package/website/assets/silhouettes/bridge.svg +0 -69
- package/website/assets/silhouettes/docs-bundle.svg +0 -113
- package/website/assets/silhouettes/doko-basket.svg +0 -70
- package/website/assets/silhouettes/fortress.svg +0 -93
- package/website/assets/silhouettes/gateway.svg +0 -54
- package/website/assets/silhouettes/gears.svg +0 -93
- package/website/assets/silhouettes/globe-satellite.svg +0 -67
- package/website/assets/silhouettes/karma-wheel.svg +0 -137
- package/website/assets/silhouettes/lama-council.svg +0 -141
- package/website/assets/silhouettes/mandala-network.svg +0 -169
- package/website/assets/silhouettes/mani-stones.svg +0 -149
- package/website/assets/silhouettes/mantra-wheel.svg +0 -116
- package/website/assets/silhouettes/mesh-nodes.svg +0 -113
- package/website/assets/silhouettes/nakpak.svg +0 -56
- package/website/assets/silhouettes/peak-lightning.svg +0 -73
- package/website/assets/silhouettes/sherpa.svg +0 -69
- package/website/assets/silhouettes/stupa-tower.svg +0 -119
- package/website/assets/silhouettes/tattva-eye.svg +0 -78
- package/website/assets/silhouettes/terminal.svg +0 -74
- package/website/assets/silhouettes/webserver.svg +0 -145
- package/website/assets/silhouettes/yak.svg +0 -78
- package/website/assets/yakmesh-logo.png +0 -0
- package/website/assets/yakmesh-logo.webp +0 -0
- package/website/assets/yakmesh-logo128x140.webp +0 -0
- package/website/assets/yakmesh-logo2.png +0 -0
- package/website/assets/yakmesh-logo2.svg +0 -51
- package/website/assets/yakmesh-logo40x44.webp +0 -0
- package/website/assets/yakmesh.gif +0 -0
- package/website/assets/yakmesh.ico +0 -0
- package/website/assets/yakmesh.jpg +0 -0
- package/website/assets/yakmesh.pdf +0 -0
- package/website/assets/yakmesh.png +0 -0
- package/website/assets/yakmesh.svg +0 -70
- package/website/assets/yakmesh128.webp +0 -0
- package/website/assets/yakmesh32.png +0 -0
- package/website/assets/yakmesh32.svg +0 -65
- package/website/assets/yakmesh32o.ico +0 -2
- package/website/assets/yakmesh32o.svg +0 -65
- package/website/assets/yakmesh32o.svgz +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# Yakmesh Sandboxing Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document describes how to run Yakmesh in a sandboxed environment on Linux and macOS. While the core security features (SANGHA, FS Hardening, Memory Safety, etc.) work on all platforms, OS-level sandboxing provides an additional defense layer.
|
|
6
|
+
|
|
7
|
+
## Linux Sandboxing
|
|
8
|
+
|
|
9
|
+
### Option 1: systemd Service with Sandboxing
|
|
10
|
+
|
|
11
|
+
Create `/etc/systemd/system/yakmesh.service`:
|
|
12
|
+
|
|
13
|
+
```ini
|
|
14
|
+
[Unit]
|
|
15
|
+
Description=Yakmesh P2P Mesh Network Node
|
|
16
|
+
After=network.target
|
|
17
|
+
|
|
18
|
+
[Service]
|
|
19
|
+
Type=simple
|
|
20
|
+
User=yakmesh
|
|
21
|
+
Group=yakmesh
|
|
22
|
+
WorkingDirectory=/opt/yakmesh
|
|
23
|
+
ExecStart=/usr/bin/node server/index.js
|
|
24
|
+
Restart=always
|
|
25
|
+
RestartSec=10
|
|
26
|
+
|
|
27
|
+
# Sandboxing directives
|
|
28
|
+
NoNewPrivileges=yes
|
|
29
|
+
ProtectSystem=strict
|
|
30
|
+
ProtectHome=yes
|
|
31
|
+
PrivateTmp=yes
|
|
32
|
+
PrivateDevices=yes
|
|
33
|
+
ProtectKernelTunables=yes
|
|
34
|
+
ProtectKernelModules=yes
|
|
35
|
+
ProtectControlGroups=yes
|
|
36
|
+
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
|
37
|
+
RestrictNamespaces=yes
|
|
38
|
+
RestrictRealtime=yes
|
|
39
|
+
RestrictSUIDSGID=yes
|
|
40
|
+
MemoryDenyWriteExecute=yes
|
|
41
|
+
LockPersonality=yes
|
|
42
|
+
SystemCallFilter=@system-service
|
|
43
|
+
SystemCallArchitectures=native
|
|
44
|
+
|
|
45
|
+
# Allow only necessary capabilities
|
|
46
|
+
CapabilityBoundingSet=
|
|
47
|
+
AmbientCapabilities=
|
|
48
|
+
|
|
49
|
+
# Filesystem access
|
|
50
|
+
ReadWritePaths=/opt/yakmesh/data
|
|
51
|
+
ReadOnlyPaths=/opt/yakmesh
|
|
52
|
+
|
|
53
|
+
# Resource limits
|
|
54
|
+
LimitNOFILE=65535
|
|
55
|
+
LimitNPROC=4096
|
|
56
|
+
|
|
57
|
+
[Install]
|
|
58
|
+
WantedBy=multi-user.target
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Enable and start:
|
|
62
|
+
```bash
|
|
63
|
+
sudo systemctl daemon-reload
|
|
64
|
+
sudo systemctl enable yakmesh
|
|
65
|
+
sudo systemctl start yakmesh
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Option 2: Firejail
|
|
69
|
+
|
|
70
|
+
Install firejail and create profile `/etc/firejail/yakmesh.profile`:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
# Yakmesh Firejail profile
|
|
74
|
+
include /etc/firejail/default.profile
|
|
75
|
+
|
|
76
|
+
# Restrict to yakmesh directory
|
|
77
|
+
whitelist /opt/yakmesh
|
|
78
|
+
read-only /opt/yakmesh
|
|
79
|
+
read-write /opt/yakmesh/data
|
|
80
|
+
|
|
81
|
+
# Network access
|
|
82
|
+
net eth0
|
|
83
|
+
|
|
84
|
+
# Capabilities
|
|
85
|
+
caps.drop all
|
|
86
|
+
caps.keep net_bind_service
|
|
87
|
+
|
|
88
|
+
# Seccomp
|
|
89
|
+
seccomp
|
|
90
|
+
|
|
91
|
+
# Memory
|
|
92
|
+
memory-deny-write-execute
|
|
93
|
+
|
|
94
|
+
# Disable unneeded features
|
|
95
|
+
no3d
|
|
96
|
+
nodvd
|
|
97
|
+
nogroups
|
|
98
|
+
nonewprivs
|
|
99
|
+
nosound
|
|
100
|
+
notv
|
|
101
|
+
novideo
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Run:
|
|
105
|
+
```bash
|
|
106
|
+
firejail --profile=/etc/firejail/yakmesh.profile node /opt/yakmesh/server/index.js
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Option 3: Docker with seccomp/AppArmor
|
|
110
|
+
|
|
111
|
+
Dockerfile:
|
|
112
|
+
```dockerfile
|
|
113
|
+
FROM node:24-slim
|
|
114
|
+
|
|
115
|
+
# Create non-root user
|
|
116
|
+
RUN groupadd -r yakmesh && useradd -r -g yakmesh yakmesh
|
|
117
|
+
|
|
118
|
+
# Set up app
|
|
119
|
+
WORKDIR /app
|
|
120
|
+
COPY --chown=yakmesh:yakmesh . .
|
|
121
|
+
RUN npm ci --production
|
|
122
|
+
|
|
123
|
+
# Switch to non-root
|
|
124
|
+
USER yakmesh
|
|
125
|
+
|
|
126
|
+
# Expose ports
|
|
127
|
+
EXPOSE 3080 9080
|
|
128
|
+
|
|
129
|
+
# Health check
|
|
130
|
+
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
|
131
|
+
CMD curl -f http://localhost:3080/health || exit 1
|
|
132
|
+
|
|
133
|
+
CMD ["node", "server/index.js"]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Docker Compose with security options:
|
|
137
|
+
```yaml
|
|
138
|
+
version: '3.8'
|
|
139
|
+
services:
|
|
140
|
+
yakmesh:
|
|
141
|
+
build: .
|
|
142
|
+
security_opt:
|
|
143
|
+
- no-new-privileges:true
|
|
144
|
+
- seccomp:unconfined # Or use custom seccomp profile
|
|
145
|
+
cap_drop:
|
|
146
|
+
- ALL
|
|
147
|
+
read_only: true
|
|
148
|
+
tmpfs:
|
|
149
|
+
- /tmp
|
|
150
|
+
volumes:
|
|
151
|
+
- ./data:/app/data:rw
|
|
152
|
+
ports:
|
|
153
|
+
- "3080:3080"
|
|
154
|
+
- "9080:9080"
|
|
155
|
+
deploy:
|
|
156
|
+
resources:
|
|
157
|
+
limits:
|
|
158
|
+
cpus: '2'
|
|
159
|
+
memory: 2G
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Option 4: bubblewrap (bwrap)
|
|
163
|
+
|
|
164
|
+
Minimal sandboxing with bubblewrap:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
#!/bin/bash
|
|
168
|
+
bwrap \
|
|
169
|
+
--ro-bind /usr /usr \
|
|
170
|
+
--ro-bind /lib /lib \
|
|
171
|
+
--ro-bind /lib64 /lib64 \
|
|
172
|
+
--ro-bind /opt/yakmesh /opt/yakmesh \
|
|
173
|
+
--bind /opt/yakmesh/data /opt/yakmesh/data \
|
|
174
|
+
--tmpfs /tmp \
|
|
175
|
+
--proc /proc \
|
|
176
|
+
--dev /dev \
|
|
177
|
+
--unshare-all \
|
|
178
|
+
--share-net \
|
|
179
|
+
--die-with-parent \
|
|
180
|
+
--new-session \
|
|
181
|
+
--hostname yakmesh \
|
|
182
|
+
--chdir /opt/yakmesh \
|
|
183
|
+
/usr/bin/node server/index.js
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## macOS Sandboxing
|
|
187
|
+
|
|
188
|
+
### Option 1: App Sandbox (sandbox-exec)
|
|
189
|
+
|
|
190
|
+
Create `yakmesh.sb`:
|
|
191
|
+
|
|
192
|
+
```scheme
|
|
193
|
+
(version 1)
|
|
194
|
+
(deny default)
|
|
195
|
+
|
|
196
|
+
; Allow basic operations
|
|
197
|
+
(allow process-exec)
|
|
198
|
+
(allow process-fork)
|
|
199
|
+
(allow signal (target self))
|
|
200
|
+
|
|
201
|
+
; Network access
|
|
202
|
+
(allow network*)
|
|
203
|
+
|
|
204
|
+
; File access - read-only for code
|
|
205
|
+
(allow file-read* (subpath "/opt/yakmesh"))
|
|
206
|
+
(allow file-read* (subpath "/usr/local/lib/node_modules"))
|
|
207
|
+
|
|
208
|
+
; File access - read-write for data
|
|
209
|
+
(allow file-read* file-write* (subpath "/opt/yakmesh/data"))
|
|
210
|
+
|
|
211
|
+
; System libraries
|
|
212
|
+
(allow file-read* (subpath "/usr/lib"))
|
|
213
|
+
(allow file-read* (subpath "/System/Library"))
|
|
214
|
+
|
|
215
|
+
; Sysctl for system info
|
|
216
|
+
(allow sysctl-read)
|
|
217
|
+
|
|
218
|
+
; Mach IPC for Node.js
|
|
219
|
+
(allow mach-lookup)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Run:
|
|
223
|
+
```bash
|
|
224
|
+
sandbox-exec -f yakmesh.sb node /opt/yakmesh/server/index.js
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Option 2: launchd with sandboxing
|
|
228
|
+
|
|
229
|
+
Create `/Library/LaunchDaemons/com.yakmesh.node.plist`:
|
|
230
|
+
|
|
231
|
+
```xml
|
|
232
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
233
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
234
|
+
<plist version="1.0">
|
|
235
|
+
<dict>
|
|
236
|
+
<key>Label</key>
|
|
237
|
+
<string>com.yakmesh.node</string>
|
|
238
|
+
<key>ProgramArguments</key>
|
|
239
|
+
<array>
|
|
240
|
+
<string>/usr/local/bin/node</string>
|
|
241
|
+
<string>/opt/yakmesh/server/index.js</string>
|
|
242
|
+
</array>
|
|
243
|
+
<key>WorkingDirectory</key>
|
|
244
|
+
<string>/opt/yakmesh</string>
|
|
245
|
+
<key>RunAtLoad</key>
|
|
246
|
+
<true/>
|
|
247
|
+
<key>KeepAlive</key>
|
|
248
|
+
<true/>
|
|
249
|
+
<key>UserName</key>
|
|
250
|
+
<string>yakmesh</string>
|
|
251
|
+
<key>GroupName</key>
|
|
252
|
+
<string>yakmesh</string>
|
|
253
|
+
<key>SandboxProfile</key>
|
|
254
|
+
<string>/opt/yakmesh/yakmesh.sb</string>
|
|
255
|
+
</dict>
|
|
256
|
+
</plist>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Load:
|
|
260
|
+
```bash
|
|
261
|
+
sudo launchctl load /Library/LaunchDaemons/com.yakmesh.node.plist
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Best Practices
|
|
265
|
+
|
|
266
|
+
### 1. Create Dedicated User
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Linux
|
|
270
|
+
sudo useradd -r -s /bin/false -d /opt/yakmesh yakmesh
|
|
271
|
+
sudo chown -R yakmesh:yakmesh /opt/yakmesh
|
|
272
|
+
|
|
273
|
+
# macOS
|
|
274
|
+
sudo dscl . -create /Users/yakmesh
|
|
275
|
+
sudo dscl . -create /Users/yakmesh UserShell /usr/bin/false
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### 2. Filesystem Permissions
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Code: read-only
|
|
282
|
+
chmod -R 555 /opt/yakmesh
|
|
283
|
+
chmod 755 /opt/yakmesh
|
|
284
|
+
|
|
285
|
+
# Data: read-write for service user only
|
|
286
|
+
chmod 700 /opt/yakmesh/data
|
|
287
|
+
chown yakmesh:yakmesh /opt/yakmesh/data
|
|
288
|
+
|
|
289
|
+
# Identity files: restrictive
|
|
290
|
+
chmod 400 /opt/yakmesh/data/machine-seed.json
|
|
291
|
+
chmod 600 /opt/yakmesh/data/node-key.json
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 3. Network Restrictions
|
|
295
|
+
|
|
296
|
+
Use iptables/nftables (Linux) or pf (macOS) to restrict network:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# Linux iptables - allow only HTTP, WebSocket, and bootstrap
|
|
300
|
+
iptables -A OUTPUT -p tcp --dport 3080 -j ACCEPT # HTTP
|
|
301
|
+
iptables -A OUTPUT -p tcp --dport 9080 -j ACCEPT # WebSocket
|
|
302
|
+
iptables -A OUTPUT -p tcp --dport 9081 -j ACCEPT # LAN node
|
|
303
|
+
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT # NTP
|
|
304
|
+
iptables -A OUTPUT -p tcp -j DROP # Block other TCP
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### 4. Resource Limits
|
|
308
|
+
|
|
309
|
+
Use cgroups v2 (Linux) for fine-grained resource control:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Create cgroup
|
|
313
|
+
sudo mkdir /sys/fs/cgroup/yakmesh
|
|
314
|
+
echo "+cpu +memory +io" | sudo tee /sys/fs/cgroup/cgroup.subtree_control
|
|
315
|
+
|
|
316
|
+
# Set limits
|
|
317
|
+
echo 200000 | sudo tee /sys/fs/cgroup/yakmesh/cpu.max # 200% CPU
|
|
318
|
+
echo 2G | sudo tee /sys/fs/cgroup/yakmesh/memory.max # 2GB RAM
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Integration with SANGHA
|
|
322
|
+
|
|
323
|
+
The sandboxing layer works WITH Yakmesh's built-in security:
|
|
324
|
+
|
|
325
|
+
| Layer | Responsibility |
|
|
326
|
+
|-------|----------------|
|
|
327
|
+
| **OS Sandbox** | Process isolation, syscall filtering, capability dropping |
|
|
328
|
+
| **SANGHA** | Collective attestation, anomaly detection |
|
|
329
|
+
| **FS Hardening** | File integrity, lock critical files |
|
|
330
|
+
| **Memory Safety** | Canary-based corruption detection |
|
|
331
|
+
| **Secure Config** | Oracle-attested configuration |
|
|
332
|
+
|
|
333
|
+
The OS sandbox is the outermost ring. If an attacker bypasses SANGHA and exploits a Node.js vulnerability, the OS sandbox prevents:
|
|
334
|
+
- Privilege escalation
|
|
335
|
+
- Access to system files
|
|
336
|
+
- Network pivoting
|
|
337
|
+
- Spawning new processes
|
|
338
|
+
|
|
339
|
+
## Monitoring
|
|
340
|
+
|
|
341
|
+
### Check sandbox status (Linux)
|
|
342
|
+
```bash
|
|
343
|
+
# systemd
|
|
344
|
+
systemctl status yakmesh
|
|
345
|
+
journalctl -u yakmesh -f
|
|
346
|
+
|
|
347
|
+
# Check security context
|
|
348
|
+
cat /proc/$(pgrep -f yakmesh)/status | grep -E 'Seccomp|Cap'
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Check sandbox status (macOS)
|
|
352
|
+
```bash
|
|
353
|
+
# launchd
|
|
354
|
+
sudo launchctl list | grep yakmesh
|
|
355
|
+
|
|
356
|
+
# Check sandbox violations
|
|
357
|
+
log show --predicate 'process == "sandboxd"' --last 1h
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Troubleshooting
|
|
361
|
+
|
|
362
|
+
### "Permission denied" errors
|
|
363
|
+
- Check file permissions: `ls -la /opt/yakmesh/data`
|
|
364
|
+
- Verify user context: `whoami` within sandbox
|
|
365
|
+
- Check seccomp logs: `dmesg | grep seccomp`
|
|
366
|
+
|
|
367
|
+
### Network connectivity issues
|
|
368
|
+
- Verify sandbox allows network: check profile allows `AF_INET`
|
|
369
|
+
- Check firewall rules: `iptables -L` or `pfctl -sr`
|
|
370
|
+
|
|
371
|
+
### Node.js features not working
|
|
372
|
+
- Some features require syscalls blocked by sandbox
|
|
373
|
+
- Adjust seccomp profile or sandbox rules as needed
|
|
374
|
+
- Test incrementally: start permissive, then restrict
|
|
375
|
+
|
|
376
|
+
## Recommended Configuration
|
|
377
|
+
|
|
378
|
+
For production deployment, combine:
|
|
379
|
+
|
|
380
|
+
1. **systemd sandboxing** (Linux) or **launchd + sandbox-exec** (macOS)
|
|
381
|
+
2. **Dedicated non-root user**
|
|
382
|
+
3. **Read-only filesystem** except `/data`
|
|
383
|
+
4. **Network firewall** limiting outbound
|
|
384
|
+
5. **Resource limits** via cgroups/launchd
|
|
385
|
+
|
|
386
|
+
This provides defense-in-depth when combined with Yakmesh's SANGHA collective security.
|