GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Role is used instead of username when adding a new server · Issue #5702 · pgadmin-org/pgadmin4

Role is used instead of username when adding a new server #5702

New issue
Copy link
New issue
Copy link
Closed
Closed
Role is used instead of username when adding a new server#5702
Copy link
Assignees
pravesh-sharma
Labels
Bug
Milestone
6.20

Description

@pr2git
pr2git
opened on Jan 2, 2023
Issue body actions

Please note that security bugs or issues should be reported to [email protected].

Describe the bug

When adding a new server in the list we have to fill in the (Register -> Server...) we have to fill in the: Username and role

Problem when connecting to the server the role is sent as instead of the Username, so I am unable to connect to server that I need to add into PgAdmin.

The problem doesn't happens with already existing servers.

To Reproduce

Steps to reproduce the behavior:

  1. In group right click choose add Server...
  2. Fill in the needed information into Connection tab
  3. Define the Username (myuser)
  4. Define a role (in my exemple role is dba)
  5. Save the setup
  6. Connect to the server
  7. Try to access for exemple to postgres DB

ERROR:

FATAL: LDAP authentication failed for user "dba" connection to server at "XXXXXXXXXX" (123.123.123.123), port 5432 failed: FATAL: no pg_hba.conf entry for host "XXXXXXXXXX", user "dba", database "postgres", SSL off

Problem is that my user is not "dba" but "myuser" "dba" is the role my user should use.

On already existing servers this problem doesn't pop-up it happens only on newly added server.
So the problem is at the creation of the server into PgAdmin 6.18 role is save for the Username field.

Expected behavior

The field Username must be used and not the role one.

Error message

FATAL: LDAP authentication failed for user "dba" connection to server at "XXXXXXXXXX" (123.123.123.123), port 5432 failed: FATAL: no pg_hba.conf entry for host "XXXXXXXXXX", user "dba", database "postgres", SSL off

user defined is not dba but myuser, in my case dba is the role I need to use.

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version: 22.04.1 LTS
  • Mode: Desktop
  • Package type: installed from apt

Activity

