create a certificate chain (Self Signed) for Azure Web App - azure

How can I create a certificate chain (Self Signed) for Azure Web App? I turned on the settings in the code and Incoming client certificates.
But in the logs I see an error:
OfflineRevocation The revocation function was unable to check revocation because the revocation server was offline
Certificate was not authenticated. Failure message: Client certificate failed validation.

You may use the New-SelfSignedCertificate command from Powershell to create a new self-signed certificate for testing purposes. For example:
PS C:\> New-SelfSignedCertificate -DnsName "www.fabrikam.com", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My"
This creates a self-signed SSL server certificate in the computer MY store with the subject alternative name set to www.fabrikam.com, www.contoso.com and Subject and Issuer name set to www.fabrikam.com.
Once you have the cert, you may upload it to your App service. Check this post on MSDN for more details on the working solution. However, do note that you might still see some certificate validation errors if the cert is self-signed. Consider using a free App Service Managed Certificate or the App Service certificate as they already satisfy the prerequisites of App Service.
Hope this helps.
References:
Add an SSL certificate in Azure App Service
Secure a custom domain

Related

Azure KeyVault generated certifcate is showing Not Valid in Browser

Created a self signed certificate in Azure KeyVault as below with DNS
Azure KeyVault Certificate
Have added the certificate to Azure Kubernetes Service as a secret using secret-store-csi-driver and added to ingress
Problem is while opening the DNS in browser it shows certificate is not valid as below
Certificate Not valid
The Certificate is already added to Trusted store and shows as below
Certificate Details
Certificate Details
Also, the certificate in browser is the one in Azure Keyvault certificate as evident from the validity date
What could be the issue?
When you use self sign a certificate, your Operating System or Browser wont trust this Cert, as it is self signed and considered insecure for the Internet.
You need to use a Cert from a valid Certification Authority or import your CA root cert that created the cert into your OS or Browser. But every user need to so this.
A better approach is Cert-Manager ff you are using AKS. Cert-Manager can issue certificates from LetsEncrypt. Here is a workflow from Microsoft for this.

App Service not returning full certificate chain with custom TLS binding

I uploaded a self signed certificate chain in .pfx format to our App Service instance and configured SNI TLS/SSL Binding. For some reason only the server certificate with depth 0 is returned although I would expect the intermediate and root cert as well.
Has anyone else encountered this behaviour? Am I missing something?
After talking to the Tech-Support at Microsoft, i have been told it is not possible to return full self-signed certificate chains via App Service for security reasons. It is however possible to use Application Gateway for SSL offload with self signed certificates.

Azure APIM - how to validate client certificate using context.Request.Certificate.Verify()

I am trying to validate a client certificate in Azure API management using context.Request.Certificate.Verify() method.
I have tried the following steps:
I have created self signed root CA certificate and then created a
client certificate and key file.
Now from postman, I am trying to call a method attaching the client certificate. I have verified that the certificate is sent to APIM via trace.
Have uploaded the root CA certificate in APIM -> CA certificates. While uploading I
converted to ".cer" file as it is not accepting ".crt" file and set the Store as "Trusted root".
In APIM policy, have used the method to validate the client certificate via context.Request.Certificate.Verify().
Now, when I try to call APIM api with client certificate, the above method (step 4) is always coming as False, verified from apim trace. Not sure, what and where I am doing wrong things. Any help/guidance or any article is really helpful.
I faced the similar issues, Investigation Summary / Cause are below:
Later customer encountered issue again when they sent PFX certificate as a client certificate to APIM from Postman.
The self signed certificate CRL distribution list (Urls in certificate revocation lists) and Access information cannot be publicly reached (APIM is public hosted and not internal) hence certificate.verify fails
2 options to fix the issue
Purchase a certificate from a Public trusted CA
Use context.Request.Certificate.VerifyNoRevocation instead of context.Request.Certificate.Verify so that APIM will not check the revocation list during certificate.verify
Note:
If certificate.verify is a mandatory order from your security team, then you would have to purchase a certificate from trusted CA
o you need to VerifyNoRevocation since apim cannot retrieve revocation list information and VerifyNoRevocation will still perform verifying certificate path as well
For client certificate validation in Azure API management generally following steps are required.
Generate a root CA , intermediate CA along with the client certificates.
Upload the intermediate certificate which validate client certificates sent by the user.
You van utilize this guide to set up the CA.

Azure App Service using Self-Signed Cert

I deployed an application out to our app service in Azure, and the app needs to have SSL to run, but since it is still in development I did not want to have to purchase a cert yet, so I created a self-signed cert through openssl. The private key is 2048 bits, which should be enough, but when I go to apply the cert to the hostname, it just sits there and never applies.
Is there a special step you have to complete to get self signed certs to work, or, are you not allowed to use self signed certs in Azure App Services?
Try to use ServerCertificateValidationCallback to monitor the verification of server certificate, comparing the certificates between local and server or just returning true.
Now when you invoke the https service in your web app, the verification callback will be invoked automatically. If failed, you will see the errors. If successful, the service response will be returned.
For more details refer this article: http://devchat.live/en/2017/09/29/how-to-invoke-https-service-protected-by-self-signed-certificate-from-azure-app-service/.

0x800b0110 ("The certificate is not valid for the requested usage".) Error in IIS 8 Windows server 2012

In the Server
I have configured a intermediate certificate .pfx file in the IIS and created a https (443) port using binding option. I use certificate for Authorisation also I am expecting a client certificate from the client , I enabled the Require SSL and clien certificate required option in the IIS.
I checked the Intermediate certificate authorities for the root certificate and they also presents, checked the .pfx file installed in the certificate store (Local Machine) also presents.
I created .cer file from the above .pfx file with include private key option and shared the .cer file with my client and he has to attach the .cer file for authorisation .
Above is the REST wcf service with POST.
In the Client Side
I tested this application after getting the .cer file, attach that to my request in my client.exe and calling the service - it returns .403 fobidden error.
In the IIS log it is logged as 403.16 , sc-win32-status code = 2148204816 error
Please help me my above approach is correct and how to avoid this error.
Is configuring CTL is the option , or I need to get a separate client certificate for use from my client side.
You need to make small steps to debug this.
First import SSL server certificate to LocalMachine\My store. Verify
that certificate is trusted (by double-clicking it and verifying
chain).
Setup SSL binding in IIS. Verify that you can access the https site (even WCF service gives some documentation page on http/s).
Import client certificate in client CurrentUser\My store. Verify that certificate is trusted (by double-clicking it and verifying
chain).
Set SSL require mode on your WCF service on IIS. Verify that when you access https site of the WCF service a certificate is prompted and no trust error is returned (again, the documentation page should be displayed)
Server certificate must have Server Authentication extension. Client certificate must have Client Authentication extension in it. Client has to trust server certificate. Server has to trust Client certificate. This means that CRLs from both chains must be reachable.

Resources