Skip to content

PostgreSQL Fix in db_setup.sh should use SHOW config_file; #669

@DePierre

Description

@DePierre

The PostgreSQL fix in db_setup.sh uses psql -V in order to find the corresponding configuration file.

However, this is not necessarily true. For instance, on my setup it fails (archlinux):

$ ./scripts/db_setup.sh init 

------------------------- OWTF Database Helper Script -------------------------
                    Helps in creation of user and database                     
-------------------------------------------------------------------------------

[+] Ensure that you have required values in /root/.owtf/db.cfg

Press Enter to continue

CREATE ROLE
CREATE DATABASE
Having SSL=true in postgres config causes many errors (psycopg2 problem)
Remove SSL=true from the PostgreSQL config?[Y/n]y
sed: can't read /etc/postgresql/9.5/main/postgresql.conf: No such file or directory
Restarting the postgresql service

$ psql -V
psql (PostgreSQL) 9.5.2
$ echo "SHOW config_file;\n" | sudo -u postgres psql
              config_file               
----------------------------------------
 /var/lib/postgres/data/postgresql.conf
(1 row)

It also fails on Travis build (Ubuntu 12.04.5 LTS):

$ sudo psql -V
psql (PostgreSQL) 9.5.2
$ echo "SHOW config_file;\n" | sudo -u postgres psql
               config_file                
------------------------------------------
 /etc/postgresql/9.1/main/postgresql.conf
(1 row)

The fix should be updated to use SHOW config_file; instead of the current version of PostgreSQL.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions