adamwoolhether / NetBox4CentOS8

Quick and easy install playbook for NetBox on CentOS 8
5 stars 4 forks source link

Peer authentication failed for user "postgres" #5

Closed dpflick closed 3 years ago

dpflick commented 3 years ago

It looks like you are making the correct modifications to postgres. Centos 8 (not stream) fully patched.

TASK [CREATE DB] ***** task path: /home/devops/onshore-devops/netbox_install.yml:68 redirecting (type: modules) ansible.builtin.postgresql_db to community.general.postgresql_db Using module file /home/devops/.local/lib/python3.6/site-packages/ansible_collections/community/general/plugins/modules/postgresql_db.py Pipelining is enabled. <172.30.30.150> ESTABLISH SSH CONNECTION FOR USER: root <172.30.30.150> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/devops/.ansible/cp/ee9f332de0 172.30.30.150 '/bin/sh -c '"'"'/usr/libexec/platform-python && sleep 0'"'"'' <172.30.30.150> (1, b'\n{"exception": "Traceback (most recent call last):\n File \"/tmp/ansible_postgresql_db_payload_aw5e51v0/ansible_postgresql_db_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_db.py\", line 595, in main\n File \"/usr/lib64/python3.6/site-packages/psycopg2/init.py\", line 130, in connect\n conn = _connect(dsn, connection_factory=connection_factory, kwasync)\npsycopg2.OperationalError: FATAL: Peer authentication failed for user \"postgres\"\n\n", "failed": true, "msg": "unable to connect to database: FATAL: Peer authentication failed for user \"postgres\"\n", "invocation": {"module_args": {"name": "netbox", "db": "netbox", "login_user": "postgres", "login_password": "", "login_host": "", "login_unix_socket": "", "port": 5432, "ssl_mode": "prefer", "owner": "", "template": "", "encoding": "", "lc_collate": "", "lc_ctype": "", "state": "present", "target": "", "target_opts": "", "maintenance_db": "postgres", "conn_limit": "", "tablespace": "", "trust_input": true, "ca_cert": null, "session_role": null, "dump_extra_args": null}}}\n', b'') <172.30.30.150> Failed to connect to the host via ssh: The full traceback is: Traceback (most recent call last): File "/tmp/ansible_postgresql_db_payload_aw5e51v0/ansible_postgresql_db_payload.zip/ansible_collections/community/general/plugins/modules/postgresql_db.py", line 595, in main File "/usr/lib64/python3.6/site-packages/psycopg2/init.py", line 130, in connect conn = _connect(dsn, connection_factory=connection_factory, kwasync) psycopg2.OperationalError: FATAL: Peer authentication failed for user "postgres"

fatal: [sot.onshoreit.net]: FAILED! => { "changed": false, "invocation": { "module_args": { "ca_cert": null, "conn_limit": "", "db": "netbox", "dump_extra_args": null, "encoding": "", "lc_collate": "", "lc_ctype": "", "login_host": "", "login_password": "", "login_unix_socket": "", "login_user": "postgres", "maintenance_db": "postgres", "name": "netbox", "owner": "", "port": 5432, "session_role": null, "ssl_mode": "prefer", "state": "present", "tablespace": "", "target": "", "target_opts": "", "template": "", "trust_input": true } }, "msg": "unable to connect to database: FATAL: Peer authentication failed for user \"postgres\"\n" }

adamwoolhether commented 3 years ago

Thanks for letting me know, i'll look into it.

Out of curiosity, was DB (netbox) previously initialized on your target machine?

dpflick commented 3 years ago

No, it was not.

From: adamwoolhether notifications@github.com Sent: Tuesday, February 16, 2021 7:10 PM To: adamwoolhether/NetBox4CentOS8 NetBox4CentOS8@noreply.github.com Cc: Daniel Flick dflick@onshoreit.net; Author author@noreply.github.com Subject: Re: [adamwoolhether/NetBox4CentOS8] Peer authentication failed for user "postgres" (#5)

Thanks for letting me know, i'll look into it.

Out of curiosity, was this user/DB previously initialized on your target machine?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/adamwoolhether/NetBox4CentOS8/issues/5#issuecomment-780223909, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEUYJFOGIHBCGDROGYJ2P6TS7MJPVANCNFSM4WWLW4TA.

adamwoolhether commented 3 years ago

It sounds like something is happening with your privilege escalation. I've just run it on two separate fresh installs and can't replicate the issue.

Can you check your pg_hba.conf file?

dpflick commented 3 years ago

I will try another fresh install. Do you recommend any other flavor of OS? I am moving away from CentOS due to Red Hat’s decision to make it a testbed.

From: adamwoolhether @.> Sent: Wednesday, February 17, 2021 12:35 AM To: adamwoolhether/NetBox4CentOS8 @.> Cc: Daniel Flick @.>; Author @.> Subject: Re: [adamwoolhether/NetBox4CentOS8] Peer authentication failed for user "postgres" (#5)

It sounds like something is happening with your privilege escalation. I've just run it on two separate fresh installs and can't replicate the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/adamwoolhether/NetBox4CentOS8/issues/5#issuecomment-780338756, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEUYJFMWNSTL5BO6KKUYUQ3S7NPRRANCNFSM4WWLW4TA.

adamwoolhether commented 3 years ago

I will try another fresh install. Do you recommend any other flavor of OS? I am moving away from CentOS due to Red Hat’s decision to make it a testbed. >.

Same...We've been running Rocky Linux over here. Same founder as CentOS.