wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
99 stars 90 forks source link

Build Wazuh Agent and generate package for FreeBSD OS #2760

Closed VenoVeno closed 6 months ago

VenoVeno commented 6 months ago
Wazuh version Install type Action performed Platform
4.7.1 Agent Install 13.1-RELEASE

I have build the wazuh agent using steps. I want to bundle the built source as a package and install on other FreeBSD machines.

Can anyone share how to build as a package for FreeBSD?

alonsobsd commented 6 months ago

Hello @VenoVeno, you can use FreeBSD ports tree to generate a wazuh binary package. Take a look at the following files https://cgit.freebsd.org/ports/tree/security/wazuh-agent

You can customize those files and generate a binary package using "make package". It will generate a FreeBSD package with your own modifications. This package can be shared/mirrored to be installed on another FreeBSD hosts using "pkg install wazuh-agent-x.x.pkg"

Take on mind 13.1 is an unsupported FreeBSD Release. You must update to 13.2 (13.3 is coming) or 14.0

VenoVeno commented 6 months ago

Take on mind 13.1 is an unsupported FreeBSD Release

Is 13.1 unsupported for freebsd ports?

portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... 5 mirrors found. Fetching public key from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot tag from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Fetching snapshot generated at Sat Jan 13 05:51:03 IST 2024: aa0f8cd706bc1f708affa7d161373ba919e614aae22cba 104 MB 27 MBps 03s Extracting snapshot... done. Verifying snapshot integrity... done. Fetching snapshot tag from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Updating from Sat Jan 13 05:51:03 IST 2024 to Sat Jan 13 17:36:59 IST 2024. Fetching 5 metadata patches. done. Applying metadata patches... done. Fetching 5 metadata files... /usr/sbin/portsnap: cannot open ca013c1cefc27bfa420b81017c5a24880ccdad3890e98aad126f849319ae2a8f.gz: No such file or directory metadata is corrupt.

Is there any workaround solution for 13.1 release with freebsd ports itself?

As we previously discussed over here, is there any way to build and ship the wazuh-agent source build from source?

alonsobsd commented 6 months ago

Take on mind 13.1 is an unsupported FreeBSD Release

Is 13.1 unsupported for freebsd ports?

No, it is not. Supported FreeBSD Release are 13.2 (13.3 soon) and 14.0

portsnap fetch

Looking up portsnap.FreeBSD.org mirrors... 5 mirrors found. Fetching public key from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot tag from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Fetching snapshot generated at Sat Jan 13 05:51:03 IST 2024: aa0f8cd706bc1f708affa7d161373ba919e614aae22cba 104 MB 27 MBps 03s Extracting snapshot... done. Verifying snapshot integrity... done. Fetching snapshot tag from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Updating from Sat Jan 13 05:51:03 IST 2024 to Sat Jan 13 17:36:59 IST 2024. Fetching 5 metadata patches. done. Applying metadata patches... done. Fetching 5 metadata files... /usr/sbin/portsnap: cannot open ca013c1cefc27bfa420b81017c5a24880ccdad3890e98aad126f849319ae2a8f.gz: No such file or directory metadata is corrupt.

Is there any workaround solution for 13.1 release with freebsd ports itself?

You can use git for fetch ports tree

# pkg install git-lite
# cd /usr
# mv ports ports.bak
# git clone https://github.com/freebsd/freebsd-ports.git ports

Or you can fetch ports into a tar.gz file

# fetch https://download.freebsd.org/ports/ports/ports.tar.gz

As we previously discussed over here, is there any way to build and ship the wazuh-agent source build from source?

As I said you, you can generate a FreeBSD binary package from ports. Your main problem is you want generate your own version with your own modifications of wazuh-agent. The easy way is modifying security/wazuh-agent port but you need know how it works on FreeBSD

# cd /usr/ports/security/wazuh-agent (Modify security/wazuh-agent files with your own requirements/needs)
# make package

It will generate a wazuh-agent-x.x.pkg file. This package can be shared/mirrored to be installed on another FreeBSD hosts using "pkg install wazuh-agent-x.x.pkg"

VenoVeno commented 6 months ago

Hi @alonsobsd,

Thanks for your reply.

I have generated the patch file using this with the modified version and moved the patched files to files directory of wazuh-agent.

Thanks.