Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode

to enable https on my node js app I have followed this page http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-nodejs.html

and included .ebextensions\https-instance.config file in my app. I sent my csr to Godaddy and downloaded my cert file.

when running app on local host i create my https server using the keys like below and app runs fine var options = { cert: fs.readFileSync('e03aae55b05ee109.pem'), key: fs.readFileSync('key.pem') };

in my https-instance.config file i pasted the contents of my key and cert into area specified in the link. I validated the YAML using an online parser http://yaml-online-parser.appspot.com/

Im getting an 503 service unavailble error when hitting domain and on checking the app logs its throwing out

[emerg] 21361#0: PEM_read_bio_X509_AUX("/etc/pki/tls/certs/server.crt") failed (SSL: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode)

i have validated my key and cert as described here and they match https://ma.ttias.be/openssl-validate-that-certificate-matches-signs-the-private-key/ any thoughts on what else could be wrong ??

like image 846
user2202098 Avatar asked Sep 28 '16 13:09

user2202098


1 Answers

indentation was wrong. Needed to be multiline. i had it as single line when trying to fix it in parser

  /etc/pki/tls/certs/server.crt:
    mode: "000400"
    owner: root
    group: root
    content: |
      -----BEGIN CERTIFICATE-----
      MIIFSDCCBDCgAwIBAgIJAOA6rlWwXuEJMA0GCSqGSIb3DQEBCwUAMIG0MQswCQYD
      VQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEa
like image 56
user2202098 Avatar answered Sep 22 '22 00:09

user2202098