Install Admin UI for Web SafetyΒΆ

Admin UI of Web Safety is installed after core components installation is finished. To install the Admin UI components on RedHat 8 navigate to ui.rpm 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 apache web server
dnf -y install httpd httpd-devel

# make apache autostart on reboot
systemctl enable httpd

# install python 3 development libs
dnf -y install python3-devel redhat-rpm-config

# install python django for web ui
pip3 install django==3.1.7
pip3 install pytz
pip3 install tld
pip3 install requests
pip3 install pandas
pip3 install PyYAML
pip3 install PyOpenSSL
pip3 install psutil
pip3 install python-ldap
pip3 install mod-wsgi
pip3 install jinja2

# enable the mod_wsgi module for python3 in apache
/usr/local/bin/mod_wsgi-express install-module > /etc/httpd/conf.modules.d/02-wsgi.conf

# and restart apache
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

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="7.6.0"
MINOR="5D82"
ARCH="amd64"
OSNAME="redhat8"

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

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

# sync ui and actual files in disk
sudo -u squid 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

# and restart all daemons
systemctl restart httpd

Please note, RPM install package copied the preconfigured virtual host file to /etc/httpd/conf.d/websafety.conf. This host is loaded automatically after startup of Apache web server. If you have other virtual hosts listening on port 80 you may need to manually modify the contents of /etc/httpd/conf.d/websafety.conf and/or remove default welcome.conf virtual host by running rm /etc/httpd/conf.d/welcome.conf.

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.