#!/bin/sh
IN=/tmp/in.fifo
OUT=/tmp/out.fifo
# fork the kinit process
empty -f -i $IN -o $OUT kinit administrator
# wait to see "@iihtman:", then send "Pass123\n",
# and timeout after 5 seconds
empty -w -t5 -i $OUT -o $IN "@iihtman:" "Pass123\n"
# renew the ticket to verify success
kinit -R #2> /dev/null
if [ $? -eq 0 ]; then
# do something with valid ticket
echo Yay
else
# kerberos auth failed
echo Boo
fi
kdestroy #2> /dev/null
rm $IN $OUT > /dev/null 2>&1
|