{"id":15061,"date":"2022-12-02T13:58:11","date_gmt":"2022-12-02T10:58:11","guid":{"rendered":"https:\/\/kifarunix.com\/?p=15061"},"modified":"2024-03-09T23:31:51","modified_gmt":"2024-03-09T20:31:51","slug":"install-wazuh-agent-on-pfsense","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-wazuh-agent-on-pfsense\/","title":{"rendered":"Install Wazuh Agent on pfSense"},"content":{"rendered":"\n
In this guide, you will learn how to install Wazuh agent on pfSense. pfSense<\/a> is the world’s most trusted opensource firewall which also doubles up as an opensource router. On the other hand, Wazuh<\/a><\/em> is a free, open source and enterprise-ready security monitoring solution for threat detection, integrity monitoring, incident response and compliance. Wazuh agents are used to collect log and event data from the remote end points that are being monitored and ship to the Wazuh server which then analyzes the event data and triggers alerts when threats or anomalies are detected<\/em>.<\/p>\n\n\n\n Ensure that you have Wazuh manager up and running before you can proceed.<\/p>\n\n\n\n We have covered installation and setup of Wazuh manager server on various systems in our previous guides.<\/p>\n\n\n\n Install and Configure Wazuh Manager on Ubuntu 22.04<\/a><\/p>\n\n\n\n Install Wazuh Server on Rocky Linux 8<\/a><\/p>\n\n\n\n Install and Setup Wazuh Server in CentOS 8\/Fedora 32<\/a><\/p>\n\n\n\n Once the server is up and running, you can proceed to install the agent on pfSense.<\/p>\n\n\n\n Well, it is good to note that pfSense software is based on FreeBSD OS.<\/p>\n\n\n\n In my demo environment, we are running pfSense 2.6.0;<\/p>\n\n\n\n You can confirm from the command line;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n Or from the pfSense dashboard;<\/p>\n\n\n\n As you can see, we have pfSense 2.6.0 based on FreeBSD 12.3.<\/p>\n\n\n\n Wazuh packages are not available on the official pfSense repositories. Thus the only way we can install Wazuh agent is via the use of official FreeBSD repos.<\/p>\n\n\n\n NOTE<\/strong>: Installing software\/packages from FreeBSD repositories on pfSense can easily brick your system. This method is neither supported nor recommended by Netgate. Thus, if you have decided to proceed in this manner, then take utmost caution. We cannot be held responsible for whatever happens to your system.<\/p>\n<\/blockquote>\n\n\n\n To enable the use of FreeBSD repositories on pfSense;<\/p>\n\n\n\n and change the line;<\/p>\n\n\n\n to;<\/p>\n\n\n\n and change the line;<\/p>\n\n\n\n to;<\/p>\n\n\n\n Once you have enabled the FreeBSD repositories, run the command below to updates package repository catalogues;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n As of this writing, Wazuh 4.3.10 is the current stable release version<\/a>. Thus run the command below to check what version is provided by the official FreeBSD repositories;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n So we go the latest stable release Wazuh package!<\/p>\n\n\n\n We are also running Wazuh Manager 4.3.10!<\/p>\n\n\n\n You can now install Wazuh agent package as follows;<\/p>\n\n\n\n Sample installation command output;<\/p>\n\n\n\n The installation summary gives how to finalize Wazuh agent setup on pfSense.<\/p>\n\n\n\n As suggested;<\/p>\n\n\n\n Change the section;<\/p>\n\n\n\n to;<\/p>\n\n\n\n In my demo setup, apart from the default log files monitored by Wazuh by default;<\/p>\n\n\n\n I will add some more;<\/p>\n\n\n\n As shown below;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n You can check the logs file if any issue;<\/p>\n\n\n\n You can now disable the use of FreeBSD official repositories on pfSense.<\/p>\n\n\n\n and change the line;<\/p>\n\n\n\n to;<\/p>\n\n\n\n Update package catalogue;<\/p>\n\n\n\n Login to Wazuh manager interface and confirm the pfSense agent status;<\/p>\n\n\n\n As you can see, the pfSense Wazuh agent (pfSense.home.arpa) is connected to the Wazuh server and is up and running.<\/p>\n\n\n\n You can simulate some activities such as;<\/p>\n\n\n\n Now click on the agent to see more details related to events collected from it.<\/p>\n\n\n\n Click on Security Events<\/strong> to see more event details;<\/p>\n\n\n\n Dashboard<\/p>\n\n\n\nInstalling Wazuh Agent on pfSense<\/h2>\n\n\n\n
cat \/etc\/version<\/code><\/pre>\n\n\n\n
2.6.0-RELEASE<\/code><\/pre>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
Enable the use of FreeBSD Official Repositories on pfSense<\/h3>\n\n\n\n
\n
\n
\/usr\/local\/etc\/pkg\/repos\/FreeBSD.conf<\/code><\/strong>;<\/li>\n<\/ul>\n\n\n\n
vi \/usr\/local\/etc\/pkg\/repos\/FreeBSD.conf<\/code><\/pre>\n\n\n\n
FreeBSD: { enabled: no<\/strong> }<\/code><\/pre>\n\n\n\n
FreeBSD: { enabled: yes<\/strong> }<\/code><\/pre>\n\n\n\n
\n
\/usr\/local\/etc\/pkg\/repos\/pfSense.conf<\/code><\/strong>;<\/li>\n<\/ul>\n\n\n\n
vi \/usr\/local\/etc\/pkg\/repos\/pfSense.conf<\/code><\/pre>\n\n\n\n
FreeBSD: { enabled: no<\/strong> }<\/code><\/pre>\n\n\n\n
FreeBSD: { enabled: yes<\/strong> }<\/code><\/pre>\n\n\n\n
Run Package Repository Catalogues Update<\/h3>\n\n\n\n
pkg update<\/code><\/pre>\n\n\n\n
Updating FreeBSD repository catalogue...\nFetching meta.conf: 100% 163 B 0.2kB\/s 00:01 \nFetching packagesite.pkg: 100% 6 MiB 1.7MB\/s 00:04 \nProcessing entries: 100%\nFreeBSD repository update completed. 33014 packages processed.\nUpdating pfSense-core repository catalogue...\npfSense-core repository is up to date.\nUpdating pfSense repository catalogue...\npfSense repository is up to date.\nAll repositories are up to date.\n<\/code><\/pre>\n\n\n\n
Check Available Wazuh Agent from FreeBSD Repos<\/h3>\n\n\n\n
pkg search wazuh-agent<\/code><\/pre>\n\n\n\n
wazuh-agent-4.3.10_1 Security tool to monitor and check logs and intrusions (agent)<\/code><\/pre>\n\n\n\n
\/var\/ossec\/bin\/wazuh-control info<\/code><\/pre>\n\n\n\n
WAZUH_VERSION=\"v4.3.10\"\nWAZUH_REVISION=\"40323\"\nWAZUH_TYPE=\"server\"<\/code><\/pre>\n\n\n\n
Installing Wazuh Agent<\/h3>\n\n\n\n
pkg install wazuh-agent<\/code><\/pre>\n\n\n\n
Updating FreeBSD repository catalogue...\nFreeBSD repository is up to date.\n...\n...\n=====\nMessage from wazuh-agent-4.3.10_1:\n\n--\nWazuh Agent was installed\n\n1) Copy \/etc\/locatime to \/var\/ossec\/etc directory\n\n # cp \/etc\/localtime \/var\/ossec\/etc\n\n2) You must edit \/var\/ossec\/etc\/ossec.conf.sample for your setup and rename\/copy\n it to ossec.conf\n\n Take a look wazuh configuration at the following url:\n\n https:\/\/documentation.wazuh.com\/current\/user-manual\/index.html\n\n3) You can find additional useful files installed at\n\n # \/var\/ossec\/packages_files\/agent_installation_scripts\n\n4) Add Wazuh agent to \/etc\/rc.conf\n\n # sysrc wazuh_agent_enable=\"YES\"\n\n5) Start Wazuh agent\n\n # service wazuh_agent start\n\n6) Enjoy it ;)<\/strong>\n<\/code><\/pre>\n\n\n\n
\n
cp \/etc\/localtime \/var\/ossec\/etc<\/code><\/pre>\n\n\n\n
\n
\/var\/ossec\/etc\/ossec.conf.sample<\/code><\/strong> to
\/var\/ossec\/etc\/ossec.conf<\/code><\/strong>.<\/li>\n<\/ul>\n\n\n\n
cp \/var\/ossec\/etc\/ossec.conf{.sample,}<\/code><\/pre>\n\n\n\n
\n
vi \/var\/ossec\/etc\/ossec.conf<\/code><\/pre>\n\n\n\n
<server>\n <address>IP<\/strong><\/address>\n <\/server><\/code><\/pre>\n\n\n\n
<server>\n <address>192.168.58.22<\/strong><\/address>\n <\/server><\/code><\/pre>\n\n\n\n
\n
<!-- Log analysis -->\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/ossec\/logs\/active-responses.log<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/messages<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/auth.log<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/syslog<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>command<\/log_format>\n <command>df -P<\/command>\n <frequency>360<\/frequency>\n <\/localfile>\n\n <localfile>\n <log_format>full_command<\/log_format>\n <command>netstat -tan |grep LISTEN |grep -v 127.0.0.1 | sort<\/command>\n <frequency>360<\/frequency>\n <\/localfile>\n\n <localfile>\n <log_format>full_command<\/log_format>\n <command>last -n 5<\/command>\n <frequency>360<\/frequency>\n <\/localfile>\n<\/code><\/pre>\n\n\n\n
\/var\/log\/openvpn.log\n\/var\/log\/system.log\n\/var\/log\/gateways.log\n\/var\/log\/userlog<\/code><\/pre>\n\n\n\n
<localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/openvpn.log<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/system.log<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/gateways.log<\/location>\n <\/localfile>\n\n <localfile>\n <log_format>syslog<\/log_format>\n <location>\/var\/log\/userlog<\/location>\n <\/localfile>\n<\/code><\/pre>\n\n\n\n
\n
sysrc wazuh_agent_enable=\"YES\"<\/code><\/pre>\n\n\n\n
\/var\/ossec\/bin\/wazuh-control start<\/code><\/pre>\n\n\n\n
Starting Wazuh v4.3.10...\nStarted wazuh-execd...\nStarted wazuh-agentd...\n2022\/12\/21 20:47:01 wazuh-syscheckd: WARNING: The check_unixaudit option is deprecated in favor of the SCA module.\nStarted wazuh-syscheckd...\nStarted wazuh-logcollector...\nStarted wazuh-modulesd...\nCompleted.\n<\/code><\/pre>\n\n\n\n
tail -f \/var\/ossec\/logs\/ossec.log<\/code><\/pre>\n\n\n\n
Disable the use of FreeBSD Official Repositories on pfSense<\/h3>\n\n\n\n
sed -iE '\/FreeBSD: { enabled: yes }\/s\/yes\/no\/' \/usr\/local\/etc\/pkg\/repos\/FreeBSD.conf<\/code><\/pre>\n\n\n\n
vi \/usr\/local\/etc\/pkg\/repos\/pfSense.conf<\/code><\/pre>\n\n\n\n
FreeBSD: { enabled: yes<\/strong> }<\/code><\/pre>\n\n\n\n
FreeBSD: { enabled: no<\/strong> }<\/code><\/pre>\n\n\n\n
pkg clean all<\/code><\/pre>\n\n\n\n
pkg update<\/code><\/pre>\n\n\n\n
Confirm pfSense Wazuh Agent Status on Wazuh Manager<\/h3>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
\n
<\/figure><\/a><\/div>\n\n\n\n