Hybrid

System requirements

OS

A Linux Server (Virtual or Physical)

or

Windows 10 with Windows Subsystem for Linux

RAM

Absolute minimum to run the daemon and some very light containers - 512MB

Minimum for “comfortable” usage – 2GB

CPU

Minimum: 2

Recommended 4+

Disk Space

10 GB for internal requirements.

The amount of additional disk space soloemnly depends on you intended use.

Since Docker uses hypervisor the host NEEDS TO HAVE VIRTUALIZATION ENABLED!

Prerequisites

node version >15

curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs

docker

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y docker-ce
sudo usermod -aG docker [USERNAME] # Please replace [USERNAME] with the user you want to run docker on
for kali specifically please visit the following link to install docker

docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

pm2

sudo npm install -g pm2

Install

Linux

Clone the repo

git clone --recurse-submodules https://git.swarmlab.io:3000/zeus/swarmlab-hybrid.git

Install it!

cd swarmlab-hybrid
./install.sh  <-- run it without root privileges

Windows

Ensure you have completed the steps described in the Prerequisites section before installing the Docker Desktop Stable 2.3.0.2 release.

Follow the usual installation instructions to install Docker Desktop. If you are running a supported system, Docker Desktop prompts you to enable WSL 2 during installation. Read the information displayed on the screen and enable WSL 2 to continue.

  • Start Docker Desktop from the Windows Start menu.

From the Docker menu, select Settings  General

wsl2 enable

  • Select the Use WSL 2 based engine check box.

    If you have installed Docker Desktop on a system that supports WSL 2, this option will be enabled by default.

Click Apply & Restart.

  • Ensure the distribution runs in WSL 2 mode. WSL can run distributions in both v1 or v2 mode.

To check the WSL mode, run:

wsl.exe -l -v

To upgrade your existing Linux distro to v2, run:

wsl.exe --set-version (distro name) 2

To set v2 as the default version for future installations, run:

wsl.exe --set-default-version 2

When Docker Desktop restarts, go to Settings  Resources  WSL Integration

wsl2 choose distro

  • WSL 2 Choose Linux distro

Click Apply & Restart.

The Docker-WSL integration will be enabled on your default WSL distribution.
  • To change your default WSL distro, run

wsl --set-default <distro name>.

For example, to set Ubuntu as your default WSL distro, run wsl --set-default ubuntu. Optionally, select any additional distributions you would like to enable the Docker-WSL integration on.

The Docker-WSL integration components running in your distro depend on glibc. This can cause issues when running musl-based distros such as Alpine Linux. Alpine users can use the alpine-pkg-glibc package to deploy glibc alongside musl to run the integration.

Set up working X11 forwarding on WSL2

Step A: Install X-Server Windows

Step B: Configure Display:

on Wsl:

export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0

Remove the Windows PATH from WSL

Step A: remove paths on runtime

Add the following code to .bashrc

PATH=$(/usr/bin/printenv PATH | /usr/bin/perl -ne 'print join(":", grep { !/\/mnt\/[a-z]/ } split(/:/));')
-OR-

Alternative (run once!)

echo "export PATH=`echo $PATH | tr ':' '\n' | grep -v /mnt/ | tr '\n' ':'`" >> ~/.bashrc

Step B: Logout/Login

Fix network issues

# Delete auto-generated files
rm /etc/resolv.conf || true
rm /etc/wsl.conf || true
Enable changing /etc/resolv.conf
# Enable changing /etc/resolv.conf
# Enable extended attributes on Windows drives
cat <<EOF > /etc/wsl.conf
[network]
generateResolvConf = false

[automount]
enabled = true
options = "metadata"
mountFsTab = false
EOF

# Use google nameservers for DNS resolution
cat <<EOF > /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
cmd as admin:
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns

Windows Search  Network Reset

Restart Windows

Install Hybrid
Clone the repo
git clone --recurse-submodules https://git.swarmlab.io:3000/zeus/swarmlab-hybrid.git
Install it!
cd swarmlab-hybrid
./install.sh  <-- run it without root privileges

Fix "x509: certificate signed by unknown authority" issue

On Error:

Get https ://registry.vlabs.uniwa.gr:5080/v2/: x509: certificate

Pulling  ...
ERROR: Get https://registry.vlabs.uniwa.gr:5080/v2/: x509: certificate signed by unknown authority

run

sudo su
touch set-ca.sh

copy-paste lines

registry_address=hub.swarmlab.io
registry_port=5443
mkdir -p /etc/docker/certs.d/$registry_address:$registry_port
openssl s_client -showcerts -connect $registry_address:$registry_port < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/$registry_address:$registry_port/ca.crt

registry_port=5480
mkdir -p /etc/docker/certs.d/$registry_address:$registry_port
openssl s_client -showcerts -connect $registry_address:$registry_port < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/$registry_address:$registry_port/ca.crt

exec file

sudo bash ./set-ca.sh

Fix "server certificate verification failed. CAfile: …​"

copy-paste lines

apt-get update
apt-get upgrade
apt-get install apt-transport-https ca-certificates -y
apt-get install --reinstall ca-certificates
mkdir -p /usr/local/share/ca-certificates/swarmlab
echo -n | openssl s_client -showcerts -connect git.swarmlab.io:3000   2>/dev/null  | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /usr/local/share/ca-certificates/swarmlab/ca.crt
update-ca-certificates
git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt

exec file

start/stop service

Linux and Windows

start

./start

stop

./stop

Open URL http://localhost:3088 in browser