mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 23:51:27 +01:00
Update auth.md
This commit is contained in:
parent
56105ca2e1
commit
3885bd78ed
34
docs/auth.md
34
docs/auth.md
@ -1,6 +1,6 @@
|
||||
#Customize harbor auth with your key and certificate
|
||||
#Customize Harbor auth with your key and certificate
|
||||
|
||||
By default, harbor use default private key and certificate in authentication. The auth procedure is like [Docker Registry v2 authentication](https://github.com/docker/distribution/blob/master/docs/spec/auth/token.md). Also, you can customize your configuration with your own key and certificate with the following steps:
|
||||
By default, Harbor use default private key and certificate in authentication. The auth procedure is like [Docker Registry v2 authentication](https://github.com/docker/distribution/blob/master/docs/spec/auth/token.md). Also, you can customize your configuration with your own key and certificate with the following steps:
|
||||
|
||||
1.If you already have a certificate, go to step 3.
|
||||
|
||||
@ -10,7 +10,7 @@ By default, harbor use default private key and certificate in authentication. T
|
||||
|
||||
|
||||
```sh
|
||||
openssl genrsa -out prvtkey.pem 2048
|
||||
openssl genrsa -out private_key.pem 2048
|
||||
```
|
||||
|
||||
you can call it prvtkey.pem or other names you like.
|
||||
@ -19,37 +19,23 @@ you can call it prvtkey.pem or other names you like.
|
||||
**2)Generate a certificate:**
|
||||
|
||||
```sh
|
||||
openssl req -new -x509 -key prvtkey.pem -out cacert.pem -days 1095
|
||||
openssl req -new -x509 -key private_key.pem -out root.crt -days 1095
|
||||
```
|
||||
|
||||
prvtkey.pem is what you generated in the first step, if you change the name, you should change it in the command. Also you can name cacert.pem what you like.
|
||||
|
||||
3.Refer to [Installation Guide](https://github.com/vmware/harbor/blob/master/docs/installation_guide.md) to install harbor. After you execute ./prepare, harbor generates several config files. We need to replace the original private key and certificate with your own key and certificate.
|
||||
3.Refer to [Installation Guide](https://github.com/vmware/harbor/blob/master/docs/installation_guide.md) to install Harbor, After you execute ./prepare, Harbor generates several config files. We need to replace the original private key and certificate with your own key and certificate.
|
||||
|
||||
4.Following are what you should do:
|
||||
|
||||
**1)edit docker-compose.yml, find private_key.pem replace it with your own private key as following:**
|
||||
|
||||
|
||||
![edit docker-compose.yml](img/edit_docker-compose-yml.png)
|
||||
|
||||
![edit docker-compose.yml](img/after_edit_docker-compose-yml.png)
|
||||
|
||||
**2)cd config/ui, you will see private_key.pem.**
|
||||
**1)cd config/ui, you will see private_key.pem.**
|
||||
|
||||
**3)replace private_key.pem with your private key.**
|
||||
**2)replace private_key.pem with your private_key.pem**
|
||||
|
||||
**4)cd ../registry, you will see root.crt. Replace it with your certificate.**
|
||||
**4)cd ../registry, you will see root.crt. Replace it with your certificate root.crt**
|
||||
|
||||
**5)at the same directory, you will see config.yml. We need to modify it, open it and find root.crt, then change it to your certificate.**
|
||||
|
||||
5.After these, go back to harbor directory, execute:
|
||||
|
||||
```sh
|
||||
docker-compose build
|
||||
5.After these, go back to the Deploy directory, you can start Harbor using following command:
|
||||
```
|
||||
```sh
|
||||
docker-compose up –d
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
6.Then you can push/pull images to see if your own certificate works. Please refer [User Guide](https://github.com/vmware/harbor/blob/master/docs/user_guide.md)
|
||||
|
Loading…
Reference in New Issue
Block a user