Exporting Certificates from AWS Certmanager Boto3 Python310 - python-3.x

So I manually imported a certificate and key pair issued by a third party to certmanage in AWS and I am trying to programaticly export to a webserver and I get this error:
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the ExportCertificate operation: Certificate ARN: arn:aws:acm:us-east-1:x:certificatexxxxxxxx is not a private certificate
Can I export a third party cert and private key from AWS certmanager?
python -V
Python 3.10.0
I am trying to export a AWS managed certificate from certmanager and its failing.
I've tried googleing the error code but come up with nothing.

AWS Certificate Manager (ACM) has two types of certificates. Public and Private.
You can't export any certificate when it is public. Even if you imported it.
You can associate your ACM certificate with ALB, for example, and put this ALB in front of your EC2 instance. But you can't export.
As you imported the certificate, it means you have the public and private parts of the certificate. You can just use it on your instance.
Only ACM privates ones can be exported.

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.

Cannot connect to external https from Azure SF due to untrusted certificate

I have an application, deployed in Azure Service Fabric.
The application connects to external web service which has an untrusted SSL certificate and fails.
I solved problem by implementing custom cert validation logic in "ServerCertificateCustomValidationCallback" method of HttpClient, however this is not an ideal solution.
How to install external SSL certificate into the trusted store on VMs in VMSS, so that any app in ASF can consume external web services without additional efforts?
Additional notes
Certificate contains no private key, so it cannot be imported into Azure key vault and used in ARM template (or I didn't find a way how to achieve this)
Certificate cannot be installed manually via RD, because this doesn't support autoscaling
It is possible to import .pfx certificate without password into Azure Key Valut. Certificate should be imported into Secrets (not into Certificates). Azure portal says, that this feature is deprecated but it works.
When certificate is in key valut, then ARM template can be used to deploy it onto VMs.
To get pfx certificates, I downloaded root and intermediate certificates in browser. Then converted .cer to .pfx via small .net console, written by myself - check X509Certificate class, it has all necessary methods.

Get Privatekey for AWS SSL

We are working on RedHat linux server with nodejs server.
While make my services ssl certified,
I got the SSL certificate from aws cli using ARN.
How could I get privatekey from aws ssl or how can I implement.
If you are using AWS Certificate Mananager (ACM) to generate the key pair and issue SSL certificates, you do not have access to the private key. The private key is managed entirely within the service.
See https://docs.aws.amazon.com/acm/latest/userguide/kms.html
Yes finally found the answer. while using load balancer for ssl certificate generation in AWS, we are no need to worry about ssl certificate things. the total things are handled by load balancer only.
what I did the wrong is, created load balancer for website in place classic load balancer for linux. Now it's working fine to me. No need to worry about ssl certificate while creating ssl certificate with load balancer in AWS
Thanks

How to download Certificate and Private Key on AWS EC2 when using NodeJS

I am relatively new to nodeJS. I have a AWS Instance using EC2 and I have successfully built http based severs.
I now want a SSL based server.
I used AWS Certificate Manager to create a new certificate and I have assigned it to the Load Balancer.
Within NodeJS I know I have to load the certificate and private key before creating the server.
What I seem to be missing is how to get the certificate and private key files onto my nodeJS server so that I can load them.
How is this done?
Within NodeJS I know I have to load the certificate and private key
before creating the server.
Incorrect. The certificate is served by the ACM certificate Elastic Load Balancer. It does not need to be, and can't be, installed on the NodeJS server.
What I seem to be missing is how to get the certificate and private
key files onto my nodeJS server so that I can load them.
You don't. That's not how ACM SSL certificates work. Once you have assigned the ACM certificate to the load balancer, and modified your DNS entries to point to the load balancer, you should be able to load your website via SSL.

Configure SSL on Windows Azure

i am having issue in configuring SSL on cloud app. i do the following steps in sequence
generate create certificate request from VM hosted on azure enviroment
a text file with CSR hash is created.
i send the hash to certificate issuing authority and i upload the new release in
the mean while on cloud
certificate issing authority send me 4 files with crt extension.
i import the .crt file in certificate manager console (certmgr.msc)
export the file in cer format.
update web role properties in VS 2012. add certificate and update endpoints.
upload cer file on cloud
publish the package and update the package on cloud.
update is not completed becasue of
certificate with thumbprint associated with HTTPS input endpoint https does not contain private key
can any one help me out how i configure SSL on cloud app.
regards,
Zeeshan
As Gaurav mentioned, in step 6, you want to export the certificate and include private key. This will generate a .PFX file and ask you to provide a password.
Furthermore, when you have the .PFX file - you will want to take care as to where you upload it to. Make sure that you upload it to Certificates area under the Web Role - the portal should ask you for a password to the .PFX file.
Management Certificates area that expects .CER files is not the right place to upload SSL certificates to. I am guessing it is likely where uploaded the .CER file from step 6
I followed the following step process when I was setting up SSL in Azure using GoDaddy as CA:
Create a Certificate Signing Request (CSR) on the web server (local IIS, not Azure)
Send CSR to CA (Certificate Authority – GoDaddy) and specify alternative domain names (if you've paid for that possibility)
Download certificate from CA
Import certificate to web server (local IIS, not Azure)
Import the intermediate certificates from CA into local computer (where you have IIS)
Export the certificate as PFX file from IIS and give it a password
Import PFX file into Azure together with password
Bind configured domain names to the certificate in Azure
There are a few different ways to create the CSR file. I used IIS Manager on my local developer computer.
You can read an extended version of the list here where all the steps are more thoroughly explained.
Have you checked the requirements for uploading and using certificate on windows azure?
The requirements is:
You need to include a certificate that must have a minumium of 2048 bit in keysize.
The certificate must be exported with Personal Information Exchange.
When creating the cerificate your subject name must match the domain name of you cloud service.
You have to include a private key.

Resources