pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Password authentication failure
9+ messages / 7 participants
[nested] [flat]

* Password authentication failure
@ 2001-06-05 15:32  Paul Hart <paul.hart@maclaren.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Paul Hart @ 2001-06-05 15:32 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all,

I'm currently running 7.1.2 on OpenBSD 2.9-current. I am attempting to
connect to a database over IP, so I have the following 'start' command
in my /etc/rc.local:

su postgres -c '/usr/local/pgsql/bin/pg_ctl -o "-i" -D /web/databases -l
\
/web/databases/logfile.log start > /dev/null'

Also, I have the following in my /web/databases/pg_hba.conf
('/web/databases' is set up as $PGDATA):

host         all         xxx.xxx.xx.0  255.255.255.0       crypt passwd

(obviously, the 'xxx.xxx.xx.0' is my host set.)

I have also created the file /web/databases/passwd which contains the
username/password pair I wish to use to connect to the database.

So, after all this, I have a jdbc connection URL of:

jdbc:postgresql://[my host]/[my db]

(as per the spec)

I also pass in the username and password that I set up using pg_passwd.


Of course, if it worked, I wouldn't have just written all of that :)

The JDBC driver claims "Password authentication failed for user 'XXXX'"

So, does anyone have any ideas?

Many Thanks,

Paul Hart




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

* Password authentication failure
@ 2001-06-05 15:33  Paul Hart <paulhart@io.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Paul Hart @ 2001-06-05 15:33 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all,

I'm currently running 7.1.2 on OpenBSD 2.9-current. I am attempting to
connect to a database over IP, so I have the following 'start' command
in my /etc/rc.local:

su postgres -c '/usr/local/pgsql/bin/pg_ctl -o "-i" -D /web/databases -l
\
/web/databases/logfile.log start > /dev/null'

Also, I have the following in my /web/databases/pg_hba.conf
('/web/databases' is set up as $PGDATA):

host         all         xxx.xxx.xx.0  255.255.255.0       crypt passwd

(obviously, the 'xxx.xxx.xx.0' is my host set.)

I have also created the file /web/databases/passwd which contains the
username/password pair I wish to use to connect to the database.

So, after all this, I have a jdbc connection URL of:

jdbc:postgresql://[my host]/[my db]

(as per the spec)

I also pass in the username and password that I set up using pg_passwd.


Of course, if it worked, I wouldn't have just written all of that :)

The JDBC driver claims "Password authentication failed for user 'XXXX'"

So, does anyone have any ideas?

Many Thanks,

Paul Hart




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

* Re: Password authentication failure
@ 2001-06-05 17:10  Peter Eisentraut <peter_e@gmx.net>
  parent: Paul Hart <paulhart@io.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Peter Eisentraut @ 2001-06-05 17:10 UTC (permalink / raw)
  To: Paul Hart <paulhart@io.com>; +Cc: pgsql-jdbc

Paul Hart writes:

> The JDBC driver claims "Password authentication failed for user 'XXXX'"

AFAIK, OpenBSD uses MD5 as the default crypt() algorithm, whereas the JDBC
driver assumes the traditional DES-like method.  I suppose you have to
hack either one to do otherwise.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter




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

* Re: Password authentication failure
@ 2001-06-05 17:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Paul Hart <paulhart@io.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Tom Lane @ 2001-06-05 17:27 UTC (permalink / raw)
  To: Paul Hart <paulhart@io.com>; +Cc: pgsql-jdbc

"Paul Hart" <paulhart@io.com> writes:
> The JDBC driver claims "Password authentication failed for user 'XXXX'"

There might be more info in the postmaster's logfile --- did you look?

			regards, tom lane



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

* RE: Password authentication failure
@ 2001-06-05 17:31  Paul Hart <paulhart@io.com>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 9+ messages in thread

From: Paul Hart @ 2001-06-05 17:31 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; Paul Hart <paulhart@io.com>; +Cc: pgsql-jdbc

Okay, a little more digging later, and the plot thickens some:

