<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Password expiry details on trusted system in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860767#M396502</link>
    <description>Cheers</description>
    <pubDate>Wed, 02 Nov 2005 11:01:12 GMT</pubDate>
    <dc:creator>Daniel Neeves</dc:creator>
    <dc:date>2005-11-02T11:01:12Z</dc:date>
    <item>
      <title>Password expiry details on trusted system</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860762#M396497</link>
      <description>Our environment is as follows; hpux 11i with F-secure ssh 3.3.0 , The issue is we do not get informed of any password expiry warnings when logging on using an ssh client be it windows or unix. As I understand it these message are not available unless we use HP's Openssh which at present is not an option. What we need is how to get details on when a users password is going to expire, then we can script it to give us a nice mail every day informing us something along the lines of "root users password expires DDMMYYYY". I've seen other thread's on here about the same subject but I couldn't find an answer that worked, Any ideas people ??</description>
      <pubDate>Tue, 14 Sep 2004 11:32:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860762#M396497</guid>
      <dc:creator>Daniel Neeves</dc:creator>
      <dc:date>2004-09-14T11:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Password expiry details on trusted system</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860763#M396498</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Take a look at this thread from itrc. There is a neat script that notifies the expiration date for all the ids on the server .&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000074740865" target="_blank"&gt;http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000074740865&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The itrc doc id is USECKBAN00000934.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Sep 2004 11:42:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860763#M396498</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2004-09-14T11:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Password expiry details on trusted system</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860764#M396499</link>
      <description>I happened to work on a very similar requirement. &lt;BR /&gt;&lt;BR /&gt;Find below the draft version of the script.&lt;BR /&gt;&lt;BR /&gt;NOTE: The script is NOT tested at all. Might even have some blunders :-). You can just use this as a "base" and take it from there.&lt;BR /&gt;&lt;BR /&gt;============================================function last_set_DAY &lt;BR /&gt;{&lt;BR /&gt;LSPWCHG=$1&lt;BR /&gt;&lt;BR /&gt;THISYEAR=$(date "+%Y")&lt;BR /&gt;&lt;BR /&gt;MONTH=$(echo $LSPWCHG | cut -d" " -f2 )&lt;BR /&gt;DAY=$(echo $LSPWCHG | cut -d" " -f3 )&lt;BR /&gt;YEAR=$(echo $LSPWCHG | cut -d" " -f5 )&lt;BR /&gt;&lt;BR /&gt;# calculate number of days in the pw change year&lt;BR /&gt;#&lt;BR /&gt;if (( YEAR % 4 == 0 ))    #IS THIS A LEAP YEAR?&lt;BR /&gt;then&lt;BR /&gt;   JULIEAP=1   #SET DAY OF YR&lt;BR /&gt;else&lt;BR /&gt;   JULIEAP=0&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;case $MONTH in&lt;BR /&gt;    Jan) MMOUNT=0;;&lt;BR /&gt;    Feb) MMOUNT=31;;&lt;BR /&gt;    Mar) (( MMOUNT = 59 + JULIEAP ));;&lt;BR /&gt;    Apr) (( MMOUNT = 90 + JULIEAP ));;&lt;BR /&gt;    May) (( MMOUNT = 120 + JULIEAP ));;&lt;BR /&gt;    Jun) (( MMOUNT = 151 + JULIEAP ));;&lt;BR /&gt;    Jul) (( MMOUNT = 181 + JULIEAP ));;&lt;BR /&gt;    Aug) (( MMOUNT = 212 + JULIEAP ));;&lt;BR /&gt;    Sep) (( MMOUNT = 243 + JULIEAP ));;&lt;BR /&gt;    Oct) (( MMOUNT = 273 + JULIEAP ));;&lt;BR /&gt;    Nov) (( MMOUNT = 304 + JULIEAP ));;&lt;BR /&gt;    Dec) (( MMOUNT = 334 + JULIEAP ));;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;(( COUNTMONTH = MMOUNT + $DAY ))&lt;BR /&gt;&lt;BR /&gt;# add number of DAY up to this YEAR&lt;BR /&gt;#&lt;BR /&gt;COUNTDAYS=0&lt;BR /&gt;while (( YEAR &amp;lt; THISYEAR ))&lt;BR /&gt;do&lt;BR /&gt;    (( COUNTDAYS = COUNTDAYS + 365 ))&lt;BR /&gt;    if (( YEAR % 4 == 0 )) #IS THIS A LEAP YEAR?&lt;BR /&gt;    then&lt;BR /&gt;        (( COUNTDAYS = COUNTDAYS + 1 ))&lt;BR /&gt;    fi&lt;BR /&gt;    (( YEAR = YEAR + 1))&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;(( COUNTDAYS = COUNTDAYS + $COUNTMONTH ))&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#################&lt;BR /&gt;# &lt;BR /&gt;# Main&lt;BR /&gt;#  &lt;BR /&gt;#################&lt;BR /&gt;&lt;BR /&gt;if [ -r /usr/local/etc/system_roles ] ; then&lt;BR /&gt;    . /usr/local/etc/system_roles&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;#################&lt;BR /&gt;#&lt;BR /&gt;# Figure out the FQDN of the system&lt;BR /&gt;#&lt;BR /&gt;#################&lt;BR /&gt;&lt;BR /&gt;SYSTEM=$(hostname | nslookup 2&amp;gt; /dev/null | grep Name: | cut -c10-)&lt;BR /&gt;SENDER=${SysMgs}&lt;BR /&gt;&lt;BR /&gt;export EXPIRE=2&lt;BR /&gt;LOCKED=0&lt;BR /&gt;SENDMSG=1&lt;BR /&gt;DISABLED=0&lt;BR /&gt;&lt;BR /&gt;awk -F":" '{print $1}' /etc/passwd | xargs -n1 | while read USER&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  echo "$USER" | egrep -q "^smbnull$|^adm$|^bin$|^sys$|^daemon$|^uucp$|^lp$|^nuucp$|^hpdb$|^www$|^soeadm$"&lt;BR /&gt;&lt;BR /&gt;  [[ $? -eq 0 ]] &amp;amp;&amp;amp; continue&lt;BR /&gt; &lt;BR /&gt;  ################&lt;BR /&gt;  #&lt;BR /&gt;  # Find out the password expiry setting for the user&lt;BR /&gt;  #&lt;BR /&gt;  ################&lt;BR /&gt;&lt;BR /&gt;  EXPTM=$(/usr/lbin/getprpw -l -r -m exptm $USER)&lt;BR /&gt;  if [ -z "$EXPTM" ] ; then EXPTM=0 ; fi&lt;BR /&gt;&lt;BR /&gt;  case $EXPTM in&lt;BR /&gt;  0|-1) &lt;BR /&gt;        if [ "$EXPIRE" -gt "0" ] ; then&lt;BR /&gt;         echo "password for user $USER has not expired" &lt;BR /&gt;        fi&lt;BR /&gt;        ;;&lt;BR /&gt;  *)    if [ "$EXPIRE" != "1" ] ; then&lt;BR /&gt;        EXPWARN=$(/usr/lbin/getprpw -l -r -m expwarn $USER)&lt;BR /&gt;        SPWCHG=$(/usr/lbin/getprpw -l -r -m spwchg $USER)&lt;BR /&gt;        LFTM=$(/usr/lbin/getprpw -l -r -m lftm $USER)&lt;BR /&gt;&lt;BR /&gt;        if [ "$SPWCHG" = "Thu Jan  1 01:00:00 1970" -a "$DISABLED" = "0" ] ; then&lt;BR /&gt;            echo "user $user never loged in!"&lt;BR /&gt;            continue&lt;BR /&gt;        fi&lt;BR /&gt;        if [ "$spwchg" = "-1" -a "$disabled" = "0" ] ; then&lt;BR /&gt;            echo "user $user never loged in - date not defined"&lt;BR /&gt;            continue&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;        last_set_day "$SPWCHG" &lt;BR /&gt;        days_last_set=$COUNTDAYS&lt;BR /&gt;        (( CALC_DATE = COUNTDAYS + $EXPTM ))&lt;BR /&gt;&lt;BR /&gt;        TODAY=$(date "+%c")&lt;BR /&gt;        last_set_day "$TODAY" &lt;BR /&gt;        DAYS_TODAY=$COUNTDAYS&lt;BR /&gt;&lt;BR /&gt;        (( EXP_DAYS = CALC_DATE - DAYS_TODAY ))&lt;BR /&gt;        (( EXP_MSG = EXP_DAYS - EXPWARN ))&lt;BR /&gt;&lt;BR /&gt;        if [ "$EXP_DAYS" -ge "$LFTM" ] ; then&lt;BR /&gt;                EXP_MSG="0"&lt;BR /&gt;                EXP_DAYS=-1&lt;BR /&gt;        fi&lt;BR /&gt;        if [ "$EXP_MSG" -le "0" ] ; then&lt;BR /&gt;          if [ "$EXP_DAYS" -lt "0" ] ; then&lt;BR /&gt;            echo "Warning: password for user $user has expired!" &lt;BR /&gt;          else&lt;BR /&gt;            if [ "$disabled" = "0" ] ; then&lt;BR /&gt;                echo "Warning: password for user $user expire in $exp_DAYs DAYs!" &lt;BR /&gt;            fi&lt;BR /&gt;          fi&lt;BR /&gt;          if [ "$SENDMSG" = "1" ] ; then&lt;BR /&gt;              (&lt;BR /&gt;                echo "From:        $Sender"&lt;BR /&gt;                echo "Return-Path: &amp;lt;$Sender&amp;gt;"&lt;BR /&gt;                echo "Subject:     Account ${USERNAME}@${SYSTEM} expire in $EXP_DAYS Days!\n"&lt;BR /&gt;                echo "Dear $USER\n"&lt;BR /&gt;                echo "your password expire in $EXP_DAYS Days!"&lt;BR /&gt;                echo "Please login to ${SYSTEM} to change the password. We recommend to use telnet.\n"&lt;BR /&gt;                echo "Regards        Unix Team"&lt;BR /&gt;              ) | sendmail $USER&lt;BR /&gt;          fi&lt;BR /&gt;        else&lt;BR /&gt;            if [ "$DISABLED" = "0" ] ; then&lt;BR /&gt;                echo "password for user $USER expire in $EXP_DAYS Days!" &lt;BR /&gt;            fi&lt;BR /&gt;        fi&lt;BR /&gt;        &lt;BR /&gt;      fi&lt;BR /&gt;      ;;&lt;BR /&gt;  esac&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;============================================&lt;BR /&gt;&lt;BR /&gt;I will also watch out to see if any of our forum folks has a better way of achieving the goal.</description>
      <pubDate>Tue, 14 Sep 2004 11:44:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860764#M396499</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2004-09-14T11:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Password expiry details on trusted system</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860765#M396500</link>
      <description>HI Daniel,&lt;BR /&gt;&lt;BR /&gt;I was about to implement this script when ssh mania started in our company as openssh versions were not supporting password expiry. I still had to develop it further but we don't need it now anymore.&lt;BR /&gt;&lt;BR /&gt;My idea was to&lt;BR /&gt;&lt;BR /&gt;1. Create a file say /etc/expirytab every day night at 12:00 AM. It's a comma seperated file with user, date of the last password change, date of expiry and days left before password expiry.&lt;BR /&gt;&lt;BR /&gt;2. Put a small script in /etc/profile and /etc/csh.login that does the following&lt;BR /&gt;&lt;BR /&gt;   a. Get the user.&lt;BR /&gt;   b. Get "how many days before the password expires from now" from /etc/expirytab&lt;BR /&gt;   c. Compare it against site 'notification policy' say 15. If it is less than the notification policy, then print a statement similar to standard notification message along with the other details like when the user changed the password, when the password will expire etc.,&lt;BR /&gt;&lt;BR /&gt;If you want you can even add code into 'script1' to send mails to the users.&lt;BR /&gt;&lt;BR /&gt;As you can see writing the script for 2 is very easy. So, I am not going to do it.&lt;BR /&gt;&lt;BR /&gt;For getting the expiry information, here is the script. You may need to add some checks like if the user file is not there etc., etc. otherwise 'awk' will hang.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;EXPIRE=60&lt;BR /&gt;NOW=$(/usr/contrib/bin/perl -e 'printf "%d\n",time()')&lt;BR /&gt;&lt;BR /&gt;if [ ! -d /tcb ]&lt;BR /&gt;then&lt;BR /&gt;echo "Only on trusted systems"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;rm -f /etc/expiry.tab&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for USER in $(logins|awk '{print $1}')&lt;BR /&gt;do&lt;BR /&gt;FIRST=`echo $USER|cut -c1`&lt;BR /&gt;USERFILE="/tcb/files/auth/${FIRST}/${USER}"&lt;BR /&gt;THEN=$(awk '/u_succhg/ {FS="u_succhg";print $2}' $USERFILE | awk '{FS=":";print $1}'|sed '&lt;BR /&gt;s/#//')&lt;BR /&gt;WHEN_CHANGED=$(echo 0d${THEN}=Y | adb)&lt;BR /&gt;&lt;BR /&gt;(( EXPIRES_ON_DATE = $THEN + ( $EXPIRE * 86400 ) ))&lt;BR /&gt;(( EXPIRES_IN_DAYS = ( $EXPIRES_ON_DATE - $NOW ) / 86400 ))&lt;BR /&gt;&lt;BR /&gt;EXPIRES_ON_DATE=$(echo 0d${EXPIRES_ON_DATE}=Y |adb)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo "$USER,$WHEN_CHANGED,$EXPIRES_ON_DATE,$EXPIRES_IN_DAYS" &amp;gt;&amp;gt; /etc/expirytab&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;PS: We compile our own openssh. The latest one 3.8.1p1 does do all kinds of password expiry stuff.</description>
      <pubDate>Tue, 14 Sep 2004 19:32:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860765#M396500</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-09-14T19:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Password expiry details on trusted system</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860766#M396501</link>
      <description>Cheers for your help guys all good suggestions, I've used the doc sanjay pointed me too and tailored it a bit.&lt;BR /&gt;&lt;BR /&gt;Cheers again</description>
      <pubDate>Wed, 15 Sep 2004 11:41:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860766#M396501</guid>
      <dc:creator>Daniel Neeves</dc:creator>
      <dc:date>2004-09-15T11:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Password expiry details on trusted system</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860767#M396502</link>
      <description>Cheers</description>
      <pubDate>Wed, 02 Nov 2005 11:01:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-details-on-trusted-system/m-p/4860767#M396502</guid>
      <dc:creator>Daniel Neeves</dc:creator>
      <dc:date>2005-11-02T11:01:12Z</dc:date>
    </item>
  </channel>
</rss>

