Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

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

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments

Comments

@openstreetmap-trac
Copy link

Reporter: bob[at]cakebox.net
[Submitted to the original trac issue database at 7.30pm, Friday, 9th January 2009]

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).

@openstreetmap-trac
Copy link
Author

Author: brett[at]bretth.com
[Added to the original trac issue at 7.03am, Sunday, 14th March 2010]

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.

@openstreetmap-trac
Copy link
Author

Author: ppawel[at]fastmail.fm
[Added to the original trac issue at 12.40pm, Friday, 26th October 2012]

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.

@openstreetmap-trac
Copy link
Author

Author: ppawel[at]fastmail.fm
[Added to the original trac issue at 1.03pm, Friday, 26th October 2012]

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...

@openstreetmap-trac
Copy link
Author

Author: brett[at]bretth.com
[Added to the original trac issue at 10.25am, Saturday, 27th October 2012]

Suggested change is applied in git commit 3f52b750a8a8b6e32a52090dae393358df495c7b.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant