|From:||Barry Lind <blind(at)xythos(dot)com>|
|Subject:||SSL support in JDBC|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
I have just verified that the SSL support added into the 7.4 driver is
working correctly, even against the new v3 protocol of a 7.4 database.
Here are my notes on how to enable SSL on both the server and jdbc client.
build ssl support into postgres server
enable ssl in postgresql.conf
ssl = true
add ssl to pg_hba.conf file:
Create a quick self-signed certificate using the following OpenSSL command:
openssl req -new -text -out server.req
Fill out the information that openssl asks for. The challenge password
can be left blank. The programm 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
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 copy the key
and certificate to the data directory of the server.
Now convert the server.crt to a format java can import on the client:
openssl x509 -in server.crt -out server.crt.der -outform der
Now import the cert into the java keystore:
keytool -keystore [your java home here]/lib/security/cacerts -alias
[any name for the cert you like (i.e. postgres)] -import -file
enter the password for the cacerts keystore (default is 'changeit').
Say yes to trust this cert.
Restart the database server and you are done.
To use SSL in jdbc add "?ssl" to the connection url.
I tested the above against both a 7.3 and 7.4 database using the current
development sources on java1.4.
|Next Message||Amogh Pandey||2003-08-09 14:11:45||how to connect jdk with postgreSQL|
|Previous Message||Darin Ohashi||2003-08-08 19:15:55||Bug in JVM causing problems with MessageTranslator|