generate a deb file from a local source

299 views
Skip to first unread message

S Rahul

unread,
Nov 18, 2022, 9:02:35 AM11/18/22
to Wazuh mailing list
Hello, Team.
I'm attempting to generate a deb file from a local source for Wazuh-manager v4.3.8, but the file is generating for the Wazuh-manager v4.5.0 version. I am requesting your assistance in generating the deb file for Wazuh-manager v4.3.8 from a local source.Packages used:-
Wazuh Manager Source
https://github.com/wazuh/wazuh/tree/4.3.8Wazuh-Package Source
https://github.com/wazuh/wazuh-packages/tree/4.3Command Executed to generate the package.
admin@test:~/wazuh-packages/debs$ pwd
/home/admin/wazuh-packages/debs
admin@test:~/wazuh-packages/debs$ sudo ./generate_debian_package.sh -b test --sources /test/wazuh/ -t manager -a amd64Final output+ deb_file=wazuh-manager_4.5.0-1
+ [[ amd64 == \p\p\c\6\4\l\e ]]
+ deb_file=wazuh-manager_4.5.0-1_amd64.deb
+ pkg_path=/build_wazuh/manager
+ [[ no == \y\e\s ]]
+ mv /build_wazuh/manager/wazuh-manager_4.5.0-1_amd64.deb /var/local/wazuh
Package wazuh-manager_4.5.0-1_amd64.deb added to /home/admin/wazuh-packages/debs/output/.
admin@test:~/wazuh-packages/debs$Please note that if i have given -b with test branch its generating the package without -b option the command is ending without any progress.
GitHubGitHub
Wazuh - The Open Source Security Platform. Contribute to wazuh/wazuh development by creating an account on GitHub. (47 kB)
GitHubGitHub
Wazuh - Tools for packages creation. Contribute to wazuh/wazuh-packages development by creating an account on GitHub. (57 kB)

Juan Carlos Tello

unread,
Nov 20, 2022, 6:48:45 AM11/20/22
to S Rahul, Wazuh mailing list
Hi Rahul,
I have verified the creation of a Debian Wazuh manager package using the following steps:

yum install git docker -y

systemctl start docker

mkdir /test/

cd /test

curl -Ls https://github.com/wazuh/wazuh/archive/v4.3.8.tar.gz | tar zx


<Made modifications to the files within /test/wazuh-4.3.8 to verify this is the files that are being used>


git clone https://github.com/wazuh/wazuh-packages

cd wazuh-packages

git checkout v4.3.8

cd deb

./generate_debian_package.sh -b v4.3.8 -t manager --packages-branch v4.3.8 --sources /test/wazuh-4.3.8/ -a amd64 -s /tmp -r myrev


I've done this on a RHEL machine, but since this is done with docker it should not affect the end result.

I've then provisioned the resulting /tmp/wazuh-manager_4.3.8-myrev_amd64.deb file to a machine running Ubuntu and installed it and verified that the changes had taken effect.

You may notice that in my procedure I did not use a git cloned sources folder but instead a package release, so although the -b modifier is mandatory it should not have an effect regarding the local branch you used to make the changes.


Please let me know if you have any issues with this procedure and I'll be happy to help.
Best Regards,
Juan C. Tello

--
You received this message because you are subscribed to the Google Groups "Wazuh mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wazuh+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/0505bc09-9cab-4bf3-aa12-dfb84ebe5290n%40googlegroups.com.

San Nam

unread,
Jan 17, 2023, 4:16:48 AM1/17/23
to Wazuh mailing list
Hi Juan,

I have gone through the above steps provided in this article and unfortunately it was not successful. Errors are below 

OS : Centos 8

[root@localhost debs]# ./generate_debian_package.sh -b v4.3.8 -t manager --packages-branch v4.3.8 --sources /test/wazuh-4.3.8/ -a amd64 -s /tmp -r myrev
Sending build context to Docker daemon  9.216kB
Step 1/12 : FROM debian:7
 ---> 10fcec6d95c4
Step 2/12 : ENV DEBIAN_FRONTEND noninteractive
 ---> Using cache
 ---> 99ef1d3733f8
Step 3/12 : RUN echo "deb http://archive.debian.org/debian/ wheezy contrib main non-free" > /etc/apt/sources.list &&     echo "deb-src http://archive.debian.org/debian/ wheezy contrib main non-free" >> /etc/apt/sources.list &&     apt-get update && apt-get install -y apt-utils &&     apt-get install -y --force-yes     curl gcc make sudo wget expect gnupg perl-base=5.14.2-21+deb7u3 perl     libc-bin=2.13-38+deb7u10 libc6=2.13-38+deb7u10 libc6-dev build-essential     cdbs devscripts equivs automake autoconf libtool libaudit-dev selinux-basics     libdb5.1=5.1.29-5 libdb5.1-dev libssl1.0.0=1.0.1e-2+deb7u20 procps gawk libsigsegv2
 ---> Running in dcc6e2da5ea6
