Skip to content
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

Versions 4.4.0+ of the module can't manage old package versions #937

Open
kali-brandwatch opened this issue Feb 25, 2024 · 0 comments
Open

Comments

@kali-brandwatch
Copy link

In wazuh 4.4.0 a breaking change on the config for the API settings config file: wazuh/wazuh#14119

Since v4.4.0 of this module, the wazuh_api_yaml.erb file is hardcoded to the newer format: 713f87e

This results in a broken agent when managing via puppet an older version of wazuh package:

Having a declared older version for the agent:

wazuh::agent::agent_package_version: "4.3.0"

Puppet fails trying to restart the service due to misconfiguration:

Feb 25 21:01:41 wzmanager03 systemd[1]: Starting Wazuh manager...
Feb 25 21:01:43 wzmanager03 env[159725]: Configuration not valid. ERROR: 2000 - Some parameters are not expected in the configuration file (WAZUH_PATH/api/configuration/api.yaml): Additional properties are not allowed ('upload_configuration' was unexpected).
Feb 25 21:01:43 wzmanager03 env[159725]: wazuh-apid: Configuration error. Exiting
Feb 25 21:01:43 wzmanager03 systemd[1]: wazuh-manager.service: Control process exited, code=exited, status=1/FAILURE
Feb 25 21:01:43 wzmanager03 systemd[1]: wazuh-manager.service: Failed with result 'exit-code'.
Feb 25 21:01:43 wzmanager03 systemd[1]: Failed to start Wazuh manager.``` 

This has not been a real issue so far because we kept using the older module version, but now we need debian12 `bookworm` support introduced only on v.4.7.2 and because of [the way this module compares](https://github.com/wazuh/wazuh-puppet/blob/master/manifests/repo.pp#L33) the `lsbtdiscodename`it means debian12 cannot use older versions of this module.

This is probably a very niche problem, since most people should already have moved from wazuh v4.3.x anyway, but it forces us to maintain a custom fork of the module just for a 2 line config change that should have been templated anyway (e.g. please allow overrides on config files or else do not hardcode breaking changes).

Needless to say, this is really wazuh's fault for introducing breaking config syntax.

I am also attaching a PR that fixes this issue in a simple manner by comparing the package version on the template and conditionally using the older or the newer format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant