Remote PostgreSQL configuration

Remote PostgreSQL configuration

Faraday uses a connection string stored in /home/faraday/.faraday/config/server.ini to connect to the database. You can use faraday-manage initdb to configure a localhost database (same server as Faraday is running). If you opt to use a remote database you will need to create a database role, database and create the schema.


Step 1: Configure PostgreSQL for remote connection

Make sure you understand this step. Using the wrong settings could leave your database server insecure


  1. Open the hba_config file. To locate this file, execute: 



$ sudo -u postgres psql -c "show hba_file"

  1. Add the following line for the faraday-server: 


      host all all <FARADAY_SERVER_IP>/24 md5

<FARADAY_SERVER_IP> Is the IP where is running the Faraday Server
  1. Then open postgresql.conf . To locate this file, execute: 



      $ sudo -u postgres psql -c "show config_file"

Allow to listen on the interface. Search for the line "listen_address" and change the value 'localhost' or use * for all interfaces. Then restart the server by doing:
       $ sudo service postgresql restart

Step 2: Create PostgreSQL role

  1. Login into the database server and execute:

             
sudo su postgres

$ createuser faraday_postgres -P

  1. Now create the database:



$ createdb faraday


Step 3: Configure Faraday Server

  1. Now on the Faraday Server instance, open the file /home/faraday/.faraday/config/server.ini and append the database configuration:



[database]
connection_string = postgresql+psycopg2://faraday_postgresql:SECRET_PASSWORD@REMOTE_IP/faraday


Step 4: Create tables


  1. Let's chage the User's Group. Run: sudo usermod -a -G faraday <user>

  2. Now you are ready to create the tables:



$ faraday-manage create-tables






    Still looking for answers? You can try opening a ticket.
      • Related Articles

      • Updating Nginx configuration

        This only applies if you are using NGINX and https. Please, make sure you have this settings on your NGINX config: proxy_pass http://localhost:5985/; proxy_redirect http:// $scheme://;
      • Debian/Ubuntu/Kali Installation

        Download Faraday's Installer from the Customer Portal . Install postgresql > 9.6 (locally or in a remote server). In order to install PostgreSQL, you can run the following command:  $ sudo apt install postgresql After the installation is completed, ...
      • CentOS7/RedHat7 Installation

        Before installation Please note that PostgreSQL YUM repository and Faraday, depend on EPEL repository for some packages. Users with RHEL, CentOS, etc. should install EPEL repo RPM along with PGDG repo RPMs to satisfy dependencies. In order to do ...
      • Docker

        Loading Image Download the Docker image file from our Customer Portal and load it in Docker:    $ docker load -i <path to image tar.gz file> Check Image    $ docker image ls | grep faraday Configuration This image can be run as a service or as a ...
      • Metasploit

        Dependencies psycopg2 [http://initd.org/psycopg/] To install it run pip using the file requirements_extras.txt. Configuration This plugin can be set from Faraday's Plugin Configuration Dialog, selecting the Metasploit Online Service Plugin item and ...