Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ jobs:
- name: Security alerting is honest in both directions
run: python3 tests/test_security_alerts.py

# The sync edits the live whitelist from a list fullhearts.app sends.
# This holds it to never touching a player it did not add, and fails
# if compose ever turns on OVERRIDE_WHITELIST.
- name: FullHearts whitelist sync never touches hand-added players
run: python3 tests/test_fullhearts_sync.py

# The design role is what lets a non-op edit the world. Its argument
# checks are the whole security boundary, so they are tested against
# inputs built to escape them: command blocks, NBT, selectors, chained
Expand All @@ -212,7 +218,7 @@ jobs:
run: |
for f in gitops/deploy.sh gitops/install_gitops.sh bootstrap_droplet.sh harden_sshd.sh \
add_admin_user.sh server-audit.sh tests/test_droplet_hardening.sh \
alerts/security_alert.sh alerts/install_alerts.sh; do
alerts/security_alert.sh alerts/install_alerts.sh gitops/install_fullhearts_sync.sh; do
[ -f "$f" ] && bash -n "$f" && echo "OK $f"
done

Expand Down
27 changes: 27 additions & 0 deletions gitops/fullhearts-sync.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[Unit]
Description=Sync website-managed whitelist entries from fullhearts.app
After=docker.service network-online.target
Wants=network-online.target

[Service]
Type=oneshot
# Token, mode and URL. Root-only, mode 600, never in git (see install_fullhearts_sync.sh).
EnvironmentFile=/etc/educraft-sync.env
# Optional: problems go to the same Discord webhook as the security alerts.
EnvironmentFile=-/etc/minecraft-alerts.env
ExecStart=/usr/bin/python3 /root/minecraft/gitops/fullhearts_sync.py
TimeoutStartSec=120

# Needs root only for `docker exec`. It reads the server's data files and
# writes nothing but its own ledger and lock.
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/var/lib/educraft-sync /run
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
RestrictSUIDSGID=true
StateDirectory=educraft-sync
StateDirectoryMode=0700
11 changes: 11 additions & 0 deletions gitops/fullhearts-sync.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Check fullhearts.app for whitelist changes

[Timer]
OnBootSec=4min
OnUnitActiveSec=2min
RandomizedDelaySec=15
Unit=fullhearts-sync.service

[Install]
WantedBy=timers.target
Loading
Loading