Install Admin UI for Web SafetyΒΆ

Admin UI of Web Safety is installed after core components installation is finished. Having a separate package for Admin UI allows for faster development cycle and improved support. To install the Admin UI components navigate to ui.deb folder and run the following scripts one by one.

Run 01_apache.sh for Apache web server.

#!/bin/bash

# all web packages are installed as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

# install apache and mod_wsgi and some other useful programs
apt -y install apache2 libapache2-mod-wsgi-py3 htop mc net-tools jq

# install kerberos client libraries
export DEBIAN_FRONTEND=noninteractive 
apt -y install krb5-user

Run 02_webui.sh to install Admin UI of Web Safety.

#!/bin/bash

# all packages are installed as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

# default arch and version
MAJOR="8.7.0"
MINOR="0A95"
ARCH="amd64"

# default os
OSNAME="debian12"
if [ -f "/etc/lsb-release" ]; then
    OSNAME="ubuntu20"
fi

# download
wget https://packages.diladele.com/websafety-ui/$MAJOR.$MINOR/$ARCH/release/$OSNAME/websafety-ui-$MAJOR.${MINOR}_$ARCH.deb

# install
dpkg --install websafety-ui-$MAJOR.${MINOR}_$ARCH.deb

Run 03_venv.sh to setup virtual environment where the Python code will run.

#!/bin/bash

# all packages are installed as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

# install various required python packages from the system repo
apt install -y python3-dev libjpeg-dev zlib1g-dev libldap2-dev libsasl2-dev libssl-dev

# install different command on debian 12 or ubuntu
if [ -f "/etc/lsb-release" ]; then
   apt install -y python3.8-venv
else
   apt install -y python3.11-venv python3-openssl
fi

# create a virtual environment in the /opt/websafety-ui folder
python3 -m venv /opt/websafety-ui/env

# install required packages into virtual environment
/opt/websafety-ui/env/bin/pip3 install -r /opt/websafety-ui/var/console/requirements.txt

# sync ui and actual files in disk (note UI does not manage network by default)
sudo -u proxy /opt/websafety-ui/env/bin/python3 /opt/websafety-ui/var/console/generate.py --core
sudo -u websafety /opt/websafety-ui/env/bin/python3 /opt/websafety-ui/var/console/generate.py --ui

# relabel folder just in case
chown -R websafety:websafety /opt/websafety-ui

Finally, run 04_integrate.sh to integrate the Apache web server and Admin UI of Web Safety.

#!/bin/bash

# all packages are installed as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

# Admin UI now runs using HTTPS so to integrate with apache, we need to enable the HTTPS
a2enmod ssl

# disable the default site and enable web safety
a2dissite 000-default
a2ensite websafety

# finally restart all daemons
service apache2 restart

After all these scripts we finally have Web Safety, Squid and Apache web server setup and running as appropriate on your real hardware server. Continue on to the next step for some post installation configuration.