infobyte / faraday

Open Source Vulnerability Management Platform
https://www.faradaysec.com
GNU General Public License v3.0
4.78k stars 885 forks source link

Cannot verify PostgreSQL version as outlined in the installation guide #414

Closed securitytime closed 3 years ago

securitytime commented 3 years ago

Issue Type

Bug Report

Faraday version

Faraday v3.12 (deb)

Steps to reproduce

I installed Faraday on a fresh and up-to-date Ubuntu Server 20.04.1.

During installation I followed the steps outlined in the installation wiki under https://github.com/infobyte/faraday/wiki/Install-Guide.

So first I downloaded Faraday's installer (step 1) and installed PostgreSQL (step 2):

tux@ubuntu:~$ sudo apt install postgresql
[sudo] password for tux: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libllvm10 libpq5 libsensors-config libsensors5 postgresql-12 postgresql-client-12 postgresql-client-common postgresql-common ssl-cert sysstat
Suggested packages:
  lm-sensors postgresql-doc postgresql-doc-12 libjson-perl openssl-blacklist isag
The following NEW packages will be installed:
  libllvm10 libpq5 libsensors-config libsensors5 postgresql postgresql-12 postgresql-client-12 postgresql-client-common postgresql-common ssl-cert sysstat
0 upgraded, 11 newly installed, 0 to remove and 53 not upgraded.
Need to get 30.6 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libllvm10 amd64 1:10.0.0-4ubuntu1 [15.3 MB]
Get:2 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpq5 amd64 12.4-0ubuntu0.20.04.1 [113 kB]
Get:3 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libsensors-config all 1:3.6.0-2ubuntu1 [6,092 B]
Get:4 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libsensors5 amd64 1:3.6.0-2ubuntu1 [27.4 kB]
Get:5 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-client-common all 214ubuntu0.1 [28.2 kB]
Get:6 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-client-12 amd64 12.4-0ubuntu0.20.04.1 [1,044 kB]
Get:7 http://de.archive.ubuntu.com/ubuntu focal/main amd64 ssl-cert all 1.0.39 [17.0 kB]
Get:8 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-common all 214ubuntu0.1 [169 kB]
Get:9 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-12 amd64 12.4-0ubuntu0.20.04.1 [13.4 MB]
Get:10 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql all 12+214ubuntu0.1 [3,924 B]                                                                                                                                   
Get:11 http://de.archive.ubuntu.com/ubuntu focal/main amd64 sysstat amd64 12.2.0-2 [453 kB]                                                                                                                                                    
Fetched 30.6 MB in 7s (4,329 kB/s)
Preconfiguring packages ...
[...]

As for step 3, I wanted to verify the PostgreSQL version as mentioned in the wiki. However, I got the following error message:

tux@ubuntu:~$ psql -c "SELECT version()" postgres
psql: error: could not connect to server: FATAL:  role "tux" does not exist

tux@ubuntu:~$ sudo psql -c "SELECT version()" postgres
psql: error: could not connect to server: FATAL:  role "root" does not exist

The rest of the installation went fine and Faraday is running normally.

Expected results

When running the command from step 3 then the PostgreSQL version should be shown instead of an error message. Perhaps PostgreSQL version 12 is not supported by the wiki.

OS

tux@ubuntu:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
securitytime commented 3 years ago

It works when I run the psql command as the postgres user:

root@ubuntu:~# psql -c "SELECT version()" postgres
psql: error: could not connect to server: FATAL:  role "root" does not exist
root@ubuntu:~# su -l postgres
postgres@ubuntu:~$ psql -c "SELECT version()" postgres
                                                            version                                                            
-------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.4 (Ubuntu 12.4-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit
(1 row)
aenima-x commented 3 years ago

Yes, the command needs to be run with the postgres user