JupyterHub openssl self signed cert "Error: error:0906D06C:PEM routines:PEM_read_bio:no start line"
<p>Trying to configure at JupyterHub on a AWS instance using a self signed OPENSSL key/cert pair. I have tried several openssl configurations, and continued to have this same error.</p>

<pre><code>jupyterhub
[I 2016-10-04 03:38:24.090 JupyterHub app:622] Loading cookie_secret from           /home/ubuntu/jupyterhub_cookie_secret
[W 2016-10-04 03:38:24.123 JupyterHub app:304] 
    Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require     restarting the proxy.
    Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.

[W 2016-10-04 03:38:24.127 JupyterHub app:757] No admin users, admin interface will be unavailable.
[W 2016-10-04 03:38:24.127 JupyterHub app:758] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2016-10-04 03:38:24.127 JupyterHub app:785] Not using whitelist. Any authenticated user will be allowed.
[I 2016-10-04 03:38:24.139 JupyterHub app:1231] Hub API listening on http://127.0.0.1:8081/hub/
[I 2016-10-04 03:38:24.143 JupyterHub app:968] Starting proxy @ http://*:8000/

crypto.js:128
      c.context.setKey(options.key);
            ^
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
    at Object.exports.createCredentials (crypto.js:128:17)
    at Server (tls.js:1176:28)
    at new Server (https.js:35:14)
    at Object.exports.createServer (https.js:54:10)
    at new ConfigurableProxy (/usr/lib/node_modules/configurable-http-    proxy/lib/configproxy.js:174:35)
    at Object.&lt;anonymous&gt; (/usr/lib/node_modules/configurable-http-proxy/bin/configurable-http-proxy:189:13)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
[C 2016-10-04 03:38:25.158 JupyterHub app:1237] Failed to start proxy
    Traceback (most recent call last):
      File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/jupyterhub/app.py", line 1235, in start
    yield self.start_proxy()
      File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/jupyterhub/app.py", line 989, in start_proxy
    _check()
      File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/jupyterhub/app.py", line 985, in _check
        raise e
    RuntimeError: Proxy failed to start with exit code 8
</code></pre>

<p>Generated the current pair using this command</p>

<pre><code>openssl req -new -x509 -days 365 -utf8 -out mycert.pem -keyout mykey.pem
</code></pre>

<p>Verified that it is in fact PEM format</p>

<pre><code>openssl x509 -in mycert.pem -text -noout
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            ec:16:a1:7d:64:6b:90:42
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=SG, ST=SG, L=Singapore, O=GoldenCompass
        Validity
            Not Before: Oct  4 02:58:55 2016 GMT
            Not After : Oct  4 02:58:55 2017 GMT
        Subject: C=SG, ST=SG, L=Singapore, O=GoldenCompass
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
&lt;snippet&gt;
</code></pre>

<p>jupyterhub_config.py</p>

<pre><code>&lt;snippet&gt;
## Path to SSL certificate file for the public facing interface of the proxy
#  
#  Use with ssl_key
c.JupyterHub.ssl_cert = '/home/ubuntu/mykey.pem'

## Path to SSL key file for the public facing interface of the proxy
#  
#  Use with ssl_cert
c.JupyterHub.ssl_key = '/home/ubuntu/mycert.pem'

&lt;snippet&gt;
</code></pre>

<p>Your config has your certificate and key reversed:</p>

<p>You have this:</p>

<pre><code>c.JupyterHub.ssl_cert = '/home/ubuntu/mykey.pem'
c.JupyterHub.ssl_key = '/home/ubuntu/mycert.pem'
</code></pre>

<p>but you should have this:</p>

<pre><code>c.JupyterHub.ssl_cert = '/home/ubuntu/mycert.pem'
c.JupyterHub.ssl_key = '/home/ubuntu/mykey.pem'
</code></pre>

python ssl jupyter jupyter-notebook jupyterhub