Skip to content

Commit

Permalink
new certificate with SAN
Browse files Browse the repository at this point in the history
  • Loading branch information
qianjun1993 committed Mar 9, 2021
1 parent 466b54b commit e8938c3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 60 deletions.
32 changes: 15 additions & 17 deletions build/docker/ca.crt
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
-----BEGIN CERTIFICATE-----
MIIDITCCAgmgAwIBAgIJALwezbB84FA9MA0GCSqGSIb3DQEBCwUAMCYxJDAiBgNV
BAMMG0FkbWlzc2lvbiBXZWJob29rIFNlcnZlciBDQTAgFw0xOTA1MTQxNjUxMjZa
GA8yMjkzMDIyNjE2NTEyNlowJjEkMCIGA1UEAwwbQWRtaXNzaW9uIFdlYmhvb2sg
U2VydmVyIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWrYVeKO
cbhHD3spB3at0WGI29DOobCNjxb9KKQqY0rCnkgKygsTOM4LP0mXUEz/7jCOJqYE
dyLV+PQBSfYSpS543+RbKFv9gAz1cV/8udCZ5PJCvRggEMLRxvr3QwZDZQKHhETD
A7MFEKIBk/pLMhDYx15fNY4ryif2TH9Gc8DXkn5JAAgtXWi3kxf9N3Ie+EqLFYa9
mBQdenlc9njJXzHKUKOqoiV6BzmJ6rVpHbVPFgE4OvMm1rlky32ARl07tD4bYzaZ
ak2JQPCBkHjJ68G5vS3qAa1VU66yqqbeBtykgdiFHKpOJMkwgLI8IJ/TMztuZxBk
AG8ZyiPX4PumlQIDAQABo1AwTjAdBgNVHQ4EFgQU4HWijNVBZFUWJs0cC9x7eyUq
vw0wHwYDVR0jBBgwFoAU4HWijNVBZFUWJs0cC9x7eyUqvw0wDAYDVR0TBAUwAwEB
/zANBgkqhkiG9w0BAQsFAAOCAQEAa8TwSCf6j+xpN+NHhEP2Vyytiqj4JWx+BDzS
nbBnC4lHmdMpw5JqRGI/oiNzO+t9qYtWfZuifB9jy46Vd0j24LmEjLQIsc+NLWEv
5ltTEW4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MnmYjFojWtrBJmmjSb4x89agLhxgAN9wZ6PgCmvizftxB3ASNjhh9TiOmwmJ
H30pznf4+Fgpze+qk0YQ2RQ29nCb+xKGp7dZX++i7tYEjNJLNoJ9net37oNN0w==
-----END CERTIFICATE-----
34 changes: 18 additions & 16 deletions build/docker/tls.crt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIC0jCCAboCCQD8dzANQe5A8jANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtB
ZG1pc3Npb24gV2ViaG9vayBTZXJ2ZXIgQ0EwIBcNMTkwNTE0MTY1MTI2WhgPMjI5
MzAyMjYxNjUxMjZaMC4xLDAqBgNVBAMMI2Nyb24taHBhLWNvbnRyb2xsZXIua3Vi
ZS1zeXN0ZW0uc3ZjMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzJrg
0l0KWpT9CELiSjKdqDETRlqecoG4O5v3Zxq+sB+Z2hpIgIsJL23HngUjllyMrZXr
DdyZwugsPKuO2U7oPH187J3OyLU9P8gcKrkSMhzVMS9KWXg/BSHaINIWzwI6+Bqz
odz7NmyL43Z6CGSCNq90uTU9u31J+9c13q8beXav4mBIg6O55rJuXofqCqMyNJp2
7jrko3X6xUjDV1hDtNvvKXwvstohLL2X4/5lKWhAr3hn1z5Zb3G34Uwua20lSpPh
1EJWjioAx8S4T4VvJbQ9o25bSYktn2NsnN5X1/WrbmecjlabjRKxPvQA1HzgYTnn
kSKaC1fAPEII7OBJIwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBVdbDPNAVAa1PY
k6boR9RGOjMnEJ7R+dHDgeFOY6VsrI7kOwTp5HWGbNVUoIV7xqL3x8XE0snQ7+8m
Z0uhaBKVuD4trs0oyOgL+x78vJpDnt7Ki9/m/xbOPNlg0D28k4AOsu57R0K5b5gH
8iFjfhqYM28o1keQIqlX5vI51pqOqOorysefAV9C8SfYpTXYc9InsJvH8PPb7ZF4
7RE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9y5DOB/m4ehEq3An1zjS4yGTpozhf/R5+bbR3G
8pcNUCyXrzCpXLoSOzCtyCPcP80QrfncMgxpDQlrJVxuyT7qsCGddfTocbIiVZJE
yew5OxppFtC0k+sL9IOHCgSK84DNsoHGkMmYzLY2U1ZpnNASYdNQaxkwZvsZh6Jy
EN4/olD6tqJLkxOHfTCVN0ic07Hh6wSLUY1sEHuPFVO9RKU62XvTJ2KyHID27w==
-----END CERTIFICATE-----
50 changes: 25 additions & 25 deletions build/docker/tls.key
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAzJrg0l0KWpT9CELiSjKdqDETRlqecoG4O5v3Zxq+sB+Z2hpI
gIsJL23HngUjllyMrZXrDdyZwugsPKuO2U7oPH187J3OyLU9P8gcKrkSMhzVMS9K
WXg/BSHaINIWzwI6+Bqzodz7NmyL43Z6CGSCNq90uTU9u31J+9c13q8beXav4mBI
g6O55rJuXofqCqMyNJp27jrko3X6xUjDV1hDtNvvKXwvstohLL2X4/5lKWhAr3hn
1z5Zb3G34Uwua20lSpPh1EJWjioAx8S4T4VvJbQ9o25bSYktn2NsnN5X1/Wrbmec
jlabjRKxPvQA1HzgYTnnkSKaC1fAPEII7OBJIwIDAQABAoIBAG+gU+YRIrP2svHN
472NTdxUIerxR567TPMgjWKwAbb/FqYaTtHqiPFaWFzK+vZuucV+lEX0w+LFXlUf
WAkQ9r0BzaUeF5IC506j81IPtHCosFtsLIkRhHhdVq8vT4hS9C8mCjjV4ix4Hf3U
RpHLnAsPwIPHG03t9e4zJM3ABSJHdmRzWyJfLBgqVxxoNqN6fFYLTcvfYlNAED4V
LLPVRCalNLe1LdO+2jTw97rOKguXEhDqWIpUra15EnBiTWXholLHvpTkF8U5gI4X
DaoL9wVuuk6TaaWxrk9zzEVVeTYcfqQrCkv4R6KTD7JzbI0ipijD+jjkGyWVvVEE
HLe16GECgYEA/jqsgoJyYwFu5YvaYyzp+Ou/zw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mcj9QIyB45
oi5LeV3jDi6/qVszXbyEoRiWP1k9pAQJZJ6cED9QcvtMuUVc+m2071UcXZ52I+wN
jLIEj5hdtjEbEShJCoqEm2BOV+dXJEegu+9qEHxA9+oe50lK/7FDizzIaCKHaLRB
EFpdBQKBgGmV/X7pLS244Hmbt4HXLIzAE5CQg5IIdUKT+v0Ih3Hz3Ku1VlIZYnZ5
5NdULo5O79CkOBug5sSpd+AI8Q36qvzmLArcooFhmhpS/aCr8oZceJrcmb2Q8W2U
fYM9Mj+KNIR883dk20/y2S96OpqmT4FVp7TH+S0qwKHbJsZZDmIi
-----END RSA PRIVATE KEY-----
25 changes: 23 additions & 2 deletions hack/gencerts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,31 @@ mkdir -p $key_dir
chmod 0700 $key_dir
cd $key_dir

SANCNF=san.cnf

cat << EOF > ${SANCNF}
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = CN
O = tkestack
CN = cron-hpa-controller.kube-system.svc
[v3_req]
keyUsage = critical, digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth, serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=cron-hpa-controller.kube-system.svc
EOF

# Generate the CA cert and private key
openssl req -nodes -new -x509 -days 100000 -keyout ca.key -out ca.crt -subj "/CN=Admission Webhook Server CA"
# Generate the private key for the webhook server
openssl genrsa -out tls.key 2048
# Generate a Certificate Signing Request (CSR) for the private key, and sign it with the private key of the CA.
openssl req -new -days 100000 -key tls.key -subj "/CN=cron-hpa-controller.kube-system.svc" \
| openssl x509 -req -days 100000 -CA ca.crt -CAkey ca.key -CAcreateserial -out tls.crt
openssl req -new -sha256 -days 100000 -key tls.key -subj "/cron-hpa-controller.kube-system.svc" -reqexts v3_req -config ${SANCNF} \
| openssl x509 -req -days 100000 -CA ca.crt -CAkey ca.key -CAcreateserial -extensions v3_req -extfile ${SANCNF} -out tls.crt

0 comments on commit e8938c3

Please sign in to comment.