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 - Download geschikte en recente versie van OpenSSL via https://indy.fulgan.com/SSL/
of download hier: 64-bits of 32-bits
- 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. - 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.
- Maak een sleutel (server.key) en onderteken daarmee een certificaat (server.crt) via de volgende commando’s:
- 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. - Verwijderen van het wachtwoord uit de sleutel:
openssl rsa -in server.key -out server.key Hierna mag je het gebruikte wachtwoord vergeten. - Maken van het zelfondertekende certificaat:
openssl req -new -key server.key -x509 -days 7300 -out server.crt
- Kopieer deze twee bestanden, server.key en server.crt, naar de PostgreSQL data map.
- Bewerk het postgresql.conf bestand en stel het volgende in:
- ssl = on
- ssl_cert_file = 'server.crt'
- ssl_key_file = 'server.key'
- Bewerk het pg_hba.conf bestand en vervang host door hostssl voor alle verbindingen behalve die via 127.0.0.1 en ::1.
- Herstart de server (via services.msc of door het herstarten van Windows).
- 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 - Download a recent version of OpenSSL through https://indy.fulgan.com/SSL/
or download here: 64-bits or 32-bits
- 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.
- 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.
- Create a key (server.key) and use it to sign the certificate (server.crt) using the following commands:
- 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.
- Remove the password from the key:
openssl rsa -in server.key -out server.key After this step, you may forget the used password.
- Create the self-signed certificate:
openssl req -new -key server.key -x509 -days 7300 -out server.crt
- Copy these two files , server.key and server.crt, to the PostgreSQL data folder.
- Edit the postgresql.conf file and set the following properties:
- ssl = on
- ssl_cert_file = 'server.crt'
- ssl_key_file = 'server.key'
- Edit the pg_hba.conf file and replace host with hostssl for all connections except the ones through 127.0.0.1 and ::1.
- Restart the server (through services.msc or simply restart Windows).
- This concludes the necessary steps.
|