Menu:
  :. HomePage
  :. Linux
  :. Solaris
  :. Windows
  :. Programování
  :. Java + Tomcat
  :. HW obecně
  :. VoIP - Asterisk
  :. Cisco - Mikrotik - Síť
  :. O mě
  :. Fotogalerie

 Testovací:
  :. ASP projekt
  :. JSP projekt



 Doporučuji:

Savvy - profesionální webhosting, webdesign a serverhosting
Internetový obchod Stromeček.cz - hardware, software a mobily za super ceny
AirCon Miroslav
Galerie fotek
Notebooky
Webdesign Praha

www.eprdel.cz
www.root.cz
Lumimont

NAVRCHOLU.cz
A



Vaše IP:
3.138.122.195

PostgreSQL - podpora SSL

Vygenerovani certifikatu pro server:

With SSL support compiled in, the PostgreSQL server can be started with SSL enabled by setting the parameter ssl to on in postgresql.conf. When starting in SSL mode, the server will look for the files server.key and server.crt in the data directory, which must contain the server private key and certificate, respectively. These files must be set up correctly before an SSL-enabled server can start. If the private key is protected with a passphrase, the server will prompt for the passphrase and will not start until it has been entered.

The server will listen for both standard and SSL connections on the same TCP port, and will negotiate with any connecting client on whether to use SSL. By default, this is at the client's option; see Section 21.1 about how to set up the server to require use of SSL for some or all connections.


OpenSSL supports a wide range of ciphers and authentication algorithms, whose strength varies significantly. You can restrict the list of ciphers that can be used to connect to your server by adjusting the ssl_ciphers parameter.


PostgreSQL reads the system-wide OpenSSL configuration file. By default, this file is named openssl.cnf and is located in the directory reported by openssl version -d. This default can be overridden by setting environment variable OPENSSL_CONF to the name of the desired configuration file.


For details on how to create your server private key and certificate, refer to the OpenSSL documentation. A self-signed certificate can be used for testing, but a certificate signed by a certificate authority (CA) (either one of the global CAs or a local one) should be used in production so the client can verify the server's identity. To create a quick self-signed certificate, use the following OpenSSL command:


openssl req -new -text -out server.req

Fill out the information that openssl asks for. Make sure you enter the local host name as "Common Name"; the challenge password can be left blank. The program will generate a key that is passphrase protected; it will not accept a passphrase that is less than four characters long. To remove the passphrase (as you must if you want automatic start-up of the server), run the commands:


openssl rsa -in privkey.pem -out server.key
rm privkey.pem

Enter the old passphrase to unlock the existing key. Now do:


openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod og-rwx server.key

to turn the certificate into a self-signed certificate and to copy the key and certificate to where the server will look for them.


If verification of client certificates is required, place the certificates of the CA(s) you wish to check for in the file root.crt in the data directory. When present, a client certificate will be requested from the client during SSL connection startup, and it must have been signed by one of the certificates present in root.crt. (See Section 30.16 for a description of how to set up client certificates.) Certificate Revocation List (CRL) entries are also checked if the file root.crl exists.


When the root.crt file is not present, client certificates will not be requested or checked. In this mode, SSL provides communication security but not authentication.


The files server.key, server.crt, root.crt, and root.crl are only examined during server start; so you must restart the server to make changes in them take effect.



Nastaveni certifikatu pro postges:


If the server demands a client certificate, libpq will send the certificate stored in file ~/.postgresql/postgresql.crt within the user's home directory. A matching private key file ~/.postgresql/postgresql.key must also be present, and must not be world-readable. (On Microsoft Windows these files are named %APPDATA%\postgresql\postgresql.crt and %APPDATA%\postgresql\postgresql.key.)


If the file ~/.postgresql/root.crt is present in the user's home directory, libpq will use the certificate list stored therein to verify the server's certificate. (On Microsoft Windows the file is named %APPDATA%\postgresql\root.crt.) The SSL connection will fail if the server does not present a certificate; therefore, to use this feature the server must have a server.crt file. Certificate Revocation List (CRL) entries are also checked if the file ~/.postgresql/root.crl exists (%APPDATA%\postgresql\root.crl on Microsoft Windows).


If you are using SSL inside your application (in addition to inside libpq), you can use PQinitSSL(int) to tell libpq that the SSL library has already been initialized by your application.




Zdroje:
http://postgres.enterprisedb.com/83/doc/dbserver/pg/ssl-tcp.html
http://www.postgresql.org/docs/8.2/static/libpq-ssl.html
 
« Zpět na seznam