Operating System - HP-UX
1830992 Members
2589 Online
110018 Solutions
New Discussion

Re: trusted system question

 
SOLVED
Go to solution
Charles McCary
Valued Contributor

trusted system question

Hi - I've got trusted system setup, and I've defined (through sam) that passwords will expire in 45 days. I'm looking for some way to tell when a password for a given account will expire. I've looked in the individual tcb files, but I don't see things like ulife.

I want to be able to script something to email when a password is getting close to expiring.

Here's an example of one id's auth file:
:u_name=[username]:u_id#600:\
:u_pwd=xqnwLah2e.DlY:\
:u_auditid#29:\
:u_auditflag#1:\
:u_succhg#1120567895:u_unsucchg#1121279523:u_pswduser=cemccary:u_suclog#1123684720:\
:u_suctty=tty:u_unsuclog#1122898756:u_unsuctty=tty:u_lock@:\
:chkent:

Here's the getprpw info for this same account:

uid=600, bootpw=NO, audid=29, audflg=1, mintm=-1, maxpwln=-1, exptm=-1, lftm=-1, spwchg=Tue Jul 5 07:51:35 2005, upwchg=Wed Jul 13 13:32:03 2005, acctexp=-1, llog=-1, expwarn=-1, usrpick=DFT, syspnpw=DFT, rstrpw=DFT, nullpw=DFT, admnum=-1, syschpw=DFT, sysltpw=DFT, timeod=-1, slogint=Wed Aug 10 09:38:40 2005, ulogint=Mon Aug 1 07:19:16 2005, sloginy=tty, culogin=-1, uloginy=tty, umaxlntr=-1, alock=NO, lockout=0000000


Do I have something set up incorrectly? Any thoughts?
3 REPLIES 3
Pete Randall
Outstanding Contributor
Solution

Re: trusted system question

Mel Burslan
Honored Contributor

Re: trusted system question

USER=someusername;U=`echo $USER |cut -c1`
exp=$(logins -x -l $USER | tail -1 | awk '{print $4}')
((exp_time = exp * 86400))
last_change=$(grep u_succhg /tcb/files/auth/$U/$USER | \
awk -F "u_succhg#" ' {print $2}' |\
awk -F ":" ' {print $1}' )

((exp_date = last_change + exp_time))
((time_left = exp_date - current_time))
((days_left = time_left / 86400))

we use this code snippet in a larger script to scan upcoming password expirations and email our users, as tehy seem to be quite forgetful about this unfortunate event.

Hope this helps
________________________________
UNIX because I majored in cryptology...
Charles McCary
Valued Contributor

Re: trusted system question

xf