-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate_req.sh
More file actions
executable file
·43 lines (41 loc) · 1.69 KB
/
generate_req.sh
File metadata and controls
executable file
·43 lines (41 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
ORG="Your Organization"
COUNTRY=US
STATE=CA
GROUP=YOURGROUP
EMAIL="yourname@youremail.com"
CONTINUE=./combine_cert.sh
if [[ $1 ]]; then
echo "Preparing to generate a private key and"
echo "certificate request with the following information:"
echo "=================================================="
echo "Organization: ${ORG}"
echo "Country: ${COUNTRY}"
echo "State: ${STATE}"
echo "Group: ${GROUP}"
echo "Email: ${EMAIL}"
echo "User: $1"
echo "--------------------------------------------------"
echo "If this is incorrect, press ^C now and correct it."
echo "The country, state, and group are defined at the top of $0"
echo "=================================================="
read -p "Press enter to continue"
openssl req -new -config vpnreq.config -out $1-req.pem -keyout $1-key.pem \
-subj "/C=${COUNTRY}/ST=${STATE}/O=${ORG}/OU=${GROUP}/CN=$1/emailAddress=${EMAIL}"
cat $1-req.pem
echo "=================================================="
echo "Copy and paste the above request into the"
echo " certificate request form for your VPN or forward"
echo " it to your network administrator"
echo "--------------------------------------------------"
echo "After your request has been approved, retrive the"
echo " \"certificate chain\" in \"ASCII\" format from"
echo " your certificate request server or your network"
echo " administrator and save it to this directory as"
echo " \"certnew.p7b\""
echo "=================================================="
read -p "Press enter to continue\n(or to continue later, type: \"${CONTINUE} $0\" )"
$CONTINUE $1
else
echo "Syntax: $0 username"
fi