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

43 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
################################################################################
# Intended use: Simple shell script to create certs (RSA or EC)
#
# Notes: This script support Linux Bash shell script only
# Install Bash from https://www.gnu.org/software/bash/
#
# Copyright (C) 2015 - 2025, VGISC Dev Team <dev@vgisc.com>
################################################################################
filepath=`readlink -f $0`
basedir=`dirname $filepath`
CLIENT_DIR="$basedir/client"
DOMAIN="vgisc.com"
OPENSSL_BIN="$basedir/bin/openssl"
MKC4B_B64_BIN="$basedir/bin/util_mkc4b_encrypt_encode_file"
i=1
NUM=99
echo "==========================================================="
echo "Generating cert/key for clients in $CLIENT_DIR/..."
echo "==========================================================="
echo ""
while [ $i -le $NUM ]
do
echo "Generating cert/key for client \"vpn$i.vgisc.com\"..."
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
cp -rf $CLIENT_DIR/* $basedir/$DOMAIN/
echo "All plain text encrypted and key/cert files have saved to ./$DOMAIN/"
echo ""
echo "All Done"