socfortress / CoPilot

SOCFortress CoPilot
https://www.socfortress.co
GNU Affero General Public License v3.0
210 stars 40 forks source link

Office 365 3rd party plugin in customer wazuh-manager not adding trailing "/" after host:port #315

Closed SecurityArsenal closed 1 month ago

SecurityArsenal commented 1 month ago

I am trying to add Office 365 to a customer I click deploy and it just says: An error occurred. Please try again later.

2024-10-02 03:09:26.258 | ERROR | app.connectors.wazuh_manager.utils.universal:send_get_request:178 - Failed to send GET request to manager/configuration with error: Failed to parse: https://domain:55000manager/configuration

When I check the logs it seems like it is missing a "/" shouldn't it be? https://domain:55000/manager/configuration

I tried to add trailing "/" to the connection for wazuh-manager but it will not work with "/"at the end. So wonder if it is missing in function.

I also see this in the logs: ERROR [apscheduler.executors.default] Job "invoke_alert_creation_collect (trigger: interval[0:05:00], next run at: 2024-10-02 03:32:42 UTC)" raised an exception Traceback (most recent call last): File "/opt/venv/lib/python3.11/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job retval = await job.func(*job.args, **job.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/copilot/backend/app/schedulers/services/invoke_alert_creation.py", line 23, in invoke_alert_creation_collect await create_alert_auto_route(session=session) File "/opt/copilot/backend/app/incidents/routes/incident_alert.py", line 167, in create_alert_auto_route alert_id = await create_alert(create_alert_request, session) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/copilot/backend/app/incidents/services/incident_alert.py", line 642, in create_alert customer_code = await get_customer_code(dict(alert_details._source)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/copilot/backend/app/incidents/services/incident_alert.py", line 211, in get_customer_code raise HTTPException( fastapi.exceptions.HTTPException 2024-10-02 03:27:42.468 | ERROR | app.schedulers.scheduler:scheduler_listener:64 - Job invoke_alert_creation_collect crashed:

SecurityArsenal commented 1 month ago

The other issue when using "Third party integrations" if they fail or don't work it seems to break the alerts of that customer, and there is no way to remove the "Third party integrations" for example Office365. I test and now that it has the above error I get no alerts from that customer like it was before trying to add the plugin.

Is there a way to delete the "Third party integrations" without having to figure out all the changes it made and manually ripping it out. That seems the be the biggest issue I run into. If you don't have a way to do snapshots and take them every time you try to do something, then you have no way to remove it and try again without breaking the system.

taylorwalton commented 1 month ago

Do you have the latest version of CoPilot? I do see the / being added as apart of the source code https://github.com/socfortress/CoPilot/blob/main/backend/app/integrations/office365/services/provision.py#L248

EDIT: Found the error