-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server returned response without token info during connection authentication #31
Comments
We found the error :
The error disappears. Do we need uid in all modules? If yes why does checkpoint api not return it? |
Hi @CapAnsible , I've few questions:
Thanks, |
Hi @chkp-orso , I identified how triggered / reproduce the above issue, it is triggered when using underscore "_" in the hostname and mapping that hostname in to an ip address in /etc/hosts Steps to reproduce.
Add det following to /etc/ansible/hosts:
Add det following line to /etc/hosts Test with this playbook:
The result of the play-book will be:
This is the error I see in API.elg when using hostname with underscore (chkp_sms) in the name:
While using a dash sign in the hostname (chkp-mgmt) provides a successful login with correct X-Forwarded-Host header:
|
Hi @justjais , Are you familiar with this issue? |
@chkp-orso excuse me for the delayed response here, and WRT to issue No I haven't faced the issue |
Hi @chkp-orso , I also have the same as CapAnsible. The module throws the "Server returned response without token info during connection authentication: 200" error unless line 63 in checkpoint.py is commented out. I believe it's because I'm connecting to a readonly/standby controller which isn't returning a uid field on login. Connecting to the active controller DOES return this value and the module works fine with that, but I specifically want to use the standby controller for the queries I want to perform. Is there any chance of an update which will allow connecting to standby controllers? |
@BarrieAlmond can u share the complete verbose debug log of your play run, also can u confirm if your hostname has |
Hi @justjais , I'm connecting by IP so there's no - in the hostname. I've included the debug log though I've cut out some of the tasks from before it gets to the failure since they run locally and aren't relevant, and I've obscured some details for security. I've also included the output from login calls using cURL. ansible-playbook 2.9.6 PLAYBOOK: playbookname.yml **************************************************************************************Positional arguments: playbookname.yml TASK [playbookname : taskname] ************************************************task path: /home/username/checkpoint/roles/rolename/tasks/includes/include.yml:8 Output from logging in to the standby server using cURL: Output from logging in to the active server using cURL: As you can see, the active server returns a uid value, while the standby - the one I want to use - does not. I believe this is why commenting out the line mentioned earlier solves the problem with connecting to the standby. |
@BarrieAlmond Thanks for your quick response, for further triaging can u add |
Hi @justjais , no change I'm afraid. Here is the log, and at the bottom I've included my inventory. ansible-playbook 2.9.6 PLAYBOOK: playbookname.yml *********************************************************************************************************************************************************************************************************** PLAY [Create CSV of Checkpoint objects requested for decom] ********************************************************************************************************************************************************************************* TASK [playbookname : taskname] ********************************************************************************************************************************************************************* all: |
@BarrieAlmond can u share your complete play as well for me to triage from my end, Thanks. |
Hi @justjais , the play I've been using is quite complex but any basic play will fail if that one line in checkpoint.py isn't commented out. This one for example will work if the line is commented out, but give the above error with the default collection files...apologies if the yaml formatting gets mangled:
|
@BarrieAlmond were you able to get past the particular issue ? |
@justjais Only with the tweak detailed above by CapAnsible of commenting out line 63 in checkpoint.py (httpapi in collections). It would be nice if this could be officially incorporated in to the code if there is no other/better solution. |
Hey @justjais just stumpled over this issue while while trying the exact simple playbook @BarrieAlmond mentioned above. I just wanted some facts from host objects. I ran into the same error when connecting with a user who has only read permissions. This also works with the workaround by commenting out line 65 in When connecting as a user who has read/write permissions, the playbook is executed successfully without commenting out the line in Maybe this helps getting this issue sorted out. |
@CapAnsible @dapLinux @BarrieAlmond were you trying to use Gaia API or the Management API (web_api)? These are different and use different collections. Gaia API uses check_point.gaia collection. You need that for managing host-level items (hostname, routes, interfaces, users, etc.). Management API (aka web_api) is for the Security Management server. Gaia API uses "ansible_network_os: check_point.gaia.checkpoint", and Management API uses "ansible_network_os: check_point.mgmt.checkpoint". They have different httapi plugins. |
Hi all
Trying to connect to Gaia rest api with ansible
Inventory :
[test:vars]
checkpoint ansible_host=XXXXXXX
ansible_user='XXXXXXXXX'
ansible_password='XXXXXXXXXXX'
ansible_network_os=checkpoint
ansible_httpapi_use_ssl=True
ansible_httpapi_validate_certs=False
[test]
XXXXXXX
Playbook:
connection: httpapi
gather_facts: false
tasks:
cp_mgmt_host_facts:
details_level: standard
limit: 50
offset: 0
I get this response :
PLAY [test] *******************************************************************************************************************************************************************************************************************************************************************
TASK [collect-host facts] *****************************************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: Server returned response without token info during connection authentication: 200
fatal: [XXXXXXX]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n File "/user/thki/.ansible/tmp/ansible-local-1618CZXifK/ansible-tmp-1598617196.57-1627-159382009972429/AnsiballZ_cp_mgmt_host_facts.py", line 102, in \n _ansiballz_main()\n File "/user/thki/.ansible/tmp/ansible-local-1618CZXifK/ansible-tmp-1598617196.57-1627-159382009972429/AnsiballZ_cp_mgmt_host_facts.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/user/thki/.ansible/tmp/ansible-local-1618CZXifK/ansible-tmp-1598617196.57-1627-159382009972429/AnsiballZ_cp_mgmt_host_facts.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.check_point.cp_mgmt_host_facts', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python2.7/runpy.py", line 176, in run_module\n fname, loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_cp_mgmt_host_facts_payload_fQtftI/ansible_cp_mgmt_host_facts_payload.zip/ansible/modules/network/check_point/cp_mgmt_host_facts.py", line 131, in \n File "/tmp/ansible_cp_mgmt_host_facts_payload_fQtftI/ansible_cp_mgmt_host_facts_payload.zip/ansible/modules/network/check_point/cp_mgmt_host_facts.py", line 126, in main\n File "/tmp/ansible_cp_mgmt_host_facts_payload_fQtftI/ansible_cp_mgmt_host_facts_payload.zip/ansible/module_utils/network/checkpoint/checkpoint.py", line 179, in api_call_facts\n File "/tmp/ansible_cp_mgmt_host_facts_payload_fQtftI/ansible_cp_mgmt_host_facts_payload.zip/ansible/module_utils/network/checkpoint/checkpoint.py", line 56, in send_request\n File "/tmp/ansible_cp_mgmt_host_facts_payload_fQtftI/ansible_cp_mgmt_host_facts_payload.zip/ansible/module_utils/connection.py", line 185, in rpc\nansible.module_utils.connection.ConnectionError: Server returned response without token info during connection authentication: 200\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
XXXXXXX : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ansible --version
ansible 2.9.12
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/user/thki/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Ive verified that I can connect to api via curl and get token back? Our checkpoint administrator can see login and logoff on management server?
The text was updated successfully, but these errors were encountered: