Skip to content

Commit b241c82

Browse files
committed
WIP
Signed-off-by: Shay Nehmad <[email protected]>
1 parent b779c68 commit b241c82

File tree

4 files changed

+32
-27
lines changed

4 files changed

+32
-27
lines changed

Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
FROM ubuntu:latest
1+
FROM ubuntu:focal
22

33
# Users will log into this machine, so we need to unminimize it.
44
# See https://wiki.ubuntu.com/Minimal
55
RUN yes | unminimize
66

77
# Install dependencies.
88
RUN apt update -y
9+
RUN apt clean -y
910
RUN DEBIAN_FRONTEND="noninteractive" apt install -y tzdata
10-
RUN apt install -y \
11+
RUN apt clean -y
12+
RUN apt update -y && apt install -y \
1113
git-all \
1214
vim \
1315
nano \
@@ -69,7 +71,6 @@ RUN chmod 770 /home/tester/.zshrc
6971
# Copy the test files to the tester account
7072
COPY levels/tests /home/tester/tests
7173
RUN chown --recursive tester:tester /home/tester
72-
RUN chmod 770 --recursive tester:tester /home/tester/tests
7374

7475
# Set up SSH
7576
RUN mkdir /var/run/sshd

README.md

+27-22
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,27 @@
22

33
Git CTF 🚩 but good this time.
44

5-
- [make-git-better-2](#make-git-better-2)
6-
- [Dependencies](#dependencies)
7-
- [Build](#build)
8-
- [Ansible](#ansible)
9-
- [How to build the challenge Docker manually](#how-to-build-the-challenge-docker-manually)
10-
- [Create the hook script](#create-the-hook-script)
11-
- [powershell](#powershell)
12-
- [sh](#sh)
13-
- [Build and run docker image](#build-and-run-docker-image)
14-
- [Build docker](#build-docker)
15-
- [Run docker](#run-docker)
16-
- [Copy ssh key (for outside cloning)](#copy-ssh-key-for-outside-cloning)
17-
- [Useful oneliner](#useful-oneliner)
18-
- [Connect to the running instance](#connect-to-the-running-instance)
19-
- [How to build the web content](#how-to-build-the-web-content)
20-
- [Build the level browser](#build-the-level-browser)
21-
- [Set up docker-tcp-switchboard](#set-up-docker-tcp-switchboard)
22-
- [Test](#test)
23-
- [Unit tests](#unit-tests)
24-
- [Test levels](#test-levels)
25-
- [Develop](#develop)
26-
- [Add a new stage](#add-a-new-stage)
5+
* [Dependencies](#dependencies)
6+
* [Build](#build)
7+
* [Ansible](#ansible)
8+
* [How to build the challenge Docker manually](#how-to-build-the-challenge-docker-manually)
9+
* [Create the hook script](#create-the-hook-script)
10+
* [powershell](#powershell)
11+
* [sh](#sh)
12+
* [Build and run docker image](#build-and-run-docker-image)
13+
* [Build docker](#build-docker)
14+
* [Run docker](#run-docker)
15+
* [Copy ssh key (for outside cloning)](#copy-ssh-key-for-outside-cloning)
16+
* [Useful oneliner](#useful-oneliner)
17+
* [Connect to the running instance](#connect-to-the-running-instance)
18+
* [How to build the web content](#how-to-build-the-web-content)
19+
* [Build the level browser](#build-the-level-browser)
20+
* [Set up docker-tcp-switchboard](#set-up-docker-tcp-switchboard)
21+
* [Test](#test)
22+
* [Unit tests](#unit-tests)
23+
* [Test levels](#test-levels)
24+
* [Develop](#develop)
25+
* [Add a new stage](#add-a-new-stage)
2726

2827
## Dependencies
2928

@@ -45,6 +44,12 @@ ansible-playbook -v -i hosts build.yaml
4544
```
4645

4746
Make sure that you have Ansible configured correctly with your SSH keys.
47+
[Here's the docs](https://docs.ansible.com/ansible/latest/inventory_guide/connection_details.html).
48+
49+
> Note: Remember to expose 22 to your IP. If you're like me with AWS EC2, you
50+
> need to add a rule to the security group. Like this:
51+
>
52+
> `aws ec2 authorize-security-group-ingress --group-id PUT_HERE --protocol tcp --port 22 --cidr "$(curl -s https://wtfismyip.com/json | jq -r '.YourFuckingIPAddress')/32"`
4853
4954
### How to build the challenge Docker manually
5055

build/ansible/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
chdir: /home/{{ ansible_facts['user_id'] }}/make-git-better-2/scripts
1414

1515
- name: Build Docker image
16-
shell: docker build --tag mgb:0.1 --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
16+
shell: docker build --tag mgb:0.1 --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S%z) --build-arg OWASP_FLAG_1="AppSec-IL{g1t_d035_P3rM1t_T0_c0mm1T}" --build-arg OWASP_FLAG_2="AppSec-IL{1f_y0u_w4n7_17_c0m3_4nd_917_17}" .
1717
args:
1818
chdir: /home/{{ ansible_facts['user_id'] }}/make-git-better-2
1919

build/ansible/hosts

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
[ctfservers]
22
3-

0 commit comments

Comments
 (0)