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

Closed
DePierre opened this Issue Apr 20, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@DePierre
Contributor

DePierre commented Apr 20, 2016

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.

viyatb added a commit that referenced this issue Apr 21, 2016

[misc] Fixes #668, #669
- Now postgres service will restart only if user inputs "y"
- The fix uses `SHOW config_file;` to get the path for the
  postgres config file
@viyatb

This comment has been minimized.

Show comment
Hide comment
@viyatb

viyatb Apr 21, 2016

Member

Fixed in 522f64b

Member

viyatb commented Apr 21, 2016

Fixed in 522f64b

@viyatb viyatb closed this Apr 21, 2016

DePierre added a commit to DePierre/owtf that referenced this issue Apr 21, 2016

[misc] Fixes #668, #669
- Now postgres service will restart only if user inputs "y"
- The fix uses `SHOW config_file;` to get the path for the
  postgres config file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment