-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure <indexer> config is present in ossec.conf after upgrade via deb package #2684
Ensure <indexer> config is present in ossec.conf after upgrade via deb package #2684
Conversation
197f4cf
to
d0e0905
Compare
43293e2
to
2648bc6
Compare
Co-authored-by: Kevin Cardenas <kevin.cardenas@wazuh.com>
This reverts commit d0e0905.
Co-authored-by: Tomas <tsarquis88@gmail.com>
bbd3ff8
to
40548b1
Compare
LGTM! Tested with the
% ./generate_debian_package.sh -b dev-20952-handle-old-vd-config -t manager -a amd64 -j 8 --packages-branch dev-2683-fix-upgrade-config-failure
# apt install ./wazuh-manager_4.8.0-1_amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'wazuh-manager' instead of './wazuh-manager_4.8.0-1_amd64.deb'
Suggested packages:
expect
The following packages will be upgraded:
wazuh-manager
1 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/122 MB of archives.
After this operation, 91.4 MB of additional disk space will be used.
Get:1 /home/server-admin/wazuh-manager_4.8.0-1_amd64.deb wazuh-manager amd64 4.8.0-1 [122 MB]
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 132946 files and directories currently installed.)
Preparing to unpack .../wazuh-manager_4.8.0-1_amd64.deb ...
Unpacking wazuh-manager (4.8.0-1) over (4.7.0-1) ...
Setting up wazuh-manager (4.8.0-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
N: Download is performed unsandboxed as root as file '/home/server-admin/wazuh-manager_4.8.0-1_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
# cat /var/ossec/logs/ossec.log | grep vulnerability
2023/12/22 12:10:21 wazuh-modulesd: WARNING: vulnerability-detector configuration is deprecated. Use vulnerability-detection instead.
2023/12/22 12:10:30 wazuh-modulesd: WARNING: vulnerability-detector configuration is deprecated. Use vulnerability-detection instead.
2023/12/22 12:10:30 wazuh-modulesd:vulnerability-scanner: INFO: Starting vulnerability_scanner module.
2023/12/22 12:10:30 wazuh-modulesd:vulnerability-scanner: INFO: Vulnerability scanner module is disabled |
PD: Also working when VD is enabled: # cat /var/ossec/logs/ossec.log | grep vulnerability
2023/12/22 12:17:39 wazuh-modulesd: WARNING: vulnerability-detector configuration is deprecated. Use vulnerability-detection instead.
2023/12/22 12:17:39 wazuh-modulesd:vulnerability-scanner: INFO: Stopping vulnerability_scanner module.
2023/12/22 12:17:49 wazuh-modulesd: WARNING: vulnerability-detector configuration is deprecated. Use vulnerability-detection instead.
2023/12/22 12:17:49 wazuh-modulesd:vulnerability-scanner: INFO: Starting vulnerability_scanner module.
2023/12/22 12:17:50 wazuh-modulesd:content-updater: INFO: Starting scheduled action for 'vulnerability_feed_manager'
2023/12/22 12:17:50 wazuh-modulesd:content-updater: INFO: Action for 'vulnerability_feed_manager' started |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generated the package using the dev-20952-handle-old-vd-config branch
./generate_debian_package.sh -b dev-20952-handle-old-vd-config -t manager -a amd64 -j 8 --packages-branch dev-2683-fix-upgrade-config-failure
After upgrade
2023/12/22 15:56:37 wazuh-monitord: INFO: Started (pid: 525588).
2023/12/22 15:56:38 wazuh-modulesd: WARNING: vulnerability-detector configuration is deprecated. Use vulnerability-detection instead.
2023/12/22 15:56:38 wazuh-modulesd:router: INFO: Loaded router module.
Ossec.conf file contains the indexer configuration:
<ossec_config>
<indexer>
<enabled>yes</enabled>
<hosts>
<host>https://0.0.0.0:9200</host>
</hosts>
<username>admin</username>
<password>admin</password>
<ssl>
<certificate_authorities>
<ca>/etc/filebeat/certs/root-ca.pem</ca>
</certificate_authorities>
<certificate>/etc/filebeat/certs/filebeat.pem</certificate>
<key>/etc/filebeat/certs/filebeat-key.pem</key>
</ssl>
</indexer>
</ossec_config>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
Description
This PR improves the
postinst
script of the Debian manager package generation process to ensure that after an upgrade the ossec.conf file contains the Indexer configuration section.If the existing
ossec.conf
does not have an Indexer configuration section then the default Indexer configuration is appended at the end ofossec.conf
as part of a new<ossec_conf>
block.If the existing
ossec.conf
does have an Indexer configuration then no changes are done to theossec.conf
.Results
Package generation
The package has been generated by running
Fresh install
ossec.conf
Upgrade from v4.7 to v4.8
v4.7 installation
v4.7 ossec.conf
v4.7 service status
Note
The error encountered during upgrade is the one shown below (in the status) related to the presence of the
<vulnerability-detector>
. This will be fixed on a different issue.Note
After manually removing the
<vulnerabilty-detector>
block from the ossec.conf file the manager starts correctlyossec.conf after upgrade, with appended indexer config
Reinstallation of v4.8