pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedconverting to MD5
3+ messages / 3 participants
[nested] [flat]
* converting to MD5
@ 2004-10-19 18:00 owenn panng <trilogy@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: owenn panng @ 2004-10-19 18:00 UTC (permalink / raw)
To: pgsql-jdbc
Hi there, I was wondering what is needed to done on both the postgres
& client side to connect via MD5. Right now, we are connecting fine
by just specifying password in pg_hba.conf:
host database user xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx password
But I would like to change this to use:
host database user xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx md5
I have the user stored in pg_shadow (note: the passwd listed is not
the real one):
usename | usesysid | usecreatedb | usesuper | usecatupd |
passwd | valuntil | useconfig
user | 100 | t | f | f |
md59033f409a99f207fa816b990467a9999 | |
On the client side, we are using pg74.215.jdbc2.jar with code based on
the example given on
http://jdbc.postgresql.org/documentation/pgjdbc.html
String url = "jdbc:postgresql://" + host + "/" + database;
try {
Class.forName("org.postgresql.Driver");
con =
DriverManager.getConnection(url, userID, password);
}
I can generate the same password that matches the one stored in
pg_shadow. So how do I specify that the password I am sending is in
MD5? Any help would be appreciated.
Thanks, O.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: converting to MD5
@ 2004-10-19 18:10 Kris Jurka <books@ejurka.com>
parent: owenn panng <trilogy@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Kris Jurka @ 2004-10-19 18:10 UTC (permalink / raw)
To: owenn panng <trilogy@gmail.com>; +Cc: pgsql-jdbc
On Tue, 19 Oct 2004, owenn panng wrote:
> I can generate the same password that matches the one stored in
> pg_shadow. So how do I specify that the password I am sending is in
> MD5? Any help would be appreciated.
You don't. The JDBC driver sends the database and user name it wants to
connect to to the server. The server sends back the password format to
use (if any) and the driver responds with the password in that format. So
there's nothing you need to do, you just specify the password in plain
text as normal.
Kris Jurka
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: converting to MD5
@ 2004-10-19 18:22 John R Pierce <pierce@hogranch.com>
parent: owenn panng <trilogy@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: John R Pierce @ 2004-10-19 18:22 UTC (permalink / raw)
To: owenn panng <trilogy@gmail.com>; +Cc: pgsql-jdbc
owenn panng wrote:
> Hi there, I was wondering what is needed to done on both the postgres
> & client side to connect via MD5.
with 7.4.x and 8, at least, you don't need to do anything special, the client
libraries take care of it transparently. the pg_shadow file is created
automatically when you use
ALTER USER username WITH ENCRYPTED PASSWORD 'password';
as a SQL statement. (actually, it appears it uses $PGDATA/global/pg_pwd for
this if you don't specify anything else).
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-10-19 18:22 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19 18:00 converting to MD5 owenn panng <trilogy@gmail.com>
2004-10-19 18:10 ` Kris Jurka <books@ejurka.com>
2004-10-19 18:22 ` John R Pierce <pierce@hogranch.com>
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