pax_global_header00006660000000000000000000000064122071106570014513gustar00rootroot0000000000000052 comment=16922fb97fa15a9637d996b02ea45c406eab27e9 lastlog-notification-0.2/000075500000000000000000000000001220711065700155035ustar00rootroot00000000000000lastlog-notification-0.2/.gear-rules000064400000000000000000000000071220711065700175470ustar00rootroot00000000000000tar: . lastlog-notification-0.2/90-lastlog-into-pam.sh000075500000000000000000000004551220711065700214630ustar00rootroot00000000000000#!/bin/sh a= . install2-init-functions for n in local krb5 krb5_ccreds; do subst "s|#%PAM-1.0|#%PAM-1.0\nauth optional pam_exec.so quiet /usr/bin/lastlog-notification-store|" $destdir/etc/pam.d/system-auth-$n echo "session optional pam_lastlog.so silent" >> $destdir/etc/pam.d/system-auth-$n done lastlog-notification-0.2/lastlog-notification-show000075500000000000000000000001341220711065700225360ustar00rootroot00000000000000#!/bin/sh [ -f ~/.lastlog ] && notify-send "Last login" "$(date -d @$(cat ~/.lastlog))" ||: lastlog-notification-0.2/lastlog-notification-store000075500000000000000000000016361220711065700227220ustar00rootroot00000000000000#!/bin/sh PATH=/bin:/usr/bin uid=$(id -u "$PAM_USER") lastlog_date= [ -n "$uid" ] || exit # local user if [ "$uid" -le 4999 ]; then lastlog_date="$(LC_ALL=C lastlog -u $uid | grep -oE '(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]+.*')" else # fetch lastlog information from kerberos LDAP txt_record=$(host -t TXT _kerberos) [ -n "$txt_record" ] || exit dn=$(echo $txt_record | cut -d ' ' -f1|sed 's/^_kerberos./dc=/;s/\./,dc=/g') realm=$(echo $txt_record | cut -d\" -f2) base=krbPrincipalName=$PAM_USER@$realm,cn=$realm,cn=kerberos,ou=kdcroot,$dn lastlog_date="$(ldapsearch -LL -x -b $base krbLastSuccessfulAuth | grep krbLastSuccessfulAuth | cut -d' ' -f2 | sed -r 's/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})Z$/\1-\2-\3 \4:\5:\6Z/')" fi [ -n "$lastlog_date" ] && date +%s -d "$lastlog_date" > $(getent passwd "$PAM_USER" |cut -d: -f6)/.lastlog ||: lastlog-notification-0.2/lastlog-notification.desktop000064400000000000000000000004751220711065700232350ustar00rootroot00000000000000[Desktop Entry] Type=Application Name=Last login notification Name[ru]=Оповещение о последнем входе в систему Comment=Last local or Kerberos login notification Comment[ru]=Оповещение о последнем входе в систему Exec=/usr/bin/lastlog-notification-show lastlog-notification-0.2/lastlog-notification.spec000064400000000000000000000020341220711065700225070ustar00rootroot00000000000000Name: lastlog-notification Version: 0.2 Release: alt1 Summary: Notify user about last login via freedesktop notification License: GPL Group: System/Configuration/Other BuildArch: noarch Source: %name-%version.tar Requires: shadow-log openldap-clients bind-utils %description Notify user about last login via freedesktop notification. It support both local and kerberos logins. In kerberos case last login on any workstation time is shown. %prep %setup %install %define hookdir %_datadir/install2/postinstall.d mkdir -p %buildroot%hookdir install -pm755 *.sh %buildroot%hookdir/ mkdir -p %buildroot%_bindir install -pm755 lastlog-notification-{store,show} %buildroot%_bindir mkdir -p %buildroot/etc/xdg/autostart install -pm644 lastlog-notification.desktop %buildroot/etc/xdg/autostart/ %files %hookdir/* %_bindir/* /etc/xdg/autostart/* %changelog * Tue Aug 27 2013 Anton V. Boyarshinov 0.2-alt1 - added support for never logged users * Fri Aug 23 2013 Anton V. Boyarshinov 0.1-alt1 - initial build