{"id":9590,"date":"2021-07-10T23:26:03","date_gmt":"2021-07-10T20:26:03","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9590"},"modified":"2024-03-18T19:40:18","modified_gmt":"2024-03-18T16:40:18","slug":"install-wazuh-agent-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-wazuh-agent-on-rocky-linux-8\/","title":{"rendered":"Install Wazuh Agent on Rocky Linux 8"},"content":{"rendered":"\n<p>In this tutorial, you will learn how to install Wazuh agent on Rocky Linux 8. Our previous setup was on setting up Wazuh server with ELK on Rocky Linux. <em>The <a href=\"https:\/\/documentation.wazuh.com\/current\/installation-guide\/wazuh-agent\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">Wazuh agent<\/a> is multi-platform and runs on the hosts that the user wants to monitor. It communicates with the Wazuh manager, sending data in near real time through an encrypted and authenticated channel<\/em>.<\/p>\n\n\n\n<p>In our previous guide, we learnt how to install Wazuh server on Rocky Linux 8.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-wazuh-server-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Wazuh Server on Rocky Linux 8<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Wazuh Agent on Rocky Linux 8<\/h2>\n\n\n\n<p>In this tutorial, we are going to install the Wazuh agent in another Rocky Linux 8 Desktop acting at the end point from which we are collecting logs. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create the Wazuh Repository<\/h3>\n\n\n\n<p>Run the command below to create the Wazuh 4.x repository on Rocky Linux 8.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\ncat > \/etc\/yum.repos.d\/wazuh.repo << 'EOL'\n[wazuh_repo] \ngpgcheck=1 \ngpgkey=https:\/\/packages.wazuh.com\/key\/GPG-KEY-WAZUH \nenabled=1 \nname=Wazuh repository \nbaseurl=https:\/\/packages.wazuh.com\/4.x\/yum\/ \nprotect=1 \nEOL\n<\/code><\/pre>\n\n\n\n<p>Import the Wazuh repository GPG key<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rpm --import http:\/\/packages.wazuh.com\/key\/GPG-KEY-WAZUH<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Wazuh Agent<\/h3>\n\n\n\n<p>Once the repos are in place, you can install Wazuh agent by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf -y install wazuh-agent<\/code><\/pre>\n\n\n\n<p>The installation is now complete.<\/p>\n\n\n\n<p>You can also specify the Wazuh manager from the command line. Replace the IP appropriately.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>WAZUH_MANAGER<strong>=<\/strong>\"192.168.60.19\" dnf install wazuh-agent<\/code><\/pre>\n\n\n\n<p>The next step is to enable the agent to communicate with the manager.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add Wazuh Agent on Wazuh Server<\/h3>\n\n\n\n<p><strong>Login to Wazuh manager<\/strong>, and run the command below to add the agent to the server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nWazuh v4.1.5 Agent manager. *\nThe following options are available: *\n\n(A)dd an agent (A).\n(E)xtract key for an agent (E).\n(L)ist already added agents (L).\n(R)emove an agent (R).\n(Q)uit.\nChoose your action: A,E,L,R or Q: A\n<\/code><\/pre>\n\n\n\n<p>Select add an agent (A) and press enter.<\/p>\n\n\n\n<p>Provide a name for the agent(in our case RockyLinux8Desktop) and IP of the agent and confirm.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n- Adding a new agent (use '\\q' to return to the main menu).\n  Please provide the following:\n   * A name for the new agent: RockyLinux8Desktop\n   * The IP Address of the new agent: 192.168.60.18\nConfirm adding it?(y\/n): y\nAgent added with ID 001.\n<\/code><\/pre>\n\n\n\n<p><strong>Note the ID given to the agent<\/strong>, 001, in our case.<\/p>\n\n\n\n<p>If you want to add more agents, please do so.<\/p>\n\n\n\n<p>To automatically add the agent, Wazuh from the command line, simply use the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents -a &lt;agent_IP&gt; -n &lt;agent_name&gt;<\/code><\/pre>\n\n\n\n<p>For example, to add the second agent to Wazuh server;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents -a 192.168.60.20 -n Ubuntu20<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n****************************************\n* Wazuh v4.1.5 Agent manager.          *\n* The following options are available: *\n****************************************\n   (A)dd an agent (A).\n   (E)xtract key for an agent (E).\n   (L)ist already added agents (L).\n   (R)emove an agent (R).\n   (Q)uit.\nChoose your action: A,E,L,R or Q: \n- Adding a new agent (use '\\q' to return to the main menu).\n  Please provide the following:\n   * A name for the new agent:    * The IP Address of the new agent: Confirm adding it?(y\/n): Agent added with ID 002.\n\nmanage_agents: Exiting.\n<\/code><\/pre>\n\n\n\n<p>You can list the agents using the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents -l<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Available agents:<br>ID: 001, Name: RockyLinux8Desktop, IP: 192.168.60.18<br>ID: 002, Name: Ubuntu20, IP: 192.168.60.20<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Register Wazuh Agents<\/h3>\n\n\n\n<p>For an agent to communicate with the manager, you need to register the the agent key from the server and install it on the agent.<\/p>\n\n\n\n<p>There are two ways in which you can register Wazuh agents.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#manual-reg\">Manual Wazuh Agent registration<\/a><\/li>\n\n\n\n<li><a href=\"#auto-reg\">Automatic Wazuh Agent registration<\/a><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"manual-reg\">Manual Wazuh Agent Registration<\/h4>\n\n\n\n<p>To manually register Wazuh agents, login to the server and extract the registration key for the specific Wazuh agent. You can use the <code><strong>\/var\/ossec\/bin\/manage_agents<\/strong><\/code> command manually or automatically as shown below;<\/p>\n\n\n\n<p>Manual agent key extraction;<\/p>\n\n\n\n<p>\/var\/ossec\/bin\/manage_agents<\/p>\n\n\n\n<p>When command runs, select option E and specify the agent ID and press Enter.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n****************************************\n* Wazuh v4.1.5 Agent manager.          *\n* The following options are available: *\n****************************************\n   (A)dd an agent (A).\n   (E)xtract key for an agent (E).\n   (L)ist already added agents (L).\n   (R)emove an agent (R).\n   (Q)uit.\nChoose your action: A,E,L,R or Q: <strong>E<\/strong>\n\nAvailable agents: \n   ID: 001, Name: RockyLinux8Desktop, IP: 192.168.60.18\n   ID: 002, Name: Ubuntu20, IP: 192.168.60.20\nProvide the ID of the agent to extract the key (or '\\q' to quit): <strong>001<\/strong>\n\nAgent key information for '001' is: \n<strong>MDAxIFJvY2t5TGludXg4RGVza3RvcCAxOTIuMTY4LjYwLjE4IDhmYjY5OGNjMTRmMGI4Zjg1NjIxZDk2ODgxOTM1M2JkODA5ZTE3NTRiZjA5MGQ4NTdlY2E5ZjgxZmEzMDBjMzM=<\/strong>\n\n** Press ENTER to return to the main menu.\n...\n<\/code><\/pre>\n\n\n\n<p>Automatic agent Key extraction:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents -e &lt;agent-id&gt;<\/code><\/pre>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents -e 001<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Agent key information for '001' is: \nMDAxIFJvY2t5TGludXg4RGVza3RvcCAxOTIuMTY4LjYwLjE4IDhmYjY5OGNjMTRmMGI4Zjg1NjIxZDk2ODgxOTM1M2JkODA5ZTE3NTRiZjA5MGQ4NTdlY2E5ZjgxZmEzMDBjMzM=<\/code><\/pre>\n\n\n\n<p>Copy the key and paste it in an accessible place as we will be using in the next step.<\/p>\n\n\n\n<p>Set the Wazuh Server Address on Wazuh Agent<\/p>\n\n\n\n<p> On <strong>the agent,<\/strong> edit the file<strong> \/var\/ossec\/etc\/ossec.conf<\/strong> and add the Wazuh manager IP\/resolvable hostname.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/var\/ossec\/etc\/ossec.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>... \n&lt;ossec_config&gt;\n  &lt;client&gt;\n    &lt;server&gt;\n      &lt;address&gt;<strong>192.168.60.19<\/strong>&lt;\/address&gt;\n      &lt;port&gt;1514&lt;\/port&gt;\n      &lt;protocol&gt;tcp&lt;\/protocol&gt;\n    &lt;\/server&gt;\n...<\/code><\/pre>\n\n\n\n<p>Save and quit<\/p>\n\n\n\n<p>Import the Wazuh Agent Key extracted above<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/manage_agents<\/code><\/pre>\n\n\n\n<p>Press I to import the key previously generated from the manager.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n****************************************\n* Wazuh v4.1.5 Agent manager.          *\n* The following options are available: *\n****************************************\n   (I)mport key from the server (I).\n   (Q)uit.\nChoose your action: I or Q: I\n\n* Provide the Key generated by the server.\n* The best approach is to cut and paste it.\n*** OBS: Do not include spaces or new lines.\n\nPaste it here (or '\\q' to quit): MDAxIFJvY2t5TGludXg4RGVza3RvcCAxOTIuMTY4LjYwLjE4IDhmYjY5OGNjMTRmMGI4Zjg1NjIxZDk2ODgxOTM1M2JkODA5ZTE3NTRiZjA5MGQ4NTdlY2E5ZjgxZmEzMDBjMzM=\n\nAgent information:\n   ID:001\n   Name:RockyLinux8Desktop\n   IP Address:192.168.60.18\n\nConfirm adding it?(y\/n): y\nAdded.\n...\n<\/code><\/pre>\n\n\n\n<p>Quit and restart the agent.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/ossec-control restart<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"auto-reg\">Automatic Wazuh Agent Registration<\/h4>\n\n\n\n<p>With the automatic agent registration, run the command below on Wazuh agent server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/agent-auth -m 192.168.60.19 -A RockyLinux8Desktop -I 192.168.60.18<\/code><\/pre>\n\n\n\n<p>Consult <code><strong>\/var\/ossec\/bin\/agent-auth -h<\/strong><\/code> for more info on command line options used.<\/p>\n\n\n\n<p>Sample output of the command;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n2021\/07\/10 15:51:15 agent-auth: INFO: Started (pid: 19633).\n2021\/07\/10 15:51:15 agent-auth: INFO: Requesting a key from server: 192.168.60.19\n2021\/07\/10 15:51:15 agent-auth: INFO: No authentication password provided\n2021\/07\/10 15:51:15 agent-auth: INFO: Using agent name as: RockyLinux8Desktop\n2021\/07\/10 15:51:15 agent-auth: INFO: Waiting for server reply\n2021\/07\/10 15:51:15 agent-auth: INFO: Valid key received\n<\/code><\/pre>\n\n\n\n<p>Restart Wazuh agent;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart wazuh-agent<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">List Active Wazuh Agents on Wazuh Server<\/h4>\n\n\n\n<p>Run the command below on Wazuh server to check agent status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/var\/ossec\/bin\/agent_control -l<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Wazuh agent_control. List of available agents:\n   ID: 000, Name: localhost.localdomain (server), IP: 127.0.0.1, Active\/Local\n   ID: 001, Name: RockyLinux8Desktop, IP: 192.168.60.18, Active\n   ID: 002, Name: Ubuntu20, IP: 192.168.60.20, Never connected\n\nList of agentless devices:<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Verify Agent Data Reception on Kibana<\/h3>\n\n\n\n<p>The agent registration is complete.<\/p>\n\n\n\n<p>Check that the agents are now active. Note, we only connected a single agent in this setup.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1877\" height=\"455\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agents.png\" alt=\"Install Wazuh Agent on Rocky Linux 8\" class=\"wp-image-9597\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agents.png?v=1625947723 1877w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agents-768x186.png?v=1625947723 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agents-1536x372.png?v=1625947723 1536w\" sizes=\"(max-width: 1877px) 100vw, 1877px\" \/><\/figure>\n\n\n\n<p>To see more information, click on <strong>Active agents<\/strong> options.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1895\" height=\"661\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agent-details.png\" alt=\"\" class=\"wp-image-9598\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agent-details.png?v=1625947758 1895w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agent-details-768x268.png?v=1625947758 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/active-agent-details-1536x536.png?v=1625947758 1536w\" sizes=\"(max-width: 1895px) 100vw, 1895px\" \/><\/figure>\n\n\n\n<p>Navigate to <strong>Wazuh&gt;Modules&gt;Security Events <\/strong>to view security related events and dashboards.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1899\" height=\"873\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/wazuh-security-events.png\" alt=\"\" class=\"wp-image-9599\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/wazuh-security-events.png?v=1625947784 1899w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/wazuh-security-events-768x353.png?v=1625947784 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/wazuh-security-events-1536x706.png?v=1625947784 1536w\" sizes=\"(max-width: 1899px) 100vw, 1899px\" \/><\/figure>\n\n\n\n<p>You can explore more on the modules such as Auditing and Policy Monitoring,Regulatory Compliance and Threat Detection and Response.<\/p>\n\n\n\n<p>That concludes our guide on how to install Wazuh agent.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reference<\/h3>\n\n\n\n<p>Wazuh Agent installation<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-ossec-agent-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install OSSEC Agent on Rocky Linux 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-nagios-nrpe-agent-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Nagios NRPE Agent on Rocky Linux 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/easy-way-to-install-wazuh-agents-on-ubuntu-debian\/\" target=\"_blank\" rel=\"noreferrer noopener\">Easy Way to Install Wazuh Agents on Ubuntu\/Debian<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to install Wazuh agent on Rocky Linux 8. Our previous setup was on setting up Wazuh server with<\/p>\n","protected":false},"author":3,"featured_media":9601,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[34,121,72],"tags":[3822,3821,3823,3824,3581],"class_list":["post-9590","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-howtos","category-monitoring","tag-install-wazuh-agent-rocky-linux","tag-install-wazuh-agents-linux","tag-rocky-linux-wazuh-agent","tag-wazuh","tag-wazuh-agent","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9590"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=9590"}],"version-history":[{"count":9,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9590\/revisions"}],"predecessor-version":[{"id":21735,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9590\/revisions\/21735"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9601"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=9590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=9590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=9590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}