vgisc-rsa-4096/encrypt_keys.sh
2025-02-24 11:30:30 +07:00

45 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# Date: 2021-07-20
# Author: Ho Sy Tan <hstan@vgisc.com>
# Description: Simple shell script to create client certs (RSA or EC)
filepath=`readlink -f $0`
basedir=`dirname $filepath`
CLIENT_DIR="$basedir/client"
PROJECT_SRC_DIR="/vgisc/6t/CT129/Dev/BML/src"
OPENSSL_BIN="$PROJECT_SRC_DIR/rls/3.3.1/rootfs/opt/vgisc/usr/linux-x86_64/bin/openssl"
TEST_OPENSSL_BIN="$OPENSSL_BIN"
MKC4B_B64_BIN="$PROJECT_SRC_DIR/lib/libvcrypt-3.3.1/tools/bin/linux-x86_64/util_mkc4b_encrypt_encode_file"
export LD_LIBRARY_PATH="$PROJECT_SRC_DIR/rls/3.3.1/rootfs/opt/vgisc/usr/linux-x86_64/lib:$LD_LIBRARY_PATH"
i=1
NUM=99
echo "==========================================================="
echo "Generating cert/key for clients in $CLIENT_DIR/..."
echo "==========================================================="
echo ""
while [ $i -le $NUM ]
do
echo "==========================================================="
echo "Generating cert/key for client \"vpn$i.vgisc.com\"..."
echo "==========================================================="
echo ""
./build.sh rsa client vpn$i.vgisc.com
${MKC4B_B64_BIN} -e $CLIENT_DIR/vpn$i.vgisc.com.key $CLIENT_DIR/vpn$i.vgisc.com.mkc4b.b64
i=`expr $i + 1`
done
echo "==========================================================="
echo "All plain text encrypted and key/cert files have saved to ./$CLIENT_DIR/"
echo "==========================================================="
echo ""
echo "All Done"