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 and Python Django framework.

#!/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 pip3 and other python modules, ldap/sasl (we need it for python ldap module)
apt -y install python3-pip python3-dev libjpeg-dev zlib1g-dev libldap2-dev libsasl2-dev libssl-dev

# on RPI install libatlas for numpy
cat /proc/cpuinfo | grep -m 1 ARMv7 > /dev/null 2>&1
if [ $? -eq 0 ]; then
    apt-get install libatlas-base-dev
fi

# install django and all other modules
pip3 install django==3.1.2
pip3 install pytz
pip3 install tld
pip3 install requests
pip3 install pandas
pip3 install PyYAML
pip3 install PyOpenSSL
pip3 install psutil
pip3 install jinja2

# there are some bugs in Ubuntu 18 and Python3 environment concerning the LDAP module,
# so we fix them by removing obsolete ldap modules and reinstalling the correct one
pip3 uninstall ldap
pip3 uninstall ldap3
pip3 uninstall python-ldap

# ok this one is fine
pip3 install python-ldap

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

# 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="7.6.0"
MINOR="87A4"
ARCH="amd64"

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

# download
wget http://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

# let ui to manage the network
sudo -u websafety python3 /opt/websafety-ui/var/console/utils.py --network=$OSNAME

# sync ui and actual files in disk
sudo -u proxy python3 /opt/websafety-ui/var/console/generate.py --core
sudo -u websafety python3 /opt/websafety-ui/var/console/generate.py --ui

# relabel folder
chown -R websafety:websafety /opt/websafety-ui

# integrate with apache
a2dissite 000-default
a2ensite websafety

# and 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.