[Psycopg] sslmode

jerickso at indian.com jerickso at indian.com
Tue Mar 14 18:46:16 CET 2006


On Tue, 14 Mar 2006, Timothy Smith wrote:

> sslmode in connect(). is it useable under windows (psycopg build 1.1.21) and 
> if so how do i use it? can't find any explanation anywhere about it

Where did you get the windows build from.  The following information is if 
you download the binaries from:
   http://www.stickpeople.com/projects/python/win-psycopg/index.html

The 1.1.21 does NOT have SSL support.  You might be able to upgrade it to 
SSL support yourself by installing the windows version of pgAdmin III and 
replace the psycopg libpq.dll with the one included in pgAdmim, as well as 
all the other DLLs that are tied to it (with my testing, it included 
libeay32.dll, ssleay32.dll, comerr32.dll, libiconv-2.dll, libintl-2.dll, 
and krb5_32.dll).  There might be a singular libpq.dll that has the SSL 
support built in, but this is the one program that popped to mind that had 
SSL support.

The 2.0Beta binaries DO have SSL support and would recommend them even tho 
it has 'Beta' in the name.


To use SSL, add the following parameter to the connect string:
  sslmode=
 	disable  - No SSL
 	allow    - First try non SSL, then try SSL
 	prefer   - First try SSL, then non-SSL connection
 	require  - Only try SSL connection
ie:

# Connect up to the test database using only SSL support
#
c = psycopg2.connect("host=test user=test dbname=test sslmode=require")


-jason


More information about the Psycopg mailing list