Skip to content

Marmeus/pentesting-infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Infra pentesting

It has a very simple infrastructure with the tools you might need when working on a pentesting team.

It contains:

  • WireGuard (VPN) - vpn.home.arpa
  • PiHole (DNS) - dns.home.arpa
  • PwnDoc - pwndoc.home.arpa
  • Gitea - git.home.arpa
  • Wiki.js - wiki.home.arpa
  • Netdata - netdata.home.arpa
  • Nginx
  • KMS
  • Rsyslog

Setup

Server

To deploy the infraestructure, just execute the installation script, passing the PiHole password as argument and the IP or domain where the VPN server will be located.

bash ./install.sh

Once everything is set and running, change the IP of /run/systemd/resolve/resolv.conf by 127.0.0.1.

Finally, you only need to add your telegram API key and CHATID to the netdata container so you can be notified if something odd happens on your machine. To do so, follow this link.

Clients

The client-setup.sh configures the Kali Linux machine to do the following:

  • Create new user, with the auditors name
  • Change hostname, to distinguish the kali machine from the different auditors
  • Change time zone to UTC to keep track of logs
  • Modify kali's rsyslog, to store the commands executed by the auditor and send them to the cloud.

Execute:

sudo bash client-setup.sh <username> <rsyslog_server_ip>"

Create Backups

PwnDoc

sudo tar -czf ~/Infra/BackUps/PwnDoc/pwndoc_mongo-data.tar.gz -C ~/Infra/PwnDoc/backend/mongo-data/ .
sudo tar -czf ~/Infra/BackUps/PwnDoc/pwndoc_templates.tar.gz -C ~/Infra/PwnDoc/backend/report-templates/ .

Gitea

docker exec -u git -d -w /backup gitea bash -c '/usr/local/bin/gitea dump --tempdir /backup/'

PiHole

docker exec -d -w /backup pihole bash -c "pihole-FTL --teleporter"

Restore backups

PwnDoc

  1. Stop the backend container
docker stop pwndoc-backend
  1. Restore the data Reference: https://pwndoc.github.io/pwndoc/#/installation?id=backup
sudo rm -rf ./PwnDoc/backend/mongo-data/*
sudo tar -xzf ~/Downloads/mongo-data.tar.gz -C ./PwnDoc/backend/mongo-data
sudo tar -xzf ~/Downloads/pwndoc_templates.tar.gz -C ./PwnDoc/backend/report-templates/
  1. Restart the frontend container.
docker restart pwndoc-frontend

Gitea

  1. Stop the containers
  2. Copy the backup file, unzip it and move everything to its place. Reference: https://docs.gitea.com/administration/backup-and-restore#using-docker-rootless-restore
sudo cp ~/Downloads/gitea-dump.zip ./Gitea/backup/
sudo chown 1000:1000 ./Gitea/backup/gitea-dump.zip
docker exec -u git -it -w /backup gitea bash 
unzip gitea-dump.zip
mv app.ini /etc/gitea/app.ini; 
rm -rf  /var/lib/gitea/* && mv data/* /var/lib/gitea; 
cp -r ./repos/. /var/lib/gitea/git/repositories/
chown -R git:git /etc/gitea/app.ini /var/lib/gitea
  1. Restore the database
sudo cp ./Gitea/backup/gitea-db.sql ./Gitea/postgres/
docker exec -it gitea-postgres bash 
psql -U gitea -d gitea < /var/lib/postgresql/data/gitea-db.sql
  1. Restart the containers.
docker restart gitea gitea-postgres

PiHole

  1. Access to https://dns.home.arpa/admin/settings.php?tab=teleporter
  2. Upload the backup file and press on restore.
  3. Access the container and update the list of ad-serving domains
docker exec -d pihole bash -c 'pihole -g'

About

A small infraestructure for a beginner pentesting team

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors