Azure Application gateway with lets encrypt - azure

I have an AKS cluster running running Internal nginx ingress + cert-manager which generates lets encrypt for ssl terminations.
I would like to include application gateway as an entry point, where I expect that SSL internet traffic hits Applicatiom Gateway and traffic is forwarded to the nginx ingress, then to my application. I do not mind if SSL offloading is done at Appgw level or on the AKS cluster itself.
One of my biggest headaches is that Application gateway requires a certificate when an https listener is created. Since the certifiate is generated automatically on the AKS cluster I do not see the benefit of supplying an SSL certificate to the Application Gateway neither do I want to go through the extra work of generating a certificate and storing it keyvault etc etc.
What is the neatest way to tackle this problem? Potential solutions I have considered are
Configure Application Gateway to passthrough SSL to the AKS cluster
Somehow configure cert-manager to store the certificate in keyvault
The only options I see are (but I like neither are)
Purchase a certificate and store it in keyvault (however I prefer using Lets Encrypt)
Generate the SSL certificate on a cluster and then write a script which scrapes the certificate and stores it in Azure Key Vault
Any help will be appreciated

As per this tutorial here you can use cert-manager an AKS add-on that automates the creation and management of certificates.
You can also go through this tutorial which uses Azure automation runbook to automate certificate rotation for ApGw.

Since the above hasn't solution hasn't really helped me, I had decided to write an aks cron job which syncs certificates to azure keyvault.
If anyone is interested, I would be able to open source it.

Related

Understanding where generating fullchain.pem and privkey.pem fits into this cluster setup

I used this repo https://github.com/scarolan/vault-aws-cf to generate a HashiCorp Vault and HashiCorp Consul cluster for secrets management. During the setup, it was required that the vault AMI's needed certificates, in this case a fullchain.pem and privkey.pem
What is their purpose in this setup? I generated a managed certificate for https on Amazon Web Services but want to understand the AMI server requirements for the certificates.
those certs are used for your https listeners, for example here.
The AWS certificates you generated through AWS ACM wont work since they are managed by AWS.
You could generated AWS certs through ACM, but you'd need access to the private key as well, for example https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-export-private.html . That means that AWS wont be able to rotate your certs and you need to do it by hand.
You could also place your Vault behind an ALB and attach the certificates you generated in the first place in that ALB. This means that your SSL is terminated at the Load balancer level and the traffic between your ALB and Vault is going to be unencrypted.

Node HTTP/2 the correct place to set managed certificate

