{"action":"created","issue":{"url":"https://api.github.com/repos/wazuh/wazuh/issues/1238","repository_url":"https://api.github.com/repos/wazuh/wazuh","labels_url":"https://api.github.com/repos/wazuh/wazuh/issues/1238/labels{/name}","comments_url":"https://api.github.com/repos/wazuh/wazuh/issues/1238/comments","events_url":"https://api.github.com/repos/wazuh/wazuh/issues/1238/events","html_url":"https://github.com/wazuh/wazuh/issues/1238","id":357615602,"node_id":"MDU6SXNzdWUzNTc2MTU2MDI=","number":1238,"title":"Test multiple groups","user":{"login":"TJOSERAFAEL","id":16609513,"node_id":"MDQ6VXNlcjE2NjA5NTEz","avatar_url":"https://avatars2.githubusercontent.com/u/16609513?v=4","gravatar_id":"","url":"https://api.github.com/users/TJOSERAFAEL","html_url":"https://github.com/TJOSERAFAEL","followers_url":"https://api.github.com/users/TJOSERAFAEL/followers","following_url":"https://api.github.com/users/TJOSERAFAEL/following{/other_user}","gists_url":"https://api.github.com/users/TJOSERAFAEL/gists{/gist_id}","starred_url":"https://api.github.com/users/TJOSERAFAEL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TJOSERAFAEL/subscriptions","organizations_url":"https://api.github.com/users/TJOSERAFAEL/orgs","repos_url":"https://api.github.com/users/TJOSERAFAEL/repos","events_url":"https://api.github.com/users/TJOSERAFAEL/events{/privacy}","received_events_url":"https://api.github.com/users/TJOSERAFAEL/received_events","type":"User","site_admin":false},"labels":[{"id":954213549,"node_id":"MDU6TGFiZWw5NTQyMTM1NDk=","url":"https://api.github.com/repos/wazuh/wazuh/labels/qa","name":"qa","color":"237b93","default":false}],"state":"open","locked":false,"assignee":{"login":"cristgl","id":14914658,"node_id":"MDQ6VXNlcjE0OTE0NjU4","avatar_url":"https://avatars2.githubusercontent.com/u/14914658?v=4","gravatar_id":"","url":"https://api.github.com/users/cristgl","html_url":"https://github.com/cristgl","followers_url":"https://api.github.com/users/cristgl/followers","following_url":"https://api.github.com/users/cristgl/following{/other_user}","gists_url":"https://api.github.com/users/cristgl/gists{/gist_id}","starred_url":"https://api.github.com/users/cristgl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristgl/subscriptions","organizations_url":"https://api.github.com/users/cristgl/orgs","repos_url":"https://api.github.com/users/cristgl/repos","events_url":"https://api.github.com/users/cristgl/events{/privacy}","received_events_url":"https://api.github.com/users/cristgl/received_events","type":"User","site_admin":false},"assignees":[{"login":"cristgl","id":14914658,"node_id":"MDQ6VXNlcjE0OTE0NjU4","avatar_url":"https://avatars2.githubusercontent.com/u/14914658?v=4","gravatar_id":"","url":"https://api.github.com/users/cristgl","html_url":"https://github.com/cristgl","followers_url":"https://api.github.com/users/cristgl/followers","following_url":"https://api.github.com/users/cristgl/following{/other_user}","gists_url":"https://api.github.com/users/cristgl/gists{/gist_id}","starred_url":"https://api.github.com/users/cristgl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristgl/subscriptions","organizations_url":"https://api.github.com/users/cristgl/orgs","repos_url":"https://api.github.com/users/cristgl/repos","events_url":"https://api.github.com/users/cristgl/events{/privacy}","received_events_url":"https://api.github.com/users/cristgl/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2018-09-06T11:37:55Z","updated_at":"2018-10-05T06:45:06Z","closed_at":null,"author_association":"MEMBER","body":"## Feature description\r\n\r\nThe multiple group feature adds the capability to add various groups to an agent. For example you can add the groups` group1, group2, group3` to the agent **001**.\r\n\r\nFirst of all download the RESTful API branch: https://github.com/wazuh/wazuh/tree/dev-37-multigroup-improvement\r\n# Tests\r\n\r\n- ## Create a new group\r\n    - ### How to \r\n      - `/var/ossec/bin/agent_groups -a -g newgroup`\r\n      - Check if the group is created in the database:\r\n        - `# sqlite3 /var/ossec/var/db/global.db`\r\n        - select * from \\`group`\r\n     - ### Expected results \r\n       - Group is created\r\n\r\n- ## Add the new group to an agent\r\n    - ### How to \r\n      - `/var/ossec/bin/agent_groups -a -i 001 -g newgroup`\r\n      - Check if the group is added to the agent in the database:\r\n         - `# sqlite3 /var/ossec/var/db/global.db`\r\n         - select \\`group` from agent where id ='1'\r\n         - select * from belongs\r\n      - Check if the multiple group folder is created\r\n         - `# ls /var/ossec/var/multigroups`\r\n      - Check if the multiple group is ok in agent 001\r\n         - `# cat /var/ossec/queue/agent-groups/001 `\r\n    - ### Expected results \r\n        - Group is added to the agent 001, you should see **default-newgroup** in `/var/ossec/var/multigroups` and default-newgroup in ` /var/ossec/queue/agent-groups/001`\r\n\r\n- ## List the groups\r\n    - ### How to \r\n      - `/var/ossec/bin/agent_groups -l -g newgroup`\r\n    - ### Expected results \r\n        -  You must see the following output:\r\n    ```\r\n      1 agent(s) in group 'newgroup':\r\n          ID: 001  Name: TEST. * \r\n    ```\r\n    The ***** at the end of the agent name indicates that it belongs to multiple groups:\r\n\r\n- ## Change the` agent.conf` file of the new group\r\n    - ### How to \r\n      - `# nano /var/ossec/etc/shared/newgroup/agent.conf`\r\n      - Save the changes:\r\n         - `# sqlite3 /var/ossec/var/db/global.db`\r\n         - select \\`group` from agent where id ='1'\r\n         - select * from belongs\r\n      - Check if the new group `agent.conf `is merged with the `default agent.conf`\r\n         - `# cat /var/ossec/var/multigroups/default-newgroup/agent.conf`\r\n      - On the agent **001** check the received the agent.conf file\r\n         - `# cat /var/ossec/etc/shared/agent.conf `\r\n    - ### Expected results \r\n        - The **agent.conf** file from **default,newgroup** get merged, **the agent must receive this configuration**\r\n\r\n- ## Remove the global.db databse\r\n    - ### How to \r\n      - `# rm /var/ossec/var/db/global.db`\r\n      - Restart the manager:\r\n      - Check if the database and all the tables are created and filled\r\n         - `# sqlite3 /var/ossec/var/db/global.db`\r\n         - select * from agent\r\n         - select * from belongs\r\n         - select * from \\`group`\r\n    - ### Expected results \r\n        - All tables must exists, the belongs table have to be filled  and the group table filled with all the existing groups.\r\n\r\n- ## Remove the new group\r\n    - ### How to \r\n      - `/var/ossec/bin/agent_groups -r -g newgroup`\r\n      - Check if the group is removed from the database:\r\n        - `# sqlite3 /var/ossec/var/db/global.db`\r\n         - select \\`group` from agent where id ='1'\r\n         - select * from belongs\r\n      - Check if the multiple group folder is removed\r\n         - `# ls /var/ossec/var/multigroups`\r\n      - Check if the group is ok in agent 001\r\n         - `# cat /var/ossec/queue/agent-groups/001 `\r\n    - ### Expected results \r\n        - Group is removed, you should **not** see **default-newgroup** in `/var/ossec/var/multigroups` and default-newgroup in ` /var/ossec/queue/agent-groups/001`\r\n\r\n- ## Add an agent with **Authd** that contains a multigroup\r\n    - ### How to \r\n      - `/var/ossec/bin/agent-auth -m MANAGER_IP -G group1,group2,group3`\r\n      - Check if the multiple group folder is created\r\n         - `# ls /var/ossec/var/multigroups`\r\n      - Check if the group is ok in agent 00X\r\n         - `# cat /var/ossec/queue/agent-groups/00X `\r\n    - ### Expected results \r\n        - Multigroup is created, you should  see **group1,group2,group3** in `/var/ossec/var/multigroups` and group1,group2,group3 in ` /var/ossec/queue/agent-groups/00X`\r\n\r\n- ## Add an agent with **Authd** that contains an **invalid (non existing)** group\r\n    - ### How to \r\n      - `/var/ossec/bin/agent-auth -m MANAGER_IP -G group1,group2,group3,invalidgroup`\r\n      - Check the Authd message\r\n         - `# ERROR: Invalid group: invalidgroup (from manager)`\r\n    - ### Expected results \r\n        - The agent is not registered because the group does not exists\r\n\r\n- ## Add an agent with **Authd** that contains a **malformed** multigroup\r\n    - ### How to \r\n      - `/var/ossec/bin/agent-auth -m MANAGER_IP -G ,,,default,,,,group1,,,,,group2`\r\n      - Check the Authd message\r\n         - `# ERROR: Invalid multigroup: ,,,default,,,,group1,,,,,group2`\r\n    - ### Expected results \r\n        - The agent is not registered because the group if malformed\r\n\r\n- ## Remove an agent with **manage_agents**\r\n    - ### How to \r\n      - `/var/ossec/bin/manage_agents`\r\n      - Remove an agent that belongs to a **multigroup**\r\n    - ### Expected results \r\n        - If the agent removed is the only one that belongs to the multigroup, that folder should be removed from `/var/ossec/var/multigroups`. If not that folder should stay.\r\n\r\n- ## Remove a multigroup folder\r\n    - ### How to \r\n      - `rm -rf /var/ossec/var/multigroups/(HASH)`\r\n    - ### Expected results \r\n        - When the agent send the ACK, the folder should be created again in `/var/ossec/var/multigroups`\r\n\r\n- ## Remove .metadata file\r\n    - ### How to \r\n      - `rm -rf /var/ossec/var/multigroups/.metadata`\r\n    - ### Expected results \r\n        - When the agents send the ACK, the file should be created again in `/var/ossec/var/multigroups`\r\n\r\n- ## Repeat the tests with real time option enabled\r\n  - ### How to \r\n      - Set wazuh_database.real_time=1 in `/var/ossec/etc/internal_options.conf`\r\n  - ### Expected results \r\n        - When adding, creating and removing a group, the changes will apply immediately to the  `/var/ossec/var/db/global.db` database\r\n\r\n- ## Repeat the tests with real time option disabled\r\n  - ### How to \r\n      - Set wazuh_database.real_time=0 in `/var/ossec/etc/internal_options.conf`\r\n  - ### Expected results \r\n        - When adding, creating and removing a group, the changes will apply every `wazuh_database.interval` (60 by default) seconds to the `/var/ossec/var/db/global.db` database\r\n\r\n- ## Repeat the tests with the RESTful API\r\n   - ### How to  \r\n     - Add a group to an agent with `curl -u foo:bar -X PUT \"http://localhost:55000/agents/001/group/newgroup?pretty\"`\r\n  - ### Expected results \r\n      - Same results for each test\r\n\r\n# Check list\r\n\r\n| Version | Revision | Branch |\r\n| --- | --- | --- |\r\n| 3.7.0 | 3704 | 3.7 |\r\n\r\n- [x] Create a new group\r\n- [ ] Add the new group to an agent\r\n- [ ] List the groups\r\n- [ ] Change theagent.conf file of the new group\r\n- [ ] Remove the global.db databse\r\n- [ ] Remove the new group\r\n- [ ] Add an agent with Authd that contains a multigroup\r\n- [ ] Add an agent with Authd that contains an invalid (non existing) group\r\n- [ ] Add an agent with Authd that contains a malformed multigroup\r\n- [ ] Remove an agent with manage_agents\r\n- [ ] Remove a multigroup folder\r\n- [ ] Remove .metadata file\r\n- [ ] Repeat the tests with real time option enabled\r\n- [ ] Repeat the tests with real time option disabled\r\n- [ ] Repeat the tests with the RESTful API\r\n\r\n\r\n# Known issues\r\n\r\nNone"},"comment":{"url":"https://api.github.com/repos/wazuh/wazuh/issues/comments/427262814","html_url":"https://github.com/wazuh/wazuh/issues/1238#issuecomment-427262814","issue_url":"https://api.github.com/repos/wazuh/wazuh/issues/1238","id":427262814,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzI2MjgxNA==","user":{"login":"cristgl","id":14914658,"node_id":"MDQ6VXNlcjE0OTE0NjU4","avatar_url":"https://avatars2.githubusercontent.com/u/14914658?v=4","gravatar_id":"","url":"https://api.github.com/users/cristgl","html_url":"https://github.com/cristgl","followers_url":"https://api.github.com/users/cristgl/followers","following_url":"https://api.github.com/users/cristgl/following{/other_user}","gists_url":"https://api.github.com/users/cristgl/gists{/gist_id}","starred_url":"https://api.github.com/users/cristgl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristgl/subscriptions","organizations_url":"https://api.github.com/users/cristgl/orgs","repos_url":"https://api.github.com/users/cristgl/repos","events_url":"https://api.github.com/users/cristgl/events{/privacy}","received_events_url":"https://api.github.com/users/cristgl/received_events","type":"User","site_admin":false},"created_at":"2018-10-05T06:45:06Z","updated_at":"2018-10-05T06:45:06Z","author_association":"CONTRIBUTOR","body":"https://github.com/wazuh/wazuh/issues/1569"}}
{"actor":{"display_login":"cristgl"}}