Published using Google Docs
PostgreSQL SSL Manual
Updated automatically every 5 minutes

PostgreSQL SSL Manual- MplusKASSA

PostgreSQL SSL Manual

Nederlands

English

Nederlands

Waarom?
Waarom is dit belangrijk? Omdat het anders mogelijk is voor iemand met een packet-sniffer om alle queries en resultaten van de database te onderscheppen.

Gebruik van OpenSSL op Windows

  1. Download geschikte en recente versie van OpenSSL via https://indy.fulgan.com/SSL/
    of download hier:
    64-bits of 32-bits
  2. Pak de ZIP uit en voeg het volgende bestand toe aan de uitgepakte map: openssl.cnf
    Copy-paste de inhoud van dit bestand. Niet downloaden vanwege foute encoding.
     
  3. Open de commandline, ga naar de map waarin OpenSSL is uitgepakt en voer het volgende commando uit: set OPENSSL_CONF=openssl.cnf

OpenSSL stappen

Deze stappen kun je op Windows pas doen als je bovenstaande stappen hebt doorlopen.

  1. Maak een sleutel (server.key) en onderteken daarmee een certificaat (server.crt) via de volgende commando’s:
  1. Maken van de sleutel:
    openssl genrsa -des3 -out server.key 1024
    Het wachtwoord dat je hier ingeeft hoef je enkel te onthouden voor het volgende commando.
     
  2. Verwijderen van het wachtwoord uit de sleutel:
    openssl rsa -in server.key -out server.key
    Hierna mag je het gebruikte wachtwoord vergeten.
     
  3. Maken van het zelfondertekende certificaat:
    openssl req -new -key server.key -x509 -days 7300 -out server.crt
     
  1. Kopieer deze twee bestanden, server.key en server.crt, naar de PostgreSQL data map.
     
  2. Bewerk het postgresql.conf bestand en stel het volgende in:
  1. ssl = on 
  2. ssl_cert_file = 'server.crt' 
  3. ssl_key_file = 'server.key' 
  1. Bewerk het pg_hba.conf bestand en vervang host door hostssl voor alle verbindingen behalve die via 127.0.0.1 en ::1.
  2. Herstart de server (via services.msc of door het herstarten van Windows).
  3. Tot zover alle stappen.

English

Why?
Why is this important? Because otherwise anybody with a packet sniffer may intercept queries and results to and from your database.

Usage of OpenSSL on Windows

  1. Download a recent version of OpenSSL through https://indy.fulgan.com/SSL/
    or download here:
    64-bits or 32-bits
  2. Unzip and add the following file to the newly created folder: openssl.cnf
    Copy-paste the contents of this file. Don’t download and transfer, because of wrong encoding.
  3. Open the command prompt, navigate to the folder where you unzipped OpenSSL and execute the following command: set OPENSSL_CONF=openssl.cnf

OpenSSL steps

These steps can only be performed in Windows after you have gone through the steps above.

  1. Create a key (server.key) and use it to sign the certificate (server.crt) using the following commands:
  1. Create the key:
    openssl genrsa -des3 -out server.key 1024
    The password you enter here, is only necessary for the step directly after this one.
  2. Remove the password from the key:
    openssl rsa -in server.key -out server.key
    After this step, you may forget the used password.
  3. Create the self-signed certificate:
    openssl req -new -key server.key -x509 -days 7300 -out server.crt
  1. Copy these two files , server.key and server.crt, to the PostgreSQL data folder.
     
  2. Edit the postgresql.conf file and set the following properties:
  1. ssl = on 
  2. ssl_cert_file = 'server.crt' 
  3. ssl_key_file = 'server.key' 
     
  1. Edit the pg_hba.conf file and replace host with hostssl for all connections except the ones through 127.0.0.1 and ::1.
     
  2. Restart the server (through services.msc or simply restart Windows).
     
  3. This concludes the necessary steps.

/