I have created a NodeJS application using http/2 following this example:
Note: this application uses self-signed certificate until now.
We deployed it on GKE, and it is working until now.
Here is how this simple architecture looks like:
Now, we want to start using real certificate, and don`t know where is the right place to put it.
Should we put it in pod (overriding self-signed certificate)?
Should we add a proxy on the top of this architecture to put the certificate in?
In GKE you can use a ingress object to routing external HTTP(S) traffic to your applications in your cluster. With this you have 3 options:
Google-managed certificates
Self-managed certificates shared with GCP
Self-managed certificates as Secret resources
Check this guide for the ingress load balancing
The Client's SSL session terminates at the LB level, the self-signed certificates being used are just to encrypt communication between the LB and the Pods. So if you want the client to use your new valid certificate it needs to be at the LB level.
On a side note, having your application servers communicate with the LoadBalancer over HTTP will give you a performance boost. Since the LB is acting as a reverse proxy anyway.
You can read this article about LoadBalancing it's written by the author of HAProxy

Azure VM SSL certificate

I have backend https://x-x-x.com hosted in azure portal recently that https has been expired and my task is to replace it with new certificate which is in pkg format.
Now I have been looking around inside Azure Portal for app service but I can only find Azure Resource group which has Virtual Machine has Linux(ubuntu) server and load balancer. After reading documentation I found out that I can do it by connecting to VM and install SSL there using docker and HA proxy. But I am not sure how to do it and if I am on right track or not?
My concern is what is the best way to do it and is there any resource which I can follow to complete my task and will it replace my backend https://x-x-x.com certificate?

Service Fabric, which certificate do I use where?

I'm settings up a Service Fabric cluster in Azure and want to run a web API (using .NET Core) over https. I want to use my CA-signed wildcard (*.mydomain.com) certificate to access this API. But I'm a bit confused as to where I use it when I create the cluster, is it the cluster or client certificate? I'm thinking the client certificate, but the documentation states that this is for admin tools (i.e. the Explorer), so I'm unsure on how to proceed.
And yes I've read a ton of posts and resources, but I still find this confusing.
There are three certificate types. Here is a summary overview of them.
The Cluster certificate is used for the Explorer endpoint and is deployed to the primary nodes. So if you add your *.mydomain.com wildcard cert there, and CNAME something (e.g. manage.mydomain.com) to [yourcluster].[region].cloudapp.azure.com, then when you hit your management endpoint that cert will be what will be presented to the web browser.
The Reverse Proxy SSL certificate is deployed to each of the nodes and is used when using the built-in reverse proxy feature of Service Fabric. In this case this is what is being used when you hit https://api.mydomain.com/YourAppName/YourService/Resource (where api.mydomain.com is another CNAME to yourcluster.region.cloudapp.azure.com). This is used as an alternative to running your own reverse proxy or other offloading layer (Application Gateway, IIS, nginx, API Management, etc).
The Client certificates are used in place of Azure Active Directory authentication to the management endpoint. So instead of managing users in AAD (with the _Cluster AAD application and the Admin / Read-Only roles), you manage access by handing out management certificates (Admin or Read-Only) to your trusted users.
You can also have secondaries these certificates to use in certificate rollover situations.
The way we are using it is to have Application gateway configured in front of service fabric cluster, and web certificate is uploaded to Application Gateway (and dns is pointing to application gateway) In that scenario SSL is terminated at application gateway.
Another possibility is to terminate SSL at each node in service fabric cluster, in this scenario you would need to ensure that certificate gets deployed to each of the nodes.
As for cluster vs client certificate dilemma, I am also confused, but I think the answer is neither. Client certificate is not for sure since this certificate is used to identify you as admin when running service fabric admin ps scripts.
I do not think it is cluster certificate either, here is what MS docs say what it is used for:
Cluster and server certificate is required to secure a cluster and prevent unauthorized access to it. It provides cluster security in two ways:
Cluster authentication: Authenticates node-to-node communication for cluster federation. Only nodes that can prove their identity with this certificate can join the cluster.
Server authentication: Authenticates the cluster management endpoints to a management client, so that the management client knows it is talking to the real cluster. This certificate also provides an SSL for the HTTPS management API and for Service Fabric Explorer over HTTPS.
as far as I am reading into it, this certificate is used for internal cluster authentication, and it is also used so your management tools can be asured that they are working with right cluster.

How to bind custom SSL certificate to Service Fabric cluster management endpoint?

I have an Azure Service Fabric cluster running with management endpoint https://mysf.westeurope.cloudapp.azure.com:19080/Explorer.
And I have a CNAME record:
sf.mycoolcluster.nl --> mysf.westeurope.cloudapp.azure.com and a valid certificate for sf.mycoolcluster.nl.
What I would like is to go to https://sf.mycoolcluster.nl:19080/Explorer and see my own certificate being served. However, I see no way of binding my certificate to port 19080 on the cluster so this doesn't happen.
I already configured my own certificate as the secondary SF certificate via the cluster ARM template and started using this certificate everywhere the primary certificate was used. This works fine. But still the (old) primary certificate is used by the management endpoint, resulting in a certificate validation error.
You need to setup secondary certificate by ARM template deployment, then You need to change primary with secondary (Swap) , wait 30min, delete the secondary and wait 30 min. All described here https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-security-update-certs-azure

Resources