How to download AWS certificate to use it with NodeJS - node.js

I'm struggling with AWS to enable https systematically. I requested a certificate through the certificate manager, and then have the ELB and Security Group listen to HTTPS and port 443.
But I also need my server on the AWS instance to listen to https request on the 443 port, right? My server is running with NodeJS and Express. From what I understood, I'd need to have a certificate (.crt) file and key to do it correctly, but I didn't find out how to download them from AWS Certificate Manager.
Did anyone faced this problem before? Thanks all!

I also need my server on the AWS instance to listen to https request
on the 443 port, right?
Nope, you enable the certificate on the ELB. SSL termination happens on the ELB, and communication between the ELB and your NodeJS server occurs over HTTP inside your VPC. The ELB will send a special HTTP header X-Forwarded-Proto to your NodeJS server, which you can check if you need to know if the connection between the ELB and the client is over HTTP or HTTPS.
You can't download certificates generated by Amazon's ACM service. You can only use them via Load Balancers or CloudFront distributions.

No, You cannot download the certificate, instead of that you can configure your Apache. for configuring https open /etc/apache2/sites-available/default-ssl.conf
and add this lines to that file.
<Location /subDomain>
ProxyPass http://localhost:port
ProxyPassReverse http://localhost:port
</Location>
after adding restart your apache.
And open the browser and check https://yourdns.com/subDomain

My application's ssl certificate (running in AWS ECS) expired 2 days ago. Because that certificate is managed by ACM and can not be downloaded and installed manually. I do the following to renew it:
In ACM, submit the request for renew the certificate, (need to
provide email or DNS provider to verify this domain is owned by you.
) I used email way. After validation, the certificate renew request
's status changed from 'pending' to 'issued'.
There is no place to download the certificate, as above answer, we
need to use ELB or other service to install that certificate. In aws
console, EC2 => Load balancer => View/edit certificates => add the
certificates created for that. => done

Related

Cant connect to the cloudflare with A - DNS

My ubuntu server work correctly in port 80 using nginx, it's finally switch to port:3000 for Nodejs app to run. Everything okay when i pass the dns to the browser but when I try to connect with cloudflare It's appear the 502 bad gateway code when access the domain name? I'm kind of new in cdn hosting please tell me what to do! Many thanks
My Cloudflare Setup
Assuming you are running your webservice on port 80 publicly available:
What you could do is to disable the encryption between Cloudflare and your origin (not recommended):
Select your Domain, go to SSL/TLS -> Overview. Select "Off (not secure)"
But you really shouldn't do this for a production environment.
Your nginx should support encrypted traffic over HTTPS.
Issue a selfsigned certificate (not recommended), have a look at certbot or better:
Issue a Cloudflare Origin Certificate (SSL/TLS -> Origin Server)

EC2 backend and Firebase frontend using HTTPS

I have read many similar questions and found numerous articles elsewhere but I'm still unsure how to solve this.
What I'm trying to achieve:
Set my node app on AWS EC2 up to be able to communicate on HTTPS for free or at the lowest cost possible, while still being production ready.
What I have done:
Added inbound rules on my EC2 instance to accepts all traffic
on HTTP and HTTPS and additionally added a rule for HTTPS on PORT 443
specifically.
Set my node app to listen on port 443.
Most articles I have read recommend setting up a reverse proxy server using NGINX and a custom domain with an SSL certificate.
This leads me to the following questions:
Do I need a custom domain for my backend, for it to communicate on HTTPS?
If yes, can I use my Firebase free domain or a subdomain of it? E.g. https://myapp.firebaseapp.com/ or https://api.myapp.firebaseapp.com/
If yes and no, and I buy a custom domain, can I use mydomain.com for my frontend and api.mydomain.com for my backend - can this be done using the same SSL certificate?
Do I need a reverse proxy server?

HTTPS not working for Azure Traffic Manager for Azure Function at azurewebsites.net

I'm trying to use https://mysite.trafficmanager.net that should resolve to https://myfunction.azurewebsites.net without adding my own SSL cert or domain.
When I go directly to https://myfunction.azurewebsites.net the cert is valid, but when I go to https://mysite.trafficmanager.net I get a cert error saying the cert is issued to *.azurewebsites.net
Do I have to purchase my own SSL to get this to work? It seems like the certs should just work within the Azure family and that I'm just missing a configuration setting.
You get a cert error since myfunction.azurewebsites.net have a certificate for *.azurewebsites.net but not *.trafficmanager.net so traffic manager site is not secured unless you have a custom domain + SSL cert.
The azure traffic manager works at DNS level. This means that it does not handle any request, just making the right redirection. The clients connect directly to the selected endpoint, not through Traffic Manager.
If you want to access the endpoint via HTTPS, you just need to bind an SSL certificate on your endpoint. If you want this error to disappear, you can read this Azure networking feedback.
For a dev\test scenario, there are a couple options you may want to
consider:
Buy a real cert and domain/sub-domain for your dev-test setup.
Create a self-signed certificate for your site with the *.trafficmanager.net SAN added to it and install this self-signed cert to the Trusted Certificate Authorities store on your clients to not
get browser warnings.

SSL with appcloud.net subdomains

My SSL certificate is not verified on a subdomain of cloudapp.net - Classic Virtual server at Azure.
I setup everything in my IIS, and my port rule 443.
Could the subdomains at cloudapp.net not work with HTTPS at all?
Could the subdomains at cloudapp.net not work with HTTPS at all?
I tested it recently on my side and I make sure that the subdomains at cloudapp.net could work with HTTPS. Following are my steps.
Step 1. Generated certificate and installed it to IIS. I created and used a self-signed certificate for testing. I generated the .pfx file according to ways described in following link.
Generating a Self-Signed Certificate for Windows Azure Cloud Service
After that, we can upload the certificate to IIS of VM.
Step 2. Add HTTPS binding to your IIS.
Step 3. Enable 443 port for inbound rules and outbound rules.
Step 4. Add 443 endpoint for your VM.

Node.js - Change the SSL certificate for an HTTPS server dynamically at runtime

I'm building an HTTPS proxy in node. Basically I'm allowing people to set a DNS CNAME alias to my proxy machine (which has a wildcard DNS setupped), and import their SSL certificate into my application (like AWS Elastic Load Balancer does) so that their CNAME hostname is properly protected and recognized by the client on every request.
Now I'm working on the proxy side, and I'm trying to find a way to load the right certificate dynamically before the SSL handshake with the client. The workflow is:
A new request is received by the server
Get the hostname requested by the client (that is the DNS CNAME alias set by the user)
Load the right certificate belonging to that hostname
Use the loaded certificate in the current request (need help here)
Handshake (with the loaded certificate - which varies from request to request)
Is there a way to do that?
Here we go: using SNI in node should make it work.
The problem is that not all the clients (browsers or libraries) support it yet.

Resources