Next
  1. pr2git
    added
    Bug
    on Jan 2, 2023
  2. akshay-joshi
    added this to Not Refinedon Jan 4, 2023
  3. adityatoshniwal
    added
    EDB Sprint 133
    on Jan 6, 2023
  4. adityatoshniwal
    added this to Current Sprint (213) and removed this from Not Refinedon Jan 6, 2023
  5. akshay-joshi
    moved this to 🆕 New in Current Sprint (213)on Jan 6, 2023
  6. pr2git commented on Jan 17, 2023

    @pr2git
    pr2git
    on Jan 17, 2023
    Author
    More actions

    Hi, I was happy to see a new release of PgAdmin but this major bug is not yet resolved and include in it.

    I use my login and then I need to take another role to grant the read-only, read-write or DBA role this is no longer possible since you send the role instead of the login name to the remote server.
    Do you realise that it is no longer possible to create a valid new server that we can connect to in PgAdmin GUI?
    Only existing servers are working fine.

    This is a Major bug making PgAdmin totally unusable in my organisation.

  7. akshay-joshi
    added
    EDB Sprint 134
    and removed
    EDB Sprint 133
    on Jan 18, 2023
  8. adityatoshniwal commented on Jan 19, 2023

    @adityatoshniwal
    adityatoshniwal
    on Jan 19, 2023
    Contributor
    More actions

    After digging, possible solution would be to run SET ROLE command after connecting with username just how psql tool works uses roles.

  9. pr2git commented on Jan 19, 2023

    @pr2git
    pr2git
    on Jan 19, 2023
    Author
    More actions

    Please check how was stored data when creating a new host in version 6.17 for exemple.
    In 6.17 (and below) you store the Username properly and the Role the option. The role is to perform automaticly the set role. This was always working fine in PgAdmin until 6.17 (even in version 4).

    Since 6.18 you are no longer storing the Username but you are storing the role as Username (this is the major bug) in PgAdmin internal server DB which is wrong. So when connection you are using the role and no longer the username!

    Former created servers are working fine only newly created servers are affected by this bug. So the problem is in the Create Server function that now wrongly store the field Role as Username, Username must be used to login and Role must be used to create the set role!

    I insist on already defined servers in PgAdmin (the one created before 6.18 the connection is working fine!). With the newly added server PgAdmin is trying to connect to the server with the role defined and not the username (which is wrong).

    So this is a pure PgAdmin GUI bug that mix up Username and Role when storing a new server. All the logics to connect is still correct. If it was a bug in the connection logic I would no longer be able to use the existing servers.

    To explain you, when you connect to one of our servers with a login you get no access right on any database, you explicitly need to perform a set role. And the access role defined cannot be used to login, they are pure access role.

    So I am connecting with my login: pr2 which is authenticated with the LDAP and then PgAdmin perform a set role dbro;

    Here is how my username is defined:

    CREATE ROLE pr2 WITH
    LOGIN
    NOSUPERUSER
    NOINHERIT
    NOCREATEDB
    NOCREATEROLE
    NOREPLICATION;

    Here is how the role dbro is defined:

    CREATE ROLE dbro WITH
    NOLOGIN
    NOSUPERUSER
    NOINHERIT
    NOCREATEDB
    NOCREATEROLE
    NOREPLICATION;

    GRANT dbro TO pr2;

    So I connect to the server with pr2 and get only login right then set role dbro to get access (of course we have several possible role).

    Now PgAdmin is storing the Role as username for newly added server and then try to log with the role instead of the Username which is wrong. Already defined servers are not affected by this bug introduced since 6.18 only newly added servers are.

    The main advantage of PgAdmin was this was foreseen by default for a given Username to perform the role defined in the GUI.

  10. akshay-joshi
    moved this from 🆕 New to 🏗 In Progress in Current Sprint (213)on Jan 31, 2023
  11. akshay-joshi
    assigned
    adityatoshniwal
    on Jan 31, 2023
  12. akshay-joshi
    added
    EDB Sprint 135
    and removed
    EDB Sprint 134
    on Feb 1, 2023
  13. 6 remaining items

  14. akshay-joshi
    added this to the 6.20 milestone on Feb 1, 2023
  15. pravesh-sharma commented on Feb 2, 2023

    @pravesh-sharma
    pravesh-sharma
    on Feb 2, 2023
    Contributor
    More actions
    Screen.Recording.2023-02-02.at.12.01.43.PM.mov

    @adityatoshniwal Tried testing on today's snapshot and facing this issue.

  16. adityatoshniwal
    added a commit that references this issue on Feb 2, 2023

    Send the username to server node when created. pgadmin-org#5702

    6fa765a
  17. adityatoshniwal
    moved this from In Testing to In Review in Current Sprint (213)on Feb 2, 2023
  18. adityatoshniwal
    assigned
    adityatoshniwal
    and unassigned
    pravesh-sharma
    on Feb 2, 2023
  19. adityatoshniwal commented on Feb 2, 2023

    @adityatoshniwal
    adityatoshniwal
    on Feb 2, 2023
    Contributor
    More actions

    @pravesh-sharma Once merged, please also test shared servers.

  20. akshay-joshi
    added a commit that references this issue on Feb 2, 2023

    Send the username to server node when created. #5702

    cdc1248
  21. pravesh-sharma
    moved this from In Review to In Testing in Current Sprint (213)on Feb 2, 2023
  22. pravesh-sharma
    assigned
    pravesh-sharma
    and unassigned
    adityatoshniwal
    on Feb 2, 2023
  23. pravesh-sharma commented on Feb 3, 2023

    @pravesh-sharma
    pravesh-sharma
    on Feb 3, 2023
    Contributor
    More actions

    Issue fixed. Also checked for shared servers.
    Tested on snapshot build https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/2023-02-03/

  24. pravesh-sharma
    closed this as completedon Feb 3, 2023
  25. pravesh-sharma
    moved this from In Testing to ✅ Done in Current Sprint (213)on Feb 3, 2023
  26. akshay-joshi
    removed this from Current Sprint (213)on Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @pravesh-sharma
    pravesh-sharma

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    • 6.20

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.