add cert generator scripts, arrange scripts dir
This commit is contained in:
40
scripts/certs/regen-all.sh
Executable file
40
scripts/certs/regen-all.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
printf "Enter CA pass: "
|
||||
read -s pass
|
||||
printf "\n"
|
||||
else
|
||||
pass=$1
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
cd "$DIR"
|
||||
printf "${RED}Phase 1${NC} - Generating CA...\n"
|
||||
out=$(./gen-ca.sh $pass 2>&1)
|
||||
if [[ $out == *error* ]]; then
|
||||
printf "%s\n" "$out"
|
||||
exit 1
|
||||
fi
|
||||
printf "${RED}Phase 2${NC} - Generating server cert and key...\n"
|
||||
cd server
|
||||
out=$(./gen.sh $pass 2>&1)
|
||||
if [[ $out == *error* ]]; then
|
||||
printf "%s\n" "$out"
|
||||
exit 1
|
||||
fi
|
||||
printf "${RED}Phase 3${NC} - Generating client cert and key...\n"
|
||||
cd ../client
|
||||
out="$(./gen.sh $pass 2>&1)"
|
||||
if [[ $out == *error* ]]; then
|
||||
printf "%s\n" "$out"
|
||||
exit 1
|
||||
fi
|
||||
printf "${GREEN}Done!${NC}\n"
|
||||
|
||||
chmod -R +r "$DIR"
|
||||
|
||||
Reference in New Issue
Block a user