API & LDAP Users
Posted: Wed Feb 13, 2019 12:50 pm
Hey folks
I will need to add/remove users on a regular basis. However this is a PITA on 6 isolated environments, each hooked into their own LDAP server [rhel IDM]. The current process is to import the users each time from the "Add users from LDAP/AD" button. I put in my username as the dn string for myself, my password and it pops up the ldap tree.
I thought I would try via the API, and this option doesnt work in the API calls as there is no import. Thats fair enough.
So I thought i would use the documentation and try it, however this is what I get: [The auth-id i got from the authserver XGET referenced from the docs]
curl -k -XPOST "https://X.X.X.X/nagiosxi/api/v1/system/ ... y&pretty=1" -d 'auth_type=ldap&auth_server_id=5bacb57bc9d00&&ad_username=eddy&ldap_dn="cn=users,cn=accounts,dc=ref,dc=company,dc=net"&username=eddy&name=Electric Eddy&email=ed'
{
"success": "User account eddy was added successfully!",
"user_id": null
}
I will need to add/remove users on a regular basis. However this is a PITA on 6 isolated environments, each hooked into their own LDAP server [rhel IDM]. The current process is to import the users each time from the "Add users from LDAP/AD" button. I put in my username as the dn string for myself, my password and it pops up the ldap tree.
I thought I would try via the API, and this option doesnt work in the API calls as there is no import. Thats fair enough.
So I thought i would use the documentation and try it, however this is what I get: [The auth-id i got from the authserver XGET referenced from the docs]
curl -k -XPOST "https://X.X.X.X/nagiosxi/api/v1/system/ ... y&pretty=1" -d 'auth_type=ldap&auth_server_id=5bacb57bc9d00&&ad_username=eddy&ldap_dn="cn=users,cn=accounts,dc=ref,dc=company,dc=net"&username=eddy&name=Electric Eddy&email=ed'
{
"success": "User account eddy was added successfully!",
"user_id": null
}