mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 00:27:44 +01:00
Merge pull request #8646 from bitsf/add_harbor_test_ca
use fix root CA for test
This commit is contained in:
commit
aab3925dab
@ -2,8 +2,10 @@
|
||||
|
||||
# These certs file is only for Harbor testing.
|
||||
IP='127.0.0.1'
|
||||
if [ ! -z "$1" ]; then IP=$1; fi
|
||||
OPENSSLCNF=
|
||||
DATA_VOL='/data'
|
||||
CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
for path in /etc/openssl/openssl.cnf /etc/ssl/openssl.cnf /usr/local/etc/openssl/openssl.cnf; do
|
||||
if [[ -e ${path} ]]; then
|
||||
@ -16,21 +18,28 @@ if [[ -z ${OPENSSLCNF} ]]; then
|
||||
fi
|
||||
|
||||
# Create CA certificate
|
||||
openssl req \
|
||||
-newkey rsa:4096 -nodes -sha256 -keyout harbor_ca.key \
|
||||
-x509 -days 365 -out harbor_ca.crt -subj '/C=CN/ST=PEK/L=Bei Jing/O=VMware/CN=HarborCA'
|
||||
#openssl req \
|
||||
# -newkey rsa:4096 -nodes -sha256 -keyout $CUR_DIR/harbor_ca.key \
|
||||
# -x509 -days 365 -out $CUR_DIR/harbor_ca.crt -subj '/C=CN/ST=PEK/L=Bei Jing/O=VMware/CN=HarborCA'
|
||||
|
||||
# Generate a Certificate Signing Request
|
||||
if echo $IP|grep -E '^([0-9]+\.){3}[0-9]+$' ; then
|
||||
openssl req \
|
||||
-newkey rsa:4096 -nodes -sha256 -keyout $IP.key \
|
||||
-out $IP.csr -subj '/C=CN/ST=PEK/L=Bei Jing/O=VMware/CN=HarborManager'
|
||||
-out $IP.csr -subj "/C=CN/ST=PEK/L=Bei Jing/O=VMware/CN=HarborManager"
|
||||
echo subjectAltName = IP:$IP > extfile.cnf
|
||||
else
|
||||
openssl req \
|
||||
-newkey rsa:4096 -nodes -sha256 -keyout $IP.key \
|
||||
-out $IP.csr -subj "/C=CN/ST=PEK/L=Bei Jing/O=VMware/CN=$IP"
|
||||
echo subjectAltName = DNS.1:$IP > extfile.cnf
|
||||
fi
|
||||
|
||||
# Generate the certificate of local registry host
|
||||
echo subjectAltName = IP:$IP > extfile.cnf
|
||||
openssl x509 -req -days 365 -in $IP.csr -CA harbor_ca.crt \
|
||||
-CAkey harbor_ca.key -CAcreateserial -extfile extfile.cnf -out $IP.crt
|
||||
openssl x509 -req -days 365 -sha256 -in $IP.csr -CA $CUR_DIR/harbor_ca.crt \
|
||||
-CAkey $CUR_DIR/harbor_ca.key -CAcreateserial -extfile extfile.cnf -out $IP.crt
|
||||
|
||||
# Copy to harbor default location
|
||||
mkdir -p $DATA_VOL/cert
|
||||
cp $IP.crt $DATA_VOL/cert/server.crt
|
||||
cp $IP.key $DATA_VOL/cert/server.key
|
||||
cp $IP.key $DATA_VOL/cert/server.key
|
||||
|
32
tests/harbor_ca.crt
Normal file
32
tests/harbor_ca.crt
Normal file
@ -0,0 +1,32 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFhTCCA22gAwIBAgIUBWPUOcl5wyYV18FraR9cayN1F1UwDQYJKoZIhvcNAQEL
|
||||
BQAwUjELMAkGA1UEBhMCQ04xDDAKBgNVBAgMA1BFSzERMA8GA1UEBwwIQmVpIEpp
|
||||
bmcxDzANBgNVBAoMBlZNd2FyZTERMA8GA1UEAwwISGFyYm9yQ0EwHhcNMTkwODEz
|
||||
MDMyMjUwWhcNMjAwODEyMDMyMjUwWjBSMQswCQYDVQQGEwJDTjEMMAoGA1UECAwD
|
||||
UEVLMREwDwYDVQQHDAhCZWkgSmluZzEPMA0GA1UECgwGVk13YXJlMREwDwYDVQQD
|
||||
DAhIYXJib3JDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALjlYE0c
|
||||
16ZsTVBpr2s48QXxuc0IcddfyWqpBGwiWTGG3/LS/ebkiFfKVViBicK2A5IofI4X
|
||||
6UBuu+hb3FZjJtpqNPFMrOK0K0eiheBQVxeCQavtoT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XHfQvvso1HU
|
||||
e+Wcy3EoADr3aYCytPppo33zDHBX4+lcL2rKAH2+K5JOhnxZuRR4dWoczkI5mYRi
|
||||
qZ809uHnXoV4yJ14NWnoil6kUF3YxU9hWzjEaVcZfp7WUw0BeTZ9M0VqkjxSiSuz
|
||||
QvSzoPqZ2ajfxawf1fdttU6YUewBkjMOTC2C8qoA8m7HNRTznoZbfFITG1gJlnFT
|
||||
y8oWY+ZrEsG7lID2zMaZopSAwDzuBoqLGE66LK+RtFSrAcGHSr3Xlp0R6hX4FeyN
|
||||
flTTBxE6eNoEiV56x9RuSDvWnw/l38B/y9q9wMNkI+kb2d8QNkWFz9q1W01Vdceo
|
||||
ZzTA/fNcErZ0YiE/wY9VEW+DRoO3ntMN8lEsNLr04kUG7RJ6EOu6kQPHQuJ3Bujy
|
||||
rnAVXLxzOqGPfKD6gBQS2pTikQCYpqtaFg==
|
||||
-----END CERTIFICATE-----
|
52
tests/harbor_ca.key
Normal file
52
tests/harbor_ca.key
Normal file
@ -0,0 +1,52 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQC45WBNHNembE1Q
|
||||
aa9rOPEF8bnNCHHXX8lqqQRsIlkxht/y0v3m5IhXylVYgYnCtgOSKHyOF+lAbrvo
|
||||
W9xWYybaajTxTKzitCtHooXgUFcXgkGr7aE6Re3bblsr9mwIJr1WoAcbVLFlls0j
|
||||
tb2pzuAHLP4o32Y1HcTfSUJOsQ4+UPgi6NIpIxT00w+Q0+NGfPan+ONFVNNfW+9G
|
||||
WFHetWQBn5XyTQ0GdeBqhrhu6VE1zEu+nLgm6RpXYYCC5AZikvwd4JtXsWMweqJi
|
||||
g24BkziuB4iaSrAtMVn2I2PS2k05mifqvF1c7+qCbubuUVksdkxF8u9h7xPK2C6N
|
||||
cyl0PjtN/12z4iv24LGBLDyMbpjDyhDmSd73VMVjp2CLLFakIKqQAcqOJPhKwbkF
|
||||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A8riI3
|
||||
OklJe9yWnEniWc7KHtBtcnZcr8yAVokr9o/St5LlAoIBAQDQ7eVGphrPudG4xEOK
|
||||
E5HwdiBioljNeF112lODpOU16YtB+z5XhotiIOMfRw/8465AME8Us4dHG9EsNbie
|
||||
jd9ul4tiMhJ3eysRIqTRpCSy57qvT6s+Wcfuu14Db82PXa6s6IscTZ1k2ue0XShj
|
||||
95eb5cmDERSZk8KsIbH6uw2Da9fOclyHUWNCBTnb5KEMVNbZXMgAN0KxISn2k/Eo
|
||||
Mgp8P8DZnVZ8mumz1XSbW/eTt8eopeebEMjqC0kiOa0CKp0qF1KtCwVK7f3SGO79
|
||||
Y7AzWWBlJxAqhCUuQh6U+kwqYX8XjwzeuYuOXPjKQiKHjqHMKzhMi8fiwhnmtAbN
|
||||
oDYJAoIBAAYnTbQcHv5KExeolWropSnY4xfWfzC/nmfFTao1iPfbDiFMkO8uRku4
|
||||
eOgvlPbiS/cT1MEKSfQqTyMkWxlgghTiDMOTkm6iFQ1q4UQN7ua4eNVNeItTdpZb
|
||||
c3UER6XNgI0CpdOb6Jq1529+g9/dly39qqQM4n82nFuizknMWlW5BlxsbwTy2xhi
|
||||
JAA3JgLgB38UdL1sBDscX2vCl5pZhXXxWmVDud67exbMUnR4ib1bzG4nsXTHe72P
|
||||
Jq2W5mySj9uDfcNHyBmfl95mP+VWOjQlxMg/cmS/CU3q04cMzUKX4froNRUi3eYQ
|
||||
CFZg63hc+GA5YEhJM3n6ZkTZnTJH3Lc=
|
||||
-----END PRIVATE KEY-----
|
1
tests/harbor_ca.srl
Normal file
1
tests/harbor_ca.srl
Normal file
@ -0,0 +1 @@
|
||||
63B7F610244848F31E6F589536F579890B0812B3
|
@ -8,7 +8,7 @@ set -e
|
||||
# prepare cert ...
|
||||
sudo sed "s/127.0.0.1/$1/" -i tests/generateCerts.sh
|
||||
sudo ./tests/generateCerts.sh
|
||||
sudo mkdir -p /etc/docker/certs.d/$1 && sudo cp ./harbor_ca.crt /etc/docker/certs.d/$1/
|
||||
sudo mkdir -p /etc/docker/certs.d/$1 && sudo cp ./tests/harbor_ca.crt /etc/docker/certs.d/$1/
|
||||
|
||||
sudo ./tests/hostcfg.sh
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user