Skip to content

Commit

Permalink
Merge pull request #2819 from wazuh/merge-4.8.1-into-4.8.2
Browse files Browse the repository at this point in the history
Merge 4.8.1 into 4.8.2

Failing checks explained in the previous message of this PR.
  • Loading branch information
Dwordcito authored Feb 9, 2024
2 parents 1b3e21c + 2cd9c55 commit 57d9ae3
Show file tree
Hide file tree
Showing 34 changed files with 419 additions and 230 deletions.
12 changes: 6 additions & 6 deletions aix/SPECS/wazuh-agent-aix.spec
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ rm -fr %{buildroot}
- More info: https://documentation.wazuh.com/current/release-notes/release-3-12-1.html
* Wed Mar 25 2020 support <[email protected]> - 3.12.0
- More info: https://documentation.wazuh.com/current/release-notes/release-3-12-0.html
* Thu Feb 24 2020 support <[email protected]> - 3.11.4
* Mon Feb 24 2020 support <[email protected]> - 3.11.4
- More info: https://documentation.wazuh.com/current/release-notes/release-3-11-4.html
* Wed Jan 22 2020 support <[email protected]> - 3.11.3
- More info: https://documentation.wazuh.com/current/release-notes/release-3-11-3.html
Expand All @@ -424,15 +424,15 @@ rm -fr %{buildroot}
- More info: https://documentation.wazuh.com/current/release-notes/release-3-10-1.html
* Mon Aug 26 2019 support <[email protected]> - 3.10.0
- More info: https://documentation.wazuh.com/current/release-notes/release-3-10-0.html
* Mon Aug 8 2019 support <[email protected]> - 3.9.5
* Thu Aug 8 2019 support <[email protected]> - 3.9.5
- More info: https://documentation.wazuh.com/current/release-notes/release-3-9-5.html
* Mon Jul 12 2019 support <[email protected]> - 3.9.4
* Fri Jul 12 2019 support <[email protected]> - 3.9.4
- More info: https://documentation.wazuh.com/current/release-notes/release-3-9-4.html
* Mon Jul 02 2019 support <[email protected]> - 3.9.3
* Tue Jul 02 2019 support <[email protected]> - 3.9.3
- More info: https://documentation.wazuh.com/current/release-notes/release-3-9-3.html
* Mon Jun 11 2019 support <[email protected]> - 3.9.2
* Tue Jun 11 2019 support <[email protected]> - 3.9.2
- More info: https://documentation.wazuh.com/current/release-notes/release-3-9-2.html
* Mon Jun 01 2019 support <[email protected]> - 3.9.1
* Sat Jun 01 2019 support <[email protected]> - 3.9.1
- More info: https://documentation.wazuh.com/current/release-notes/release-3-9-1.html
* Mon Feb 25 2019 support <[email protected]> - 3.9.0
- More info: https://documentation.wazuh.com/current/release-notes/release-3-9-0.html
Expand Down
2 changes: 1 addition & 1 deletion aix/generate_wazuh_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ build_perl() {

curl -LO http://www.cpan.org/src/5.0/perl-5.10.1.tar.gz -k -s
gunzip perl-5.10.1.tar.gz && tar -xf perl-5.10.1.tar
cd perl-5.10.1 && ./Configure -des -Dcc='gcc'
cd perl-5.10.1 && ./Configure -des -Dcc='gcc' -Dusethreads
make && make install
ln -fs /usr/local/bin/perl /bin/perl
ln -fs /usr/local/bin/perl /opt/freeware/bin/perl
Expand Down
224 changes: 86 additions & 138 deletions bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,88 @@
install_variables_files=glob.glob('**/installVariables.sh', recursive=True)
changelog_md_files=glob.glob('**/CHANGELOG.md', recursive=True)
VERSION_files=glob.glob('**/VERSION', recursive=True)
builder_files=glob.glob('**/unattended_installer/builder.sh', recursive=True)

## Bump version in .spec files
#Format variables
SPEC_FORMAT_STRING="%a %b %d %Y"
spec_date=date.strftime(SPEC_FORMAT_STRING)
for spec_file in spec_files:
with open(spec_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + spec_file)
filedata=file.read()
# Replace version and revision
REGEX=r'Version:\s*(\d+\.\d+\.\d+)'
filedata=re.sub(REGEX, f"Version: {version}", filedata)
REGEX=r'Revision:\s*(\d+)'
filedata=re.sub(REGEX, 'Revision: ' + str(args.revision),
filedata)
# Add new version to changelog
REGEX=r'%changelog'
changelog_string=(f"* {spec_date} support <[email protected]> - {version}"
"\n- More info: https://documentation.wazuh.com/current/release-"
f"notes/release-{version.major}-{version.minor}-"
f"{version.micro}.html")
filedata=re.sub(REGEX, '%changelog\n' + changelog_string, filedata)

with open(spec_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in deb changelog files
DEB_FORMAT_STRING="%a, %d %b %Y %H:%M:%S +0000"
deb_changelog_date=date.strftime(DEB_FORMAT_STRING)
PKGINFO_FORMAT_STRING="%d%b%Y"

#Regex-replacement dicts for each file
spec_files_dict = {
r'Version:\s*(\d+\.\d+\.\d+)':f"Version: {version}",
r'Revision:\s*(\d+)':'Revision: ' + str(args.revision),
r'%changelog':'%changelog\n'
+ (f"* {spec_date} support <[email protected]> - {version}"
"\n- More info: https://documentation.wazuh.com/current/release-"
f"notes/release-{version.major}-{version.minor}-"
f"{version.micro}.html")}

copyright_files_dict = {
(r'Wazuh, Inc <[email protected]> on '
r'(\w+),\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)\s\+(\d+)'):
f"Wazuh, Inc <[email protected]> on {deb_changelog_date}"}

pkginfo_files_dict = {
r'VERSION=\"(\d+\.\d+\.\d+)\"':f'VERSION=\"{version}\"',
r'PSTAMP=(.*)':f'PSTAMP=\"{date.strftime(PKGINFO_FORMAT_STRING)}\"'}

pkgproj_files_dict = {
r'<string>(\d+\.\d+\.\d+)-(\d+)</string>':
f'<string>{version}-{args.revision}</string>',
r'<string>wazuh-agent-(\d+\.\d+\.\d+)-(\d+)':
f'<string>wazuh-agent-{version}-{args.revision}'}

test_files_dict = {
r'wazuh-manager.x86_64\s+(\d+\.\d+\.\d+)-(\d+)':
f'wazuh-manager.x86_64 {version}-{args.revision}',
r'wazuh_version=\"(\d+\.\d+\.\d+)\"':
f'wazuh_version=\"{version}\"'}

install_variables_files_dict = {
r'wazuh_major=\"(\d+\.\d+)\"':
f'wazuh_major=\"{version.major}.{version.minor}\"',
r'wazuh_version=\"(\d+\.\d+\.\d+)\"':f'wazuh_version=\"{version}\"'}

changelog_md_files_dict = {
(r'All notable changes to this project '
r'will be documented in this file.'):
(r'All notable changes to this project '
r'will be documented in this file.') + '\n'
+ (f"## [{version}]\n\n- https://github.com/wazuh/"
f"wazuh-packages/releases/tag/v{version}\n")}

builder_files_dict = {
r'source_branch=\"(\d+\.\d+\.\d+)\"': f'source_branch=\"{version}\"'}

VERSION_files_dict = {
r'(\d+\.\d+\.\d+)': f'{version}'}


#Generic function to bump a file
def bump_file_list(file_list, regex_replacement):
"""Bumps a list of files matching the given regex and replacements
Args:
file_list(list): path list for the selected files.
regex_replacement(dict): specific dict for the file list where the key
represent the regex to be matched and the value its replacement.
"""
for bumping_file in file_list:
with open(bumping_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + bumping_file)
filedata=file.read()
for regex in regex_replacement:
# Replace match
filedata=re.sub(regex, regex_replacement[regex], filedata)

with open(bumping_file, 'w', encoding="utf-8") as file:
file.write(filedata)


## Bump version in deb changelog files
for changelog_file in changelog_files:
with open(changelog_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + changelog_file)
Expand All @@ -84,119 +138,13 @@
with open(changelog_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in deb copyrigth files

for copyrigth_file in copyright_files:
with open(copyrigth_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + copyrigth_file)
filedata=file.read()
# Replace version and revision
REGEX=(r'Wazuh, Inc <[email protected]> on '
r'(\w+),\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)\s\+(\d+)')
filedata=re.sub(REGEX,
f"Wazuh, Inc <[email protected]> on {deb_changelog_date}",
filedata)

with open(copyrigth_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in pkginfo files

PKGINFO_FORMAT_STRING="%d%b%Y"

for pkginfo_file in pkginfo_files:
with open(pkginfo_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + pkginfo_file)
filedata=file.read()
# Replace version and revision
REGEX=r'VERSION=\"(\d+\.\d+\.\d+)\"'
filedata=re.sub(REGEX, f'VERSION=\"{version}\"', filedata)
REGEX=r'PSTAMP=(.*)'
filedata=re.sub(REGEX,
f'PSTAMP=\"{date.strftime(PKGINFO_FORMAT_STRING)}\"',
filedata)

with open(pkginfo_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in .pkgproj files

for pkgproj_file in pkgproj_files:
with open(pkgproj_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + pkgproj_file)
filedata=file.read()
# Replace version and revision
REGEX=r'<string>(\d+\.\d+\.\d+)-(\d+)</string>'
filedata=re.sub(REGEX, f'<string>{version}-{args.revision}</string>',
filedata)
REGEX=r'<string>wazuh-agent-(\d+\.\d+\.\d+)-(\d+)'
filedata=re.sub(REGEX,
f'<string>wazuh-agent-{version}-{args.revision}',
filedata)

with open(pkgproj_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in test-*.sh files

for test_file in test_files:
with open(test_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + test_file)
filedata=file.read()
# Replace version and revision
REGEX=r'wazuh-manager.x86_64\s+(\d+\.\d+\.\d+)-(\d+)'
filedata=re.sub(REGEX,
f'wazuh-manager.x86_64 {version}-{args.revision}',
filedata)
REGEX=r'wazuh_version=\"(\d+\.\d+\.\d+)\"'
filedata=re.sub(REGEX, f'wazuh_version=\"{version}\"', filedata)

with open(test_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in installVariables.sh files

for install_variables_file in install_variables_files:
with open(install_variables_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + install_variables_file)
filedata=file.read()
# Replace version and revision
REGEX=r'wazuh_major=\"(\d+\.\d+)\"'
filedata=re.sub(REGEX,
f'wazuh_major=\"{version.major}.{version.minor}\"',
filedata)
REGEX=r'wazuh_version=\"(\d+\.\d+\.\d+)\"'
filedata=re.sub(REGEX, f'wazuh_version=\"{version}\"', filedata)

with open(install_variables_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in CHANGELOG.md files

for changelog_md_file in changelog_md_files:
with open(changelog_md_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + changelog_md_file)
filedata=file.read()
# Add new version to changelog
REGEX=(r'All notable changes to this project '
r'will be documented in this file.')
changelog_string=(f"## [{version}]\n\n- https://github.com/wazuh/"
f"wazuh-packages/releases/tag/v{version}\n")
filedata=re.sub(REGEX, REGEX + '\n' + changelog_string,
filedata)

with open(changelog_md_file, 'w', encoding="utf-8") as file:
file.write(filedata)

## Bump version in VERSION files

for VERSION_file in VERSION_files:
with open(VERSION_file, 'r', encoding="utf-8") as file:
print('Bumping version in ' + VERSION_file)
filedata=file.read()
# Replace version and revision
REGEX=r'(\d+\.\d+\.\d+)'
filedata=re.sub(REGEX, f'{version}', filedata)

with open(VERSION_file, 'w', encoding="utf-8") as file:
file.write(filedata)
bump_file_list(spec_files,spec_files_dict)
bump_file_list(copyright_files,copyright_files_dict)
bump_file_list(pkginfo_files,pkginfo_files_dict)
bump_file_list(pkgproj_files,pkgproj_files_dict)
bump_file_list(test_files,test_files_dict)
bump_file_list(install_variables_files,install_variables_files_dict)
bump_file_list(changelog_md_files,changelog_md_files_dict)
bump_file_list(VERSION_files,VERSION_files_dict)
bump_file_list(builder_files,builder_files_dict)
13 changes: 12 additions & 1 deletion debs/SPECS/wazuh-manager/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ override_dh_install:
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/debian/10
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/debian/11
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/debian/12
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/ol/9
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rhel/5
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rhel/6
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rhel/7
Expand All @@ -156,7 +157,10 @@ override_dh_install:
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/ubuntu/22/04
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/windows
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sunos/5/11
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/almalinux/9
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rocky/8
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rocky/9
mkdir -p ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/almalinux/8

cp -r ruleset/sca/* ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca

Expand Down Expand Up @@ -192,6 +196,8 @@ override_dh_install:
cp etc/templates/config/centos/7/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/centos/7
cp etc/templates/config/centos/8/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/centos/8

cp etc/templates/config/ol/9/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/ol/9

cp etc/templates/config/rhel/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rhel
cp etc/templates/config/rhel/5/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rhel/5
cp etc/templates/config/rhel/6/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rhel/6
Expand All @@ -213,7 +219,12 @@ override_dh_install:
cp etc/templates/config/ubuntu/20/04/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/ubuntu/20/04
cp etc/templates/config/ubuntu/22/04/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/ubuntu/22/04

cp etc/templates/config/rocky/8/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rocky/8
cp etc/templates/config/rocky/9/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rocky/8
cp etc/templates/config/rocky/8/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/rocky/9

cp etc/templates/config/almalinux/8/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/almalinux/8
cp etc/templates/config/almalinux/9/sca.files ${TARGET_DIR}$(INSTALLATION_SCRIPTS_DIR)/sca/almalinux/9


override_dh_fixperms:
dh_fixperms
Expand Down
6 changes: 3 additions & 3 deletions hp-ux/generate_wazuh_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ depot_path=""
control_binary=""

# Needed variables to build Wazuh with custom GCC and cmake
PATH=${build_tools_path}/bootstrap-gcc/gcc94_prefix/bin:${build_tools_path}/cmake_prefix_install/bin:$PATH:/usr/local/bin
PATH=${build_tools_path}/bootstrap-gcc/gcc94_prefix/bin:${build_tools_path}/cmake_prefix_install/bin:/usr/local/bin:$PATH
LD_LIBRARY_PATH=${build_tools_path}/bootstrap-gcc/gcc94_prefix/lib
export LD_LIBRARY_PATH
CXX=${build_tools_path}/bootstrap-gcc/gcc94_prefix/bin/g++
Expand Down Expand Up @@ -71,6 +71,8 @@ build_environment() {
/usr/local/bin/depothelper $fpt_connection -f regex
/usr/local/bin/depothelper $fpt_connection -f python

rm -rf ${build_tools_path}

# Install GCC 9.4
mkdir ${build_tools_path}
cd ${build_tools_path}
Expand Down Expand Up @@ -201,8 +203,6 @@ clean() {
userdel wazuh
groupdel wazuh

rm -rf ${build_tools_path}

exit ${exit_code}
}

Expand Down
6 changes: 6 additions & 0 deletions rpms/CentOS/6/i386/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ RUN yum -y install util-linux-ng \

RUN yum-builddep python34 -y

RUN curl -OL http://packages.wazuh.com/utils/perl/perl-5.10.1.tar.gz && \
gunzip perl-5.10.1.tar.gz && tar -xf perl*.tar && \
cd /perl-5.10.1 && ./Configure -des -Dcc='gcc' -Dusethreads && \
make -j2 && make install && ln -fs /usr/local/bin/perl /bin/perl && \
cd / && rm -rf /perl-5.10.1*

# Update rpmbuild, rpm and autoconf
RUN curl -O http://packages.wazuh.com/utils/autoconf/autoconf-2.69.tar.gz && \
gunzip autoconf-2.69.tar.gz && tar xvf autoconf-2.69.tar && \
Expand Down
6 changes: 6 additions & 0 deletions rpms/CentOS/6/x86_64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ RUN yum-builddep python34 -y
RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
RUN yum install -y nodejs

RUN curl -OL http://packages.wazuh.com/utils/perl/perl-5.10.1.tar.gz && \
gunzip perl-5.10.1.tar.gz && tar -xf perl*.tar && \
cd /perl-5.10.1 && ./Configure -des -Dcc='gcc' -Dusethreads && \
make -j2 && make install && ln -fs /usr/local/bin/perl /bin/perl && \
cd / && rm -rf /perl-5.10.1*

# Update rpmbuild, rpm and autoconf
RUN curl -O http://packages.wazuh.com/utils/autoconf/autoconf-2.69.tar.gz && \
gunzip autoconf-2.69.tar.gz && tar xvf autoconf-2.69.tar && \
Expand Down
7 changes: 7 additions & 0 deletions rpms/CentOS/7/aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ RUN curl -OL http://packages.wazuh.com/utils/cmake/cmake-3.18.3.tar.gz && \
CXX=/usr/local/gcc-9.4.0/bin/g++ && \
make -j$(nproc) && make install && cd / && rm -rf cmake-*

# Install Perl 5.10
RUN curl -OL http://packages.wazuh.com/utils/perl/perl-5.10.1.tar.gz && \
gunzip perl-5.10.1.tar.gz && tar -xf perl*.tar && \
cd /perl-5.10.1 && ./Configure -des -Dcc='gcc' -Dusethreads && \
make -j2 && make install && ln -fs /usr/local/bin/perl /bin/perl && \
cd / && rm -rf /perl-5.10.1*

RUN curl -O http://packages.wazuh.com/utils/openssl/openssl-1.1.1a.tar.gz && \
tar -xzf openssl-1.1.1a.tar.gz && cd openssl* && \
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' && \
Expand Down
Loading

0 comments on commit 57d9ae3

Please sign in to comment.