// edit: @tialaramex answer is correct, I misread your question.
That's not possible, for some prior discussion see:
Using the DNS-01 challenge type does not require any open ports and is currently your only option if you're unable to use port 80 (with HTTP-01) and 443 (with TLS-SNI-01). The validation is performed through a TXT record you need to add to your DNS.
pfgâs answer is about using a different port to do the Letâs Encrypt validation. And if thatâs what you want, yeah, that post is right you canât do that. But I think you already HAVE a perfectly nice certificate for your name synodins.com, and you would just like to ALSO use that certificate for this server on port 8002. That IS possible. But, as you noticed it is not working right, so you need help figuring out why.
First observation, that port isnât speaking SSL / TLS at all, itâs speaking plain unencrypted HTTP. You need to configure the server answering on port 8002 to offer TLS encryption. A ânodejsâ person might have more insight than me.
The ACME server needs to prove that you control port 80 or 443.
Assuming you do, there are 2 ways to handle that that may work for you:
You can create a proxypass on the port 80 server to proxy /.well-known to port 8002, then configure the letsencrypt-auto to bind to 8002. ACME will ping port80, but your client runs on 8002. see https://github.com/certbot/certbot/issues/2697
You can use the manual option and have the port 80 server route /.well-known to a directory that you can manually edit
You have LE working fine on your server, but you also want to use the certificate on port 8002âŚ
You have to configure whatever is running on port 8002 to be an SSL server that uses your LE cert. You could also have port 8002 be on nginx/apache and use your SSL certificate there as a gateway, then proxypass up to node-js speaking plain HTTP on port 8003.
The location of the LetsEncrypt certs are well documented. You can either link to their âliveâ directory, or copy them into your node project (just be sure to keep them updated)
And Im trying to figure out which pem files are to be where.
There are:
cert,chain,fullchain and privkey
in the /etc/letsencrypt/live folder.
From that link i copied
const options = {
key: fs.readFileSync(âtest/fixtures/keys/agent2-key.pemâ),
cert: fs.readFileSync(âtest/fixtures/keys/agent2-cert.pemâ)
};
I guess the cert is for the âcertâ key.
But is âprivkeyâ the other one?
How do I precede those things?
Do I just do /etc/letsencrypt/live/synodins.com/cert.pm ?
In the const options.
I am trying that right now but im getting error âunexptected tokenâ when i fire that script up as a server.
https.createServer(options, (req, res) => {
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensionsâŚjs (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Node tells you pretty much what the issue is. Seems like you're running on a Node version that doesn't support ES6, so use function(req, res) { ... } instead of (req, res) => { ... }.