Production hardening: host-aware install, ownership contracts, firewall safety

This commit is contained in:
2026-04-30 03:26:14 +05:00
parent 0545990968
commit c10ab1fafd
25 changed files with 190 additions and 262 deletions
+27 -1
View File
@@ -29,10 +29,20 @@
Рекомендуемый hardening:
- `NoNewPrivileges=true`
- `PrivateTmp=true`
- `UMask=0077`
- `ProtectHome=true`
- `ProtectSystem=strict`
- `ReadOnlyPaths=/etc/hysteria/config.yaml`
- `ReadWritePaths=/var/lib/hy2xs-admin /var/log/hy2xs`
- `RestrictAddressFamilies=AF_INET AF_UNIX`
- `SystemCallArchitectures=native`
- `LockPersonality=true`
Для `hysteria-server.service` также обязателен sandbox-контур:
- `ProtectSystem=strict`
- `ReadOnlyPaths=/etc/hysteria/config.yaml`
- `ReadWritePaths=/var/lib/hysteria`
- `CapabilityBoundingSet=CAP_NET_BIND_SERVICE`
Важно:
- HY2XS admin не должен запускаться как часть unit Hysteria
@@ -48,7 +58,23 @@
IPv4-only policy:
- использовать `table ip`, а не `table inet`;
- IPv6 правила не добавлять;
- UI-порт разрешать только с локального bind-host.
- UI работает только на `127.0.0.1` в production baseline.
## Firewall modes
`HY2XS_FIREWALL_ENABLED=true`:
- orchestrator управляет baseline nftables.
`HY2XS_FIREWALL_ALLOW_TAKEOVER=false`:
- safe default.
- существующий не-HY2XS `/etc/nftables.conf` блокирует install/reconfigure (fail-fast).
`HY2XS_FIREWALL_ALLOW_TAKEOVER=true`:
- явный destructive takeover.
- использовать только после ручной проверки хоста.
`HY2XS_FIREWALL_ENABLED=false` или `--skip-firewall`:
- оператор полностью управляет firewall вручную.
После staged-проверки можно включать default policy `drop`.