-
Notifications
You must be signed in to change notification settings - Fork 60
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
Change handling of configuration files in packages #310
Comments
UpdateWorked in new packages with the required behavior DebFor the deb packages, the Then, on the
That creates an Additional discoveryWhile creating the package, an error in a route was discovered. This caused the installation script always to create a new keystore, even if it already existed. That also required input from the user, which was why the terminal freezed on the upgrades (#301). RPMThe RPM packages already have a mechanism to save the new configuration file as |
We have decided to keep the default behavior of dpkg, but forcing it to keep the user modified files over ours. This can be done using the We need to ensure that the files in the RPM package contain the |
TestsRPMNew installation 🟢
[root@localhost vagrant]# ls -l /etc/wazuh-dashboard/
total 12
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 312 Sep 18 17:01 node.options
-rw-r--r--. 1 wazuh-dashboard wazuh-dashboard 226 Sep 18 17:27 opensearch_dashboards.keystore
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 634 Sep 18 17:28 opensearch_dashboards.yml Upgrade 🟢
[root@localhost vagrant]# ls -l /etc/wazuh-dashboard/
total 16
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 312 Sep 18 17:01 node.options
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 226 Sep 18 18:43 opensearch_dashboards.keystore
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 635 Sep 18 18:44 opensearch_dashboards.yml
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 634 Sep 18 17:01 opensearch_dashboards.yml.rpmnew DEBNew installation 🟢
root@vagrant:/home/vagrant# ls -l /etc/wazuh-dashboard/
total 12
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 312 May 5 2023 node.options
-rw-r--r-- 1 wazuh-dashboard wazuh-dashboard 226 Sep 18 18:04 opensearch_dashboards.keystore
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 634 May 5 2023 opensearch_dashboards.yml Upgrade 1🟢
Configuration file '/etc/wazuh-dashboard/opensearch_dashboards.yml'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** opensearch_dashboards.yml (Y/I/N/O/D/Z) [default=N] ? Upgrade 2🟢
|
TestRPMNew installation 🟢[root@fedora37 vagrant]# ls -l /etc/wazuh-dashboard/
total 12
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 312 Sep 6 20:28 node.options
-rw-r--r--. 1 wazuh-dashboard wazuh-dashboard 226 Sep 19 10:33 opensearch_dashboards.keystore
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 634 Sep 6 20:28 opensearch_dashboards.yml Upgrade 🟢[root@fedora37 vagrant]# ls -l /etc/wazuh-dashboard/
total 16
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 312 Sep 18 17:01 node.options
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 226 Sep 19 10:23 opensearch_dashboards.keystore
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 643 Sep 19 10:23 opensearch_dashboards.yml
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 634 Sep 18 17:01 opensearch_dashboards.yml.rpmnew
[root@fedora37 vagrant]# DEBNew installation 🟢root@vagrant:/vagrant# ls -l /etc/wazuh-dashboard/
total 12
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 312 May 5 2023 node.options
-rw-r--r-- 1 wazuh-dashboard wazuh-dashboard 226 Sep 19 09:18 opensearch_dashboards.keystore
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 634 May 5 2023 opensearch_dashboards.yml Upgrade 1 🟢Configuration file '/etc/wazuh-dashboard/opensearch_dashboards.yml'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** opensearch_dashboards.yml (Y/I/N/O/D/Z) [default=N] ? root@vagrant:/vagrant# ls -l /etc/wazuh-dashboard/
total 16
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 312 May 5 2023 node.options
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 226 Sep 19 09:22 opensearch_dashboards.keystore
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 643 Sep 19 09:23 opensearch_dashboards.yml
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 634 May 5 2023 opensearch_dashboards.yml.dpkg-dist Upgrade 2 🟢Configuration file '/etc/wazuh-dashboard/opensearch_dashboards.yml'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
==> Keeping old config file as default. root@vagrant:/home/vagrant# cat /etc/wazuh-dashboard/opensearch_dashboards.yml
[...]
#opensearch.username:1234
#opensearch.password:1234
[...] |
TestsRPM 🟢New installation 🟢[root@localhost wazuh-dashboard]# yum localinstall /vagrant/packages/wazuh-dashboard_4.9.1-1_x86_64_24c454efa8.rpm
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:09:31 ago on Thu Sep 19 09:51:17 2024.
Dependencies resolved.
======================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================
Installing:
wazuh-dashboard x86_64 4.9.1-1 @commandline 253 M
Transaction Summary
======================================================================================================================================
Install 1 Package
Total size: 253 M
Installed size: 849 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64 1/1
Installing : wazuh-dashboard-4.9.1-1.x86_64 1/1
Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64 1/1
Verifying : wazuh-dashboard-4.9.1-1.x86_64 1/1
Installed:
wazuh-dashboard-4.9.1-1.x86_64
Complete!
[root@localhost wazuh-dashboard]# ls -l /etc/wazuh-dashboard/
total 12
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 312 Sep 18 17:01 node.options
-rw-r--r--. 1 wazuh-dashboard wazuh-dashboard 226 Sep 19 10:01 opensearch_dashboards.keystore
-rw-r-----. 1 wazuh-dashboard wazuh-dashboard 634 Sep 18 17:01 opensearch_dashboards.yml
Upgrade 🟢The configuration file [root@localhost wazuh-dashboard]# yum localinstall /vagrant/packages/wazuh-dashboard_4.9.1-1_x86_64_24c454efa8.rpm
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:18:45 ago on Thu Sep 19 09:51:17 2024.
Dependencies resolved.
======================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================
Upgrading:
wazuh-dashboard x86_64 4.9.1-1 @commandline 253 M
Transaction Summary
======================================================================================================================================
Upgrade 1 Package
Total size: 253 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64 1/1
Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64 1/2
Upgrading : wazuh-dashboard-4.9.1-1.x86_64 1/2
warning: /etc/wazuh-dashboard/opensearch_dashboards.yml created as /etc/wazuh-dashboard/opensearch_dashboards.yml.rpmnew
Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64 1/2
Running scriptlet: wazuh-dashboard-4.8.2-1.x86_64 2/2
Cleanup : wazuh-dashboard-4.8.2-1.x86_64 2/2
Running scriptlet: wazuh-dashboard-4.8.2-1.x86_64 2/2
Running scriptlet: wazuh-dashboard-4.9.1-1.x86_64 2/2
Running scriptlet: wazuh-dashboard-4.8.2-1.x86_64 2/2
Verifying : wazuh-dashboard-4.9.1-1.x86_64 1/2
Verifying : wazuh-dashboard-4.8.2-1.x86_64 2/2
Upgraded:
wazuh-dashboard-4.9.1-1.x86_64
Complete!
|
TestsDEBNew installation 🟢root@ubuntu-jammy:/home/vagrant# dpkg -i /vagrant/packages/wazuh-dashboard_4.9.1-1_amd64_24c454efa8.deb
Selecting previously unselected package wazuh-dashboard.
(Reading database ... 87541 files and directories currently installed.)
Preparing to unpack .../wazuh-dashboard_4.9.1-1_amd64_24c454efa8.deb ...
Creating wazuh-dashboard group... OK
Creating wazuh-dashboard user... OK
Unpacking wazuh-dashboard (4.9.1-1) ...
Setting up wazuh-dashboard (4.9.1-1) ...
root@ubuntu-jammy:/home/vagrant# ls -la /etc/wazuh-dashboard/
node.options opensearch_dashboards.keystore opensearch_dashboards.yml Upgrade 1 🟢Using root@ubuntu-jammy:/home/vagrant# dpkg -i /vagrant/packages/wazuh-dashboard_4.9.1-1_amd64_24c454efa8.deb
(Reading database ... 178533 files and directories currently installed.)
Preparing to unpack .../wazuh-dashboard_4.9.1-1_amd64_24c454efa8.deb ...
Unpacking wazuh-dashboard (4.9.1-1) over (4.8.2-1) ...
Setting up wazuh-dashboard (4.9.1-1) ...
Installing new version of config file /etc/systemd/system/wazuh-dashboard ...
Installing new version of config file /etc/wazuh-dashboard/node.options ...
Configuration file '/etc/wazuh-dashboard/opensearch_dashboards.yml'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** opensearch_dashboards.yml (Y/I/N/O/D/Z) [default=N] ? y
Installing new version of config file /etc/wazuh-dashboard/opensearch_dashboards.yml ...
root@ubuntu-jammy:/home/vagrant# ls -la /etc/wazuh-dashboard/
certs/ opensearch_dashboards.keystore opensearch_dashboards.yml.dpkg-old
node.options opensearch_dashboards.yml Upgrade 2 🟢Using the command root@ubuntu-jammy:/home/vagrant# dpkg --force-confdef --force-confold -i /vagrant/packages/wazuh-dashboard_4.9.1-1_amd64_24c454efa8.deb
(Reading database ... 178533 files and directories currently installed.)
Preparing to unpack .../wazuh-dashboard_4.9.1-1_amd64_24c454efa8.deb ...
Unpacking wazuh-dashboard (4.9.1-1) over (4.8.2-1) ...
Setting up wazuh-dashboard (4.9.1-1) ...
Installing new version of config file /etc/systemd/system/wazuh-dashboard ...
Installing new version of config file /etc/wazuh-dashboard/node.options ...
Configuration file '/etc/wazuh-dashboard/opensearch_dashboards.yml'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
==> Keeping old config file as default.
root@ubuntu-jammy:/home/vagrant# nano /etc/wazuh-dashboard/opensearch_dashboards.yml
root@ubuntu-jammy:/home/vagrant# ls -la /etc/wazuh-dashboard/
node.options opensearch_dashboards.keystore opensearch_dashboards.yml opensearch_dashboards.yml.dpkg-dist
|
Description
We have to modify the
deb
andrpm
packages to detect old configuration files and automatically prevent from overwriting them, removing the need for user inputs and thus reducing the possibility of issues that can occur after upgradesThe text was updated successfully, but these errors were encountered: