Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 4.5.0 < 8.0.0
- , ,
Start using this module
Add this module to your Puppetfile:
mod 'nexcess-auditd', '4.2.0'
Learn more about managing modules with a PuppetfileDocumentation
auditd
Table of Contents
- Module Description
- Usage - Configuration options and additional functionality
- Audispd
- Reference
- Limitations
- Copyright
Module Description
This module installs, and configures the auditd service and ruleset. The currently supported platforms are:
- RHEL 6/7
- CentOS 6/7
- Ubuntu 16.04
By default, the only rules that are applied are the buffer size, and action to take on failure.
Usage
Installing and starting
include ::auditd
Specifying Rules
Rules can be specified via four parameters:
- auditd::base_rules
- auditd::main_rules
- auditd::server_rules
- auditd::finalize_rules
Each location takes a yaml list of rules like so:
auditd::main_rules:
- '-a always,exit -F path=/etc/passwd -F perm=wa -F key=accounts'
- '-a always,exit -F path=/etc/gshadow -F perm=wa -F key=accounts'
The purpose of each location is as follows:
- auditd::base_rules is loaded before any other rules are processed
- auditd::main_rules is the primary set of rules to use
- auditd::server_rules are any rules specific to a given node, that should load after the primary rules
- auditd::finalize_rules are any rules that should load after all other rules. The common use for this is to lock the rules from changing without a reboot.
Note about augenrules
Currently, this module depends on the auditctl
and augenrules
binaries to load rules. While there is a parameter to not use augenrules
, there currently isn't any alternative that is tried.
Note about service restarts
Due to some implementations of auditd not being able to be fully restarted, configuration changes for the service its self trigger a service reload. Because Puppet doesn't provide an easy way to trigger service reloads instead of restarts, this is handled by a case statement and exec. Currently, the following service providers should work when sepecified:
- redhat
- systemd
Additional service providers may be added in the future.
Audispd
This module also allows for some basic audispd (audit event multiplexor) configuration.
Usage
By default, this module will attempt to manage a file at /etc/audisp/audispd.conf
, and install additional audispd plugins. You can prevent management of audispd by setting the auditd::audisp::manage
parameter to false
.
Plugins
auditd::audisp::plugin
is a resource type which can be used to create plugin configuration files. If the auditd::audisp::plugins
parameter is not empty, this module will attempt to create a configuration file for the plugin(s) specified in the parameter.
Reference
Classes
Public Classes
- auditd: Main class, includes all other classes.
- auditd::audisp::plugins: Class to set up specified audispd plugins.
Private Classes
- auditd::install: Handles package installation.
- auditd::config: Handles auditd configuration.
- auditd::rules: Handles auditd rules.
- auditd::service: Handles auditd service and rule loading.
- auditd::audisp: Handles management of audispd
- auditd::audisp::install: Handles installation of audispd plugins
- auditd::audisp::config: Handles configuration of audispd
Types
auditd::audisp::plugin
This type creates a configuration file for a audispd plugin. It accepts the following parameters:
- 'active' - Whether or not the plugin should be activated. Valid options: Boolean. Default value: true
- 'direction' - Which direction events flow to the plugin. Valid options: 'in' or 'out'. Default value: 'out'
- 'path' - The absolute path to the plugin executable. Valid options: String . Default value: undef
- 'type' - How the plugin wants to run. Valid options: 'builtin' or 'always'. Default value: 'always'
- 'args' - Maximum of 2 arguments to pass to the child program. Valid options: Array containing strings. Default value: []
- 'format' - The format to send events as. Valid options: 'binary' or 'string'. Default value: 'string'
It uses the title of the resource to create a file called "${title}.conf", under the directory specified in auditd::audisp::plugindir
.
Parameters
The below parameters are available in the ::auditd
class. The man page for auditd.conf can be referenced for more detailed description of each option.
auditd::conf
The fullpath of the main auditd configuration file. Valid options: string containing fullpath. Default value: '/etc/audit/auditd.conf'
auditd::log_file
The file to use for audit logging. Valid options: string containing fullpath. Default value: '/var/log/audit/audit.log'
auditd::log_format
The log format describes how the information should be stored on disk. Valid options: string containing log format. Default value: 'RAW'
auditd::log_group
The group that is applied to the log file's permissions. Valid options: string containing group. Default value: 'root'
auditd::priority_boost
Tells the audit daemon how much of a priority boost it should take. Valid options: 0 or positive integer. Default value: 4
auditd::flush
Tells the audit daemon how to handle flushing audit records to disk. Valid options: string containing flush method. Default value: 'INCREMENTAL'
auditd::freq
Configures how often an explicit flush to disk is issued. Valid options: positive ingeger. Default value: 20
auditd::num_logs
The number of log files to keep if rotate is given as the max_log_file_action. Valid options: integer between 0 and 99. Default value: 5
auditd::disp_qos
Controls whether you want blocking/lossless or non-blocking/lossy communication between the audit daemon and the dispatcher. Valid options: string containing communication type. Default value: 'lossy'
auditd::dispatcher
Application that all events are passed to. Valid options: string containing the path to a program. Default value: '/sbin/audispd'
auditd::name_format
How node names are inserted into event stream. Valid options: string containing the node name format. Default value: 'NONE'
auditd::admin_name
Machine name if auditd::name_format
is set to user
. Valid options: string containing the machine name. Default value: undef
auditd::max_log_file
Maximum log file size in MB. Valid options: positive numeric. Default value: 6
auditd::max_log_file_action
Action to take when auditd::max_log_file
size is reached. Valid options: string containing action to take. Default value: 'ROTATE'
auditd::space_left
When the machine reaches auditd::space_left
diskspace (in MB) remaining, take an action. Valid options: positive numeric. Default value: 75
auditd::space_left_action
Action to take when the auditd daemon detects low disk space. Valid options: string containing the action to take. Default value: 'SYSLOG'
auditd::action_mail_acct
Email alert is sent to when auditd::space_left_action
is set to 'email'. Valid options: string containing email. Default value: 'root'
auditd::admin_space_left
'Last chance' threshold in MB to take action when machine is low on disk space. Valid options: positive numeric. Default value: 50
auditd::admin_space_left_action
See auditd::space_left_action
.
auditd::disk_full_action
Action to take when partition used for logs is full. Valid options: string containing action. Default value: 'SUSPEND'
auditd::disk_error_action
Action to take when disk error is occured when writing or rotating logs. Valid options: string containing action. Default value: 'SUSPEND'
auditd::tcp_listen_port
TCP port to listen for events from other machines on. Valid options: integer between 1 and 65535. Default value: undef
auditd::tcp_listen_queue
How many pending connections to allow. Valid options: positive integer. Default value: 5
auditd::tcp_max_per_addr
How many connections per-host are allowed. Valid options: integer between 1 and 1024. Default value: 1
auditd::use_libwrap
Whether or not to use tcp_wrappers to restrict connections. Valid options: boolean. Default value: true
auditd::tcp_client_ports
Specifies which incoming ports are allowed for client connections. Valid options: integer between 1 and 65535, or two integers seperated with a '-'. Default value: undef
auditd::tcp_client_max_idle
Number of seconds a client is allowed to remain idle. Valid options: positive integer. Default value: 0
auditd::enable_krb5
If enabled, Kerberos 5 will be used for authentication. Valid options: boolean. Default value: false
auditd::krb5_principal
The principal for the server. Valid options: string containing the principal. Default value: 'auditd'
auditd::krb5_key_file
The key for the server's principal. Valid options: string containing path to key. Default value: undef
auditd::service_manage
Whether to manage the service with this module. Valid options: boolean. Default value: true
auditd::service_enable
Whether to enable the the service on system start. Valid options: boolean. Default value: true
auditd::service_name
The name of the auditd serivce. Valid options: string containing the service name. Default value: 'auditd'
auditd::service_provider
The service provider that would normally be used with the service type. Valid options: string containing the service provider. Default value: 'systemd'
Note that this is normally determined automatically by Puppet. Due to how service reloads are managed, we have to manually specify it to trigger a service reload instead of a restart.
auditd::manage_package
Whether to manage the package with this module. Valid options: boolean. Default value: true
auditd::package_name
Name of the auditd package. Valid options: string containing package name. Default value: 'audit'
auditd::package_state
State to use for package type. Valid options: string containing package state. Default value: 'present'
auditd::use_augenrules
Whether to use augenrules
format for rule creation (i.g. 'rules.d' format; not monolithic file). Valid options: boolean. Default value: true
Note, that currently if set to false
, then no rules will be applied or loaded by the module.
auditd::rulesd_dir
Directory to use for 'rules.d' format. Valid options: string containing path to directory. Default value: '/etc/audit/rules.d'
auditd::purge_rules
Whether to remove any files Puppet doesn't manage from the directory specified by auditd::rulesd_dir
. Valid options: boolean. Default value: true
auditd::rules_buffer_size
auditd::rules_failure_mode
auditd::base_rules
Rules to load before any other, after the buffer and failure options. Valid options: list containing strings of rules. Default value: undef
auditd::main_rules
Rules to be loaded as the 'core' set. Valid options: list containing strings of rules. Default value: undef
auditd::server_rules
Rules to be loaded after the main rules, to be used for node-specific configuration. Valid options: list containing strings of rules. Default value: undef
auditd::finalize_rules
Rules to be loaded after any other rule specified. Mainly used if you wanted to lock rules from changing without a reboot. Valid options: list containing strings of rules. Default value: undef
auditd::audisp::manage
Whether to manage audispd with this module or not. Valid options: Boolean. Default value: true
auditd::audisp::audispd_conf
The configuration file to use for audispd. Vaild options: String. Default value: '/etc/audisp/audispd.conf'
auditd::audisp::plugindir
The path to the 'plugins.d' directory for audispd. Valid options: String. Default value: '/etc/audisp/plugins.d'
auditd::audisp::q_depth
How large the internal queue should be for audispd. Valid options: Numeric. Default value: 80
auditd::audisp::overflow_action
How audispd should react when its internal queue overflows. Valid options: String. Default value: 'syslog'
auditd::audisp::audispd_priority_boost
How much of a priority boost audispd should have. Valid options: Postitive Integer. Default value: 4
auditd::audisp::max_restarts
How many attempts audispd will make to restart crashed plugins. Valid options: Positive Integer. Default value: 10
auditd::audisp::audispd_name_format
How node names are inserted into event stream. Valid options: String. Default value: hostname
auditd::audisp::audispd_name
String identifying the machine when using the 'user' name_format. Valid options: String. Default value: undef
auditd::audisp::install_plugins
Whether to install additional audispd plugins. Valid options: Boolean. Default value: true
auditd::audisp::plugin_package_name
The name of the package containing the audispd plugins. Valid options: String. Default value: 'audispd-plugins'
auditd::audisp::plugins
A list of plugins to configure on a server. Vaild options: Hash of plugins and parameters. Default value: undef
Limitations
Currently the module is only really useful on systems that have augenrules
and use the rules.d directory. While the option is there to disable augenrules, there currently isn't any alternative method implemented.
Copyright
Copyright 2016 Nexcess.net
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependencies
- puppetlabs/stdlib (>= 4.0.0 < 8.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.