#!/bin/bash # Arguments: SCRIPT_DIR=$(dirname "$0") SCRIPT_DIR=${SCRIPT_DIR:-"."} CA_PATH="${SCRIPT_DIR}/myCA" if [[ ! -f "$CA_PATH.pem" || ! -f "$CA_PATH.key" ]]; then echo "CA certificates missing!" echo "checked path: $CA_PATH.(pem/key)" exit 1 fi openssl genrsa -out "$SCRIPT_DIR/$1".key 4096 openssl req -new -key "$1".key -out "$SCRIPT_DIR/in.csr" -subj "/C=US/ST=PRIVATE/L=PRIVATE/O=Success!/OU=Success/CN=$1" cat > "$SCRIPT_DIR/extfile" <