Refactor setup to Python - #89
Merged
Merged
Conversation
Move CTF setup and verify logic into Python packages while keeping ctf_setup.sh as a thin bootstrap. Update Terraform contributor and release setup paths, add release packaging, and refresh CTF testing guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the CTF setup and verification logic from a single Bash script (ctf_setup.sh) into a Python package layout (setup/ and verify/), keeping ctf_setup.sh as a thin cloud-init bootstrap. It also introduces a two-mode Terraform deployment (release vs. contributor) for all three cloud providers, adds a release-packaging GitHub workflow, and refreshes contributor and testing documentation. Challenge 9 is reworked from mutating /etc/resolv.conf to writing a systemd-resolved drop-in.
Changes:
- Replace monolithic Bash setup and
verifyshell function with Python packages (setup/,verify/) bootstrapped viauv/Python 3.13, while preserving flag format, instance ID, HMAC-SHA256 token, and state file layout. - Split Terraform startup into release mode (download SHA256-verified release tarball) and contributor mode (local bootstrap + SSH upload of local
ctf_setup.sh,setup,verify); addsetup_release_tagand reworknull_resourceto depend onuse_local_setup. - Add
.github/workflows/release-setup.ymlto build a deterministiclinux-ctfs-setup.tar.gzplus checksum on release; update tests, docs, and challenge 9 to use the systemd-resolved drop-in.
Show a summary per file
| File | Description |
|---|---|
ctf_setup.sh |
Slimmed to a cloud-init bootstrap that logs to /var/log/ctf_setup.log, installs uv/Python 3.13, runs setup, installs verify, and writes done/failed markers. |
setup/pyproject.toml, setup/main.py, setup/helpers.py, setup/system.py, setup/state.py, setup/flags.py |
New Python setup package: system configuration, flag generation, state file writing, helper utilities. |
setup/challenges/*.py |
One module per challenge (ch01–ch18) replacing the inline Bash setup; ch09 now writes /etc/systemd/resolved.conf.d/ctf-dns.conf. |
verify/pyproject.toml, verify/src/verify/{__init__,__main__,commands,state}.py |
New verify CLI built on rich/pyfiglet, preserving commands (progress, list, hint, time, export, numeric flag check) and token format. |
aws/main.tf, azure/main.tf, gcp/main.tf |
Add release/contributor mode locals, setup_release_tag variable, conditional null_resource.local_setup, and update outputs. |
aws/README.md, azure/README.md, gcp/README.md, README.md, CONTRIBUTING.md |
Document release vs. contributor mode, new setup-readiness markers, and updated local checks. |
.github/workflows/release-setup.yml |
New workflow to build deterministic linux-ctfs-setup.tar.gz + SHA256 and upload to releases. |
.github/skills/ctf-testing/deploy_and_test.sh, .github/skills/ctf-testing/test_ctf_challenges.sh, .github/skills/ctf-testing/SKILL.md |
Add _wait_for_setup marker polling, switch ch09 test to drop-in, fix pass → _pass, restructure SKILL guidance. |
.gitignore |
Ignore __pycache__/, *.py[cod], .venv/. |
Copilot's findings
- Files reviewed: 43/44 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move CTF setup and verify logic into Python packages while keeping ctf_setup.sh as a thin bootstrap.
Update Terraform contributor and release setup paths, add release packaging, and refresh CTF testing guidance.