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-pam.postinst
#!/bin/sh
# postinst script for imunify360-webshield-bundle

set -e

case "$1" in
    triggered)
        # dovecot auth dir changed
        if [ -f /usr/local/cpanel/cpanel ]; then
            /usr/sbin/imunify360-pam dovecot-reset || true
        fi
        ;;
    configure)
        # deprive other users access to app data for releases upto 5.8.0-14
        chmod -R o-rwx /var/i360_pam_imunify/wl/    \
            /var/i360_pam_imunify/users/            \
            /opt/i360_pam_imunify/db/

        SECRET_FILE=/opt/i360_pam_imunify/key
        if [ ! -e ${SECRET_FILE} ]; then
            #NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
            NEW_UUID=$(cat /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | dd bs=16 count=1 2> /dev/null)
            echo "${NEW_UUID}" > ${SECRET_FILE}
            chown root:root ${SECRET_FILE}
            chmod 400 ${SECRET_FILE}
        fi

        # Plug in dovecot module on cPanel
        if [ -f /usr/local/cpanel/cpanel ]; then
            /usr/sbin/imunify360-pam dovecot-native symlink || true
        fi

        if [ -e /usr/sbin/imunify360-pam ]; then
            # 'imunify360-pam {enable|disable}' is idempotent command
            /usr/sbin/imunify360-pam enable >/dev/null
        fi

        if ! deb-systemd-helper is-enabled imunify360-pam.service > /dev/null 2>&1; then
            deb-systemd-helper enable imunify360-pam.service > /dev/null 2>&1 || :
        fi
        if ! deb-systemd-helper is-enabled imunify360-pam.socket > /dev/null 2>&1; then
            deb-systemd-helper enable imunify360-pam.socket > /dev/null 2>&1 || :
        fi

        systemctl restart imunify360-pam > /dev/null || true

        ;;
    abort-upgrade|abort-remove|abort-deconfigure)
        ;;
    *)
        echo "postinst called with unknown argument \`$1'" >22
        exit 1
        ;;
esac

exit 0