Passwort ändern mit HTTP API

Hallo,
irgendetwas funktioniert nicht richtig, nur was??
ich generiere mir ein neues PW mittels:

htpasswd -n
New password:
Re-type new password:
:$apr1$24f1fozq$jO6r79npFEQHMq6CrIBSg/

anschließend:
curl -k “https://IP-ADDR/SITENAME/check_mk/webapi.py?action=edit_users&_username=automation&_secret=0cb4cd62-a4fc-4a08-867a-392d01b9490e&output_format=python&request_format=python” -d ‘request={“users”:{“USER”:{“set_attributes”:{“connector”:“htpasswd”,“password”:"$apr1$f9kkEDs8$fHm4TVHSDhO6Uj3XoMGmf."}}}}’

{‘result’: None, ‘result_code’: 0}

Danach noch:
curl -k “https://IP_ADDR/SITENAME/check_mk/webapi.py?_secret=0cb4cd62-a4fc-4a08-867a-392d01b9490e&_username=automation&action=activate_changes” -d ‘request={“allow_foreign_changes”:“1”}’

{“result”: {“sites”: {“SITE1”: {"_time_updated": 1613030155.57856, “_status_details”: “Started at: 08:55:46. Finished at: 08:55:55.”, “_phase”: “done”, “_status_text”: “Success”, “_pid”: 39342, “_state”: “success”, “_time_ended”: 1613030155.57856, “_expected_duration”: 8.568977748336794, “_time_started”: 1613030146.848377, “_site_id”: “SITE1”, “_warnings”: []}, “SITE2”: {"_time_updated": 1613030149.931367, “_status_details”: “Started at: 08:55:46. Finished at: 08:55:49.”, “_phase”: “done”, “_status_text”: “Success”, “_pid”: 39343, “_state”: “success”, “_time_ended”: 1613030149.931367, “_expected_duration”: 2.851643074745397, “_time_started”: 1613030146.85503, “_site_id”: “SITE2”, “_warnings”: []}}}, “result_code”: 0}

Nach den Result-Ausgaben solle ich mich nun mit dem neuem PW anmelden können, klappt aber leider nicht, “Invalid credentials”

habe ich da was übersehen??

schon mal Danke für die Unterstützung.
Sven

Hallo,
habe den Denkfehler gefunden. Im Request muss das PW im Klartext stehen und nicht wie ich vermutete verschlüsselt…

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.