-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add support for agent self-restarting for Linux: Design #63
Comments
Update 2024-08-05
|
UpdateConfirm Module Restarts: This step involves checking the status of all restarted modules to ensure they are running as expected. Flowchart on mermaidchart
Note: |
UpdateAfter syncing with the team, it looks like I can continue with the next step for the parent issue. I was able to set up a Docker environment to work in. However, after reviewing some other issues, I realized that I still need to gather more information. Component diagram
Stateful module: use Agent comms API
Command manager
|
UpdateBased on the previous issues and images, I propose creating a CLI (Command Line Interface) that connects with the Client on the Agent Comms API to send commands to each module. This approach allows us to reuse the existing API communications without generating new code. Flowchart on mermaidchart
For the next step, the MVP, we can reuse the code implemented here (issue: Agent Command Manager #4). Taking into account the type of message that should be generated by the Client to the Command Manager: {
"command": {
"name": "local_agent",
"type": "restart-agent"
},
"origin": {
"moduleName": "client",
"serverName": ""
},
"parameters": {
"data": "all",
"error": 0,
"extra_args": [],
"status": "pending"
}
} Some essential features for this MVP include:
We can exclude the following for now:
The primary focus should be on the reset process itself, rather than the initial trigger. Some suggestions that came to my mind after this research:
|
@lchico Thanks for the design proposal. I just want to review the Shutdown operation. Sometimes, modules take too long to stop. That's why they need a timeout on Shutdown too. GJ! |
@vikman90 Yes, the diagram wasn't very clear, so I've made some updates. Following up on our previous discussion with @MarcelKemp : Command Execution Prioritization: This will not be implemented at this time. |
LGTM! |
Update
2025-01-15
flowchart TD
A["Receive Restart Command"] --> B["Identify Run Method <br> - systemd <br> - Manual"]
B --> K["Systemd"] & L["Manual"]
K --> C["Restart Service <br>with systemd"]
L --> M{"Fork"}
M --> N["Parent:<br>Report Restart"] & O["Child:<br>Stop Wazuh-Agent"]
C --> D["Configuration: <br> - Timeout Stop 30s"]
O --> D
D -- Timeout --> F["Kill Service & Log"]
F --> H["Start Wazuh-Agent"]
D -- Shutdown Gracefully --> H
H --> I["Confirm agent restarts"]
2025-01-16
|
Update
flowchart TD
A["Receive Restart Command"] --> B["Identify Run Method <br> - systemd <br> - Manual"]
B --> K["Systemd"] & L["Manual"]
K --> C["Restart Service <br>with systemd"]
L --> M{"Fork"}
M --> N["Parent: Continue<br>Agent excecution"] & O["Child:<br>Stop Wazuh-Agent"]
C --> D["Configuration: <br> - Timeout Stop 30s"]
O --> D
D -- Timeout --> F["Kill Service & Log"]
F --> H["Start Wazuh-Agent"]
D -- Shutdown Gracefully --> H
H --> I["Confirm agent restarts"]
2025-01-20
flowchart TD
A["Receive Restart Command"] --> Z["Report Restart<br>in Progress"]
Z --> B["Identify Run Method <br> - systemd <br> - Manual"]
B --> K["Systemd"] & L["Manual"]
K --> C["Restart Service <br>with systemd"]
L --> M{"Fork"}
M --> N["Parent: Continue<br>Agent excecution"] & O["Child:<br>Stop Wazuh-Agent"]
C --> D["Configuration: <br> - Timeout Stop 30s"]
O --> D
D -- Timeout --> F["Kill Service & Log"]
F --> H["Start Wazuh-Agent"]
D -- Shutdown Gracefully --> H
H --> I["Confirm agent restarts"]
|
Parent issue:
Description
Outline the design and workflow for the restart command.
Functional requirements
Non-functional requirements
Implementation restrictions
The text was updated successfully, but these errors were encountered: