Skip to content

Refactor setup to Python - #89

Merged
madebygps merged 1 commit into
mainfrom
refactor/setup-to-python
May 27, 2026
Merged

Refactor setup to Python#89
madebygps merged 1 commit into
mainfrom
refactor/setup-to-python

Conversation

@madebygps

Copy link
Copy Markdown
Collaborator

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.

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>
Comment thread setup/helpers.py Dismissed
Comment thread setup/helpers.py Dismissed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 verify shell function with Python packages (setup/, verify/) bootstrapped via uv/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); add setup_release_tag and rework null_resource to depend on use_local_setup.
  • Add .github/workflows/release-setup.yml to build a deterministic linux-ctfs-setup.tar.gz plus 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

@madebygps
madebygps merged commit 4b2801a into main May 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants