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

Add parameter and default for Option SocketDir #723

Merged
merged 3 commits into from
Oct 28, 2020

Conversation

wdberry
Copy link
Contributor

@wdberry wdberry commented Oct 23, 2020

Fixes an issue that occurred after upgrading from Zabbix 4.0 to 5.0 that prevents the zabbix-proxy service from starting correctly.

Pull Request (PR) description

Add parameter and default for Option SocketDir

Added the parameter socketdir to be able to override Option SocketDir in both zabbix_server.conf and zabbix_proxy.conf via an ENC (such as Foreman).

It was added in zabbix_server.conf for completeness, however, in Zabbix 5.0 the proxy service creates a Unix socket for preprocessing called zabbix_proxy_preprocessing.sock.

In the default location, /tmp, SELinux violations on creating the socket prevented the zabbix-proxy service from starting in my deployment on CentOS 7.

My workaround was to override SocketDir, which was added to zabbix_proxy.conf in 5.0, to change the directory that this socket is created in from the default to /var/run/zabbix.

Because it only exists when the service is running, /var/run seemed the appropriate place, and /var/run/zabbix already existed and had appropriate SELinux labels due to the agent and proxy PID files.

To resolve this issue without explicitly setting the parameter, I set the default for socketdir within zabbix::proxy to be /var/run/zabbix if zabbix_version is >= 5.0.

That seems a safe and sane enough default that works when both SELinux is enabled or disabled so that it's not necessary to do a boolean and comparison against both zabbix_version and facts('os.selinux.enabled').

This Pull Request (PR) fixes the following issues

n/a

Added the parameter socketdir to be able to override Option SocketDir in both zabbix_server.conf and zabbix_proxy.conf via an ENC (such as Foreman).

It was added in zabbix_server.conf for completeness, however, in Zabbix 5.0 the proxy service creates a Unix socket for preprocessing called zabbix_proxy_preprocessing.sock.

In the default location, /tmp, SELinux violations on creating the socket prevented the zabbix-proxy service from starting in my deployment on CentOS 7.

My workaround was to override SocketDir, which was added to zabbix_proxy.conf in 5.0, to change the directory that this socket is created in from the default to /var/run/zabbix.

Because it only exists when the service is running, /var/run seemed the appropriate place, and /var/run/zabbix already existed and had appropriate SELinux labels due to the agent and proxy PID files.

To resolve this issue without explicitly setting the parameter, I set the default for socketdir within zabbix::proxy to be /var/run/zabbix if zabbix_version is >= 5.0.

That seems a safe and sane enough default that works when both SELinux is enabled or disabled so that it's not necessary to do a boolean and comparison against both zabbix_version and facts('os.selinux.enabled').
templates/zabbix_server.conf.erb Outdated Show resolved Hide resolved
templates/zabbix_server.conf.erb Outdated Show resolved Hide resolved
templates/zabbix_proxy.conf.erb Outdated Show resolved Hide resolved
Removes extra newline at end of zabbix_proxy.conf and zabbix_server.conf
I realized, after the fact, that the better code pattern rather than explicitly configuring the default value to the implied default is to omit it from the configuration file by the default by using a default of undef and conditional statements.
@kenyon kenyon removed the tests-fail label Oct 26, 2020
@bastelfreak bastelfreak merged commit 7ae8f5b into voxpupuli:master Oct 28, 2020
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

Successfully merging this pull request may close these issues.

3 participants