-
Notifications
You must be signed in to change notification settings - Fork 1
/
minio-tls-generate.sh
executable file
·59 lines (55 loc) · 1.28 KB
/
minio-tls-generate.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
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# Script to generate tls secret for minio service
# minio-tls-generate.sh minio-service test minio-secret
SERVICE_NAME=$1
NAMESPACE=$2
SECRET=$3
cat <<EOF | cfssl gencert -initca - | cfssljson -bare ca
{
"CN": "Root CA",
"names": [
{
"O": "Cloud"
}
],
"key": {
"algo": "rsa",
"size": 2048
}
}
EOF
cat <<EOF > ca-config.json
{
"signing": {
"default": {
"expiry": "87600h",
"usages": ["signing", "key encipherment", "server auth", "client auth"]
}
}
}
EOF
cat <<EOF | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=./ca-config.json - | cfssljson -bare server
{
"hosts": [
"localhost",
"${SERVICE_NAME}",
"${SERVICE_NAME}.${NAMESPACE}",
"${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local",
"*.${SERVICE_NAME}",
"*.${SERVICE_NAME}.${NAMESPACE}",
"*.${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local"
],
"names": [
{
"O": "Cloud"
}
],
"CN": "${SERVICE_NAME}",
"key": {
"algo": "rsa",
"size": 2048
}
}
EOF
cfssl bundle -ca-bundle=ca.pem -cert=server.pem | cfssljson -bare server
kubectl create secret generic ${SECRET} --from-file=private.key=server-key.pem --from-file=public.crt=server.pem