Formatting

This commit is contained in:
Stuart Clements 2019-12-18 14:17:28 +01:00
parent e64a592f91
commit ca152f6eb0

View File

@ -36,19 +36,19 @@ The certificate usually contains a `.crt` file and a `.key` file, for example, `
1. Generate a private key.
```
```
openssl genrsa -out yourdomain.com.key 4096
```
```
1. Generate a certificate signing request (CSR).
Adapt the values in the `-subj` option to reflect your organization. If you use an FQDN to connect your Harbor host, you must specify it as the common name (`CN`) attribute and use it in the key and CSR filenames.
```
```
openssl req -sha512 -new \
-subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=yourdomain.com" \
-key yourdomain.com.key \
-out yourdomain.com.csr
```
```
1. Generate an x509 v3 extension file.
Regardless of whether you're using either an FQDN or an IP address to connect to your Harbor host, you must create this file so that you can generate a certificate for your Harbor host that complies with the Subject Alternative Name (SAN) and x509 v3 extension requirements. Replace the `DNS` entries to reflect your domain.
@ -94,6 +94,7 @@ After generating the `ca.crt`, `yourdomain.com.crt`, and `yourdomain.com.key` fi
1. Convert `yourdomain.com.crt` to `yourdomain.com.cert`, for use by Docker.
The Docker daemon interprets `.crt` files as CA certificates and `.cert` files as client certificates.
```
openssl x509 -inform PEM -in yourdomain.com.crt -out yourdomain.com.cert
```
@ -110,7 +111,6 @@ After generating the `ca.crt`, `yourdomain.com.crt`, and `yourdomain.com.key` fi
```
If you mapped the default `nginx` port 443 to a different port, create the folder `/etc/docker/certs.d/yourdomain.com:port`, or `/etc/docker/certs.d/harbor_IP:port`.
1. Restart Docker Engine.
`systemctl restart docker`