Skip to content
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

Removed deprecated force_time parameter on rest-API #1053

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vhsantos
Copy link

@vhsantos vhsantos commented Oct 4, 2023

The time_force parameter have been deprecated since version 4.3.0, which generate these error when we try to register the agent via rest-API on wazuh 4.5.2

TASK [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : Linux | Obtain JWT Token] *********************************************************************************************************************************************************
changed: [wazuh-agent-local] => {"cache_control": "no-cache, no-store, must-revalidate, max-age=0", "changed": true, "connection": "close", "content": "{\"data\": {\"token\": \"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ3YXp1aCIsImF1ZCI6IldhenVoIEFQSSBSRVNUIiwibmJmIjoxNjk2NDMzMzU2LCJleHAiOjE2OTY0MzQyNTYsInN1YiI6ImN1c3RvbS12aHMiLCJydW5fYXMiOmZhbHNlLCJyYmFjX3JvbGVzIjpbMV0sInJiYWNfbW9kZSI6IndoaXRlIn0.ALaTpuiLBHkS4XkpYtFZeac88QczoqpsfoJSTUOX7S7CNGXyJSiPV11_npQ_Kh8dylKi4HmjB2GghSgKtOUEc2kVAM1pMK5bqtI4S1WlXpJMmXoN7KuYbxJEotaHh-xex2exdS1Ff2DZ2Lq0cIcc9Auf5A0-9bk8NAiMdXs9BZxWdM3w\"}, \"error\": 0}", "content_length": "440", "content_security_policy": "none", "content_type": "application/json; charset=utf-8", "cookies": {}, "cookies_string": "", "date": "Wed, 04 Oct 2023 15:29:16 GMT", "elapsed": 0, "expires": "0", "json": {"data": {"token": "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ3YXp1aCIsImF1ZCI6IldhenVoIEFQSSBSRVNUIiwibmJmIjoxNjk2NDMzMzU2LCJleHAiOjE2OTY0MzQyNTYsInN1YiI6ImN1c3RvbS12aHMiLCJydW5fYXMiOmZhbHNlLCJyYmFjX3JvbGVzIjpbMV0sInJiYWNfbW9kZSI6IndoaXRlIn0.ALaTpuiLBHkS4XkpYtFZeac88QczoqpsfoJSTUOX7S7CNGXyJSiPV11_npQ_Kh8dylKi4HmjB2GghSgKtOUEc2kVAM1pMK5bqtI4S1WlXpJMmXoN7KuYbxJEotaHh-xex2exdS1Ff2DZ2Lq0cIcc9Auf5A0-9bk8NAiMdXs9BZxWdM3w"}, "error": 0}, "msg": "OK (440 bytes)", "pragma": "no-cache", "redirected": false, "referrer_policy": "no-referrer, strict-origin-when-cross-origin", "status": 200, "strict_transport_security": "max-age=63072000; includeSubdomains", "url": "https://xxx.xxx.xxx.xxx:55000/security/user/authenticate", "x_content_type_options": "nosniff", "x_frame_options": "DENY", "x_xss_protection": "1; mode=block"}

TASK [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : Linux | Create the agent key via rest-API] ****************************************************************************************************************************************
fatal: [wazuh-agent-local]: FAILED! => {"changed": false, "changed_when_result": "The conditional check 'api_agent_post.json.error == 0' failed. The error was: error while evaluating conditional (api_agent_post.json.error == 0): 'dict object' has no attribute 'error'. 'dict object' has no attribute 'error'", "connection": "close", "content": "{\"title\": \"Bad Request\", \"detail\": \"Invalid field found {'force_time'}\"}\n", "content_length": "73", "content_type": "application/problem+json; charset=utf-8", "date": "Wed, 04 Oct 2023 15:29:16 GMT", "elapsed": 0, "json": {"detail": "Invalid field found {'force_time'}", "title": "Bad Request"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "status": 400, "url": "https://xxx.xxx.xxx.xxx:55000/agents"}

after applying this patch, the agent can register without problem.

TASK [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : Linux | Obtain JWT Token] *********************************************************************************************************************************************************
changed: [wazuh-agent-local]

TASK [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : Linux | Create the agent key via rest-API] ****************************************************************************************************************************************
changed: [wazuh-agent-local]

TASK [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : Linux | Validate registered agent key matches manager record] *********************************************************************************************************************
ok: [wazuh-agent-local]

TASK [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : Linux | Import Key (via rest-API)] ************************************************************************************************************************************************
changed: [wazuh-agent-local]

[...]

ok: [wazuh-agent-local]

RUNNING HANDLER [../roles/wazuh-ansible/roles/wazuh/ansible-wazuh-agent : restart wazuh-agent] ***************************************************************************************************************************************************
changed: [wazuh-agent-local]

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************
wazuh-agent-local          : ok=24   changed=5    unreachable=0    failed=0    skipped=21   rescued=0    ignored=0   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant