test(deploy): guard managed target isolation defaults
Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
c5cabf076f
commit
54a0fb79f8
2 files changed
+111
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"""Static deployment guard; run with python3 deploy/managed-target/check_static.py."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
directory = Path(__file__).resolve().parent
|
||||
compose = (directory / "compose.yaml").read_text()
|
||||
entrypoint = (directory.parents[1] / "managed-target-entrypoint.sh").read_text()
|
||||
readme = (directory / "README.md").read_text()
|
||||
|
||||
# ponytail: checks the committed Compose shape, not arbitrary YAML; use a YAML
|
||||
# parser if this definition grows beyond its single service and single secret.
|
||||
assert " privileged: false\n" in compose
|
||||
assert " cap_drop: [ALL]\n" in compose
|
||||
assert " cap_add: [NET_ADMIN, NET_RAW, SETUID, SETGID, DAC_OVERRIDE]\n" in compose
|
||||
assert compose.count(" - type: bind\n") == 1
|
||||
assert " source: ./target-state\n" in compose
|
||||
assert " target: /var/lib/zapret-autotune/target\n" in compose
|
||||
assert " create_host_path: false\n" in compose
|
||||
assert " secrets: [ss_password]\n" in compose
|
||||
assert compose.endswith("secrets:\n ss_password:\n file: ./ss_password\n")
|
||||
assert "SS_PASSWORD" not in compose
|
||||
assert "ss_password=$(cat /run/secrets/ss_password) || exit 1" in entrypoint
|
||||
assert "export ss_password" not in entrypoint
|
||||
assert "export SS_PASSWORD" not in entrypoint
|
||||
assert "container-wide, not restricted" in readme
|
||||
assert "mode `0600`" in readme
|
||||
assert "not a symlink" in readme
|
||||
Reference in new issue
Block a user