Node.js configuration

Made an easy to use auto renewing library for node. Hope it can help some people! https://github.com/DylanPiercey/auto-sni

1 Like

If I can take a guess, I would think that youā€™re curling the wrong port. Have you tried hitting your server from a web browser?

Hi there.

These appear to be the droids Iā€™m looking for - Iā€™ve got an ExpressJS Server serving HTTPS with self-signed certs.

How do I swap these certificates from being my self-signed ones to some lovely legitimate LE certs? Iā€™ve got the client. I ran
sudo ./letsencrypt-auto certonly --webroot -w /var/www/example -d example.com -d www.example.com
ā€¦and I got
Domain: www.example.com Type: connection Detail: Could not connect to http://www.example.com/.well-known/acme- challenge/JjzCP_GNccpNiBQggFziPD9kYhdRR2diEOhtWtkjwtc

So I checked out /var/www/example/.well-known with ls -al /var/www/example/.well-known and got . ..

So I started Googling and found this thread and itā€™s OP, which looked like the code this problem is preventing me from writing (I guess itā€™s obvious I currently donā€™t serve a ca as Iā€™m self-signed?).

How come I Could not connect to http://www.na-n.xyz/.well-known/acme-challenge/JjzCP_GNccpNiBQggFziPD9kYhdRR2diEOhtWtkjwtc ?

FWIW Iā€™m doing this on a Raspi running Jessie, which has a static IP on the local network, and it also takes care of DNS. Also there isnā€™t a port 80 -> port 443 re-route or anything, and this is the only port I forward from the router.

Please help!

Edit: I did some more reading of this thread, and I donā€™t want to open port 80 so I killed my server and used standalone and port 443 - letsencrypt certonly --standalone --standalone-supported-challenges tls-sni-01 -w /var/www/example/ -d www.example.com -d example.com

And I got
sudo /home/username/.local/share/letsencrypt/bin/letsencrypt certonly --standalone --standalone-supported-challenges tls-sni-01 -w /var/www/example/ -d www.example.com -d example.com Failed authorization procedure. www.example.com (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Failed to connect to host for DVSNI challenge.

What does that mean? - Reading the ā€˜To fix these errorsā€™ - I can still connect to the website and put up with certificate errors, so the DNS mapping is correctā€¦?

You do have port 80 forwarded, right? LE checks http://foo.baz/whatever, which implies port 80 unless you have a redirect in place.

[quote=ā€œna-n, post:23, topic:5175ā€]
-standalone-supported-challenges tls-sni-01
[/quote] - I thought that implied HTTP -> 443 ?

ā€¦ My DNS Certificates arenā€™tā€¦ quiteā€¦ right? - I dropped the www. from the list of domains and it worked - I got certs! Remembered who I bought my DNS records from, and I have an A-Record that seems to be out of date. Dā€™oh!

https is 443. Glad you got it working.

i was successfully able to get the certificates and while opening my domain it shows the green lock. But when i opened using my ip address it went showed the certificates are not verified. Also when i tried opening the domain from my mobile chrome client it even showed the certificates are invalid.

is it because of certificates ?

Letā€™s Encrypt doesnā€™t issue certificate for IP addresses, only domain names. Youā€™ll have to access your site through your domain name if you want to avoid the browser warning.

The issue with Chrome sounds like a problem with your certificate chain. You can use SSL Labs on your domain to spot any errors - look for ā€œChain issuesā€. Make sure that youā€™re using fullchain.pem (and not just cert.pem) in your configuration.