Wireguard-Mesh
Table of Contents
Requirements
- Public IPv4 address and a corresponding public DNS
- Linux Kernel version 5.6 or wireguard kernel modules installed. (see https://www.wireguard.com/install/)
- Docker (see System Requirements)
- docker-compose (see System Requirements)
Request Certificate
Please send your request for a PMD-S certificate via our contact form (login required!) https://www.material-digital.de/contact/?subject=Netzwerk-+und+Sicherheitsarchitektur.
If the direct link above does not work, go to https://material-digital.de/contact/, log in and choose the subject “Network and security architecture”.
Your request MUST include at least the following information:
- The public (sub)domain which points to your PMD-S’ public IPv4 address
- Your country code (DE, FR, UK, US etc.)
- Name of your company/institute (Fraunhofer ABC, KIT, BAM etc.)
- Name of your business unit (IT, Materials Department etc.)
If everything is alright, you will receive a ZIP file containing your identity certificate and key file.
Adjust Firewall
- Make sure your public IP can be reached via port 29292 for both UDP and TCP.
Check IPv6 is Enabled on Your System
- Check with e.g.
sysctl net.ipv6.conf.all.disable_ipv6
, which should show 0. Otherwise enable it (typically withsysctl net.ipv6.conf.all.disable_ipv6=0
and by making changes persistent through editing/etc/sysctl.conf
).
Check Wireguard (Kernels < 5.6 only!)
- When using a kernel version < 5.6, check that the wireguard kernel module is available and loaded:
1
2
sudo modprobe wireguard
sudo lsmod | grep wireguard
Get the Repository
If not done yet, download/clone this (pmd-server
) repository on your PMD-S.
1
2
git clone https://github.com/materialdigital/pmd-server.git
cd pmd-server
Setup
Automatic Setup using PMD Setup Container
- Change (
cd
) into the mesh directory (i.e.wg-mesh
). - When migrating from an old setup, do
docker compose down
to stop the currently running mesh containers and remove the old Docker network viadocker network rm wgnet
. - Run
docker run --rm --pull always -v $(pwd):/composer_root -v /run/docker.sock:/run/docker.sock -e IEK=<your-iek-uuid> materialdigital/setup
from within this directory. - Check the output for setup warnings and resolve them accordingly.
Example result
``` Status: Downloaded newer image for materialdigital/setup:latest Performing initial enrollment via EST... Establish trust into PMD CA... The CA fingerprint was successfully checked, trust anchor has been established. Generating private key and certificate signing request (CSR)... ----- Performing EST enrollment request... Certificate acquired, enrollment successful! Executing configuration script... DEBUG - Client Assertion Payload: {"iss":"...", ...,"aud":"https://daps.material-digital.de"} DEBUG - Client Assertion (encoded): ... DEBUG - Access Token: ... Retrieving OpenID Config from https://daps.material-digital.de/.well-known/openid-configuration... Retrieving JWKS from https://daps.material-digital.de/jwks.json... ### THIS IS YOUR PMD CONFIGURATION: ### PMDC_SUBNET_PREFIX=xxxx:x:x:x:: WG_ENDPOINT=pmd-s.open-semantic-lab.org:29292 SUBNET_PREFIX=xxxx:x:x:x:: PMD_ZONE=xxx.pmd.internal CA_FP=xxx Sourcing newly created .env file... Setting up docker network for PMD mesh... PMD mesh Docker network created with ID "xxx" ```Manual Setup (NOT Recommended!)
- Obtain your identity certificate/key files from https://daps.material-digital.de, place them under
pmd_config/wg/
and name themparticipant.{crt/key}
. Make sure thatparticipant.crt
contains the full chain (cert, sub-ca and ca, in that order). Additionally, place the root certificate inpmd_config/wg/root.crt
. - Create the wgnet Docker network with
docker network create --ipv6 --subnet=172.31.0.0/16 --subnet=<your-wg-mesh-subnet> wgnet
, using the IPv6 subnet which has been assigned to you. - Create/edit the
.env
file, and adaptWG_ENDPOINT
,SUBNET_PREFIX
andPMD_ZONE
to the values which have been assigned to you. You should normally not alter thePMDC_SUBNET_PREFIX
variable. - In case subnet
172.31.0.0/16
has not been available, you also have to specifyIPV4_DNS_IP
(IPv4 IP of DNS service) andIPV4_SUBNET
(IPv4 subnet ofwgnet
in CIDR notation).
Usage
When properly set up, you should be able to start your mesh via docker compose pull && docker compose up -d
.
(The docker compose pull &&
part is optional but strongly recommended to make sure that you don’t use any outdated images.)
If you also want to start a demo app container for testing, run docker compose --profile debug up -d
.
(This requires that you launch the commands from the PMD mesh git repository with the corresponding Dockerfile
.)
Run curl http://localhost:8000/connect/<DOMAIN>/<PORT>
on the host (assuming the wireguard container materialdigital/wg
has exposed port 8000) to connect to another mesh participant.