[SPAM] Re: [mod_python] mod_python+Apache2+OpenSSL missconfiguration?

Graham Dumpleton graham.dumpleton at gmail.com
Thu May 17 17:53:57 EDT 2007


Hmmm, looking at code, the SSL code in Apache is probably embedded
within the actual httpd rather than being linked in. Running:

  nm /usr/local/apache2/bin/httpd | grep ssl

would probably show that to be the case. If it is and the problems are
the result of a clash between the embedded version of SSL and the
external libraries, then solution would be to tell Apache to use
external SSL libraries using the Apache configure script option:

  --with-ssl=DIR          OpenSSL SSL/TLS toolkit

Thus rebuilding Apache to use same external SSL library may be one thing to try.

The next thing I was going to suggest you do was to take a standalone
test program that shows that what you are trying to do works outside
of Apache and make sure it still works when you run it as the same
user that Apache runs as and from the root directory of your
filesystem.

Doing this would check two things. The first is whether it is user
related and second whether it could be the result of things being run
in a directory where no write access is available.

Graham

On 18/05/07, Johans Taboada <jmt4b04d4v at gmail.com> wrote:
> 2007/5/15, Graham Dumpleton <graham.dumpleton at gmail.com>:
> > If you are relying on SSL client abilities of Python modules, you are
> > probably having a clash of some sort between version of SSL libraries
> > Apache is compiled with and those that Apache module is using.
> > Determine what version of SSL libraries your Apache is using and that
> > which your Python module is using. If they are different then problems
> > may occur as the Apache version will be used in preference to that
> > which the Python module may be linked against.
>
> Sorry for late response, and thanks for the advice Graham.
>
> I've checked the libraries with ldd, but seems to me that they're fine, I
> recognize although that I'm not a linux expert . I post ldd results, maybe
> there's something wrong I don't recognize:
>
> root at PCDCOM:/usr/src/trac/pyPgSQL-2.5.1# ldd /usr/bin/python2.4
>         linux-gate.so.1 =>  (0xffffe000)
>         libpthread.so.0 =>
> /lib/tls/i686/cmov/libpthread.so.0 (0xb7f72000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7f6e000)
>         libutil.so.1 => /lib/tls/i686/cmov/libutil.so.1 (0xb7f6a000)
>         libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7f44000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e10000)
>         /lib/ld-linux.so.2 (0xb7f8f000)
> root at PCDCOM:/usr/src/trac/pyPgSQL-2.5.1# ldd
> /usr/local/lib/python2.4/site-packages/psycopg2/_psycopg.so
>         linux-gate.so.1 =>  (0xffffe000)
>         libpq.so.4 => /usr/lib/libpq.so.4 (0xb7f45000)
>         libpthread.so.0 =>
> /lib/tls/i686/cmov/libpthread.so.0 (0xb7f32000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7dfe000)
>         libssl.so.0.9.8 =>
> /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb7dbf000)
>         libcrypto.so.0.9.8 =>
> /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xb7c85000)
>         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb7c09000)
>         libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7c05000)
>         libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1
> (0xb7bd7000)
>         /lib/ld-linux.so.2 (0x80000000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7bd3000)
>         libz.so.1 => /usr/lib/libz.so.1 (0xb7bbf000)
>         libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7b9a000)
>         libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2
> (0xb7b86000)
>         libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb7b81000)
> root at PCDCOM:/usr/src/trac/pyPgSQL-2.5.1# ldd
> /usr/local/lib/python2.4/site-packages/pyPgSQL/libpq/libpqmodule.so
>         linux-gate.so.1 =>  (0xffffe000)
>         libpq.so.4 => /usr/lib/libpq.so.4 (0xb7fb4000)
>         libpthread.so.0 =>
> /lib/tls/i686/cmov/libpthread.so.0 (0xb7fa1000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e6d000)
>         libssl.so.0.9.8 =>
> /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb7e2e000)
>         libcrypto.so.0.9.8 =>
> /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xb7cf4000)
>         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb7c78000)
>         libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7c74000)
>         libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1
> (0xb7c46000)
>         /lib/ld-linux.so.2 (0x80000000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7c42000)
>         libz.so.1 => /usr/lib/libz.so.1 (0xb7c2e000)
>         libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7c09000)
>         libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2
> (0xb7bf5000)
>         libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb7bf0000)
> root at PCDCOM:/usr/src/trac/pyPgSQL-2.5.1# ldd /usr/local/apache2/bin/httpd
>         linux-gate.so.1 =>  (0xffffe000)
>         libaprutil-0.so.0 =>
> /usr/local/apache2/lib/libaprutil-0.so.0 (0xb7f1b000)
>         libdb-4.4.so => /usr/lib/libdb-4.4.so (0xb7e17000)
>         libexpat.so.0 =>
> /usr/local/apache2/lib/libexpat.so.0 (0xb7df9000)
>         libapr-0.so.0 => /usr/local/apache2/lib/libapr-0.so.0 (0xb7dd8000)
>         librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7dcf000)
>         libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7da9000)
>         libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1
> (0xb7d7a000)
>         libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7d64000)
>          libpthread.so.0 =>
> /lib/tls/i686/cmov/libpthread.so.0 (0xb7d51000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7d4d000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c19000)
>          /lib/ld-linux.so.2 (0xb7f32000)
> root at PCDCOM:/usr/src/trac/pyPgSQL-2.5.1# ldd /usr/lib/libpq.so.4
>         linux-gate.so.1 =>  (0xffffe000)
>         libssl.so.0.9.8 =>
> /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb7ea5000)
>         libcrypto.so.0.9.8 =>
> /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xb7d6b000)
>         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb7cef000)
>         libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7cec000)
>         libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1
> (0xb7cbe000)
>         libpthread.so.0 =>
> /lib/tls/i686/cmov/libpthread.so.0 (0xb7cab000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7b76000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7b72000)
>         libz.so.1 => /usr/lib/libz.so.1 (0xb7b5e000)
>         libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7b39000)
>         libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2
> (0xb7b26000)
>         /lib/ld-linux.so.2 (0x80000000)
>         libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb7b20000)
> root at PCDCOM :/usr/src/trac/pyPgSQL-2.5.1# ldd
> /usr/local/apache2/modules/mod_python.so
>         linux-gate.so.1 =>  (0xffffe000)
>         libpthread.so.0 =>
> /lib/tls/i686/cmov/libpthread.so.0 (0xb7dca000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7dc6000)
>         libutil.so.1 => /lib/tls/i686/cmov/libutil.so.1 (0xb7dc2000)
>         libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7d9c000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c68000)
>         /lib/ld-linux.so.2 (0x80000000)
>
> I've taken a look at python modules (psycopg2 and pyPgSQL) and I guess I've
> identified where exceptions generate. It's in '''PQstatus(pgconnection)'''
> call (using libpq postgresql client library from '''python-module libpq
> wrapper''').
>
> psycopg2-2.0.5.1/psycopg/connection_int.c#L82
>     else if (PQstatus(pgconn) == CONNECTION_BAD)
>     {
>         Dprintf("conn_connect: PQconnectdb(%s) returned BAD", self->dsn);
>         PyErr_SetString(OperationalError,
> PQerrorMessage(pgconn));
>         PQfinish(pgconn);
>         return -1;
>     }
>
>
> pyPgSQL-2.5.1/pgconnection.c#L698
>     if (PQstatus(PgConnection_Get(self)) != CONNECTION_OK)
>     {
>         PyErr_SetString(PqErr_DatabaseError,
>
> PQerrorMessage(PgConnection_Get(self)));
>         PQfinish(PgConnection_Get(self));
>         PgConnection_Get(self) = (PGconn *)NULL;
>         return NULL;
>     }
>
> It may help demystify my issue.
>
> Greetings,
>
> --------------------------------------------------------
> Johans Marvin Taboada Villca    -`^_^´- .o0O( 2007-04-24, Bienvenida
> Bebecita )
> --------------------------------------------------------
> Adm. Laboratorio de Desarrollo de Software
> Carreras de Informática y Sistemas
> UMSS, Cochabamba
> Bolivia
> --------------------------------------------------------
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>



More information about the Mod_python mailing list