Skip to content

Commit

Permalink
fix bunch of issues causing CI to fail (#57)
Browse files Browse the repository at this point in the history
* install packer ansible provisioner as plugin

* fix programs dependency

* refactor elk config into static.yml

* migrate docker-compose to docker compose

* update actions versions

* run weekly build jobs
  • Loading branch information
ldruschk authored Apr 3, 2024
1 parent c251e69 commit b344bfc
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 47 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/packer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ on:
branches:
- main
workflow_dispatch:
schedule:
- cron: "0 1 * * 4"

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build and save Docker image
run: |
docker build -t ghcr.io/enowars/bambictf:latest .
docker save --output /tmp/bambictf.tar ghcr.io/enowars/bambictf:latest
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: bambictf
path: /tmp/bambictf.tar
Expand All @@ -38,21 +40,21 @@ jobs:
needs: docker-build
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: bambictf
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/bambictf.tar
- name: start docker-compose setup
- name: start docker compose setup
env:
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
run: docker-compose up -d
run: docker compose up -d
- name: prepare ansible config
run: docker-compose exec -T bambictf sh -c 'cp ansible/config_bambi.yml.sample ansible/config_bambi.yml'
run: docker compose exec -T bambictf sh -c 'cp ansible/config_bambi.yml.sample ansible/config_bambi.yml'
- name: generate config files
run: docker-compose exec -T bambictf sh -c 'cd config; TEAM_COUNT=4 GATEWAY_COUNT=2 CHECKER_COUNT=2 ./gen_config.sh'
run: docker compose exec -T bambictf sh -c 'cd config; TEAM_COUNT=4 GATEWAY_COUNT=2 CHECKER_COUNT=2 ./gen_config.sh'
- name: build packer image
run: docker-compose exec -T bambictf sh -c 'cd packer; packer build ${{ matrix.image }}.json'
run: docker compose exec -T bambictf sh -c 'cd packer; packer build ${{ matrix.image }}.json'
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ RUN curl https://releases.hashicorp.com/terraform/1.0.11/terraform_1.0.11_linux_
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \
apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" && \
apt-get update && apt-get install packer && \
packer plugins install github.com/hashicorp/hcloud
packer plugins install github.com/hashicorp/hcloud && \
packer plugins install github.com/hashicorp/ansible

# OpenVPN
RUN apt-get install -y openvpn easy-rsa zip unzip
Expand Down
13 changes: 4 additions & 9 deletions ansible/bambichecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@
become_method: sudo
vars_files:
- config_bambi.yml
- static.yml

roles:
- bambi-ssh-keys
- firewall
- wireguard
- role: filebeat
vars:
elk: 192.168.3.0
- role: journalbeat
vars:
elk: 192.168.3.0
- role: metricbeat
vars:
elk: 192.168.3.0
- filebeat
- journalbeat
- metricbeat
- vuln_checkers
- docker-block-external
- role: programs
Expand Down
15 changes: 5 additions & 10 deletions ansible/bambielk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@
become_method: sudo
vars_files:
- config_bambi.yml
- static.yml

roles:
- bambi-ssh-keys
- firewall
- wireguard
- enoelk
- docker-block-external
- role: filebeat
vars:
elk: 192.168.3.0
- role: journalbeat
vars:
elk: 192.168.3.0
- role: metricbeat
vars:
elk: 192.168.3.0
- filebeat
- journalbeat
- metricbeat
- role: programs
vars:
program_list:
- "tmux"
- "git"
- "git"
13 changes: 4 additions & 9 deletions ansible/bambiengine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@
become_method: sudo
vars_files:
- config_bambi.yml
- static.yml

roles:
- bambi-ssh-keys
- firewall
- wireguard
- enoengine
- role: filebeat
vars:
elk: 192.168.3.0
- role: journalbeat
vars:
elk: 192.168.3.0
- role: metricbeat
vars:
elk: 192.168.3.0
- filebeat
- journalbeat
- metricbeat
- docker-block-external
- role: programs
vars:
Expand Down
13 changes: 4 additions & 9 deletions ansible/bambirouter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
become_method: sudo
vars_files:
- config_bambi.yml
- static.yml

roles:
- role: filebeat
vars:
elk: 192.168.3.0
- role: journalbeat
vars:
elk: 192.168.3.0
- role: metricbeat
vars:
elk: 192.168.3.0
- filebeat
- journalbeat
- metricbeat
- bambi-ssh-keys
- firewall
- bambi-wireguard-router
Expand Down
1 change: 1 addition & 0 deletions ansible/bambivulnbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
become_method: sudo
vars_files:
- config_bambi.yml
- static.yml

roles:
- docker
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/vuln_checkers/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
dependencies:
- role: "docker"
- role: "programs"
vars:
program_list:
- git
- role: "bambi-ssh-keys"
3 changes: 3 additions & 0 deletions ansible/roles/vuln_services/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
dependencies:
- role: "docker"
- role: "programs"
vars:
program_list:
- git
- role: "bambi-ssh-keys"
1 change: 1 addition & 0 deletions ansible/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
elk: 192.168.3.0

0 comments on commit b344bfc

Please sign in to comment.