Skip to content

Commit 650dd56

Browse files
committed
Repo cleanup
1 parent ef254f1 commit 650dd56

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

.dockerignore

-3
This file was deleted.

Dockerfile

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ COPY .puppeteerrc.cjs package.json package-lock.json ./
88
RUN npm ci && npm cache clean --force
99
RUN npx puppeteer browsers install chrome --install-deps
1010

11-
COPY . .
11+
COPY index.js submit.html /app
12+
RUN mkdir /app/handlers
1213

1314
ENV PORT=8080
1415

15-
ARG RECAPTCHA_SITE
16-
ENV RECAPTCHA_SITE=${RECAPTCHA_SITE}
17-
ARG RECAPTCHA_SECRET
18-
ENV RECAPTCHA_SECRET=${RECAPTCHA_SECRET}
19-
2016
USER node
2117
CMD ["node", "index.js"]

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Admin Bot
2-
32
Admin bot used for LA CTF challenges.
43

54
## Configuration
6-
Environment variables can be stored as `KEY=VALUE` pairs in either `chall.env` or `.env`, and handlers should be stored in the `handlers` directory.
5+
The admin bot is designed to be an extensible Docker image that can be deployed to Google Cloud Run. Environment variables can optionally be stored in a file as `KEY=VALUE` pairs in either `/app/chall.env` or `/app/.env`, and challenge handlers will be read from the `/app/handlers` directory.
6+
7+
To use reCAPTCHA, set the `RECAPTCHA_SITE` and `RECAPTCHA_SECRET` environment variables to the correct value.
78

9+
An example of deployment can be seen in the [`example`](example) directory. The Docker container must be run with `--privileged` for Chrome's sandbox, or deployed in a second generation Cloud Run instance.

example/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM ghcr.io/lactf/admin-bot:latest
2+
3+
COPY handlers /app/handlers
4+
COPY chall.env /app/

example/chall.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MYCHALL_ADMINPW=supersecretpassword
2+
MYCHALL_DOMAIN=mychall.chall.lac.tf

handlers/example.js.disabled example/handlers/mychall.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module.exports = {
2-
name: "examplejs",
2+
name: "mychall",
33
timeout: 5000,
44
async execute(browser, url) {
55
const page = await browser.newPage();
66
await page.setCookie({
77
name: "adminpw",
8-
value: process.env.CHALL_ADMINPW || "placeholder",
9-
domain: process.env.CHALL_DOMAIN || "localhost:8080",
8+
value: process.env.MYCHALL_ADMINPW || "placeholder",
9+
domain: process.env.MYCHALL_DOMAIN || "localhost:8080",
1010
httpOnly: true,
1111
});
1212
await page.goto(url);

0 commit comments

Comments
 (0)