Bonjour à tous,
J’essaye d’utiliser le connecteur “Veeam Backup Enterprise Manager” : https://docs.centreon.com/pp/integrations/plugin-packs/procedures/applications-veeam-vbem-restapi/
J’utilise la version Centreon 23.10.5 sur une vm debian 11.
Depuis mon serveur poller via des commandes curl je parviens bien à utiliser l’API :
- je génère une session :
curl -si -X POST -H "Authorization: Basic XXX" -d "" https://X.X.X.X:9398/api/sessionMngr/?v=latest --insecure => Code 201 OK
- j’utilise le X-RestSvcSessionId généré pour intérroger l’API :
curl -X GET -H "X-RestSvcSessionId: ODM5NTg5MGQtY2I5OS00NjUwLWIwNDAtOTI4ZTdjMjBjMGE1" https://X.X.X.X:9398/api/repositories --insecure => Code 200 OK (me recupère bien les infos)
Le problème c’est quand j’utilise le plugin Centreon (avec le même compte):
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=apps::backup::veeam::vbem::restapi::plugin --mode=repositories --hostname='X.X.X.X' --port=9398 --proto=https --api-username=’$APIUSER’ --api-password='$APIPWD’ --insecure --debug :
UNKNOWN: 403 Forbidden
== Info: Trying X.X.X.X:9398...
== Info: Connected to XXX (X.X.X.X) port 9398 (#0)
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info: successfully set certificate verify locations:
== Info: CAfile: /etc/ssl/certs/ca-certificates.crt
== Info: CApath: /etc/ssl/certs
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
== Info: TLSv1.2 (IN), TLS handshake, Certificate (11):
== Info: TLSv1.2 (IN), TLS handshake, Server key exchange (12):
== Info: TLSv1.2 (IN), TLS handshake, Server finished (14):
== Info: TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
== Info: TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
== Info: TLSv1.2 (OUT), TLS handshake, Finished (20):
== Info: TLSv1.2 (IN), TLS handshake, Finished (20):
== Info: SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
== Info: ALPN, server accepted to use h2
== Info: Server certificate:
== Info: subject: CN=XXX
== Info: start date: Sep 13 15:58:01 2021 GMT
== Info: expire date: Sep 11 15:58:01 2031 GMT
== Info: issuer: CN=XXX
== Info: SSL certificate verify result: self signed certificate (18), continuing anyway.
== Info: Using HTTP2, server supports multi-use
== Info: Connection state changed (HTTP/2 confirmed)
== Info: Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
== Info: Using Stream ID: 1 (easy handle 0x562c536977f0)
=> Send header: GET /api/query?format=Entities&type=Repository HTTP/2
Host: XXX:9398
content-type:application/json
accept:application/json
x-restsvcsessionid: NzkwZDIwMjMtZmUwZS00MDQ5LWI2YjAtZWRmOGM0NzBhMDc2
== Info: Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
=> Recv header: HTTP/2 403
=> Recv header: cache-control: private
=> Recv header: content-length: 119
=> Recv header: content-type: application/json
=> Recv header: server: Microsoft-HTTPAPI/2.0
=> Recv header: x-frame-options: SAMEORIGIN
=> Recv header: x-xss-protection: 1; mode=block
=> Recv header: strict-transport-security: max-age=31536000
=> Recv header: x-content-type-options: nosniff
=> Recv header: date: Fri, 23 Feb 2024 11:16:40 GMT
=> Recv header:
=> Recv data: {"FirstChanceExceptionMessage":null,"StackTrace":null,"Message":"Access denied.","StatusCode":403,"Status":"Forbidden"}
== Info: Connection #0 to host XXX left intact
== Info: Found bundle for host XXX: 0x562c53720dc0
== Info: Connected to X (X.X.X.X) port 9398 (#0)
== Info: Server auth using Basic with user 'CENTREON'
== Info: Using Stream ID: 3 (easy handle 0x562c536977f0)
=> Send header: POST /api/sessionMngr/ HTTP/2
Host: X:9398
authorization: Basic XXX
content-type:application/json
accept:application/json
content-length: 0
Je ne comprends pas j’utilise le même compte que sur ma commande Curl précédente.
Ce que je constate c’est quand utilisant le plugin il créé une session (comme j’ai fait en curl -X POST...) et utilise bien le X-RestSvcSessionId généré.
Je ne vois pas pourquoi il me retourne un accès denied alors qu’il autorise bien l’accès aux “repositories” via curl.
Y’a-t-il moyen de préciser le X-RestSvcSessionId dans la commande Centreon ? Ou savez-vous où je m’y prends mal ?
D’avance merci.
Bonne journée