Get:1 http://archive.debian.org wheezy Release.gpg [2373 B]
Get:2 http://archive.debian.org wheezy Release [191 kB]
Ign http://archive.debian.org wheezy Release
Get:3 http://archive.debian.org wheezy/contrib Sources [55.8 kB]
Get:4 http://archive.debian.org wheezy/main Sources [7533 kB]
Get:5 http://archive.debian.org wheezy/non-free Sources [112 kB]
Get:6 http://archive.debian.org wheezy/contrib amd64 Packages [50.5 kB]
Get:7 http://archive.debian.org wheezy/main amd64 Packages [7634 kB]
Get:8 http://archive.debian.org wheezy/non-free amd64 Packages [100 kB]
Fetched 15.7 MB in 4s (3485 kB/s)
Reading package lists...
W: GPG error: http://archive.debian.org wheezy Release: The following signatures were invalid: KEYEXPIRED 1587841717 KEYEXPIRED 1668891673 KEYEXPIRED 1557241909
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libapt-inst1.5
The following NEW packages will be installed:
  apt-utils libapt-inst1.5
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 545 kB of archives.
After this operation, 2049 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  libapt-inst1.5 apt-utils
E: There are problems and -y was used without --force-yes
The command '/bin/sh -c echo "deb http://archive.debian.org/debian/ wheezy contrib main non-free" > /etc/apt/sources.list &&     echo "deb-src http://archive.debian.org/debian/ wheezy contrib main non-free" >> /etc/apt/sources.list &&     apt-get update && apt-get install -y apt-utils &&     apt-get install -y --force-yes     curl gcc make sudo wget expect gnupg perl-base=5.14.2-21+deb7u3 perl     libc-bin=2.13-38+deb7u10 libc6=2.13-38+deb7u10 libc6-dev build-essential     cdbs devscripts equivs automake autoconf libtool libaudit-dev selinux-basics     libdb5.1=5.1.29-5 libdb5.1-dev libssl1.0.0=1.0.1e-2+deb7u20 procps gawk libsigsegv2' returned a non-zero code: 100
[root@localhost debs]#

Thanks
San Nam

Juan Carlos Tello

unread,
Jan 17, 2023, 11:41:12 AM1/17/23
to San Nam, Wazuh mailing list
Hello San Nam,

This error is caused because last year the keys for the Debian 7 (Wheezy) repository expired and this operating is no longer officially supported by Debian. The Wazuh Packages docker containers were created to used Debian 7 and will be updated, for this an issue has been opened here: https://github.com/wazuh/wazuh-packages/issues/1964

A viable workaround is to set the debian repository as trusted, for example in order to fix this for the command above, while in the wazuh-packages/debs/ folder run: sed -i 's/deb http/deb [trusted=yes] http/g' Debian/amd64/Dockerfile

Then run again the package generation command
./generate_debian_package.sh -b v4.3.8 -t manager --packages-branch v4.3.8 --sources /test/wazuh-4.3.8/ -a amd64 -s /tmp -r myrev

You will still see the expired key warnings, but the package will compile.

I hope this helps.
Best Regards,
Juan C. Tello

San Nam

unread,
Jan 18, 2023, 2:54:35 AM1/18/23
to Wazuh mailing list
Hi Juan,
Thanks for your help, It worked well.

San Nam

unread,
Jan 18, 2023, 3:54:52 AM1/18/23
to Wazuh mailing list
Hi Juan,
I have noticed that the below files are not getting updated in the deb package

Customized ossec.conf
integrations scripts 
and added one vulnerability folder for nvd-feed and msu to make those offline scan but the folder and contents are not creating after installation.

Any suggestion to resolve this issue?

Thanks
San Nam

Juan Carlos Tello

unread,
Jan 18, 2023, 6:37:14 AM1/18/23
to San Nam, Wazuh mailing list
Hi San Nam,

When installing, Wazuh uses the inst-functions.sh file to determine which files will be deployed, for example integrations to be added are specified here: https://github.com/wazuh/wazuh/blob/v4.3.10/src/init/inst-functions.sh#L988-L990 note that this references an install function that with the exception of some operating systems (SunOS, HP-UX or AIX) is declared here: https://github.com/wazuh/wazuh/blob/v4.3.10/install.sh#L50

The ossec.conf is dynamically generated depending on the type of installation as well as local circumstances such as the operating system and software installed. In the case of the Wazuh manager it is specified here https://github.com/wazuh/wazuh/blob/v4.3.10/src/init/inst-functions.sh#L681 that the source file is etc/ossec-server.conf and not etc/ossec.conf.

I hope this helps you find how to make the changes necessary to your custom installation. Since this is straying from the original topic of troubleshooting the deb generation I recommend opening a new thread if you have more questions in order to provide better visibility to the conversation.

Best Regards,
Juan C. Tello
Reply all
Reply to author
Forward
0 new messages