Quickstart

This guide will get you all set up and ready to use Netgoat in Reverse Proxy mode or DNS Mode

Choose your mode

Before you can start using Netgoat CE (Community Edition), you will need to select a mode of operations, which is either Reverse Proxy mode or DNS Mode. Each mode has its own setup and configuration steps. Depending on resources and usage type it will vary if you plan to use with cloudflare go for reverse proxy for standalone and more features go with DNS Mode.

Running Netgoat CE/BE

After picking your mode, you can install Netgoat CE (Community Edition) or BE (Business Edition) using the following methods:

  • Docker: If you prefer containerization, you can run Netgoat using Docker. This is the recommended way to run Netgoat.
  • Install Script: You can use the provided install script to set up Netgoat on your system. This is a straightforward method that automates the installation process.
  • Manual Install: You can follow the manual installation guide to set up Netgoat on your system. This method gives you more control over the installation process and allows for customization.

Manual Install

To run Netgoat Via Manual Install, you need to following pre-requisites:

  • Git installed on your system.
  • Bun installed on your system.
  • Nano, Vim, or any other editors installed on your system.
  • Ports 80, 443, 1933, 3000, 3010, 2222 open on your firewall and avaliable on the IP you plan to run the services on.
  • Instances of LogDB and CentralMonServer, MongoDB (you'd only need 1 of these for several netgoat instances)

Installing pre-requisites (Linux)

sudo apt update && sudo apt upgrade -y
sudo apt install git curl unzip nano -y
curl -fsSL https://bun.sh/install | bash

export PATH="$HOME/.bun/bin:$PATH"
source ~/.bashrc

bun i -g pm2 # This is required to keep it alive and not use systemctl but you can use systemctl if you want

Installing pre-requisites (Windows)

powershell -c "irm bun.sh/install.ps1|iex" # You gotta frick around for windows 
bun i -g pm2 # This is required to keep it alive and not use systemctl but you can use systemctl if you want

Pulling the repo

git clone https://github.com/cloudable-dev/NetGoat.git
cd NetGoat

Installing Dependencies

bun install

cd LogDB
bun install
cd ..

cd CentralMonServer
bun install
cd ..

cd reactbased
bun install
cd ..

Setting up environment variables

We'll rename the .env.example files to .env and edit them to match your setup.

cp .env.example .env
cp ./LogDB/.env.example ./LogDB/.env
cp ./CentralMonServer/.env.example ./CentralMonServer/.env
cp ./reactbased/.env.example ./reactbased/.env

# Now its time to edit the frontend's API URLs
# Make sure to replace `NEW_BACKEND_URL` and `NEW_LOGDB_URL` with the actual URLs or IP addresses where your backend API and LogDB services will be hosted.
sed -i 's|https://backendapi\.netgoat\.xyz|NEW_BACKEND_URL|' ./reactbased/next.config.js
sed -i 's|https://logdb\.netgoat\.xyz|NEW_LOGDB_URL|' ./reactbased/next.config.js

We will now be filling the .env files! You will need

  • MongoDB connection string (MongoDB Atlas is recommended)

Now just fill it in! Everything should be self-explanatory.

Compiling

Compile the React Frontend

cd reactbased
bun run build
cd ..

Running the systems

Running Services with PM2 (Bun)

PM2 can run Bun scripts just like Node.js. This setup will keep your services alive automatically.

  1. Install PM2 globally
bun i -g pm2
  1. Start all services
pm2 start ecosystem.config.js
pm2 save
pm2 status

Running Services with systemd (Linux)

  1. Create a service file for each service

Example for LogDB: create /etc/systemd/system/logdb.service:

[Unit]
Description=LogDB Service
After=network.target

[Service]
Type=simple
WorkingDirectory=/path/to/NetGoat/LogDB
ExecStart=/home/YOUR_USER/.bun/bin/bun . # For reactbased replace bun . with bun run start after building
Restart=always
RestartSec=5
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Repeat for CentralMonServer and ReactFrontend (update WorkingDirectory and ExecStart).

  1. Reload systemd and enable services
sudo systemctl daemon-reload
sudo systemctl enable logdb
sudo systemctl enable centralmonserver
sudo systemctl enable reactfrontend

sudo systemctl start logdb
sudo systemctl start centralmonserver
sudo systemctl start reactfrontend
sudo systemctl status logdb

Notes:

  • bun run start assumes you have a start script defined in each service's package.json.
  • For Next.js frontend, use next dev for development or next start for production.
  • PM2 is easier for development; systemd is better for production servers.
  • You can combine them: use PM2 to manage processes, then generate systemd units with pm2 startup.

After that's all done, you can access the Netgoat CE web interface by navigating to http://localhost:3000 in your web browser.

Was this page helpful?