This repository contains the backend services for the NethSecurity Controller, a centralized management system for NethSecurity firewall instances. It includes the Go API, VPN server, and proxy configuration.
IMPORTANT: The web UI (frontend) code is located in a separate repository: NethServer/nethsecurity-ui
The development environment is managed by Podman and the dev.sh script. This script will set up a pod containing all necessary services, including the API, VPN, UI, proxy, and a database.
-
Create Network Device: Before starting, you must create a
tunsecnetwork device with root privileges. This only needs to be done once.sudo ip tuntap add dev tunsec mod tun sudo ip addr add 172.21.0.1/16 dev tunsec sudo ip link set dev tunsec up -
Start Environment: Run the
startcommand to create and start the Podman pod. This also generates anapi.envfile with the necessary environment variables for the API service../dev.sh start
-
Stop Environment: Run the
stopcommand to stop and remove the Podman pod when you are finished../dev.sh stop
- The
build.shscript usesbuildahto build the container images for all services. - Run the script to create all images locally:
./build.sh
- Do not validate tests if database is not running: the datbase is required
- The backend tests are written in Go.
- Before running the tests, ensure that the TimescaleDB database is running. You can use Podman to start a TimescaleDB container:
podman run --rm -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=report timescale/timescaledb:latest-pg16 # Wait for DB to be ready for i in {1..30}; do podman exec timescaledb pg_isready -U report && break sleep 1 done
- To run the entire API test suite, navigate to the
apidirectory and usego test:cd api && go test ./...
- Please add or update tests for any code you change.
- Stop the TimescaleDB container after testing:
podman stop timescaledb
- Make sure to always update all README files in the respective service directories when making changes.
- This project follows the Conventional Commits specification.
- Please format your commit messages accordingly. The scope of the commit should be one of the services (
api,vpn,ui,proxy). - Good commit message examples:
feat(api): add endpoint for user preferencesfix(vpn): resolve authentication handshake failuredocs(api): update documentation for /status endpoint