I'm throwing an exception at line 170 in Connection.java, which suggests
that the response from the server is 'E'. That in and of itself is not
too interesting. What *is* interesting is that I have been denied access
even before the server asks for a password (the code to deal with that
is in lines 200-215 of the same method). This, to me, suggests that
something isn't happening right with regards the protocol matching in
the JDBC client. Or that I'm stupid, I'm willing to accept either
answer.

However, based on that, I would guess that the crypt() problem isn't it.

As for the postmaster log file, there is nothing special in there:

verify_password: password mismatch for 'XXXX'.
Password authentication failed for user 'XXXX'

The stack trace is below. Under that is some commentary on the initial
response I received (thank you!)

java.sql.SQLException: Password authentication failed for user 'XXXX'
 	at org.postgresql.Connection.openConnection(Connection.java:170)
 	at org.postgresql.Driver.connect(Driver.java:122)
 	at java.sql.DriverManager.getConnection(DriverManager.java:517)
 	at java.sql.DriverManager.getConnection(DriverManager.java:177)
[...]

Peter Eisentraut writes:
> > The JDBC driver claims "Password authentication failed for
> > user 'XXXX'"
>
> AFAIK, OpenBSD uses MD5 as the default crypt() algorithm,
> whereas the JDBC
> driver assumes the traditional DES-like method.  I suppose you have to
> hack either one to do otherwise.

Uhm... would that then mean that if I was on an OpenBSD machine as a
client (i.e. just running psql), I would be unable (at least without
massaging some code) to access a postgres instance on, say, a Solaris
box? That sounds *very* fishy to me.

Any chance we can have a standardized hashing function built into the
code? If you can't guarantee implementation at the OS level (or you make
false assumptions), there seems to be no other truly suitable
alternative.

Thanks,

Paul Hart




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

* Re: Password authentication failure
@ 2001-06-05 20:08  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Paul Hart <paulhart@io.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Tom Lane @ 2001-06-05 20:08 UTC (permalink / raw)
  To: Paul Hart <paulhart@io.com>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-jdbc

"Paul Hart" <paulhart@io.com> writes:
> However, based on that, I would guess that the crypt() problem isn't it.
> As for the postmaster log file, there is nothing special in there:
> verify_password: password mismatch for 'XXXX'.

No, that tells us quite a lot: checking in the source code for that
message, I can see that the backend has received your username and
password, and has found the username in an external password file,
and has attempted to match your password against what was in the
password file.  And that match didn't work.  I think that crypt()
is exactly where your problem is.  Did you build the external
password file with pg_passwd, or manually?

> Uhm... would that then mean that if I was on an OpenBSD machine as a
> client (i.e. just running psql), I would be unable (at least without
> massaging some code) to access a postgres instance on, say, a Solaris
> box? That sounds *very* fishy to me.

If you use the crypt auth method (crypt on client side and send
that across the wire) then yes, the crypt algorithms offered by
client and server C libraries had better match.  However, AFAICT
you are not doing that.  In the regular passwd method what we are
assuming is that the crypt library routine linked into the
postmaster is the same one linked into pg_passwd, or whatever
program you use to maintain the flat password file.  Since these
are on the same machine it's not such a big assumption.

> Any chance we can have a standardized hashing function built into the
> code?

Are you volunteering?  There have been a couple of long discussions
on pghackers about a better password challenge protocol.  IIRC we
came up with a good-looking paper design, but there was a notable
lack of effort on actually making it happen.

			regards, tom lane



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

* Re: Password authentication failure
@ 2001-06-11 18:41  Jeff Waugh <jaw@ic.net>
  parent: Paul Hart <paul.hart@maclaren.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Jeff Waugh @ 2001-06-11 18:41 UTC (permalink / raw)
  To: Paul Hart <paul.hart@maclaren.com>; pgsql-jdbc

Use the password that you specified in your
CREATE USER command.

The password in the specified file is ignored when using 
the crypt authentication method.
(However, if you do specify a file, the user must have a
record there.)

