Skip to content

Commit

Permalink
Randomize certificate generation (WhatsApp#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
slawlor authored Jan 10, 2023
1 parent 75d652c commit 68d98f1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions proxy/src/generate-certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ echo "| SSL Certificate Generation |"
echo "----------------------------"
echo

export RANDOM_CA=$(head -c 60 /dev/urandom | tr -dc 'a-zA-Z0-9')
export CA_KEY="ca-key.pem"
export CA_CERT="ca.pem"
export CA_SUBJECT="whatsapp.selfsigned"
export CA_SUBJECT="${RANDOM_CA}"
export CA_EXPIRE="36500" # 100 years

export SSL_CONFIG="openssl.cnf"
Expand All @@ -21,13 +22,15 @@ export SSL_CERT="cert.pem"
export SSL_SIZE="2048"
export SSL_EXPIRE="3650" # 10 years

export SSL_SUBJECT="proxy.whatsapp.net"
export RANDOM_SSL=$(head -c 60 /dev/urandom | tr -dc 'a-zA-Z0-9')
export SSL_SUBJECT="${RANDOM_SSL}.net"
export SSL_DNS=${SSL_DNS}
export SSL_IP=${SSL_IP}

export DEBUG=${DEBUG:=1}

echo "--> Certificate Authority"
echo "Generating certs for ${SSL_SUBJECT}"

if [[ -e ./${CA_KEY} ]]; then
echo "====> Using existing CA Key ${CA_KEY}"
Expand Down

0 comments on commit 68d98f1

Please sign in to comment.