pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Encrypted Passwords
7+ messages / 4 participants
[nested] [flat]

* Encrypted Passwords
@ 2003-01-10 06:49  Rob Abernethy IV <abernethy@dynedge.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Rob Abernethy IV @ 2003-01-10 06:49 UTC (permalink / raw)
  To: pgsql-admin

How does postgres calculate the MD5 version of a password to store in the 
database during user creation?  I am trying to set up a postgres JDBCRealm to 
work with Tomcat.  The problem is that the resulting digest from Java is 
different then the digest stored in the database for the same word.

clear-text: tomcat
java: 1b359d8753858b55befa0441067aaed3
postgres: md5efcc1c51a80be13b59cdb96d758a0184

--
Robert Abernethy IV
Dynamic Edge, Inc.
734.975.0460



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Encrypted Passwords
@ 2003-01-10 07:47  Rob Abernethy IV <abernethy@dynedge.com>
  parent: Rob Abernethy IV <abernethy@dynedge.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Rob Abernethy IV @ 2003-01-10 07:47 UTC (permalink / raw)
  To: pgsql-admin

Perl also came up with the same digest as Java.

--
Robert Abernethy IV
Dynamic Edge, Inc.
734.975.0460

> How does postgres calculate the MD5 version of a password to store 
> in the database during user creation?  I am trying to set up a 
> postgres JDBCRealm to work with Tomcat.  The problem is that the 
> resulting digest from Java is different then the digest stored in 
> the database for the same word.
> 
> clear-text: tomcat
> java: 1b359d8753858b55befa0441067aaed3
> postgres: md5efcc1c51a80be13b59cdb96d758a0184
> 
> --
> Robert Abernethy IV
> Dynamic Edge, Inc.
> 734.975.0460
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Encrypted Passwords
@ 2003-01-10 21:10  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Rob Abernethy IV <abernethy@dynedge.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Bruce Momjian @ 2003-01-10 21:10 UTC (permalink / raw)
  To: Rob Abernethy IV <abernethy@dynedge.com>; +Cc: pgsql-admin

Rob Abernethy IV wrote:
> How does postgres calculate the MD5 version of a password to store in the 
> database during user creation?  I am trying to set up a postgres JDBCRealm to 
> work with Tomcat.  The problem is that the resulting digest from Java is 
> different then the digest stored in the database for the same word.
> 
> clear-text: tomcat
> java: 1b359d8753858b55befa0441067aaed3
> postgres: md5efcc1c51a80be13b59cdb96d758a0184

What did you use as salt?  PostgreSQL users the user name as salt.
When I run /contrib/pgcrypto's MD5 I get the same value as PostgreSQL.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Encrypted Passwords
@ 2003-01-13 01:53  Rob Abernethy IV <abernethy@dynedge.com>
  parent: Rob Abernethy IV <abernethy@dynedge.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Rob Abernethy IV @ 2003-01-13 01:53 UTC (permalink / raw)
  To: pgsql-admin

Can you tell postgres *NOT* to use a salt when calculating the MD5 digest?  I
found that it prepends the username to the password before making the calculation.

--
Robert Abernethy IV
Dynamic Edge, Inc.
734.975.0460

> Perl also came up with the same digest as Java.
> 
> --
> Robert Abernethy IV
> Dynamic Edge, Inc.
> 734.975.0460
> 
> > How does postgres calculate the MD5 version of a password to store
> > in the database during user creation?  I am trying to set up a
> > postgres JDBCRealm to work with Tomcat.  The problem is that the
> > resulting digest from Java is different then the digest stored in
> > the database for the same word.
> >
> > clear-text: tomcat
> > java: 1b359d8753858b55befa0441067aaed3
> > postgres: md5efcc1c51a80be13b59cdb96d758a0184
> >
> > --
> > Robert Abernethy IV
> > Dynamic Edge, Inc.
> > 734.975.0460
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Encrypted Passwords
@ 2003-01-13 02:47  Rob Abernethy IV <abernethy@dynedge.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: Rob Abernethy IV @ 2003-01-13 02:47 UTC (permalink / raw)
  To: pgsql-admin

Well, actually I *do* want to.  My goal is to be able to use my existing set
of database users to authenticate to web apps running in Tomcat.  Tomcat
allows you to set up a JDBC Realm for authentication, which lets you connect
to a database and use usernames and passwords from that database.  The problem
is that Tomcat computes the digest without a salt and, therefore,
authentication is failing because the two digested versions of the same
password are different.

Has anyone else used postgres to set up a JDBC Realm?  Can anyone suggest any
alternatives?

--
Robert Abernethy IV
Dynamic Edge, Inc.
734.975.0460


> "Rob Abernethy IV" <abernethy@dynedge.com> writes:
> > Can you tell postgres *NOT* to use a salt when calculating the MD5
> > digest?
> 
> No, and you wouldn't want to.  The salt is an essential security
> feature.
> 
> 			regards, tom lane





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Encrypted Passwords
@ 2003-01-13 15:38  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Rob Abernethy IV <abernethy@dynedge.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2003-01-13 15:38 UTC (permalink / raw)
  To: Rob Abernethy IV <abernethy@dynedge.com>; +Cc: pgsql-admin

"Rob Abernethy IV" <abernethy@dynedge.com> writes:
> Can you tell postgres *NOT* to use a salt when calculating the MD5
> digest?

No, and you wouldn't want to.  The salt is an essential security
feature.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Encrypted Passwords
@ 2003-01-13 20:11  Tim Ellis <pvspam-postgres@hacklab.net>
  parent: Rob Abernethy IV <abernethy@dynedge.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Tim Ellis @ 2003-01-13 20:11 UTC (permalink / raw)
  To: Rob Abernethy IV <abernethy@dynedge.com>; +Cc: pgsql-admin

> The problem
> is that Tomcat computes the digest without a salt and, therefore,
> authentication is failing because the two digested versions of the same
> password are different.

If there is not a feature within Tomcat to allow adding the username as
a salt to the MD5 hash, then Tomcat is broken. This is so common, I
cannot imagine any product bothering to implement MD5 hashing without
allowing a fairly generic salting API call.

Thankfully, Tomcat comes with source, so it can be fixed if, indeed, it
is broken.

Do not waste any energy trying to get Postgres to not salt the hash,
you'd be using energy ruining one product instead of fixing another.

--
Tim Ellis
Senior Database Architect





^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2003-01-13 20:11 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-10 06:49 Encrypted Passwords Rob Abernethy IV <abernethy@dynedge.com>
2003-01-10 07:47 ` Rob Abernethy IV <abernethy@dynedge.com>
2003-01-13 01:53   ` Rob Abernethy IV <abernethy@dynedge.com>
2003-01-13 15:38     ` Tom Lane <tgl@sss.pgh.pa.us>
2003-01-13 02:47       ` Rob Abernethy IV <abernethy@dynedge.com>
2003-01-13 20:11         ` Tim Ellis <pvspam-postgres@hacklab.net>
2003-01-10 21:10 ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox