sorry for the newbie question. just wondering about the SSL certificate implementation.
do i implement SSL in ALB or Apache? or this should be for both?
in our setup we have ALB facing the public, and our Apache (internal) is served from ALB.
as i understand if the transaction is public, it should be using SSL to prevent any man in the middle attacks. but since ALB to apache is internal do i still need to implement the SSL?
yeh expiration is also thing to worry if implemented in apache, maybe a self-signed will do? will also check with client policy if they are very strict with this requirements.
for MITM attacks internally or cloud. our setup is, Apache server is secured and only specific vpc ip is allowed to access. for this case ALB is allowed in Apache.
to communicate with apache from public, they really need to connect to ALB.
as i understand if the transaction is public, it should be using SSL to prevent any man in the middle attacks.
Correct. The fastest way is just to setup an ACM (AWS Cert Manager) certificate on the LB. This is super-secure, since nobody actually gets the cert, AWS manages it on your behalf. It’s completely free.
If you try to do it in Apache, you will have to manage another piece of software to manage your cert. (Or pay a few hundred bucks to buy a cert.)
but since ALB to apache is internal do i still need to implement the SSL?
No, you don’t generally need SSL from the ALB to Apache. A few sites might be paranoid and encrypt it anyway, and some sites have regulations that require encryption for every leg of the journey. In that case, they would need to create a cert for Apache.
For people who want encryption end-to-end (and there really isn’t a reason not to) then the most common thing to do is:
- Register a public certificate with Amazon Certificate Manager (ACM) and have this on your ALB. If you don’t already have one, you can get a free one from ACM
- Create a “self-signed” certificate on your web servers and use this within Apache/NGINX. You can script the creation of a self-signed certificate as part of your deployment process, and you can set the expiry of the certificate to 25 years or more so you never have to worry about it expiring
- The users will see the real certificate and see green in their browser address bar. The ALB will happily accept the self-signed certificate and encrypt the internal traffic
I’m the lead engineer for Amazon ELB
…
You’re right that ALB does not validate the certificates on targets…
…
We believe that this protection is far stronger than certificate authentication.
…
The short of it is that traffic simply can’t be man-in-the-middled or spoofed on the VPC network, it’s one of our core security guarantees.
yes, setting up apache will add more to complications.
specially in future, as you need to maintain the certificate from time to time.
ACM will be the best option for this.
Use AWS Certificate Manager (ACM) to manage the certification and implement it at the ALB level. You are correct in that it will prevent any MITM attacks insofar as intercepting data between the ALB public endpoint and the end user’s request.
If you have a certificate from a third party, go ahead and try and switch it over to ACM, because even if you import the third party cert into ACM, which is easily doable, unfortunately, ACM cannot automatically renew it for you. Subsequently, you would have to renew it and then import the new one yourself, which is annoying, hence my recommendation to let ACM handle automatically renewing it for you. Official AWS docs verifying imported certs cannot be renewed.
If you setup Apache to use SSL as well, yes it meets some of the more annoying compliance requirements out there, and it is kind of nice to be able to say traffic is encrypted 100% end to end. But you have to setup the cert on the VM or the Docker image you’re going to be instantiating with ECS or… whatever. That requires more work. And if you, say for instance, forget to renew the cert on the compute instance, at best loading your website starts throwing warnings, at worst it stops loading.
The only time to really setup something like that is where there’s some third party regulation you absolutely positively have to meet and the auditor is about as understanding and forgiving as that
So, I’m going to give a different answer from most of the people, because I work far too much in security sensitive areas, and run into way too damn much where people said ‘oh, security here doesn’t matter’, and then it gets used for a little bit more… And, well, it doesn’t end well.
You want SSL certificates at both the ALB layer and at the Apache.
For the ALB layer, by all means, use ACM. It’s easy, it works, you can set it and forget it.
For the apache, you have a few different options, all of which come with different tradeoffs. My personal preference for EC2 instances is to either give them real names and use letsencrypt, or to have a very basic CA infrastructure that you can use to automatically issue certificates to your instances.
The latter is, frankly, more complicated. Most people have neither the need nor the desire to deal with setting up something like Hashicorp Vault just to issue certs to your endpoints, even if it’s convenient as hell once you have it rolling.
(Just making a single self-signed cert and adding it to the ALB trust store sounds easy, but then you have to figure out how you’re going to provision that cert and key to your instances. Which almost always ends up with you checking the damn thing into your source code repository, which is a horrible idea. Now, there are ways to make that… Moderately less disgusting, like encrypting it with a KMS key, and using KMS (with a role that only the instances get) to decrypt the key and cert on instance start. But again, complexity to get off the ground.)