infobloxopen/infoblox-client

Verification Issue

Closed this issue · 18 comments

I am getting authorization issues when trying to login:

Traceback (most recent call last):
...
File "my\install\directory.py", line 162, in _validate_authorized
raise ib_ex.InfobloxBadWAPICredential(response='')
infoblox_client.exceptions.InfobloxBadWAPICredential: Infoblox IPAM is misconfigured: infoblox_username and infoblox_password are incorrect.

Here is where I am stumped, first, I thought this infoblox-client repository was for the NIOS appliance (like the description states), so I'm wondering why I am even seeing an IPAM misconfiguration line.

Second, I have verified my username and password numerous times and they allow me to login to the infoblox NIOS appliance when I go to the url manually.

Thanks for your help

Would you mind providing a copy of the code that is causing the exception? Please also provide any relevant screen output/log messages.

We'll look into it.

Right now, I'm just testing the connection. Code is as follows:

from infoblox_client import connector
from infoblox_client import objects
opts = {'host': 'ip_of_our_NIOS', 'username': 'my_username', 'password': 'my_password'}
conn = connector.Connector(opts)
nw = conn.get_object('record:host', {'ipv4addr~': 'some_test_ip'})

C:\...\site-packages\requests\packages\urllib3\connectionpool.py:852: InsecureRequestWar
ning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)

Traceback (most recent call last):
File "", line 1, in
File "C:\...\site-packages\infoblox_client\connector.py", line 41, in callee return func(*args, **kwargs)
File "C:\...\site-packages\infoblox_client\connector.py", line 250, in get_object ib_object = self._get_object(obj_type, url)
File "C:\...\site-packages\infoblox_client\connector.py", line 269, in _get_object self._validate_authorized(r)
File "C:\...\site-packages\infoblox_client\connector.py", line 162, in _validate_authorized raise ib_ex.InfobloxBadWAPICredential(response='')
infoblox_client.exceptions.InfobloxBadWAPICredential: Infoblox IPAM is misconfigured: infoblox_username and infoblox_password are incorrect.

Please let me know if you need any other info. Thank you

Could you please run the following command? This is effectively what the above code does...

curl -k1 -u my_username:my_password -X GET "https://ip_of_our_NIOS/wapi/v1.4/record:host?ipv4addr~=some_test_ip"

I am getting a syntax error at the username:password part. Using python 3.6 thru powershell.

If your username/password has any special characters, you would have to quote it appropriately. I suspect that it's the same for the python code. You might have to quote it as a raw string.

Yes I tried that originally and then I just tried without the quotes, still no dice. I also tried it on my Macbook and it gave me the same error as well.

In the python code, have you tried this?...

opts = {'host': 'ip_of_our_NIOS', 'username': r"my_username", 'password': r"my_password"}

If that still doesn't work, would it be possible to setup a NIOS account with very simple username/password and try with that?

Ok tried that and this is the new output!

Traceback (most recent call last):
File "C:...\lib\site-packages\requests\packages\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "C:...\lib\site-packages\requests\packages\urllib3\util\connection.py", line 60, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:...\lib\socket.py", line 743, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 844, in _validate_conn
conn.connect()
File "C:...\lib\site-packages\requests\packages\urllib3\connection.py", line 284, in conn
ect conn = self._new_conn()
File "C:...\lib\site-packages\requests\packages\urllib3\connection.py", line 150, in _new
_conn self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x033F0B10>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:...\lib\site-packages\requests\adapters.py", line 423, in send timeout=timeout
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 678, in urlopen
**response_kw)
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 678, in urlopen
**response_kw)
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 678, in urlopen
**response_kw)
File "C:...\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:...\lib\site-packages\requests\packages\urllib3\util\retry.py", line 376, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: /url_of_our_NIOS/ui/wapi/v1.4/record%3Ahost?ipv4addr~=some_host_ip (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x033F0B10>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:...\lib\site-packages\infoblox_client\connector.py", line 41, in callee return func(*args, **kwargs)
File "C:...\lib\site-packages\infoblox_client\connector.py", line 250, in get_object ib_object = self._get_object(obj_type, url)
File "C:...\lib\site-packages\infoblox_client\connector.py", line 267, in _get_object r = self.session.get(url, **opts)
File "C:...\lib\site-packages\requests\sessions.py", line 501, in get return self.request('GET', url, **kwargs)
File "C:...\lib\site-packages\requests\sessions.py", line 488, in request resp = self.send(prep, **send_kwargs)
File "C:...\lib\site-packages\requests\sessions.py", line 609, in send r = adapter.send(request, **kwargs)
File "C:...\lib\site-packages\requests\adapters.py", line 487, in send raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: /url_of_our_NIOS/ui/wapi/v1.4/record%3Ahost?ipv4addr~=some_test_ip (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x033F0B10>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:...\lib\site-packages\infoblox_client\connector.py", line 45, in callee raise ib_ex.InfobloxConnectionError(reason=e)
infoblox_client.exceptions.InfobloxConnectionError: Infoblox HTTP request failed with: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: /url_of_our_NIOS/ui/wapi/v1.4/record%3Ahost?ipv4addr~=some_test_ip (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x033F0B10>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

As I suggested earlier, would you be able to setup an account with simple username/password?

Unfortunately I can't create a simple account for security reasons

Do I need to be an admin to be able to communicate with infoblox through python? I have read-write access as part of my job responsibilities but I am not an administrator for our account.

No, you don't need to be admin to use the python client. You should be able to use the same credential to perform the same task that you can do via the GUI.

I tried using all sorts of special characters in the password, and I could not reproduce the exception that you last reported.

If possible, maybe you can changed the password to eliminate a special character one at a time?

Hey @johnbelamaric, how would I go about doing this (allow insecure/include cert in request)? I don't see cert as an attribute in the Connector object. I am still having this issue and I have verified my login works when I go directly the NIOS. Thank you!

was the cert questions answered? I'm having the same issue, how to add cert_valid 'no'? or add a cert?

Hi @ku0100 was your question answered or you are still facing this issue?

Hi @ku0100 Can you please confirm if we can close this issue or you need help?

Closing the issue as no response from the user.