-
Notifications
You must be signed in to change notification settings - Fork 1
Changes to make DamCTF work #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
detjensrobert
wants to merge
28
commits into
main
Choose a base branch
from
dr/damctf-crunch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
374380a
move render_strict helper to lib module
detjensrobert b1d1c84
Make sure helm binary is available for cluster-setup
detjensrobert c9ba519
Handle displaying all errors in cli main instead of in command run funcs
detjensrobert 372b456
Switch to better-documented official external-dns chart
detjensrobert cf19204
move extdns user values to end of template
detjensrobert 506f22e
use challenge domain as cert issuer email
detjensrobert 6131fa2
fix cert issuer quoting
detjensrobert 5b1cad2
add ingress aws lb config, request cert for challenge ingresses
detjensrobert 6d19acc
Use strict render helper for challenge manifest templates
detjensrobert 1a1ce7a
fix tls config for chal ingress
detjensrobert 7d4d088
also add AWS LB config opts to tcp services
detjensrobert af3aae0
create external-dns cnames instead of alias
detjensrobert 5c2b144
Add documentation for challenge description template fields
detjensrobert 6af3086
Full docs on how to write challenge.yaml for chal authors
detjensrobert 76bb60c
use our ingress class for cert challenges
detjensrobert bd3e348
clarify provide is files only
detjensrobert d0513ad
Add registry pull credentials to challenge namespaces
detjensrobert 8977698
use challenge name instead of category-name slug for tcp domains
detjensrobert 9880f03
Fix flag reference in test chal bar
detjensrobert 034c11d
render out challenge information to markdown temporarily
detjensrobert 7cc91f6
add architecture selector for arm challenges
detjensrobert 76d6139
build container images for the pods arch
detjensrobert 0933877
fix returned archive path for in-repo asset zips
detjensrobert 33ab4c4
trim flag whitespace in chal info
detjensrobert 626fec0
Always pull latest challenge images
detjensrobert 314443c
fix domains for chals with spaces
detjensrobert d91818f
fix hostname template
detjensrobert 2a94604
Fetch docker.io credentials when building challenge images
detjensrobert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
# How to write beaverCDS challenge.yaml config | ||
|
||
tldr: see [the TCP example](#full-tcp-example) or [the web example](#full-http-example). | ||
|
||
### Metadata | ||
|
||
Self explanatory. | ||
|
||
```yaml | ||
name: yet another pyjail | ||
author: somebody, John Author | ||
``` | ||
|
||
### Description | ||
|
||
Challenge description supports markdown and Jinja-style templating for challenge info. | ||
The Jinja template fields available are: | ||
|
||
| Field name | Description | | ||
| ----------- | ----------- | | ||
| `hostname` | The hostname or domain for the challenge | ||
| `port` | The port that the challenge is listening on | ||
| `nc` | Insert the `nc` command to connect to TCP challenges (`nc {{hostname}} {{port}}`) | ||
| `link` | Create a Markdown link to the exposed hostname/port | ||
| `url` | The URL from `link` without the accompanying Markdown | ||
| `challenge` | The full challenge.yaml config for this challenge, with subfields | ||
|
||
You probably only want `{{ nc }}` or `{{ link }}`. | ||
|
||
Example: | ||
|
||
```yaml | ||
description: | | ||
Some example challenge. Blah blah blah flavor text. | ||
|
||
In case you missed it, this was written by {{ challenge.author }} | ||
and is called {{ challenge.name }}. | ||
|
||
{{ link }} # -becomes-> [example.chals.thectf.com](https://example.chals.thectf.com) | ||
{{ nc }} # -becomes-> `nc example.chals.thectf.com 12345` | ||
``` | ||
|
||
|
||
### Flag | ||
|
||
Read flag from file: | ||
|
||
```yaml | ||
flag: | ||
file: ./flag | ||
``` | ||
|
||
### Pods | ||
|
||
Defines how any container images for this challenge are built and deployed. | ||
|
||
The pod `name` is also used for extracting files, see [Providing files to | ||
users](<for-challenge-authors#Providing files to users>). | ||
|
||
`build` works similar to [Docker Compose](https://docs.docker.com/reference/compose-file/build/#illustrative-example), | ||
either: | ||
- a string path to the build context folder | ||
- yaml with explicit `context` path, `dockerfile` path within context folder, and `args` build args \ | ||
(only `context`, `dockerfile`, and `args` are supported for the detailed form) | ||
|
||
`ports` controls how the container is exposed. This should be a list of what port the container is listening, and how | ||
that port should be exposed to players: | ||
- For TCP challenges, set `expose.tcp` to the subdomain and port: `<subdomain>:<port>` | ||
- For HTTP challenges, set `expose.http` to the subdomain only: `<subdomain>` \ | ||
The website domain will automatically be set up with an HTTPS cert. | ||
|
||
|
||
```yaml | ||
pods: | ||
- name: tcp-example | ||
build: . | ||
replicas: 2 | ||
ports: | ||
- internal: 31337 | ||
expose: | ||
tcp: thechal:30124 # exposed at thechal.<challenges_domain>:30124 | ||
|
||
- name: web-example | ||
build: | ||
context: src/ | ||
dockerfile: Containerfile | ||
replicas: 2 | ||
ports: | ||
- internal: 31337 | ||
expose: | ||
http: webchal # exposed at https://webchal.<challenges_domain> | ||
``` | ||
|
||
|
||
|
||
|
||
This can be omitted if there are no containers for the challenge. | ||
|
||
### Providing files to users | ||
|
||
Files to give to players as downloads in frontend. | ||
|
||
These can be from the challenge folder in the repository, or from the | ||
challenge's built container. These can also be zipped together into one file, or | ||
uploaded separately. These need to be files, directories or globs are not (yet) | ||
supported. | ||
|
||
This can be omitted if there are no files provided. | ||
|
||
```yaml | ||
provide: | ||
# file from the challenge folder in the repo | ||
- somefile.txt | ||
|
||
# multiple files from chal_folder/src/, zipped as together.zip | ||
- as: together.zip | ||
include: | ||
- src/file1 | ||
- src/file2 | ||
- src/file3 | ||
|
||
# extract these files from inside of the container image | ||
# for the `main` pod (see previous section) | ||
- from: main | ||
include: | ||
- /chal/notsh | ||
- /lib/x86_64-linux-gnu/libc.so.6 | ||
|
||
# same as above, but now zipped together | ||
- from: main | ||
as: notsh.zip | ||
include: | ||
- /chal/notsh | ||
- /lib/x86_64-linux-gnu/libc.so.6 | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
# Examples | ||
|
||
## Full TCP example | ||
|
||
```yaml | ||
name: notsh | ||
author: John Author | ||
description: |- | ||
This challenge isn't a shell | ||
|
||
{{ nc }} | ||
|
||
provide: | ||
- from: main | ||
include: | ||
- /chal/notsh | ||
- /lib/x86_64-linux-gnu/libc.so.6 | ||
|
||
flag: | ||
file: ./flag | ||
|
||
pods: | ||
- name: main | ||
build: . | ||
replicas: 2 | ||
ports: | ||
- internal: 31337 | ||
expose: | ||
tcp: 30124 | ||
``` | ||
|
||
## Full HTTP example | ||
|
||
```yaml | ||
name: bar | ||
author: somebody | ||
description: | | ||
can you order a drink from the webserver? | ||
|
||
{{ url }} | ||
|
||
difficulty: 1 | ||
|
||
flag: | ||
file: ./flag | ||
|
||
# no provide: section needed if no files | ||
|
||
pods: | ||
- name: bar | ||
build: | ||
context: . | ||
dockerfile: Containerfile | ||
replicas: 1 | ||
ports: | ||
- internal: 80 | ||
expose: | ||
http: bar # subdomain only | ||
``` |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
type: kubernetes.io/dockerconfigjson | ||
metadata: | ||
name: "rcds-{{ slug }}-pull" | ||
namespace: "rcds-{{ slug }}" | ||
stringData: | ||
.dockerconfigjson: | | ||
{ | ||
"auths": { | ||
"{{ registry_domain }}": { | ||
"auth": "{{ creds_b64 }}" | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future consideration: do we want a way to use non-letsencrypt ACME?