ledgersmb / LedgerSMB

Double-entry accounting & ERP for the web
https://ledgersmb.org
Other
420 stars 152 forks source link

Cannot log into setup.pl #8017

Closed howardlowndes closed 4 months ago

howardlowndes commented 8 months ago

Version

1.11.9

What browsers are you seeing the problem on?

This problem isn't browser related

What happened?

I'm trying to log into setup.pl as lsmb_dbadmin using what I thought was the correct password, being the one that is saved in Google Password Manager - there it looks like what I know I have previously used. However, I am getting the following error:

Error! Could not connect to database: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "lsmb_dbadmin" connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "lsmb_dbadmin" at lib/LedgerSMB/Scripts/setup.pm line 344. dbversion: 1.11.9, company:

The pg_hba.conf file is:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             postgres                                peer
local   all             all                                     peer
host    all             postgres    127.0.0.1/32            reject
host    all             postgres    ::1/128                 reject
host    postgres,template0,template1   lsmb_dbadmin         127.0.0.1/32    scram-sha-256 
host    postgres,template0,template1   lsmb_dbadmin         ::1/128     scram-sha-256 
host    postgres,template0,template1   all          127.0.0.1/32     reject
host    postgres,template0,template1   all          ::1/128      reject
host    all             all             127.0.0.1/32            scram-sha-256
host    all             all             ::1/128                 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256

What should have happened?

Where do I need to go to to fix this problem?

howardlowndes commented 8 months ago

I am able to log into the database as a user

ehuelsmann commented 8 months ago

You should be able to log into the PostgreSQL cluster using the psql command line client and set the password of the user:

alter role lsmb_dbadmin password 'YOURPASSWORD';
howardlowndes commented 8 months ago

Unfortunately that didn't work for me.

Using psql AMS the log shows: 2024-02-13 20:14:31.789 AEDT [18729] @. ERROR: permission denied 2024-02-13 20:14:31.789 AEDT [18729] @. STATEMENT: alter role lsmb_dbadmin password '****';

When I try to log in using setup.pl http://setup.pl the log presents: 2024-02-13 20:12:56.734 AEDT [18593] @. FATAL: password authentication failed for user "lsmb_dbadmin" 2024-02-13 20:12:56.734 AEDT [18593] @. DETAIL: User "lsmb_dbadmin" has an expired password. Connection matched pg_hba.conf line 102: "host all all ::1/128 scram-sha-256" 2024-02-13 20:12:56.767 AEDT [18594] @. FATAL: password authentication failed for user "lsmb_dbadmin" 2024-02-13 20:12:56.767 AEDT [18594] @. DETAIL: User "lsmb_dbadmin" has an expired password. Connection matched pg_hba.conf line 102: "host all all ::1/128 scram-sha-256" 2024-02-13 20:12:56.830 AEDT [18597] @. FATAL: password authentication failed for user "lsmb_dbadmin" 2024-02-13 20:12:56.830 AEDT [18597] @. DETAIL: User "lsmb_dbadmin" has an expired password. Connection matched pg_hba.conf line 98: "host postgres,template0,template1 lsmb_dbadmin ::1/128 scram-sha-256 " 2024-02-13 20:12:56.863 AEDT [18598] @. FATAL: password authentication failed for user "lsmb_dbadmin" 2024-02-13 20:12:56.863 AEDT [18598] @. DETAIL: User "lsmb_dbadmin" has an expired password. Connection matched pg_hba.conf line 98: "host postgres,template0,template1 lsmb_dbadmin ::1/128 scram-sha-256 "

On Tue, 13 Feb 2024 at 18:09, Erik Huelsmann @.***> wrote:

You should be able to log into the PostgreSQL cluster using the psql command line client and set the password of the user:

alter role lsmb_dbadmin password 'YOURPASSWORD';

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1940538173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7W6FQBABEISCWPHJBTYTMGRFAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBQGUZTQMJXGM . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

ehuelsmann commented 8 months ago

What is the exact psql command you use to connect to the database?

howardlowndes commented 8 months ago

psql AMS

then

alter role lsmb_dbadmin password '****';

On Wed, 14 Feb 2024 at 05:07, Erik Huelsmann @.***> wrote:

What is the exact psql command you use to connect to the database?

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1942120814, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7UKFU33D4RFNEYHTSDYTOTURAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBSGEZDAOBRGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

ehuelsmann commented 8 months ago

Hi,

I don't understand how you can receive a "permission denied" error. As what user did you run that command? As the 'postgres' unix user? That should have connected you to the database as "postgres" superuser which can't receive a "permission denied" on the command you showed.

Regards,

Erik.

howardlowndes commented 8 months ago

I'm logged into the computer as myself - a user with sudo access and I can issue psql AMS and can get access but is I try psql -U postgres -d AMS I get $ psql -d AMS -U postgres psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"

On Fri, 16 Feb 2024 at 08:48, Erik Huelsmann @.***> wrote:

Hi,

I don't understand how you can receive a "permission denied" error. As what user did you run that command? As the 'postgres' unix user? That should have connected you to the database as "postgres" superuser which can't receive a "permission denied" on the command you showed.

Regards,

Erik.

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1947393651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7U3RPNIDHDVX6PYV7DYTZ7DBAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXGM4TGNRVGE . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

ehuelsmann commented 8 months ago

Try running

sudo -u postgres psql

And after that the alter role command

howardlowndes commented 7 months ago

