<?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: shadow MD5 hashed passwords in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221876#M327547</link>
    <description>Sorry, for bothering you Matti.&lt;BR /&gt;Too kind of you to refer me to the Tomcat Realm Doc.&lt;BR /&gt;I will be reading this and hope that I will find the answers there...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ralph</description>
    <pubDate>Thu, 26 Jun 2008 07:44:21 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2008-06-26T07:44:21Z</dc:date>
    <item>
      <title>shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221871#M327542</link>
      <description>&lt;!--!*#--&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;though the following was exercised on a Linux box (in which case the ITRC Linux Forum would have been the right place to post this, but attention here seems higher ;-)&lt;BR /&gt;I hope the HP-UX Forum is equally suited,&lt;BR /&gt;especially since HP for quite a while now have been issuing a supported shadow passwd depot for HP-UX, if I remember correctly.&lt;BR /&gt;&lt;BR /&gt;Actually, my main objective is to provide MD5 or SHA hashed password strings for a Tomcat, rather than storing clear text passwords in the notorious tomcat-users.xml file.&lt;BR /&gt;But before this is going to work I will have to assure that my hash strings are encrypted correctly.&lt;BR /&gt;So I just use /etc/shadow entries for comparison here.&lt;BR /&gt;&lt;BR /&gt;From man shadow I read that a leading $1$ indicates that the following hash wasn't produced by (DES) crypt() but MD5 algorithm instead. It also reads in the manpage that the used characters must be out of the Base64 character set.&lt;BR /&gt;&lt;BR /&gt;So I compared with this user account&lt;BR /&gt;&lt;BR /&gt;# getent shadow nagios|cut -d: -f2&lt;BR /&gt;!!&lt;BR /&gt;&lt;BR /&gt;i.e. no passwd set, so let's set it to "nagios" likewise&lt;BR /&gt;&lt;BR /&gt;# passwd nagios&lt;BR /&gt;Changing password for user nagios.&lt;BR /&gt;New UNIX password: &lt;BR /&gt;BAD PASSWORD: it is based on a dictionary word&lt;BR /&gt;Retype new UNIX password: &lt;BR /&gt;passwd: all authentication tokens updated successfully.&lt;BR /&gt; &lt;BR /&gt;# getent shadow nagios|cut -d: -f2&lt;BR /&gt;$1$jhHJZ.FL$XTPM.rY2UlDsJL6lhbmrj0&lt;BR /&gt;&lt;BR /&gt;But when I try to reproduce this (aided by a handy Perl module) I get a totally deviating hash.&lt;BR /&gt;&lt;BR /&gt;# perl -MDigest::MD5=md5_base64 -le 'print md5_base64("nagios")'&lt;BR /&gt;DrCjjPvPd5heTSgbeMwzNg&lt;BR /&gt;&lt;BR /&gt;I also copied and pasted this string while editing /etc/shadow manually.&lt;BR /&gt;But of course this didn't work when trying to login.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2008 05:21:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221871#M327542</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-06-25T05:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221872#M327543</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;There are some really hot Linux people in the Linux forums that don't read this forums.&lt;BR /&gt;&lt;BR /&gt;I've looked at the shadow password depot for HP-UX. It appears to function like Linux.&lt;BR /&gt;&lt;BR /&gt;I'm not sure about the dictionary check because that comes from cracklib, which is a Linux utility that checks passwords for dictionary words. It even nails commonly used Hebrew phrases.&lt;BR /&gt;&lt;BR /&gt;You seem to be trying to duplicate functionality in a script that is provided through standard system commands like passwd, which is already wired into crack with appropriate encryption.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 25 Jun 2008 06:15:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221872#M327543</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2008-06-25T06:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221873#M327544</link>
      <description>The encrypted password string is not just a simple MD5 hash of the password: it also contains a "salt" value which is generated randomly each time a password is set. If the salt was not used, attacking the password encryption would be much easier.&lt;BR /&gt;&lt;BR /&gt;Without the salt, any possible password would only have exactly 1 matching encrypted form. It would be easy to pre-calculate a dictionary of encryptions of most common passwords.&lt;BR /&gt;&lt;BR /&gt;With the 8-character salt, any password has 64^8 = about 280 000 000 000 000 possible encryptions: for an effective dictionary attack, the dictionary would have to list all the possible forms _for each password candidate_.&lt;BR /&gt;&lt;BR /&gt;"man 3 crypt" has this in the NOTES chapter:&lt;BR /&gt;-------------&lt;BR /&gt;Glibc Notes&lt;BR /&gt;The glibc2 version of this function has the following additional features. If salt is a character string starting with the three characters "$1$" followed by at most eight characters, and optionally terminated by "$",  then instead of using the DES machine, the glibc crypt function uses an MD5-based algorithm, and outputs up to 34 bytes, namely  "$1$&lt;SALT&gt;$&lt;ENCODED&gt;", where "&lt;SALT&gt;" stands for the up to 8 characters following "$1$" in the salt, and "&lt;ENCODED&gt;" is a further 22 characters.  The characters in "&lt;SALT&gt;" and "&lt;ENCODED&gt;" are drawn from the set [aâ  zAâ  Z0â  9./]. The entire key is significant here (instead of only the first 8 bytes).&lt;BR /&gt;-----------&lt;BR /&gt;&lt;BR /&gt;In most Linux systems, the actual authentication happens through the PAM libraries (usually libpam_unix.so), making the code in glibc redundant. &lt;BR /&gt;&lt;BR /&gt;Some Linux distributions (e.g. Debian) offer a libpam_unix2.so library, which can use the Blowfish algorithm in addition to MD5. If Blowfish hashing is used, the password has a leading $2$.&lt;BR /&gt;&lt;BR /&gt;MK&lt;/ENCODED&gt;&lt;/SALT&gt;&lt;/ENCODED&gt;&lt;/SALT&gt;&lt;/ENCODED&gt;&lt;/SALT&gt;</description>
      <pubDate>Wed, 25 Jun 2008 07:11:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221873#M327544</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2008-06-25T07:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221874#M327545</link>
      <description>Hi Matti,&lt;BR /&gt;&lt;BR /&gt;from having used the Perl implementation of (DES) crypt several times I knew about the existence of the salt.&lt;BR /&gt;I was simply using the wrong Perl module.&lt;BR /&gt;Whereas, this one encrypts the string as found in /etc/shadow&lt;BR /&gt;&lt;BR /&gt;# getent shadow nagios|cut -d: -f2&lt;BR /&gt;$1$jhHJZ.FL$XTPM.rY2UlDsJL6lhbmrj0&lt;BR /&gt; &lt;BR /&gt;# perl -MCrypt::PasswdMD5 -le 'print unix_md5_crypt("nagios","jhHJZ.FL")'&lt;BR /&gt;$1$jhHJZ.FL$XTPM.rY2UlDsJL6lhbmrj0&lt;BR /&gt;&lt;BR /&gt;Thanks for the reminder.&lt;BR /&gt;&lt;BR /&gt;Btw, do you know what kind of encrypted string the tomcat-users.xml file would expect?&lt;BR /&gt;In the example I've found so far in my Apache Tomcat book it looks like a hex string,&lt;BR /&gt;but no separator that would identify a possible salt substring.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2008 08:05:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221874#M327545</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-06-25T08:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221875#M327546</link>
      <description>Hmm. Apparently Tomcat does something other than "Unix-style MD5 password hashing".&lt;BR /&gt;&lt;BR /&gt;See:&lt;BR /&gt;&lt;A href="http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html" target="_blank"&gt;http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Apparently this command would produce a hashed password that would be appropriate for Tomcat:&lt;BR /&gt;&lt;BR /&gt;java org.apache.catalina.realm.RealmBase \&lt;BR /&gt;    -a {algorithm} {cleartext-password}&lt;BR /&gt;&lt;BR /&gt;(Disclaimer: I don't currently maintain any Tomcat installations beyond the OS level. This information was gained by Googling with "site:tomcat.apache.org tomcat-users.xml" and eyeballing the first few hits. Not tested in any fashion.)&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Wed, 25 Jun 2008 11:52:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221875#M327546</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2008-06-25T11:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221876#M327547</link>
      <description>Sorry, for bothering you Matti.&lt;BR /&gt;Too kind of you to refer me to the Tomcat Realm Doc.&lt;BR /&gt;I will be reading this and hope that I will find the answers there...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ralph</description>
      <pubDate>Thu, 26 Jun 2008 07:44:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221876#M327547</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-06-26T07:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221877#M327548</link>
      <description>&lt;!--!*#--&gt;Addendum,&lt;BR /&gt;after having listed the contents of all Tomcat supplied jar files in a loop and parsed for the missing class definition error messages by the JVM on invocation iteratively, I finally arrived at the required classpath in order to successfully submit the stated method call to produce password hashes suitable for Tomcat.&lt;BR /&gt;Why didn't the authors of the Tomcat Realm Doc mention which classpath the method invocation would require?&lt;BR /&gt;Here is what finally worked for my particular Tomcat installation:&lt;BR /&gt;&lt;BR /&gt;$ /usr/java/jre1.5.0_12/bin/java -cp /var/www/tomcat/current/server/lib/catalina.jar:/var/www/tom&lt;BR /&gt;cat/current/bin/commons-logging-api.jar org.apache.catalina.realm.RealmBase -a sha secret&lt;BR /&gt;secret:e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Jun 2008 12:21:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221877#M327548</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-06-26T12:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: shadow MD5 hashed passwords</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221878#M327549</link>
      <description>&lt;!--!*#--&gt;Btw, unlike the salted Unix MD5 password hash&lt;BR /&gt;this Java method merely produces an ordinary hex MD5 digest, as can be seen from comparison to the Perl Digest::MD5::md5_hex() invocation.&lt;BR /&gt;Oh my, I rather prefer Perl's ease and terseness.&lt;BR /&gt;&lt;BR /&gt;$ /usr/java/jre1.5.0_12/bin/java -cp /var/www/tomcat/current/server/lib/catalina.jar:/var/www/tom&lt;BR /&gt;cat/current/bin/commons-logging-api.jar org.apache.catalina.realm.RealmBase -a md5 secret&lt;BR /&gt;secret:5ebe2294ecd0e0f08eab7690d2a6ee69&lt;BR /&gt; &lt;BR /&gt;$ perl -MDigest::MD5=md5_hex -le 'print md5_hex(q{secret})'&lt;BR /&gt;5ebe2294ecd0e0f08eab7690d2a6ee69&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Jun 2008 12:28:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shadow-md5-hashed-passwords/m-p/4221878#M327549</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-06-26T12:28:56Z</dc:date>
    </item>
  </channel>
</rss>

