Install Admin UI for Web SafetyΒΆ

Admin UI of Web Safety is installed after core components installation is finished. To install it on RedHat 9 navigate to ui.rpm 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 web server
dnf -y install httpd httpd-devel mod_ssl openssl python3-mod_wsgi jq

# make apache autostart on reboot
systemctl enable httpd

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 params
MAJOR="9.0.0"
MINOR="1E2A"
ARCH="amd64"

# download
curl -O https://packages.diladele.com/websafety-ui/$MAJOR.$MINOR/$ARCH/release/redhat9/websafety-ui-${MAJOR}-${MINOR}.x86_64.rpm

# install
dnf -y install websafety-ui-${MAJOR}-${MINOR}.x86_64.rpm

Run 03_venv.sh to configure Python virtual environment.

#!/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 python 3 development libs
dnf -y install python3-devel redhat-rpm-config python3-pyOpenSSL python3-requests

# rust is required for PyOpenSSL
# dnf -y module install rust-toolset

# 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 squid /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

And finaly, run 04_integrate.sh to integrate all components together.

#!/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

# disable default HTTP and HTTPS sites
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.original
mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.original

# and restart all daemons
systemctl restart httpd

# allow connection to 80, 443 and 3128 ports for apache and squid
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

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