My apologies for taking some time to get back to you but I have had to deal with some other issues. Anyway, logged into my /home/howard account, I issued the 'sudo -u postgres psql' command and it came back with:

$ sudo -u postgres psqlcould not change directory to "/home/howard": Permission deniedpsql (15.6 (Debian 15.6-0+deb12u1))Type "help" for help.postgres=#

which is a bit strange. Anyway I then issued the SQL 'select * from pg_user;' and it returned with:

Will the following SQL work 'update pg_user set valuntil = NULL where usename = "lsmb_dbadmin;' work?

Regards,

On Fri, 16 Feb 2024 at 18:09, Erik Huelsmann @.***> wrote:

Try running

sudo -u postgres plql

And after that the alter role command

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1947862278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7VDIYPQNEV6HPJVIN3YT4AZBAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXHA3DEMRXHA . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

howardlowndes commented 7 months ago

I've answered my own question - it won't work because pg_user is a view and not a table.

On Tue, 27 Feb 2024 at 09:28, Howard Lowndes @.***> wrote:

My apologies for taking some time to get back to you but I have had to deal with some other issues. Anyway, logged into my /home/howard account, I issued the 'sudo -u postgres psql' command and it came back with:

$ sudo -u postgres psqlcould not change directory to "/home/howard": Permission deniedpsql (15.6 (Debian 15.6-0+deb12u1))Type "help" for help.postgres=#

which is a bit strange. Anyway I then issued the SQL 'select * from pg_user;' and it returned with:

  • usename | usesysid | usecreatedb | usesuper | userepl | usebypassrls | passwd | valuntil | useconfig --------------+----------+-------------+----------+---------+--------------+----------+-------------------------------+----------- postgres | 10 | t | t | t | t | **** | | lsmb_dbadmin | 16388 | t | f | f | f | **** | 2024-02-09 12:11:24.007924+11 | howard | 21308 | f | f | f | f | **** | infinity | (3 rows)*

Will the following SQL work 'update pg_user set valuntil = NULL where usename = "lsmb_dbadmin;' work?

Regards,

On Fri, 16 Feb 2024 at 18:09, Erik Huelsmann @.***> wrote:

Try running

sudo -u postgres plql

And after that the alter role command

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1947862278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7VDIYPQNEV6HPJVIN3YT4AZBAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXHA3DEMRXHA . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard.

When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

ehuelsmann commented 7 months ago

When you're looking at

postgres#

type after that the alter role command (you can't edit pg_user):

alter role lsmb_dbadmin password 'YOURPASSWORD';

howardlowndes commented 7 months ago

I did that and it appeared to accept the SQL, but when I try to log into / setup.pl I still get

Could not connect to database: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "lsmb_dbadmin"connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "lsmb_dbadmin" at lib/LedgerSMB/Scripts/setup.pm http://setup.pm line 344.

dbversion: 1.11.9, company:

On Tue, 27 Feb 2024 at 09:35, Erik Huelsmann @.***> wrote:

When you're looking at

postgres#

type after that the alter role command (you can't edit pg_user):

alter role lsmb_dbadmin password 'YOURPASSWORD';

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1965448531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7QQ7BQANZRLWDEYZJTYVUE3BAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRVGQ2DQNJTGE . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

ehuelsmann commented 7 months ago

what happens if you run

psql -U lsmb_dbadmin -h 127.0.0.1 -d postgres

? Does it ask for your password? What happens if you enter YOURPASSWORD ? Does it log you into the "postgres" database?

howardlowndes commented 7 months ago

Let's start from the beginning. This is where I started: @.**:~ $ sudo -u postgres psql

*could not change directory to "/home/howard": Permission deniedpsql (15.6 (Debian 15.6-0+deb12u1))Type "help" for help.postgres=# alter role lsmb_dbadmin password 'MensShed';ALTER ROLEpostgres=# @.**:~ $

As you can see the ALTER ROLE appears to have executed correctly. I then used the command you suggested above using the password "MensShed" as previously set:

@.:~ $ psql -U lsmb_dbadmin -h 127.0.0.1 -d postgresPassword for user lsmb_dbadmin: psql: error: connection to server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user "lsmb_dbadmin"connection to server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user @.:~ $ *

Regards,

On Tue, 27 Feb 2024 at 10:15, Erik Huelsmann @.***> wrote:

what happens if you run

psql -U lsmb_dbadmin -h 127.0.0.1 -d postgres

? Does it ask for your password? What happens if you enter YOURPASSWORD ? Does it log you into the "postgres" database?

— Reply to this email directly, view it on GitHub https://github.com/ledgersmb/LedgerSMB/issues/8017#issuecomment-1965498824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMS2F7VZI7NPZ2OTJVOTV33YVUJRPAVCNFSM6AAAAABDF65NLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRVGQ4TQOBSGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Howard. -- When you want a computer system that works, just choose Linux; When you want a computer system that works, just, choose Microsoft.

ehuelsmann commented 7 months ago

Well, based on the error, I have to conclude that you're sending the wrong password, because you did set it indeed. And the pg_hba.conf file does not deny this access (unless you found in the logs that it does?)

This is not an error in setup.pl, because it already does not work from the command line. It would be good to understand this is not a documentation issue in the installation instructions. If the logs don't mention denial by pg_hba then this is something else.

github-actions[bot] commented 4 months ago

Closing: more than 90 days without user response. Feel free to reopen with your comments.