tech:pb_plugin_nagios_centreon_nsclient_403
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:pb_plugin_nagios_centreon_nsclient_403 [2025/04/04 14:28] – Jean-Baptiste | tech:pb_plugin_nagios_centreon_nsclient_403 [2025/04/04 17:25] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Pb plugin Nagios centreon NSClient 403 | ||
| + | |||
| + | Getting response 403 Your not allowed from NSClient++ running on Windows over the REST API but curl ok | ||
| + | |||
| + | ## Problème | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ~~~ | ||
| + | $ / | ||
| + | UNKNOWN: 403 Forbidden | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Alors que le curl fonctionne | ||
| + | ~~~bash | ||
| + | curl -k -u centreon: | ||
| + | ~~~ | ||
| + | |||
| + | ## Analyse - Création d'un MITM HTTPS avec socat | ||
| + | |||
| + | ### Décapsuler HTTPS en créant un MITM HTTP (HTTPS to HTTP) | ||
| + | |||
| + | ~~~bash | ||
| + | socat TCP-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Création des certificats pour encapsulation HTTPS (HTTP to HTTPS) | ||
| + | |||
| + | Voir : | ||
| + | * [[openssl_creer_un_certificat_autosigne_create_a_self-signed_ssl_certificate]] | ||
| + | * https:// | ||
| + | |||
| + | ~~~bash | ||
| + | FQDN=localhost | ||
| + | |||
| + | #openssl genrsa -out plop.key 2048 | ||
| + | #openssl req -new -key plop.key -x509 -subj '/ | ||
| + | #cat plop.key plop.cert > plop.pem | ||
| + | |||
| + | # Ou | ||
| + | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout plop.key -out plop.crt | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Résultats | ||
| + | |||
| + | ### Test OK | ||
| + | |||
| + | ~~~bash | ||
| + | curl -k -u centreon: | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | [root@centreon-central ~]# PORT=1443 FQDN=localhost | ||
| + | [root@centreon-central ~]# socat -v -ls OPENSSL-LISTEN: | ||
| + | > 2025/04/04 12: | ||
| + | GET / | ||
| + | Host: 127.0.0.1: | ||
| + | Authorization: | ||
| + | User-Agent: curl/7.61.1 | ||
| + | Accept: */* | ||
| + | |||
| + | < 2025/04/04 12: | ||
| + | HTTP/1.1 200\r\r | ||
| + | Content-Length: | ||
| + | Set-cookie: token=yapnxrpMCARCr4zdGc81tBDKsMlaZTXC; | ||
| + | Set-cookie: uid=centreon; | ||
| + | \r\r | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Test NOK | ||
| + | |||
| + | ~~~bash | ||
| + | / | ||
| + | UNKNOWN: 403 Forbidden | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | [root@centreon-central ~]# socat -v -ls OPENSSL-LISTEN: | ||
| + | > 2025/04/04 12: | ||
| + | GET / | ||
| + | TE: deflate, | ||
| + | Keep-Alive: 300 | ||
| + | Connection: Keep-Alive, TE | ||
| + | Host: 127.0.0.1: | ||
| + | User-Agent: centreon:: | ||
| + | Password: centreon | ||
| + | |||
| + | < 2025/04/04 12: | ||
| + | HTTP/1.1 403\r\r | ||
| + | Content-Length: | ||
| + | \r\r | ||
| + | 403 Your not allowed | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Solution | ||
| + | |||
| + | Ajouter les arguments ci-dessous pour l' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ~~~bash | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres socat | ||
| + | |||
| + | Pour test | ||
| + | ~~~bash | ||
| + | socat -v -ls OPENSSL-LISTEN: | ||
| + | ~~~ | ||
| + | |||
| + | |||
