-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x509: certificate relies on legacy Common Name field, use SANs instead #16971
Comments
@yangyuliufeng How do you install the harbor instance, offline installer or harbor-helm? |
btw, if this is the first time you are trying to use harbor, could you please try to use a new version of harbor (2.4.x / 2.5.x)? or can you please justify why using harbor version 1.10.3 |
Error response from daemon: Get "https://harbor.ayyy.cn/v2/": x509: certificate relies on legacy Common Name field, use SANs instead |
Hi Everyone. I have the same issue after installing Harbor. I have set the https. When trying to connect to docker I have the following error.
My harbor version is 2.5.2. And I have used the offline installer Could someone helps me on that please |
Hi Everyone. I have the same issue |
Hi @wudidehuangtiandi, @louistwiice, @465730396 And I can docker login successfully:
My openSSL version is: Could you guys please share with us your openSSL version? Could it possible it is due to openSSL version? |
cp ca.crt /etc/docker/certs.d/yourdomain.com/ - work for docker (Debian/Ubuntu) |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue. |
@yangyuliufeng Try this, I met the same problem and used this approach to solve it. {
"insecure-registries" : [ "reg.harbor.com" ]
} |
plus des détails svp |
@nisiyong @Jugson setting (custom) registries as insecure in Docker is not a solution for this problem, but at maximum a workaround. |
So, this problem has never been solved, right? |
unsolved problem, yet. |
Apparently never solved, Feb 2024 and I'm having this exact issue. Can access Harbor via web without a problem. Using a Helm chart to install Harbor and configure TLS via values.yaml with TLS secret in my Rancher cluster namespace. Guess I'll continue to beat my head against the wall. |
Same! |
try this. Here are examples: In your server: #!/bin/bash
mkdir -p /etc/ssl/private
echo "Remove old key files."
# Remove old files
sudo rm -rf /data/cert/harbor.crt
sudo rm -rf /data/cert/harbor.key
sudo rm -rf /data/cert/harbor.pem
sudo rm -rf /data/cert/harbor.cert
echo "Remove old files."
# Remove the passphrase from the private key
sudo rm -rf /etc/ssl/private/harbor.pem
sudo rm -rf /etc/ssl/private/harbor.crt
sudo rm -rf /etc/ssl/private/harbor.cert
sudo rm -rf /etc/ssl/private/harbor.key
sudo rm -rf /etc/ssl/certs/harbor.pem
sudo rm -rf /etc/ssl/certs/harbor.crt
sudo rm -rf /etc/ssl/certs/harbor.cert
sudo rm -rf /etc/ssl/certs/harbor.key
sudo rm -rf /etc/docker/certs.d/x.x.x.x/harbor.pem
sudo rm -rf /etc/docker/certs.d/x.x.x.x/harbor.key
sudo rm -rf /etc/docker/certs.d/x.x.x.x/harbor.crt
sudo rm -rf /etc/docker/certs.d/x.x.x.x/harbor.cert
sudo rm -rf /etc/pki/ca-trust/source/anchors/harbor.crt
sudo rm -rf /etc/pki/ca-trust/source/anchors/harbor.cert
sudo rm -rf /etc/pki/ca-trust/source/anchors/harbor.pem
echo "Generating a private key"
# Generate a private key
openssl genrsa -out /data/cert/harbor.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=CN/ST=Beijing/L=Beijing/O=GameSale/OU=Personal/CN=x.x.x.x" \
-key /data/cert/harbor.key \
-out /data/cert/harbor.crt
openssl req -sha512 -new \
-subj "/C=CN/ST=Beijing/L=Beijing/O=GameSale/OU=Personal/CN=x.x.x.x" \
-key /data/cert/harbor.key \
-out /data/cert/harbor.csr
cat > /data/cert/v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=x.x.x.x
IP.1=x.x.x.x
EOF
openssl x509 -req -sha512 -days 3650 \
-extfile /data/cert/v3.ext \
-CA /data/cert/harbor.crt -CAkey /data/cert/harbor.key -CAcreateserial \
-in /data/cert/harbor.csr \
-out /data/cert/harbor.crt
openssl x509 -inform PEM -in /data/cert/harbor.crt -out /data/cert/harbor.cert
openssl x509 -in /data/cert/harbor.crt -out /data/cert/harbor.pem -outform PEM
# Copy files
echo "Copy files."
sudo cp /data/cert/harbor.crt /etc/ssl/private/
sudo cp /data/cert/harbor.cert /etc/ssl/private/
sudo cp /data/cert/harbor.pem /etc/ssl/private/harbor.pem
sudo cp /data/cert/harbor.key /etc/ssl/private/
sudo cp /data/cert/harbor.crt /etc/ssl/certs/
sudo cp /data/cert/harbor.cert /etc/ssl/certs/
sudo cp /data/cert/harbor.pem /etc/ssl/certs/harbor.pem
sudo cp /data/cert/harbor.key /etc/ssl/certs/
sudo cp /data/cert/harbor.crt /etc/docker/certs.d/x.x.x.x/
sudo cp /data/cert/harbor.cert /etc/docker/certs.d/x.x.x.x/
sudo cp /data/cert/harbor.pem /etc/docker/certs.d/x.x.x.x/harbor.pem
sudo cp /data/cert/harbor.key /etc/docker/certs.d/x.x.x.x/
sudo cp /data/cert/harbor.crt /etc/pki/ca-trust/source/anchors/
sudo cp /data/cert/harbor.cert /etc/pki/ca-trust/source/anchors/
sudo cp /data/cert/harbor.pem /etc/pki/ca-trust/source/anchors/harbor.pem
echo "Generating a private key successfully."
echo "restart"
sudo update-ca-trust
systemctl restart docker
sudo systemctl restart docker.service
cd /opt/harbor
./prepare
# docker-compose down -v
# docker-compose up -d
echo "end." In your client: echo "${{ env.CERTIFICATE }}" > harbor.crt
sudo mkdir -p /usr/local/share/ca-certificates/harbor
sudo mkdir -p /etc/docker/certs.d/${{ env.HARBOR_URL }}
sudo mkdir -p /usr/local/share/ca-certificates/extra
sudo mkdir -p /etc/ssl/certs
sudo cp harbor.crt /usr/local/share/ca-certificates/harbor/harbor.crt
sudo cp harbor.crt /etc/docker/certs.d/${{ env.HARBOR_URL }}/ca.crt
sudo cp harbor.crt /usr/local/share/ca-certificates/extra/harbor.crt
sudo cp harbor.crt /etc/ssl/certs/harbor.crt
sudo update-ca-certificates
sudo systemctl restart docker
echo $HARBOR_PASSWORD | docker login $HARBOR_URL --username $HARBOR_USERNAME --password-stdin
docker build -t $HARBOR_URL/$IMAGE_NAME:$VERSION .
docker push $HARBOR_URL/$IMAGE_NAME:$VERSION |
still the same in April/2024 |
You could read my reply. It would create a standard certification. |
try use config.toml,I user harbor v2.5.5
[root@k8s-dashboard containerd]# nerdctl login https://harbor.liubxx.cn Login Succeeded |
Expected behavior and actual behavior:
I tried to login harbor registry. However, containerd cannot login harbor registry:
Steps to reproduce the problem:
The step to generate a Certificate Authority Certificate of my harbor registry : https://goharbor.io/docs/2.5.0/install-config/configure-https/
Versions:
Please specify the versions of following systems.
Additional context:
harbor.yml
and files in the same directory, including subdirectory./var/log/harbor/
.The text was updated successfully, but these errors were encountered: