Nathan K
Nathan K

Reputation: 21

cherrypy https script not working with linux startup

Trying to run a cherrypy https server on linux startup. The startup script works with cherrypy running http, but not https. Also, when running https server manually it works, so no library issues there. The summary and error is below:

  1. https and http server are working when running it manually on linux
  2. http is working on linux startup
  3. https is not working on linux startup

I output the results of the https startup script to a text file, and this error is encountered:

[25/Feb/2015:13:59:03] ENGINE Bus STARTING
[25/Feb/2015:13:59:03] ENGINE Started monitor thread '_TimeoutMonitor'.
[25/Feb/2015:13:59:03] ENGINE Started monitor thread 'Autoreloader'.
[25/Feb/2015:13:59:03] ENGINE Serving on 0.0.0.0:8099
[25/Feb/2015:13:59:03] ENGINE Bus STARTED
[25/Feb/2015:13:59:03] ENGINE Error in HTTPServer.tick
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 1837, in start
    self.tick()
  File "/usr/local/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 1902, in tick
    s, ssl_env = self.ssl_adapter.wrap(s)
  File "/usr/local/lib/python2.7/site-packages/cherrypy/wsgiserver/ssl_builtin.py", line 52, in wrap
    keyfile=self.private_key, ssl_version=ssl.PROTOCOL_SSLv23)
  File "/usr/local/lib/python2.7/ssl.py", line 387, in wrap_socket
    ciphers=ciphers)
  File "/usr/local/lib/python2.7/ssl.py", line 141, in __init__
    ciphers)
SSLError: [Errno 336265218] _ssl.c:351: error:140B0002:SSL routines:SSL_CTX_use_PrivateKey_file:system lib

I set the permissions on the folder containing the script to "chmod 777", i.e. grant all permissions to all users/groups. No luck.

Upvotes: 1

Views: 1195

Answers (2)

Nathan K
Nathan K

Reputation: 21

Fixed the solution, cyraxjoe is right. It ended up being the init.d script was running the python server file from etc/init.d/, and the private key file was using a relative path. Using the absolute path ended up solving the problem.

Thanks!!!

Upvotes: 1

cyraxjoe
cyraxjoe

Reputation: 5741

You are most likely setting a relative path to the certificate or maybe it does not have read permission.

Double check the path to the certificate. Use an absolute one and keep an eye for any required escape character. \

Upvotes: 2

Related Questions