-
Notifications
You must be signed in to change notification settings - Fork 2
/
gen_certs.sh
executable file
·50 lines (41 loc) · 998 Bytes
/
gen_certs.sh
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
44
45
46
47
48
49
#!/usr/bin/env bash
set -e
CERT="priv/stunnel.pem"
KEY="priv/stunnel.key"
cat << EOF
//////////////////////////////////////////
//// //////////////////////////////
/// //////// //// //// //// ///
// ////// //// //// // //// //
/ //////// //// // //// // //// ///
// //// //// //// //// ////
//////////////////////////////////////////
//////////////////////////////////////////
EOF
clean()
{
echo "[!] Cleaning"
rm -v "$CERT"
rm -v "$KEY"
}
gen()
{
openssl req -new -x509 -nodes -out "$CERT" -keyout "$KEY" -days 365
}
if [[ ! -e "$CERT" ]]
then
echo "[!] Certificate and key not found."
sleep 0.3
echo "[!] Generating…"
gen
else
PS3="=> "
echo "[+] Found a certificate and a key. Wyd?"
select var in 'Generate a new pair of cert/keys' 'Use the already existing ones'
do
case $REPLY in
"1") clean ; gen ; break;;
"2") break;;
esac
done
fi