HEX
Server: Apache
System: Linux hz.vslconceptsdomains.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: dkfounda (3233)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //var/lib/dpkg/info/imunify360-firewall.preinst
#!/bin/bash
# preinst script for imunify360-firewall

set -e

case "$1" in
    install)
        if [ -L /opt/imunify360/venv/share/imunify360/scripts/modsec_scan.py ]; then
            rm /opt/imunify360/venv/share/imunify360/scripts/modsec_scan.py
        fi
        # stop antivirus service if running to prevent both services from running simultaneously.
        # the antivirus trigger will mask it later, but we need to stop it now before firewall starts.
        /bin/systemctl stop imunify-antivirus.service > /dev/null 2>&1 || :
        if [ ! -e /etc/sysconfig/imunify360/imunify360-merged.config ]; then
          # to pervent possible failures other products that might use imunify360-merged.config
          cp /etc/sysconfig/imunify360/imunify360.config.defaults.example /etc/sysconfig/imunify360/imunify360-merged.config || :
        fi
    ;;

    upgrade)
        # add file-flag that upgrade is in progress
        mkdir -p /var/lib/rpm-state/
        touch /var/lib/rpm-state/imunify360-transaction-in-progress

        /bin/systemctl stop imunify360-agent.service > /dev/null 2>&1 || :
        /bin/systemctl stop imunify360.service >/dev/null 2>&1
        # imunify360-firewall <= 10 has no dos-protection daemon,
        # so we need to check its unit for existence before trying to stop it.
        if /bin/systemctl cat imunify360-dos-protection.service >/dev/null 2>&1; then
            /bin/systemctl stop imunify360-dos-protection.service
        else
            true
        fi
        # stop antivirus service if running to prevent both services from running simultaneously.
        # the antivirus trigger will mask it later, but we need to stop it now before firewall starts.
        /bin/systemctl stop imunify-antivirus.service > /dev/null 2>&1 || :
        if [ ! -e /etc/sysconfig/imunify360/imunify360-merged.config ]; then
          # to pervent possible failures other products that might use imunify360-merged.config
          cp /etc/sysconfig/imunify360/imunify360.config.defaults.example /etc/sysconfig/imunify360/imunify360-merged.config || :
        fi
    ;;

    abort-upgrade)
    ;;

    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

exit 0