diff --git a/debian/ahenk.postinst b/debian/ahenk.postinst index 8e276dc..b7b9a48 100644 --- a/debian/ahenk.postinst +++ b/debian/ahenk.postinst @@ -5,10 +5,15 @@ set -e #mkdir -p /usr/share/ahenk/plugins # update ahenk from 1.0.0-6 to 1.0.0-7 -if [ ! -d /etc/ahenk ]; then - +if [[ ! -d /etc/ahenk ]]; then mkdir -p /etc/ahenk cp -rf /tmp/ahenk/* /etc/ahenk +# update pardus21 sssd conf changes when update pardus from 24 to 25 + if [[ -f /etc/ahenk/ad_info ]]; then + if [[ -f /etc/sssd/sssd.conf ]]; then + sed -i 's/ad_domain/ad_server/g' /etc/sssd/sssd.conf + fi + fi fi systemctl enable ahenk diff --git a/debian/ahenk.postinst.debhelper b/debian/ahenk.postinst.debhelper index 842fa34..94b4d5e 100644 --- a/debian/ahenk.postinst.debhelper +++ b/debian/ahenk.postinst.debhelper @@ -6,8 +6,8 @@ fi # End automatically added section # Automatically added by dh_installinit -if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then - if [ -x "/etc/init.d/ahenk" ]; then +if [[ "$1" = "configure" ]] || [[ "$1" = "abort-upgrade" ]]; then + if [[ -x "/etc/init.d/ahenk" ]]; then update-rc.d ahenk defaults >/dev/null invoke-rc.d ahenk start || exit $? fi diff --git a/debian/ahenk.postrm b/debian/ahenk.postrm index d6231ee..4a50048 100644 --- a/debian/ahenk.postrm +++ b/debian/ahenk.postrm @@ -2,6 +2,6 @@ set -e -if [ -d /etc/ahenk ] && [ "$1" = "purge" ];then +if [[ -d /etc/ahenk ]] && [[ "$1" = "purge" ]];then rm -rf /etc/ahenk fi diff --git a/debian/ahenk.postrm.debhelper b/debian/ahenk.postrm.debhelper index e3de6e3..ed4254c 100644 --- a/debian/ahenk.postrm.debhelper +++ b/debian/ahenk.postrm.debhelper @@ -1,12 +1,12 @@ # Automatically added by dh_installinit -if [ "$1" = "purge" ] ; then +if [[ "$1" = "purge" ]] ; then update-rc.d ahenk remove >/dev/null fi # In case this system is running systemd, we make systemd reload the unit files # to pick up changes. -if [ -d /run/systemd/system ] ; then +if [[ -d /run/systemd/system ]] ; then systemctl --system daemon-reload >/dev/null || true fi # End automatically added section diff --git a/debian/ahenk.preinst b/debian/ahenk.preinst index 1f60801..cb3d88c 100644 --- a/debian/ahenk.preinst +++ b/debian/ahenk.preinst @@ -4,7 +4,7 @@ set -e # Create necessary directories #update ahenk from 1.0.0-6 to 1.0.0-7 -if [ -d /etc/ahenk ]; then +if [[ -d /etc/ahenk ]]; then cp -rf /etc/ahenk /tmp diff --git a/src/base/command/command_runner.py b/src/base/command/command_runner.py index 6339db4..b801ac1 100644 --- a/src/base/command/command_runner.py +++ b/src/base/command/command_runner.py @@ -73,7 +73,7 @@ class CommandRunner(object): if str(json_data['event']) == 'login' and self.check_last_login(): username = json_data['username'] - if username != "Debian-gdm" or username != "gdm": + if username != "Debian-gdm" and username != "gdm": display = json_data['display'] desktop = json_data['desktop'] @@ -163,22 +163,23 @@ class CommandRunner(object): elif str(json_data['event']) == 'logout': username = json_data['username'] - self.execute_manager.remove_user_executed_policy_dict(username) - self.plugin_manager.process_mode('logout', username) - self.plugin_manager.process_mode('safe', username) - if username != "Debian-gdm": - self.db_service.delete('session', '1=1') - # TODO delete all user records while initializing - self.logger.info('logout event is handled for user: {0}'.format(username)) - ip = None - if 'ip' in json_data: - ip = json_data['ip'] + if username != "Debian-gdm" and username != "gdm": + self.execute_manager.remove_user_executed_policy_dict(username) + self.plugin_manager.process_mode('logout', username) + self.plugin_manager.process_mode('safe', username) + if username != "Debian-gdm": + self.db_service.delete('session', '1=1') + # TODO delete all user records while initializing + self.logger.info('logout event is handled for user: {0}'.format(username)) + ip = None + if 'ip' in json_data: + ip = json_data['ip'] - logout_message = self.message_manager.logout_msg(username,ip) - self.messenger.send_direct_message(logout_message) - self.logger.info('Ahenk polkit file deleting..') - self.delete_polkit_user() - # self.db_service.delete('session', 'username=\'{0}\''.format(username)) + logout_message = self.message_manager.logout_msg(username,ip) + self.messenger.send_direct_message(logout_message) + self.logger.info('Ahenk polkit file deleting..') + self.delete_polkit_user() + # self.db_service.delete('session', 'username=\'{0}\''.format(username)) elif str(json_data['event']) == 'send': self.logger.info('Sending message over ahenkd command. Response Message: {0}'.format( diff --git a/src/base/registration/execute_cancel_ldap_login.py b/src/base/registration/execute_cancel_ldap_login.py index 5b91b7e..889e1e5 100644 --- a/src/base/registration/execute_cancel_ldap_login.py +++ b/src/base/registration/execute_cancel_ldap_login.py @@ -16,7 +16,7 @@ class ExecuteCancelLDAPLogin: def cancel(self): self.logger.info('Purge ldap packages') self.util.execute("apt-get install sudo -y") - self.util.execute("apt purge libpam-ldap libnss-ldap ldap-utils sudo-ldap nss-updatedb libnss-db libpam-ccreds -y") + self.util.execute("apt purge libpam-ldap libnss-ldap ldap-utils sudo-ldap nss-updatedb libnss-db libpam-ccreds libsss-sudo -y") self.util.execute("apt autoremove -y") self.logger.info('purging successfull') diff --git a/src/base/registration/execute_ldap_login.py b/src/base/registration/execute_ldap_login.py index 2e189fe..b752249 100644 --- a/src/base/registration/execute_ldap_login.py +++ b/src/base/registration/execute_ldap_login.py @@ -178,7 +178,7 @@ class ExecuteLDAPLogin: self.util.write_file(libnss_ldap_file_path, content, 'a+') self.logger.info("Configuration has been made to {0}.".format(libnss_ldap_file_path)) - result_code, p_out, p_err = self.util.execute("apt-get install libnss-db libpam-ccreds -y") + result_code, p_out, p_err = self.util.execute("apt-get install libnss-db libpam-ccreds libsss-sudo -y") if result_code != 0: self.logger.error("Error occured while downloading libnss-db libpam-ccreds.") else: