-
Notifications
You must be signed in to change notification settings - Fork 192
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
Invalid API calls and broken link in the Management < Configuration < Alerts
section
#5565
Comments
ResearchAccording to the Wazuh API reference, the current requests are not using the expected paths. Labels - ManagerManager nodeAPI endpoint:
I added a configuration for the <ossec_config>
<labels>
<label key="custom">customLabel</label>
</labels>
</ossec_config> The expected response of
Response{
"data": {
"affected_items": [],
"total_affected_items": 0,
"total_failed_items": 1,
"failed_items": [
{
"error": {
"code": 1121,
"message": "Error connecting with socket: Please verify that the component 'agent' is properly configured",
"remediation": "Please ensure the selected module is running and properly configured"
},
"id": [
"manager"
]
}
]
},
"message": "Could not read active configuration",
"error": 1
} But using the Response{
"data": {
"affected_items": [
{
"global": {
"jsonout_output": "yes",
"alerts_log": "yes",
"logall": "no",
"logall_json": "no",
"email_notification": "no",
"smtp_server": "smtp.example.wazuh.com",
"email_from": "[email protected]",
"email_to": "[email protected]",
"email_maxperhour": "12",
"email_log_source": "alerts.log",
"agents_disconnection_time": "10m",
"agents_disconnection_alert_time": "0",
"white_list": [
"127.0.0.1",
"^localhost.localdomain$",
"10.0.0.106"
]
},
"alerts": {
"log_alert_level": "3",
"email_alert_level": "12"
},
"remote": [
{
"connection": "secure",
"port": "1514",
"protocol": [
"tcp"
],
"queue_size": "131072"
}
],
"rootcheck": {
"disabled": "no",
"check_files": "yes",
"check_trojans": "yes",
"check_dev": "yes",
"check_sys": "yes",
"check_pids": "yes",
"check_ports": "yes",
"check_if": "yes",
"frequency": "43200",
"rootkit_files": [
"etc/rootcheck/rootkit_files.txt"
],
"rootkit_trojans": [
"etc/rootcheck/rootkit_trojans.txt"
],
"skip_nfs": "yes"
},
"cis-cat": {
"disabled": "yes",
"timeout": "1800",
"interval": "1d",
"scan-on-start": "yes",
"java_path": "wodles/java",
"ciscat_path": "wodles/ciscat"
},
"osquery": {
"disabled": "yes",
"run_daemon": "yes",
"log_path": "/var/log/osquery/osqueryd.results.log",
"config_path": "/etc/osquery/osquery.conf",
"add_labels": "yes"
},
"syscollector": {
"disabled": "no",
"interval": "1h",
"scan_on_start": "yes",
"hardware": "yes",
"os": "yes",
"network": "yes",
"packages": "yes",
"ports": {
"all": "no",
"item": "yes"
},
"processes": "yes",
"synchronization": {
"max_eps": "10"
}
},
"sca": {
"enabled": "yes",
"scan_on_start": "yes",
"interval": "12h",
"skip_nfs": "yes"
},
"vulnerability-detector": {
"enabled": "no",
"interval": "5m",
"min_full_scan_interval": "6h",
"run_on_start": "yes",
"provider": {
"name": "nvd",
"enabled": "yes",
"update_from_year": "2010",
"update_interval": "1h"
}
},
"syscheck": {
"disabled": "no",
"frequency": "43200",
"scan_on_start": "yes",
"alert_new_files": "yes",
"auto_ignore": {
"frequency": "10",
"timeframe": "3600",
"item": "no"
},
"directories": [
{
"path": "/etc"
},
{
"path": "/usr/bin"
},
{
"path": "/usr/sbin"
},
{
"path": "/bin"
},
{
"path": "/sbin"
},
{
"path": "/boot"
}
],
"ignore": [
"/etc/mtab",
"/etc/hosts.deny",
"/etc/mail/statistics",
"/etc/random-seed",
"/etc/random.seed",
"/etc/adjtime",
"/etc/httpd/logs",
"/etc/utmpx",
"/etc/wtmpx",
"/etc/cups/certs",
"/etc/dumpdates",
"/etc/svc/volatile",
{
"type": "sregex",
"item": ".log$|.swp$"
}
],
"nodiff": [
"/etc/ssl/private.key"
],
"skip_nfs": "yes",
"skip_dev": "yes",
"skip_proc": "yes",
"skip_sys": "yes",
"process_priority": "10",
"max_eps": "100",
"synchronization": {
"enabled": "yes",
"interval": "5m",
"max_interval": "1h",
"max_eps": "10"
}
},
"command": [
{
"name": "disable-account",
"executable": "disable-account",
"timeout_allowed": "yes"
},
{
"name": "restart-wazuh",
"executable": "restart-wazuh"
},
{
"name": "firewall-drop",
"executable": "firewall-drop",
"timeout_allowed": "yes"
},
{
"name": "host-deny",
"executable": "host-deny",
"timeout_allowed": "yes"
},
{
"name": "route-null",
"executable": "route-null",
"timeout_allowed": "yes"
},
{
"name": "win_route-null",
"executable": "route-null.exe",
"timeout_allowed": "yes"
},
{
"name": "netsh",
"executable": "netsh.exe",
"timeout_allowed": "yes"
}
],
"localfile": [
{
"log_format": "command",
"command": "df -P",
"frequency": "360"
},
{
"log_format": "full_command",
"command": "netstat -tulpn | sed 's/\\([[:alnum:]]\\+\\)\\ \\+[[:digit:]]\\+\\ \\+[[:digit:]]\\+\\ \\+\\(.*\\):\\([[:digit:]]*\\)\\ \\+\\([0-9\\.\\:\\*]\\+\\).\\+\\ \\([[:digit:]]*\\/[[:alnum:]\\-]*\\).*/\\1 \\2 == \\3 == \\4 \\5/' | sort -k 4 -g | sed 's/ == \\(.*\\) ==/:\\1/' | sed 1,2d",
"alias": "netstat listening ports",
"frequency": "360"
},
{
"log_format": "full_command",
"command": "last -n 20",
"frequency": "360"
},
{
"log_format": "syslog",
"location": "/var/ossec/logs/active-responses.log"
}
],
"ruleset": {
"decoder_dir": [
"ruleset/decoders",
"etc/decoders"
],
"rule_dir": [
"ruleset/rules",
"etc/rules"
],
"rule_exclude": [
"0215-policy_rules.xml"
],
"list": [
"etc/lists/audit-keys",
"etc/lists/amazon/aws-eventnames",
"etc/lists/security-eventchannel"
]
},
"auth": {
"disabled": "no",
"port": "1515",
"use_source_ip": "no",
"purge": "yes",
"use_password": "no",
"ciphers": "HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH",
"ssl_verify_host": "no",
"ssl_manager_cert": "etc/sslmanager.cert",
"ssl_manager_key": "etc/sslmanager.key",
"ssl_auto_negotiate": "no"
},
"cluster": {
"name": "wazuh",
"node_name": "node01",
"node_type": "master",
"port": "1516",
"bind_addr": "0.0.0.0",
"nodes": [
"NODE_IP"
],
"hidden": "no",
"disabled": "yes"
},
"labels": [
{
"label": [
{
"value": "customLabel",
"key": "custom"
}
]
}
]
}
],
"total_affected_items": 1,
"total_failed_items": 0,
"failed_items": []
},
"message": "Configuration was successfully read",
"error": 0
} I don't know if I have missed some requirements for the API response to work correctly. Cluster nodes
I configured the labels: <ossec_config>
<labels>
<label key="custom">customLabel</label>
</labels>
</ossec_config> The expected request
Response{
"data": {
"affected_items": [],
"total_affected_items": 0,
"total_failed_items": 1,
"failed_items": [
{
"error": {
"code": 1121,
"message": "Error connecting with socket: Please verify that the component 'agent' is properly configured",
"remediation": "Please ensure the selected module is running and properly configured"
},
"id": [
"node01"
]
}
]
},
"message": "Could not read active configuration in specified node",
"error": 1
} But using the Response{
"data": {
"affected_items": [
{
"global": {
"jsonout_output": "yes",
"alerts_log": "yes",
"logall": "no",
"logall_json": "no",
"email_notification": "no",
"smtp_server": "smtp.example.wazuh.com",
"email_from": "[email protected]",
"email_to": "[email protected]",
"email_maxperhour": "12",
"email_log_source": "alerts.log",
"agents_disconnection_time": "10m",
"agents_disconnection_alert_time": "0",
"white_list": [
"127.0.0.1",
"^localhost.localdomain$",
"10.0.0.106"
]
},
"alerts": {
"log_alert_level": "3",
"email_alert_level": "12"
},
"remote": [
{
"connection": "secure",
"port": "1514",
"protocol": [
"tcp"
],
"queue_size": "131072"
}
],
"rootcheck": {
"disabled": "no",
"check_files": "yes",
"check_trojans": "yes",
"check_dev": "yes",
"check_sys": "yes",
"check_pids": "yes",
"check_ports": "yes",
"check_if": "yes",
"frequency": "43200",
"rootkit_files": [
"etc/rootcheck/rootkit_files.txt"
],
"rootkit_trojans": [
"etc/rootcheck/rootkit_trojans.txt"
],
"skip_nfs": "yes"
},
"cis-cat": {
"disabled": "yes",
"timeout": "1800",
"interval": "1d",
"scan-on-start": "yes",
"java_path": "wodles/java",
"ciscat_path": "wodles/ciscat"
},
"osquery": {
"disabled": "yes",
"run_daemon": "yes",
"log_path": "/var/log/osquery/osqueryd.results.log",
"config_path": "/etc/osquery/osquery.conf",
"add_labels": "yes"
},
"syscollector": {
"disabled": "no",
"interval": "1h",
"scan_on_start": "yes",
"hardware": "yes",
"os": "yes",
"network": "yes",
"packages": "yes",
"ports": {
"all": "no",
"item": "yes"
},
"processes": "yes",
"synchronization": {
"max_eps": "10"
}
},
"sca": {
"enabled": "yes",
"scan_on_start": "yes",
"interval": "12h",
"skip_nfs": "yes"
},
"vulnerability-detector": {
"enabled": "no",
"interval": "5m",
"min_full_scan_interval": "6h",
"run_on_start": "yes",
"provider": {
"name": "nvd",
"enabled": "yes",
"update_from_year": "2010",
"update_interval": "1h"
}
},
"syscheck": {
"disabled": "no",
"frequency": "43200",
"scan_on_start": "yes",
"alert_new_files": "yes",
"auto_ignore": {
"frequency": "10",
"timeframe": "3600",
"item": "no"
},
"directories": [
{
"path": "/etc"
},
{
"path": "/usr/bin"
},
{
"path": "/usr/sbin"
},
{
"path": "/bin"
},
{
"path": "/sbin"
},
{
"path": "/boot"
}
],
"ignore": [
"/etc/mtab",
"/etc/hosts.deny",
"/etc/mail/statistics",
"/etc/random-seed",
"/etc/random.seed",
"/etc/adjtime",
"/etc/httpd/logs",
"/etc/utmpx",
"/etc/wtmpx",
"/etc/cups/certs",
"/etc/dumpdates",
"/etc/svc/volatile",
{
"type": "sregex",
"item": ".log$|.swp$"
}
],
"nodiff": [
"/etc/ssl/private.key"
],
"skip_nfs": "yes",
"skip_dev": "yes",
"skip_proc": "yes",
"skip_sys": "yes",
"process_priority": "10",
"max_eps": "100",
"synchronization": {
"enabled": "yes",
"interval": "5m",
"max_interval": "1h",
"max_eps": "10"
}
},
"command": [
{
"name": "disable-account",
"executable": "disable-account",
"timeout_allowed": "yes"
},
{
"name": "restart-wazuh",
"executable": "restart-wazuh"
},
{
"name": "firewall-drop",
"executable": "firewall-drop",
"timeout_allowed": "yes"
},
{
"name": "host-deny",
"executable": "host-deny",
"timeout_allowed": "yes"
},
{
"name": "route-null",
"executable": "route-null",
"timeout_allowed": "yes"
},
{
"name": "win_route-null",
"executable": "route-null.exe",
"timeout_allowed": "yes"
},
{
"name": "netsh",
"executable": "netsh.exe",
"timeout_allowed": "yes"
}
],
"localfile": [
{
"log_format": "command",
"command": "df -P",
"frequency": "360"
},
{
"log_format": "full_command",
"command": "netstat -tulpn | sed 's/\\([[:alnum:]]\\+\\)\\ \\+[[:digit:]]\\+\\ \\+[[:digit:]]\\+\\ \\+\\(.*\\):\\([[:digit:]]*\\)\\ \\+\\([0-9\\.\\:\\*]\\+\\).\\+\\ \\([[:digit:]]*\\/[[:alnum:]\\-]*\\).*/\\1 \\2 == \\3 == \\4 \\5/' | sort -k 4 -g | sed 's/ == \\(.*\\) ==/:\\1/' | sed 1,2d",
"alias": "netstat listening ports",
"frequency": "360"
},
{
"log_format": "full_command",
"command": "last -n 20",
"frequency": "360"
},
{
"log_format": "syslog",
"location": "/var/ossec/logs/active-responses.log"
}
],
"ruleset": {
"decoder_dir": [
"ruleset/decoders",
"etc/decoders"
],
"rule_dir": [
"ruleset/rules",
"etc/rules"
],
"rule_exclude": [
"0215-policy_rules.xml"
],
"list": [
"etc/lists/audit-keys",
"etc/lists/amazon/aws-eventnames",
"etc/lists/security-eventchannel"
]
},
"auth": {
"disabled": "no",
"port": "1515",
"use_source_ip": "no",
"purge": "yes",
"use_password": "no",
"ciphers": "HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH",
"ssl_verify_host": "no",
"ssl_manager_cert": "etc/sslmanager.cert",
"ssl_manager_key": "etc/sslmanager.key",
"ssl_auto_negotiate": "no"
},
"cluster": {
"name": "wazuh",
"node_name": "node01",
"node_type": "master",
"key": "c98b62a9b6169ac5f67dae55ae4a9088",
"port": "1516",
"bind_addr": "0.0.0.0",
"nodes": [
"wazuh.manager"
],
"hidden": "no",
"disabled": "no"
},
"labels": [
{
"label": [
{
"value": "customLabel",
"key": "custom"
}
]
}
]
}
],
"total_affected_items": 1,
"total_failed_items": 0,
"failed_items": []
},
"message": "Configuration was successfully read in specified node",
"error": 0
} I don't know if I have missed some requirements for the API response to work correctly. Labels - Agent
I added a configuration for the <ossec_config>
<labels>
<label key="custom">customLabel</label>
</labels>
</ossec_config> The labels are visible in the agent configuration. The expected request
Response{
"data": {
"labels": [
{
"value": "customLabel",
"key": "custom",
"hidden": "no"
}
]
},
"error": 0
} ReportsManager nodeAPI endpoint:
I added a configuration for the <ossec_config>
<reports>
<title>Auth_Report</title>
<group>authentication_failed,</group>
<email_to>[email protected]</email_to>
</reports>
</ossec_config> The expected response of
Response{
"data": {
"affected_items": [
{
"monitord": {
"day_wait": 10,
"compress": 1,
"sign": 1,
"monitor_agents": 1,
"keep_log_days": 31,
"rotate_log": 1,
"size_rotate": 536870912,
"daily_rotations": 12,
"delete_old_agents": 0
}
}
],
"total_affected_items": 1,
"total_failed_items": 0,
"failed_items": []
},
"message": "Active configuration was successfully read",
"error": 0
} Cluster nodeAPI endpoint:
I added a configuration for the <ossec_config>
<reports>
<title>Auth_Report</title>
<group>authentication_failed,</group>
<email_to>[email protected]</email_to>
</reports>
</ossec_config> The expected response of
Response{
"data": {
"affected_items": [
{
"monitord": {
"day_wait": 10,
"compress": 1,
"sign": 1,
"monitor_agents": 1,
"keep_log_days": 31,
"rotate_log": 1,
"size_rotate": 536870912,
"daily_rotations": 12,
"delete_old_agents": 0
}
}
],
"total_affected_items": 1,
"total_failed_items": 0,
"failed_items": []
},
"message": "Active configuration was successfully read in specified node",
"error": 0
} Conclusions
How are we supposed to retrieve this data? Am I missing something or there is a problem with the manager (4.4.x)?
The endpoint |
I was talking with some co-workers about the conclusions of my research. It seems there is a problem in the API retrieving the manager and tags from its configuration. This issue was opened to fix the problem: wazuh/wazuh#17610. The fixes should not affect the current requests done by the plugin. But we should ensure this is working as expected when the fix is ready. So this issue will be blocked until we could verify the API responses are as expected. @vikman90's responseHi guys,
❌ Get reporting options:
Using direct socket request
✅ Get reporting options:
@Selutario identified that:
These are the current API requests done by the recent plugins, so on our side, these requests don't need to change it. |
Changes
|
CheckCheck changes in wazuh/wazuh#17610. I installed from sources a Wazuh manager based in the current {"data": {"title": "Wazuh API REST", "api_version": "4.5.1", "revision": 40501, "license_name": "GPL 2.0", "license_url": "https://github.com/wazuh/wazuh/blob/v4.5.1/LICENSE", "hostname": "wazuh-manager-master-7102", "timestamp": "2023-07-18T11:10:11Z"}, "error": 0} Review changes in wazuh/wazuh#17610 Labels managerI added the following configuration to the <ossec_config>
<labels>
<label key="custom">customLabel</label>
</labels>
</ossec_config> Labels - agentI added the following configuration to the <ossec_config>
<labels>
<label key="custom">customLabel</label>
</labels>
</ossec_config> The API endpoint is working as expected: ReportsAdd to the <ossec_config>
<reports>
<title>Auth_Report</title>
<group>authentication_failed,</group>
<email_to>[email protected]</email_to>
</reports>
</ossec_config> ConclusionsIt seems the endpoint to get the manger labels (manager or cluster node) changed to use:
instead of
|
Description
This section has several problems:
Steps to reproduce
Navigate to
Management < Configuration < Alerts
Check the Network tab: there are several requests with 500 response code
Click on 'Labels'
Click on the info icon
Click on
Agent labels
Redirects to a 404 in the documentation page
Additional info
Request:
Response
Request:
Response
Broken link: https://documentation.wazuh.com/4.4/user-manual/capabilities/labels.html
should be: https://documentation.wazuh.com/current/user-manual/agents/labels.html
Tasks
Screenshots
Related issues
The text was updated successfully, but these errors were encountered: