HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux mail.btech-izolacje.pl 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
User: pewna6876 (1017)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //var/lib/dpkg/info/imunify360-pam.postinst
#!/bin/sh
# postinst script for imunify360-webshield-bundle

set -e

case "$1" in
    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 if panel is not directadmin
        DIRECTADMIN_BIN=/usr/local/directadmin/directadmin
        if [ ! -e ${DIRECTADMIN_BIN} ]; then
            mkdir -p /lib64/dovecot/auth
            rm -f /lib64/dovecot/auth/lib_imunify360.so
            ln -s `ls -r1 /usr/lib/i360_pam_imunify/lib_imunify360_*.so | head -n 1` \
                /lib64/dovecot/auth/lib_imunify360.so
        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