HTH
-Jeff
 
----- Original Message ----- 
From: "Paul Hart" <paul.hart@maclaren.com>
To: <pgsql-jdbc@postgresql.org>
Sent: Tuesday, June 05, 2001 11:32 AM
Subject: [JDBC] Password authentication failure


> Hi all,
> 
> I'm currently running 7.1.2 on OpenBSD 2.9-current. I am attempting to
> connect to a database over IP, so I have the following 'start' command
> in my /etc/rc.local:
> 
> su postgres -c '/usr/local/pgsql/bin/pg_ctl -o "-i" -D /web/databases -l
> \
> /web/databases/logfile.log start > /dev/null'
> 
> Also, I have the following in my /web/databases/pg_hba.conf
> ('/web/databases' is set up as $PGDATA):
> 
> host         all         xxx.xxx.xx.0  255.255.255.0       crypt passwd
> 
> (obviously, the 'xxx.xxx.xx.0' is my host set.)
> 
> I have also created the file /web/databases/passwd which contains the
> username/password pair I wish to use to connect to the database.
> 
> So, after all this, I have a jdbc connection URL of:
> 
> jdbc:postgresql://[my host]/[my db]
> 
> (as per the spec)
> 
> I also pass in the username and password that I set up using pg_passwd.
> 
> 
> Of course, if it worked, I wouldn't have just written all of that :)
> 
> The JDBC driver claims "Password authentication failed for user 'XXXX'"
> 
> So, does anyone have any ideas?
> 
> Many Thanks,
> 
> Paul Hart
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 




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

* password authentication failure
@ 2006-07-13 15:45  System Consult <systemconsult@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: System Consult @ 2006-07-13 15:45 UTC (permalink / raw)
  To: pgsql-jdbc

I was able able to create my database and create a Admin role with a
password with which i was able to sign on to the database using the prompt.
However, an attempt to access the database via my java application using
jdbc gave this response
FATAL: password authentication failed for user "Admin"



please assist

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

* Re: password authentication failure
@ 2006-07-13 17:21  Mark Lewis <mark.lewis@mir3.com>
  parent: System Consult <systemconsult@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Mark Lewis @ 2006-07-13 17:21 UTC (permalink / raw)
  To: System Consult <systemconsult@gmail.com>; +Cc: pgsql-jdbc

Try to connect to the database using the command-line tool and
specifying the host parameter, to force a network connection (same type
of connection that the JDBC driver uses).

So run:  
psql -h whatever_server_jdbc_uses

If that doesn't work, then you have an authentication problem; read the
PG documentation about configuring authentication with pg_hba.conf.

If it does work, then please supply the version of the driver you're
using, the JDBC URL you're using, a code snippet showing how you're
attempting to connect, and some basic info about your server (version,
host it's running on).

-- Mark Lewis


On Thu, 2006-07-13 at 16:45 +0100, System Consult wrote:
> I was able able to create my database and create a Admin role with a
> password with which i was able to sign on to the database using the
> prompt. However, an attempt to access the database via my java
> application using jdbc gave this response 
>  
> FATAL: password authentication failed for user "Admin"
> 
>  
> 
> please assist 
> 



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


end of thread, other threads:[~2006-07-13 17:21 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-05 15:32 Password authentication failure Paul Hart <paul.hart@maclaren.com>
2001-06-11 18:41 ` Jeff Waugh <jaw@ic.net>
2001-06-05 15:33 Password authentication failure Paul Hart <paulhart@io.com>
2001-06-05 17:10 ` Peter Eisentraut <peter_e@gmx.net>
2001-06-05 17:31   ` Paul Hart <paulhart@io.com>
2001-06-05 20:08     ` Tom Lane <tgl@sss.pgh.pa.us>
2001-06-05 17:27 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-07-13 15:45 password authentication failure System Consult <systemconsult@gmail.com>
2006-07-13 17:21 ` Re: password authentication failure Mark Lewis <mark.lewis@mir3.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