Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-16990

Cant use API on authentification.edit on zabbix 4.4 (working from GUI but not from python code)

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • 4.4.2rc2
    • None
    • None

      Steps to reproduce:

      1. Create a python script to configure ldap parameter (see code sample below)
      2. Check error message

      Result:

      {'code': -32602, 'message': 'Invalid params.', 'data': 'Incorrect API "authentication".', 'json': "{'jsonrpc': '2.0', 'method': 'authentication.edit', 'params': {'action': 'authentication.update', 'authentication_type': 1, 'http_auth_enabled': 0, 'ldap_configured': 1, 'ldap_host': 'ldaps://our_ldap_server.org.ca', 'ldap_port': '636', 'ldap_base_dn': 'DC=our,DC=ldap,DC=server,DC=org', 'ldap_search_attribute': 'sAMAccountName', 'ldap_bind_dn': 'CN=our.binduser,OU=Our Users,OU=Our,OU=Business Units,DC=our,DC=ldap,DC=server,DC=org', 'ldap_bind_password': 'our_bind_password', 'change_bind_password': 1, 'ldap_case_sensitive': 1, 'action_passw_change': 'authentication.edit', 'ldap_test_user': 'A_user', 'ldap_test_password': 'a_password', 'ldap_test': 1}, 'id': '1', 'auth': '35fa341dab13be0958d741b3db90184d'}"}

      Expected:
      See screenshots from ZABBIX GUI POST call, same action name, same params name and this one is working

       

      code sample:

       

      from pyzabbix import ZabbixAPI, ZabbixAPIException
      
      zapi = ZabbixAPI(url=10.55.0.24, user='Admin', password='zabbix')
      ldap_config = {
              'action': 'authentication.update',
              'authentication_type': 1,
              'http_auth_enabled': 0,
              'ldap_configured': 1,
              'ldap_host': 'ldaps://our_ldap_server.org.ca',
              'ldap_port': 636,
              'ldap_base_dn': 'DC=our,DC=ldap,DC=server,DC=org',
              'ldap_search_attribute': 'sAMAccountName',
              'ldap_bind_dn': "CN=our.binduser,OU=Our Users,OU=Our,OU=Business Units,DC=our,DC=ldap,DC=server,DC=org",
              'ldap_bind_password': "our_bind_password',
              'change_bind_password': 1,
              'ldap_case_sensitive': 1,
              'action_passw_change': 'authentication.edit',
              'ldap_test_user': A_user,
              'ldap_test_password': a_password,
              'ldap_test': 1
          }    
      try:
          zapi.do_request('authentication.edit', ldap_config)
      except ZabbixAPIException as e:
          print(e)
      

       

       

        1. zabbix_authentificate_success1.png
          162 kB
          Guillaume Harvey
        2. zabbix_authentificate_success2.png
          93 kB
          Guillaume Harvey

            dotneft Alexey Pustovalov
            guez67062 Guillaume Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: