29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
"""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 target service.
|
|
assert " privileged: false\n" in compose
|
|
assert " cap_drop: [ALL]\n" in compose
|
|
assert " cap_add: [NET_ADMIN, NET_RAW, SETUID, SETGID]\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 "SS_PASSWORD: ${SS_PASSWORD:?Set SS_PASSWORD in the deployment environment}" in compose
|
|
assert "secrets:" not in compose
|
|
assert "ss_password=${SS_PASSWORD-}" in entrypoint
|
|
assert "unset SS_PASSWORD" in entrypoint
|
|
assert "export ss_password" not in entrypoint
|
|
assert "export SS_PASSWORD" not in entrypoint
|
|
assert "Docker administrators/root can still read container" in readme
|
|
assert "removed\nfrom the entrypoint environment" in readme
|
|
assert "No host networking" in readme
|