-
-
Notifications
You must be signed in to change notification settings - Fork 228
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 support for templated SE Linux agent module #452
Changes from 5 commits
acad705
1cce7ea
20e0720
7385a8b
964467b
e4f0957
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -597,8 +597,23 @@ Many thanks for this! | |
### Standard usage | ||
* Not specified as required but for working correctly, the epel repository should be available for the 'fping'|'fping6' packages. | ||
* Make sure you have sudo installed and configured with: !requiretty. | ||
* Make sure that selinux is permissive or disabled. | ||
|
||
### SE Linux | ||
|
||
On systems with SE Linux active and enforcing, Zabbix agent will be limited unless given proper rights with an SE Linux module. | ||
This Puppet module will apply some default SE Linux rules for it. | ||
More can be provided if needed by using two class parameters, for example in Hiera YAML: | ||
|
||
```yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a newline before the codeblock |
||
zabbix::agent::selinux_require: | ||
- 'type zabbix_agent_t' | ||
- 'class process setrlimit' | ||
zabbix::agent::selinux_rules: | ||
zabbix_agent_t: | ||
- 'allow zabbix_agent_t self:process setrlimit' | ||
zabbix_script_t: | ||
- 'allow zabbix_script_t zabbix_agent_t:process sigchld' | ||
``` | ||
|
||
### When using exported resources | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -258,6 +258,8 @@ | |
String $agent_config_owner = $zabbix::params::agent_config_owner, | ||
String $agent_config_group = $zabbix::params::agent_config_group, | ||
Boolean $manage_selinux = $zabbix::params::manage_selinux, | ||
Array[String] $selinux_require = $zabbix::params::selinux_require, | ||
Hash[String, Array] $selinux_rules = $zabbix::params::selinux_rules, | ||
String $additional_service_params = $zabbix::params::additional_service_params, | ||
String $service_type = $zabbix::params::service_type, | ||
) inherits zabbix::params { | ||
|
@@ -414,9 +416,9 @@ | |
# https://support.zabbix.com/browse/ZBX-11631 | ||
if $facts['selinux'] == true and $manage_selinux { | ||
selinux::module{'zabbix-agent': | ||
ensure => 'present', | ||
source_te => 'puppet:///modules/zabbix/zabbix-agent.te', | ||
before => Service['zabbix-agent'], | ||
ensure => 'present', | ||
content_te => template('zabbix/selinux/zabbix-agent.te.erb'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you switch this to an epp template instead of erb? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tux-o-matic What I meant is that zabbix/selinux/zabbix-agent.te.erb should also be the default value of a new parameter named say $selinux_content_te , so if a user doesn't want to use the selinux template included with this module, they can use their own as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The template is an empty shell, everything is doable via the new class parameters. This PR only adds flexibility. |
||
before => Service['zabbix-agent'], | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module zabbix-agent 1.0; | ||
|
||
require { | ||
<% @selinux_require.each do |sel_require| -%> | ||
<%= sel_require %>; | ||
<% end -%> | ||
} | ||
|
||
<% @selinux_rules.keys.each do |key| -%> | ||
#============= <%= key %> ============== | ||
<% @selinux_rules[key].each do |rule| -%> | ||
<%= rule %>; | ||
<% end -%> | ||
|
||
<% end -%> |
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.
please add a newline after the heading
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.
I can recommend https://dlaa.me/markdownlint/ as a linter
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.
The README is full of it.
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.
yep. github changed their parser in the past, so now we try to enforce their rules for new changes.