Outils pour utilisateurs

Outils du site


blog

Pb curl TLS NOK - RedHat 6 et 7 LIBNSS - NSS error -8102

  • L'erreur n'apparait qu'avec la LIBCURL, ça fonctionne bien avec OpenSSL et wget.
  • L'erreur n'apparait que sur RedHat 6 et 7, pas sur RedHat 5, 8, 9

En effet la LIBCURL de RedHat 6 et 7 est compilé avec LIBNSS

# ldd /usr/bin/curl | grep nss
        libnss3.so => /usr/lib64/libnss3.so (0x00007fa6093c6000)
        libnssutil3.so => /usr/lib64/libnssutil3.so (0x00007fa609196000)

Voici l'erreur

$ curl --show-error -v https://nok.acme.fr
* About to connect() to proxy localhost port 8080 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
* Establish HTTP proxy tunnel to nok.acme.fr:443
> CONNECT nok.acme.fr:443 HTTP/1.1
> Host: nok.acme.fr:443
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* Bad certificate received. Subject = 'CN=nok.acme.fr,OU=ACME,OU=Private Group PKI,O=ACME Group,C=FR', Issuer = 'CN=PKI SERVER,OU=Private Group PKI,O=ACME Group,C=FR'
* NSS error -8102
* Closing connection #0
* Peer certificate cannot be authenticated with known CA certificates
curl: (60) Peer certificate cannot be authenticated with known CA certificates
More details here: http://curl.haxx.se/docs/sslcerts.html
Constant Value Description
SEC_ERROR_INADEQUATE_KEY_USAGE -8102 Certificate key usage inadequate for attempted operation.

Source : NSS and SSL Error Codes

Premièrement il convient de s'assurer que le problème n'est pas dû au proxy HTTP

proxytunnel -p proxy:8080 -d nok.acme.fr:443 -a 7000 &
curl --noproxy '*' -D - -v -s -H "Host: nok.acme.fr" https://localhost:7000

Le pb est toujours présent

Test OK avec OpenSSL

openssl s_client -connect localhost:7000 -servername nok.acme.fr </dev/null > /dev/null 2>&1 && echo OK
$ openssl s_client -connect ok.acme.fr:443 -servername ok.acme.fr </dev/null 2>/dev/null | openssl x509 -noout -text | grep -A1 "X509v3 Key Usage: critical"
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment

$ openssl s_client -connect localhost:7000 -servername nok.acme.fr </dev/null 2>/dev/null | openssl x509 -noout -text | grep -A1 "X509v3 Key Usage: critical"
            X509v3 Key Usage: critical
                Digital Signature, Non Repudiation

Le pb est que le certificat du serveur ne contient pas le “Usage” : Key Encipherment

Autres

Ciphers

Pour des problèmes similaires il peut être intéressant de vérifier si ce n'est pas un lié au Ciphers

$ openssl s_client -connect localhost:7000 -servername nok.acme.fr </dev/null 2>/dev/null | grep Cipher
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
    Cipher    : ECDHE-RSA-AES128-GCM-SHA256
$ /usr/lib64/nss/unsupported-tools/listsuites
...
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:
  0xc02f ECDHE RSA   AES-GCM  128 AEAD   Enabled  FIPS Domestic
...
keyUsage

Voir aussi :

$ openssl x509 -noout -ext keyUsage < entity.pem
X509v3 Key Usage: critical
    Digital Signature, Key Encipherment

$ openssl x509 -noout -ext keyUsage < intermediate.pem
X509v3 Key Usage: critical
    Certificate Sign, CRL Sign

Source : https://docs.apigee.com/how-to-guides/validating-certificate-purpose?hl=fr

2025/03/24 15:06

Pb curl 77 error setting certificate verify locations

Source : https://www.plesk.com/kb/support/on-plesk-for-linux-server-curl-command-in-chrooted-shell-or-in-scheduled-task-fails-

Both for chrooted shell and scheduled tasks

Create directories for CA certificates in the chroot template:

mkdir -p /var/www/vhosts/chroot/etc/ssl/certs/
mkdir -p /var/www/vhosts/chroot/usr/share/ca-certificates/

Copy the CA certificates to those directories:

cp -a /etc/ssl/certs/* /var/www/vhosts/chroot/etc/ssl/certs/
cp -a /usr/share/ca-certificates/* /var/www/vhosts/chroot/usr/share/ca-certificates/

Update the chroot template by running below commands one by one:

curl -o update-chroot.sh https://raw.githubusercontent.com/plesk/kb-scripts/master/update-chroot/update-chroot.sh
chmod 700 update-chroot.sh
./update-chroot.sh --apply all

Autres

/etc/pki/tls/certs/ca-bundle.crt

2025/03/24 15:06

Pb Cluster LVM Err internal cluster locking initialisation failed

# pvs
  connect() failed on local socket: Aucun fichier ou dossier de ce type
  Internal cluster locking initialisation failed.
  WARNING: Falling back to local file-based locking.
  Volume Groups with the clustered attribute will be inaccessible.
  PV                  VG      Fmt  Attr PSize   PFree
  /dev/mapper/mpatha1 vg_data lvm2 a--  508,00m 84,00m
  /dev/sda2           centos  lvm2 a--    7,51g 40,00m
ps -ef | egrep "lvm|dlm"

⇒ Aucune ligne trouvée

Solution

Le pb est liée au Cluster à la gestion des locks

Si pas de cluster :

/etc/lvm/lvm.conf

#locking_type = 3
locking_type = 1
Si cluster (exemple)
pcs cluster unstandby
root      6019     1  0 15:19 ?        00:00:00 dlm_controld -s 0
root      6030  1642  0 15:19 ?        00:00:00 /bin/bash /usr/lib/ocf/resource.d/heartbeat/clvm start
root      6139  6030  0 15:19 ?        00:00:00 /bin/bash /usr/lib/ocf/resource.d/heartbeat/clvm start
root      6140  6139  0 15:19 ?        00:00:00 /usr/sbin/clvmd -T90 -d0
root      6141  6140  0 15:19 ?        00:00:00 /usr/sbin/clvmd -T90 -d0
root      6142     2  0 15:19 ?        00:00:00 [dlm_scand]
root      6144     2  0 15:19 ?        00:00:00 [dlm_recv]
root      6145     2  0 15:19 ?        00:00:00 [dlm_send]
root      6146     2  0 15:19 ?        00:00:00 [dlm_recoverd]
root      6148  3057  0 15:19 pts/1    00:00:00 grep -E --color=auto lvm|dlm
2025/03/24 15:06

Pb clonezilla UEFI grub shell au boot

Le type de partition doit être 7 HPFS/NTFS/exFAT

2025/03/24 15:06

Pb carte réseau erreur Detected Hardware Unit Hang

Voir : https://en.wikipedia.org/wiki/Large_send_offload

Source : https://serverfault.com/questions/616485/e1000e-reset-adapter-unexpectedly-detected-hardware-unit-hang

Perte de la connectivité

Erreur

Detected Hardware Unit Hang

Solution 1

Passer le paramètre suivant au kernel Linux au boot pour désactiver l'Active-State Power Management (ASPM)

pcie_aspm=off

Solution 2 \ Installer le paquet ethtool, dans certains cas cela suffit.\ Note : Il peut donc être intéressant d'installer ce paquet dans le pressed (Dans mon cas, à ce stade de l'install le réseau est OK)

Solution 3

#ethtool -K eth0 gso off tso off sg off gro off
ethtool -K eth0 gso off gro off tso off
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki