-
Notifications
You must be signed in to change notification settings - Fork 1
/
certificate.sh
28 lines (24 loc) · 919 Bytes
/
certificate.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
#!/bin/bash
echo
echo -------------------------------
echo SSL/JKS Generation by haris44
echo https://github.com/haris44/logstash-ssl-conf
echo -------------------------------
echo All data must be on lowercase
echo You must have read/write rights on this folder
echo -------------------------------
read -p "Openssl.cnf path : " openssl
read -p "Path where new certificate will be generate : " path
read -s -p "Password : " password
echo
read -p "CA name : " name
mkdir ${path}
cp ${openssl} ${path}/openssl.cnf
cd ${path}
# Generate .crt and .key
# ======================
openssl req -x509 -batch -nodes -days 3650 -newkey rsa:2048 -keyout ${name}.key -out ${name}.crt -config openssl.cnf
# Create JKS
# ======================
keytool -genkey -alias temp -keystore ${name}.jks -storepass ${password}
keytool -import -alias alias -file ${name}.crt -keypass keypass -keystore ${name}.jks-storepass ${password}