<?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 validation in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260880#M888530</link>
    <description>Does a hog like slop?&lt;BR /&gt;&lt;BR /&gt;If you wantr to do this in a scripting language the answer is Perl. Note that the UNIX crypt function is actually a hash so that the process is not reversible. The idea is that you pass in the plaintext passwd as the first argument to crypt and the first two characters (the salt) of the stored passwd hash to the crypt function to produce a new hash. If this hash is identical to the original hash, the passwd's match. Perl's crypt function automatically ignore anything pass the first 2 characters for the salt argument. Man perlfunc and look at the crypt function for more details. &lt;BR /&gt;&lt;BR /&gt;Attached is a 3 minute example. It returns 0 for ok and non-zero for anything else.&lt;BR /&gt;&lt;BR /&gt;pwtest.pl&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "All ok"&lt;BR /&gt;else&lt;BR /&gt;  echo "You be bad"&lt;BR /&gt;fi&lt;BR /&gt;</description>
    <pubDate>Tue, 27 Apr 2004 17:05:08 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2004-04-27T17:05:08Z</dc:date>
    <item>
      <title>password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260877#M888527</link>
      <description>I need to validate a unix system user in a script, against the userid and password pair he/she enters when the script interactively asks but I am not sure how to encrypt the clear password to make the comparison to the encrypted version in the trusted system user database. Script will run with uid-0 privileges, so accessing the file containing the password will not be a problem. But I could not figure out how to encrypt the password. &lt;BR /&gt;&lt;BR /&gt;Any help is greatly appreciated</description>
      <pubDate>Tue, 27 Apr 2004 16:22:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260877#M888527</guid>
      <dc:creator>KSB_1</dc:creator>
      <dc:date>2004-04-27T16:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260878#M888528</link>
      <description>You can use the C function, crypt() for this. If you have the hp-ux 11i security book by Chris Wong, it goes into this in Chapter 2.&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Tue, 27 Apr 2004 16:45:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260878#M888528</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-04-27T16:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260879#M888529</link>
      <description>unfortuantely I do not have this book and likelihood that I can lay my hands on it is slim to none in the near future.&lt;BR /&gt;&lt;BR /&gt;is there any other way ?</description>
      <pubDate>Tue, 27 Apr 2004 16:58:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260879#M888529</guid>
      <dc:creator>KSB_1</dc:creator>
      <dc:date>2004-04-27T16:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260880#M888530</link>
      <description>Does a hog like slop?&lt;BR /&gt;&lt;BR /&gt;If you wantr to do this in a scripting language the answer is Perl. Note that the UNIX crypt function is actually a hash so that the process is not reversible. The idea is that you pass in the plaintext passwd as the first argument to crypt and the first two characters (the salt) of the stored passwd hash to the crypt function to produce a new hash. If this hash is identical to the original hash, the passwd's match. Perl's crypt function automatically ignore anything pass the first 2 characters for the salt argument. Man perlfunc and look at the crypt function for more details. &lt;BR /&gt;&lt;BR /&gt;Attached is a 3 minute example. It returns 0 for ok and non-zero for anything else.&lt;BR /&gt;&lt;BR /&gt;pwtest.pl&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "All ok"&lt;BR /&gt;else&lt;BR /&gt;  echo "You be bad"&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Apr 2004 17:05:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260880#M888530</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-27T17:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260881#M888531</link>
      <description>The Script is running with SUID Bit to root - correct ?&lt;BR /&gt;&lt;BR /&gt;In this case here a shell script part, which could solve it:&lt;BR /&gt;&lt;BR /&gt;USER=$(who am i)    # should return the real logged in user / not sure if you need to i.e. cut -c1-8 &lt;BR /&gt;su bin -c "su $user -c \"true\"" ; OK=$?&lt;BR /&gt;  # as bin the user HAS to enter the password&lt;BR /&gt;if [ "$OK" != 0 ]&lt;BR /&gt;then&lt;BR /&gt;   # su failed&lt;BR /&gt;   echo "Errormessage"&lt;BR /&gt;   exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# rest of your script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$(logname) can work instead to $(who am i) as well.</description>
      <pubDate>Tue, 27 Apr 2004 17:16:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260881#M888531</guid>
      <dc:creator>Juergen Tappe</dc:creator>
      <dc:date>2004-04-27T17:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260882#M888532</link>
      <description>Thank you.&lt;BR /&gt;pwtest.pl did the trick&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Apr 2004 17:35:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260882#M888532</guid>
      <dc:creator>KSB_1</dc:creator>
      <dc:date>2004-04-27T17:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260883#M888533</link>
      <description>Be careful.  'trusted system user database' is a key here.  In trusted systems, passwords can be much longer than the usual 8 characters.  See the differences between crypt() and bigcrypt().&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Apr 2004 02:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260883#M888533</guid>
      <dc:creator>doug hosking</dc:creator>
      <dc:date>2004-04-28T02:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260884#M888534</link>
      <description>Well, more problems encountered while I was trying to incorporate this into my general solution and I think this is mainly due to my perl instance but not being proficient (read as novice) in perl, I am not sure where to look. Here is the problem :&lt;BR /&gt;&lt;BR /&gt;pwtest.pl is in /usr/contrib/bin as follows :&lt;BR /&gt;&lt;BR /&gt;[/home/mortaluser]$ ll /usr/contrib/bin/pwtest.pl&lt;BR /&gt;-rws--x--x   1 root       sys            498 Apr 28 11:27 /usr/contrib/bin/pwtest.pl&lt;BR /&gt;[/home/mortaluser]$ /usr/contrib/bin/pwtest.pl&lt;BR /&gt;YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!&lt;BR /&gt;FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!&lt;BR /&gt;&lt;BR /&gt;I hopelessly tried to put a shell script like the one below, placed in the same /usr/contrib/bin directory:&lt;BR /&gt;[/home/mortaluser]$ cat /usr/contrib/bin/pwtest_wrapper.sh&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;#file: pwtest_wrapper.sh&lt;BR /&gt;&lt;BR /&gt;/usr/contrib/bin/pwtest.pl&lt;BR /&gt;result=`echo $?`&lt;BR /&gt;echo " "&lt;BR /&gt;&lt;BR /&gt;if [ $result -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "user validated OK!"&lt;BR /&gt;else&lt;BR /&gt;echo "user credentials NO GOOD!"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;[/home/mortaluser]$ ll /usr/contrib/bin/pwtest_wrapper.sh&lt;BR /&gt;-rws--x--x   1 root       sys            163 Apr 29 08:38 /usr/contrib/bin/pwtest_wrapper.sh&lt;BR /&gt;[/home/mortaluser]$ /usr/contrib/bin/pwtest_wrapper.sh&lt;BR /&gt;YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!&lt;BR /&gt;FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have no clue what this means or how to work around it. Again any help is greatly appreciated in advance.&lt;BR /&gt;&lt;BR /&gt;Also, I will not be able to recompile perl and wreak havoc on already running applications dependent on perl as a side note.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Apr 2004 13:51:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260884#M888534</guid>
      <dc:creator>KSB_1</dc:creator>
      <dc:date>2004-04-29T13:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260885#M888535</link>
      <description>before I forget, a kernel change can happen on the day hell freezes over (or at least it seems that far away from today). So whatever bit was not set in kernel and sounds like it can fix my problem is not likely to happen anytime soon.</description>
      <pubDate>Thu, 29 Apr 2004 13:52:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260885#M888535</guid>
      <dc:creator>KSB_1</dc:creator>
      <dc:date>2004-04-29T13:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260886#M888536</link>
      <description>The "kernel" here does not refer to the system kernel but rather the "kernel" Perl (executable) code. Your mistake was trying to make a Perl script a setuid script. Perl goes to great lengths to not let this work. Bear in mind, setuid for a shell script only has meaning to the shell executable because a shell script is not an executable. Because the passwd file must be readable by all, if all you are trying to do is verify a user then this will work. Get rid of the setuid bit.&lt;BR /&gt;&lt;BR /&gt;I really wish that this feature was not supported in the Shell because it is a glaring security hole.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Apr 2004 14:00:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260886#M888536</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-29T14:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260887#M888537</link>
      <description>Clay, newer HP-UX releases have a kernel tunable called 'secure_sid_scripts' that can be used to control whether setuid scripts are supported. As you note they can be a large security hole. Unfortunately I don't think there has been a PA-RISC release with this but it's in 11.22 and 11.23 and should be in the next version that supports PA-RISC.</description>
      <pubDate>Thu, 29 Apr 2004 14:14:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260887#M888537</guid>
      <dc:creator>doug hosking</dc:creator>
      <dc:date>2004-04-29T14:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: password validation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260888#M888538</link>
      <description>Yes, I'm well aware of that; it's just that setuid shell scripts were state-of-the-art stupid from the get-go --- they should have never been allowed. Setuid and setgid programs definitely have their place; that place just shouldn't include scripting languages.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Apr 2004 14:21:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-validation/m-p/3260888#M888538</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-29T14:21:03Z</dc:date>
    </item>
  </channel>
</rss>

