We've been having a problem with use_privatekey_file on Solaris 10.
When calling from pyOpenSSL, it somehow switches from reading the key
file from file descriptor 3 to reading from stdin (0) after the open()
call.   Truss shows the file being opened as fd 3, then a read call on
fd 0.  Inputting the keyfile into stdin causes the function to complete
and close stdin, so apparently the file descriptor is being overwritten.
Other platforms work correctly, so I'm looking for possible build errors
that might cause this problem.

 

galactica> uname -a

SunOS galactica 5.10 Generic sun4u sparc SUNW,Sun-Fire-V240

 

This occurs while running the sample code from
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442473:

 

        ctx = SSL.Context(SSL.SSLv23_METHOD)
        #server.pem's location (containing the server private key and
        #the server certificate).
        fpem = '/path/server.pem'
        ctx.use_privatekey_file (fpem)

 

Running under truss produces the following :

 

24090:  open64("/path/server2.pem", O_RDONLY) = 3

24090:  read(0, 0x01EDD7D0, 8192)       (sleeping...)

-----BEGIN RSA PRIVATE KEY-----

24090:  read(0, " - - - - - B E G I N   R".., 8192)     = 32

 

....(this is a paste of the privatekey file into stdin)....

 

-----END RSA PRIVATE KEY-----

24090:  read(0, " - - - - - E N D   R S A".., 8192)     = 30

24090:  close(0)                                        = 0

>>> 24090:      write(2, " > > >  ", 4)                         = 4

 

24090:  write(2, "\n", 1)                               = 1

24090:  sigaction(SIGINT, 0x00000000, 0xFFBFEE10)       = 0

24090:  sigaction(SIGINT, 0xFFBFED70, 0x00000000)       = 0

24090:  fstat64(2, 0xFFBFEDC8)                          = 0

24090:  fstat64(1, 0xFFBFEDC8)                          = 0

24090:  _exit(0)

 

Any ideas?

Reply via email to