|
|
@ -1,6 +1,6 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
# Smart Card KDE3.5 Authentication Script (c) 2010 Timothy Pearson
|
|
|
|
# Smart Card TDE Authentication Script (c) 2010-2011 Timothy Pearson
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
@ -293,24 +293,7 @@ while [[ 1 == 1 ]]; do
|
|
|
|
waserror=0
|
|
|
|
waserror=0
|
|
|
|
noactivesessions=0
|
|
|
|
noactivesessions=0
|
|
|
|
|
|
|
|
|
|
|
|
result_is_consistent=0
|
|
|
|
$result=$(/opt/trinity/bin/kdmctl -g list)
|
|
|
|
while [[ $result_is_consistent == 0 ]]; do
|
|
|
|
|
|
|
|
result_one=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
result_two=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
result_three=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
result_four=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
if [[ $result_one == $result_two ]]; then
|
|
|
|
|
|
|
|
if [[ $result_one == $result_three ]]; then
|
|
|
|
|
|
|
|
if [[ $result_one == $result_four ]]; then
|
|
|
|
|
|
|
|
result=$result_one
|
|
|
|
|
|
|
|
result_is_consistent=1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ $result == "ok" ]]; then
|
|
|
|
if [[ $result == "ok" ]]; then
|
|
|
|
noactivesessions=1
|
|
|
|
noactivesessions=1
|
|
|
|
result="okbutempty"
|
|
|
|
result="okbutempty"
|
|
|
@ -375,9 +358,9 @@ while [[ 1 == 1 ]]; do
|
|
|
|
cverify="User:${darray[index]}"
|
|
|
|
cverify="User:${darray[index]}"
|
|
|
|
udisplay=":${index}"
|
|
|
|
udisplay=":${index}"
|
|
|
|
if [[ $lverify == $cverify ]]; then
|
|
|
|
if [[ $lverify == $cverify ]]; then
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface quit"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface quit"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface enable false"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface enable false"
|
|
|
|
/opt/kde3/bin/kdmctl activate $udisplay
|
|
|
|
/opt/trinity/bin/kdmctl activate $udisplay
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "EUnauthorized SmartCard Inserted" > /tmp/ksocket-global/kdesktoplockcontrol &
|
|
|
|
echo "EUnauthorized SmartCard Inserted" > /tmp/ksocket-global/kdesktoplockcontrol &
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -444,10 +427,10 @@ while [[ 1 == 1 ]]; do
|
|
|
|
echo "The next display to start will be $newdisplay"
|
|
|
|
echo "The next display to start will be $newdisplay"
|
|
|
|
rm $SECURE_DIRECTORY/originalxdm
|
|
|
|
rm $SECURE_DIRECTORY/originalxdm
|
|
|
|
|
|
|
|
|
|
|
|
/opt/kde3/bin/kdmctl -g reserve
|
|
|
|
/opt/trinity/bin/kdmctl -g reserve
|
|
|
|
/opt/kde3/bin/kdmctl -g login $newdisplay now $smartcard_username $(cat $SECURE_DIRECTORY/password)
|
|
|
|
/opt/trinity/bin/kdmctl -g login $newdisplay now $smartcard_username $(cat $SECURE_DIRECTORY/password)
|
|
|
|
sleep 2
|
|
|
|
sleep 2
|
|
|
|
/opt/kde3/bin/kdmctl -g activate $newdisplay
|
|
|
|
/opt/trinity/bin/kdmctl -g activate $newdisplay
|
|
|
|
udisplay=$newdisplay
|
|
|
|
udisplay=$newdisplay
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -467,8 +450,8 @@ while [[ 1 == 1 ]]; do
|
|
|
|
|
|
|
|
|
|
|
|
while [[ $OUTPUT -eq 0 ]]; do
|
|
|
|
while [[ $OUTPUT -eq 0 ]]; do
|
|
|
|
sleep 1
|
|
|
|
sleep 1
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface quit"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface quit"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface enable false"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface enable false"
|
|
|
|
echo "exit" | scriptor 2>/dev/null 1>/dev/null
|
|
|
|
echo "exit" | scriptor 2>/dev/null 1>/dev/null
|
|
|
|
OUTPUT=$?
|
|
|
|
OUTPUT=$?
|
|
|
|
if [[ $smartcard_slave == "SLAVE" ]]; then
|
|
|
|
if [[ $smartcard_slave == "SLAVE" ]]; then
|
|
|
@ -514,24 +497,7 @@ while [[ 1 == 1 ]]; do
|
|
|
|
result="ok"
|
|
|
|
result="ok"
|
|
|
|
timeout=0
|
|
|
|
timeout=0
|
|
|
|
errcode=0
|
|
|
|
errcode=0
|
|
|
|
result_is_consistent=0
|
|
|
|
$result=$(/opt/trinity/bin/kdmctl -g list)
|
|
|
|
while [[ $result_is_consistent == 0 ]]; do
|
|
|
|
|
|
|
|
result_one=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
result_two=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
result_three=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
result_four=$(/opt/kde3/bin/kdmctl -g list)
|
|
|
|
|
|
|
|
if [[ $result_one == $result_two ]]; then
|
|
|
|
|
|
|
|
if [[ $result_one == $result_three ]]; then
|
|
|
|
|
|
|
|
if [[ $result_one == $result_four ]]; then
|
|
|
|
|
|
|
|
result=$result_one
|
|
|
|
|
|
|
|
result_is_consistent=1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ $result == "ok" ]]; then
|
|
|
|
if [[ $result == "ok" ]]; then
|
|
|
|
noactivesessions=1
|
|
|
|
noactivesessions=1
|
|
|
|
result="okbutempty"
|
|
|
|
result="okbutempty"
|
|
|
@ -587,10 +553,10 @@ while [[ 1 == 1 ]]; do
|
|
|
|
timeout=0
|
|
|
|
timeout=0
|
|
|
|
blankresult=""
|
|
|
|
blankresult=""
|
|
|
|
while [[ $blankresult != "true" ]]; do
|
|
|
|
while [[ $blankresult != "true" ]]; do
|
|
|
|
/opt/kde3/bin/kdmctl -g activate $udisplay
|
|
|
|
/opt/trinity/bin/kdmctl -g activate $udisplay
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface enable true"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface enable true"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface lock"
|
|
|
|
su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface lock"
|
|
|
|
blankresult=$(su $smartcard_username -c "export DISPLAY=$udisplay; /opt/kde3/bin/dcop kdesktop KScreensaverIface isBlanked")
|
|
|
|
blankresult=$(su $smartcard_username -c "export DISPLAY=$udisplay; /opt/trinity/bin/dcop kdesktop KScreensaverIface isBlanked")
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
blankresult="true"
|
|
|
|
blankresult="true"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|