Mini Shell

Direktori : /proc/thread-self/root/usr/share/pam_lve/scriptlets/
Upload File :
Current File : //proc/thread-self/root/usr/share/pam_lve/scriptlets/rpm_post.sh

#!/usr/bin/bash

# RPM post script
# Note: Also called from Debian pam-lve.postinst scriptlet
# RPM arguments:
# "$1" == 0 -- RPM uninstall package ???
# "$1" == 1 -- RPM upgrade/downgrade package ???
# DEB arguments:
# "$1" == "configure" - DEB install package

# "pam-lve POST INSTALL STARTED"

# RPM/DEB argument unified interpreter
argument=''
if [[ "$1" == 1 || "$1" == "configure" ]]; then
    # "$1" == 1 -- RPM upgrade/downgrade package
    # "$1" == "configure" -- DEB
    argument='upgrade'
else
    # Unknown argument (some special cases only for DEB. See pam-lve.postinst scriptlet for details),
    # skip all actions
    exit 0
fi;

# add pam without securelve in pam configs
if [ "$argument" == 'upgrade' ]; then
    if [ -e /etc/pam.d/sudo ]; then
        grep -q pam_sulve.so /etc/pam.d/sudo
        if  [ $? -eq 1 ]; then
        echo "session    required     pam_sulve.so" >> /etc/pam.d/sudo
        fi
    fi
    grep -q pam_sulve.so /etc/pam.d/su
    if  [ $? -eq 1 ]; then
        grep -q pam_lve.so /etc/pam.d/su
        if  [ $? -eq 1 ]; then
        echo "session    required     pam_sulve.so" >> /etc/pam.d/su
        else
        sed -i '/pam_lve.so/i \session    required     pam_sulve.so' /etc/pam.d/su
        fi
    fi
    grep -q pam_lve.so /etc/pam.d/sshd
    if  [ $? -eq 1 ]; then
        echo "session    required     pam_lve.so      500     0" >> /etc/pam.d/sshd
    fi
    grep -q pam_lve.so /etc/pam.d/su
    if  [ $? -eq 1 ]; then
        echo "session    required     pam_lve.so      500     0" >> /etc/pam.d/su
    fi

    # PAM config for cron
    pam_d_cron_file=''
    if [ -e "/etc/pam.d/crond" ]; then
        # Cloudlinux
        pam_d_cron_file='/etc/pam.d/crond'
    fi
    if [ -e "/etc/pam.d/cron" ]; then
        # Ubuntu
        pam_d_cron_file='/etc/pam.d/cron'
    fi
    if [ -n "$pam_d_cron_file" ]; then
        grep -q pam_lve.so "$pam_d_cron_file"
        if  [ $? -eq 1 ]; then
            echo "session    required     pam_lve.so      500     0" >> "$pam_d_cron_file"
        fi
    fi
fi

# "pam-lve POST INSTALL FINISHED"
exit 0


Zerion Mini Shell 1.0