Opened 10 years ago

Closed 7 years ago

#1465 closed defect (fixed)

Make the pgsql tasks work with postgresql ident authentication (or local socket?)

Reported by: Knut Arne Bjørndal Owned by: bretth
Priority: minor Milestone:
Component: osmosis Version:
Keywords: Cc: Knut Arne Bjørndal, ppawel@…

Description

Postgres is often setup to use it's rather genial ident authentication system by default (it is for example on debian).

Using the default debian setup I can't authenticate to postgres, getting instead a (large) screenful of exception spew.

The problem might actually be the host it's connecting to, if it goes over TCP/IP to localhost ident won't work, it has to be over the local unix socket (which is a good idea anyway, performance-wise).

Change History (5)

comment:1 Changed 9 years ago by bretth

Cc: Knut Arne Bjørndal added
Resolution: fixed
Status: newclosed

Ident identification works via TCP/IP. Some fixes were made on 21st December to make this work correctly.

Local UNIX sockets will not be supported until the PostgreSQL JDBC libraries support it. This will probably never happen.

comment:2 Changed 7 years ago by ppawel@…

Cc: ppawel@… added
Resolution: fixed
Status: closedreopened

It does not work for me - Osmosis always tries to do password authentication. I looked at the code and simply changing both DatabaseConstants.TASK_DEFAULT_USER and DatabaseConstants.TASK_DEFAULT_PASSWORD to null fixes this problem - I am able to connect to a database from Osmosis by specifying only "database" parameter - ident/trust auth does the rest.

Diff for the record:

diff --git a/core/src/main/java/org/openstreetmap/osmosis/core/database/DatabaseConstants.java b/core/src/main/java/org/openstreetmap/osmosis/core/database/DatabaseConstants.java
index 0286701..0774c5a 100644
--- a/core/src/main/java/org/openstreetmap/osmosis/core/database/DatabaseConstants.java
+++ b/core/src/main/java/org/openstreetmap/osmosis/core/database/DatabaseConstants.java
@@ -80,7 +80,7 @@ public final class DatabaseConstants {
     /**
      * The default user for a database connection.
      */
-    public static final String TASK_DEFAULT_USER = "osm";
+    public static final String TASK_DEFAULT_USER = null;
 
     /**
      * The default password for a database connection.
@@ -90,7 +90,7 @@ public final class DatabaseConstants {
     /**
      * The default password for a database connection.
      */
-    public static final String TASK_DEFAULT_PASSWORD = "";
+    public static final String TASK_DEFAULT_PASSWORD = null;
 
     /**
      * The default value for whether schema version validation should be performed.

comment:3 Changed 7 years ago by ppawel@…

The patch only works for trust authentication, ident over TCP still does not work - unless ident daemon is used which is deprecated.

And of course Unix domain connections are still not supported...

comment:4 Changed 7 years ago by bretth

Suggested change is applied in git commit 3f52b750a8a8b6e32a52090dae393358df495c7b.

comment:5 Changed 7 years ago by bretth

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.