Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
How to manage client certificates for mutual TLS to be used within AWS Lambda

Our team is using AWS Lambda functions and API Gateway to facilitate connections to open banking API's within Europe. (PSD2).

Our Lambda's are written in NodeJS.

PSD2 requires Mutual TLS, which is fine and we have everything correctly implemented and working in a sandbox environment.

An example request would look something like this:

{
  hostname: '[bank hostname]',
  path: '[bank api endpoint]',
  method: 'GET',
  headers: {
    accept: 'application/json',
    signature: 'XXX',
    date: 'XXX',
    digest: 'XXX',
    'x-request-id': 'XXX',
    'tpp-signature-certificate': '[PATH_TO_CERTIFICATE]',
    authorization: 'Bearer [accessToken]',
  },
  cert: fs.readFileSync('/var/task/certs/cert.crt'), // Buffer
  key: fs.readFileSync('/var/task/certs/private.key'), // Buffer
} 

The problem we currently have is that we are unsure where to securely store our certificates. For the time-being, we are just storing them in an assets folder in our codebase, this is not ideal and we would like to move them out of our codebase for obvious reasons.

We have been looking at AWS ACM. However it is not clear how we would retrieve a path to certificates (after uploading them) in order to use it in the request above.

So my question is how would we use AWS to securely store our certificates in such a way that we can use them in a HTTPS request?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You cannot retrieve certificates from ACM, in fact these are attached to AWS resources only such as CloudFront, ELBs and API Gateway.

To retrieve the contents there is a couple of solutions.

The first is to store this in a credential/secrets store, AWS provide this functionality in the secrets manager service. Additionally you can store a SecureString in the systems manager parameter store.

Alternatively you could use a third party solution such as HashiCorp Vault.

With this approach if you need the file to exist on disk you will need to store the output in the tmp file storage.

If these approaches do not work for you, you could make use of AWS EFS. A recent addition has added support to allow Lambdas to have a NFS mount attached to share storage.

over 4 years ago · Santiago Trujillo Report

0

I think ultimately you are looking for a solution like AWS KMS or CloudHSM, which would allow you to securely store your private keys and perform cryptographic functions rather than reveal the keys for "external usage". This is the most secure way as even you won't be able to see the keys (although CloudHSM actually allows to upload/download keys).

As Node.js TLS module is based on OpenSSL and CloudHSM comes with ready-made openssl engine that you'll be able to use for Mutual TLS. Options privateKeyEngine, privateKeyIdentifier, publicKeyEngine and publicKeyIdentifier of tls.createSecureContext are to be used for that.

For AWS KMS (which is a way more cost-efficient solution) there is open source openssl engine written in Rust.

That being said, I'm not sure if you are able to use custom openssl engines in Lambda or if CloudHSM engine is included into Lambda's Node.js environment (which would be very logical). So you may also choose to "offload" mutual TLS connectivity to a "micro service" running outside Lambda. We went this way and implemented a very simple broker "proxying" mTLS calls using securely stored private keys.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!