Deno: Custom CA certificates

Created on 8 May 2020  路  6Comments  路  Source: denoland/deno

In node, I was able to get around my organisations custom certificate authority using the $NODE_EXTRA_CA_CERTS environment variable. It seems to me that no such environmental variable or flag exists in deno.

All 6 comments

Is the --cert flag what you're looking for?

As suggested by @WilcoKruijer --cert flag is what you're looking for @jajaperson - it takes a path to file with certificate that will be later used by Deno's HTTP client - both for module downloads as well as fetch() API.

Do we have an Environment variable alternative as well?
It can be a useful feature when creating internal base images for corporates.

@mkkhedawat HTTP_PROXY and HTTPS_PROXY should work as well

@mkkhedawat do either of those take a .pem file path like --cert?

I would guess they take proxy URLs (cntlm/pac) just like node js. But I don't want to proxy internal traffic. So for my use case, I wrote a small script :

#!/bin/sh

if [[ $1 == "run" ]];
    then command shift && command /bin/deno2 run --cert=/usr/local/share/ca-certificates/corporate.pem "$@" ;
else
    command /bin/deno2 "$@";
fi;

& Docker file as

# prebuild cert workaround until deno starts using native tls
RUN mv /bin/deno /bin/deno2
COPY deno.sh /bin/deno
RUN chmod +x /bin/deno

It replaces deno run with deno run --cert=blah
Rest as usual.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

doutchnugget picture doutchnugget  路  3Comments

ry picture ry  路  3Comments

benjamingr picture benjamingr  路  3Comments

sh7dm picture sh7dm  路  3Comments

ry picture ry  路  3Comments