WIP: Wazuh puppet module 3.9 installing via puppet with separate client and server

This commit is contained in:
ts
2019-10-28 12:05:33 +00:00
parent 53b233a14f
commit de2ce220e5
58 changed files with 2895 additions and 1 deletions

View File

@@ -8,7 +8,7 @@
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs-stdlib', '4.24.0' # stdlib enables parsejson() in manifests and other useful functions
mod 'puppetlabs-stdlib', '4.25.1' # stdlib enables parsejson() in manifests and other useful functions
mod 'SecGen-secgen_functions', :path => '<%= SECGEN_FUNCTIONS_PUPPET_DIR %>'
<% @currently_processing_system.module_selections.each do |selected_module| -%>

View File

@@ -0,0 +1,344 @@
# Change Log
All notable changes to this project will be documented in this file.
## [v3.9.1]
### Added
- Update to Wazuh version 3.9.1_6.8.0
## [v3.9.0]
### Added
- Allow certificates to be defined by file path ([#112](https://github.com/wazuh/wazuh-puppet/pull/112))
### Changed
- Update to Wazuh version 3.9.0 ([#118](https://github.com/wazuh/wazuh-puppet/pull/118))
## [v3.8.2]
### Changed
- Update to Wazuh version 3.8.2. ([#107](https://github.com/wazuh/wazuh-puppet/pull/107))
## [v3.8.1]
### Changed
- Update to Wazuh version 3.8.1 ([#104](https://github.com/wazuh/wazuh-puppet/pull/104))
## [v3.8.0]
### Added
- Feature/agent auth cert key ([#98](https://github.com/wazuh/wazuh-puppet/pull/98))
- Install package even if repos are not managed by wazuh ([#99](https://github.com/wazuh/wazuh-puppet/pull/99))
### Added
- Updating params.pp and _common.erb so all the options of localfile can be used ([#97](https://github.com/wazuh/wazuh-puppet/pull/97))
## [v3.7.2]
### Added
- Updating params.pp and _common.erb so all the options of localfile can be used ([#97](https://github.com/wazuh/wazuh-puppet/pull/97))
### Fixed
- Fixing process_list.erb performance ([#94](https://github.com/wazuh/wazuh-puppet/pull/94))
- Update windows agent version ([#96](https://github.com/wazuh/wazuh-puppet/pull/96))
## [v3.7.1]
### Added
- Add integration support. ([#89](https://github.com/wazuh/wazuh-puppet/pull/89))
- Add support for who data. ([#84](https://github.com/wazuh/wazuh-puppet/pull/84))
- Grouping agents. ([#82](https://github.com/wazuh/wazuh-puppet/pull/82))
### Fixed
- Fix firewall module and support excluding decoders and rules. ([#81](https://github.com/wazuh/wazuh-puppet/pull/81))
### Changed
- Updated metadata.json.
- Changed addlog for command support. ([#90](https://github.com/wazuh/wazuh-puppet/pull/90))
## v3.7.0-3701
### Added
- New repository management and content.
- Add support for Wazuh 3.x. ([#85](https://github.com/wazuh/wazuh-puppet/pull/85))
### Fixed
- Fix username (puppet to puppetlabs). ([#74](https://github.com/wazuh/wazuh-puppet/pull/74))
## Change Log old version.
## 2017-xx-xx support@wazuh.com - 2.0.23
* Fixed issue #18 with the pull request #17. (thanks @lemrouch)
* Fixed issue #29 puppetlabs/apt version 4 onwards breaks the installation of wazuh server (thanks @rafaelfc-olx)
* Adding support for changing ossec_server_protocol with the pull request #30 (thanks @rafaelfc-olx)
* Managing wazuh-api alongside with wazuh-manager with the pull request #31 (thanks @rafaelfc-olx)
* Preventing Duplicated declaration issues regarding apt-transport-https package with the pull request #32 (thanks @rafaelfc-olx)
* Adding support for changing the client protocol and validating the manager by CA with the pull request #34 (thanks @rafaelfc-olx)
* Configuring wazuh-api from puppet with the pull request #35 (thanks @rafaelfc-olx)
* Adding notify_time and time-reconnect options to client config with the pull request #36 (thanks @rafaelfc-olx)
* New wazuh-winagent-v2.1.1-1.exe added.
* Profile name for Centos 7 is not _server, it's _common like RHEL7 with the pull request #38 (thanks @juliovalcarcel)
* Verifying if @wodle_openscap_content is defined, fixed #45 and #46
* Set the same file permissions than the installed package, fixed #41
* Adding the ability to set "type" attribute for "ignore" tag, fixed #19
* Adding support to OracleLinux, Fixed #43
* Add an option for the agent/manager class to manage the firewall automatically with puppetlabs/firewall
## 2017-05-27 support@wazuh.com - 2.0.22
* Fixed issue #3. (Thanks for reporting it @ddholstad99)
* Fixed issue #4. (Thanks for reporting it @elisiano)
* Explicitly use the windows package provider pull request #11 (Thanks @damoxc)
* Enable fedora 23/24/25 for pull request #9 (Thanks @ddholstad99)
* Fix for issue Fix for #6 validate_cmd pull request #12 (Thanks @dakine1111)
* Add $wodle_openscap_content parameter to server.pp pull request #12 (Thanks hex2a)
* Added some changes in order to do this module compatible. (pull request #5 thanks elisano)
## 2017-04-24 Jose Luis Ruiz - 2.0.21
* Fix apt deprecation warnings. (thanks @kdole)
* Avoid warnings when storeconfigs are not available. (thanks @kdole)
* Use default local_files setting. (thanks @kdole)
* Making ossec server port configurable. (thanks @edge-records)
* Allow custom agent configurations (thanks @ffleming)
* Fixed issec #66 (thanks @thedawidbalut)
* Adds options to control rootcheck feature. (thanks @netman2k)
* Use puppet-selinux instead of jfryman-selinux (thanks @netman2k)
* Allow custom ossec.conf in agent and server template (thanks @sam-wouters)
* Fixed issue #71. (Thanks for reporting it @sc-chad)
* Fixed issue #72. (Thanks for reporting it @sc-chad)
* Clean code and added new OpenScap option (thanks @0x2A)
* module refactored/adapted for wazuh 2.0 (thanks @0x2A)
* New wazuh-agent-2.0.exe for Windows.
## 2016-12-08 Jose Luis Ruiz - 2.0.20
* Fixed typo in the windows package, this type made the deploy fails under windows.
## 2016-12-08 Jose Luis Ruiz - 2.0.19
* Compat with Older versions facter. (pull request #47 thanks @seefood)
* Template paths as parameters. (pull request #48 thanks @seefood )
* Client: allow configurable service_has_status, default to params. (pull request #51 thanks @josephholsten )
* Added Yakketi to the supported distributions.
* Modified activeresponse.erb to include <rules_id></rules_id> tags (pull request #56 thanks @MatthewRBruce)
* Modified client.pp and server.pp to accept package versions as parameter. (pull request #57 thanks @MatthewRBruce)
## 2016-10-20 Jose Luis Ruiz - 2.0.18
* Fixed 10_ossec.conf.erb template, "local_decoder" added to rules configuration
## 2016-10-18 Jose Luis Ruiz - 2.0.17
* Fixed gpgkey path under CentOS and RHEL
## 2016-10-18 Jose Luis Ruiz - 2.0.16
* Add local_decoder.xml and local_rules.xml templates
## 2016-10-15 Jose Luis Ruiz - 2.0.15
* Add option to enable syslog output. (pull request #35 thanks @TravellingGUy )
* Add Add Amazon Linux support. (pull request #37 thanks @seefood)
* Hard-coded GPG key for RHEL-like systems. (pull request #37 thanks @tobowers)
* Override package & service name for client installation. (pull request #43 thanks MrSecure)
## 2016-06-14 Jose Luis Ruiz - 2.0.14
* Add prefilter to agent config. (pull request #32 thanks @cmblong )
* Add function addlog to the agent. (issue #30 thanks @paul-cs)
* Add the apt::key can set a proxy and the key add process could be done. (issue #34 thanks @drequena)
## 2016-06-14 Jose Luis Ruiz - 2.0.13
* Adding xenial to the supported distributions.(pull request #31 thanks @stephen-kainos)
## 2016-05-04 Jose Luis Ruiz - 2.0.12
Jose Luis Ruiz <jose@wazuh.com>:
* Add MariaDB support ( (pull reques #3 thanks @ialokin)
* Permit admin to disable auto_ignore for files which change more than three times. (pull request #24 thanks @cmblong)
* Change fqdn_rand(3000) to a variable to allow us to increase the number of available clients. (pull request #25 thanks @cmblong)
* Can now set a minimal activeresponse entry containing just repeated_offenders by defining $ar_repeated_offenders in the wazuh::client. (pull request #26 thanks @ialokin)
* Add variable to enable prefilter command. (pull request #27 thanks @cmblong)
* Set service provider to redhat on Redhat systems. (pull request #28 thanks @cmblong))
## 2016-05-04 Jose Luis Ruiz - 2.0.11
Jose Luis Ruiz <jose@wazuh.com>:
* Fix windows installation error in params. (pull request #20 thanks @cmblong)
* Added support for repeated_offenders in activeresponse (pull request #21 thanks @ialokin)
## 2016-04-26 Jose Luis Ruiz - 2.0.10
Jose Luis Ruiz <jose@wazuh.com>:
* Extra rules config to integrate Wazuh ruleset. (pull request #17 thanks @TravellingGUy)
* Allow configuration of the email_maxperhour and email_idsname configuration items. (pull request #18 thanks @TravellingGUy)
* Fix bug in client exported resources (pull request #19 thanks @scottcunningham)
## 2016-02-23 Jose Luis Ruiz - 2.0.9
Jose Luis Ruiz <jose@wazuh.com>:
* Allow the agent identity to be modified. (pull request #10 thanks @damoxc)
* prevent the agent-auth command being used. (pull request #11 thanks @damoxc)
* Change log directory to only be readable by user and group. (pull request #12 thanks @damoxc)
* Add the ability to configure a MySQL database with OSSEC server. (pull request #14 thanks @coreone)
## 2016-02-05 Jose Luis Ruiz - 2.0.8
Jose Luis Ruiz <jose@wazuh.com>:
* Fix some typos with puppet-lint.
## 2016-02-05 Jose Luis Ruiz <jose@wazuh.com> - 2.0.7
Jose Luis Ruiz <jose@wazuh.com>:
* Run agent-auth if client.keys doesn't exist an agent. (pull request #9 thanks @TravellingGuy)
## 2016-02-03 Jose Luis Ruiz <jose@wazuh.com> - 2.0.6
Jose Luis Ruiz <jose@wazuh.com>:
* Add ability to manage epel repo to master/client configs (pull request #4 thanks @justicel)
* The @path uses the puppet level path variable (pull request #5 thanks @justicel)
* Allow whitelisting of IP addreses (thanks @chaordix)
* Provides an option to tell the puppet module to not manage the client.keys file at all. (pull request #7 thanks @TravellingGuy)
## 2016-01-19 Jose Luis Ruiz <jose@wazuh.com> - 2.0.5
Jose Luis Ruiz <jose@wazuh.com>:
* Add multiple email_to addresses
* Adding support for server-hostname in agent config (pull request #3 thanks @alustenberg)
* Adding ossec_scanpaths configuration thanks to @djjudas21 repository
## 2015-12-21 Jose Luis Ruiz <jose@wazuh.com> - 2.0.4
Jose Luis Ruiz <jose@wazuh.com>:
* Add manage_repo option on client.pp (issue #2 reported by @cudgel)
* Add new repo for RHEL5 and CentOS5 have different rpm signature.
## 2015-12-02 Jose Luis Ruiz <jose@wazuh.com> - 2.0.3
Jose Luis Ruiz <jose@wazuh.com>:
* Fix server package name for Ubuntu (thanks to @HielkeJ for Pull request)
* Add full fingerprint for Ubuntu and Debian (thanks to @HielkeJ for Pull request)
## 2015-10-13 Jose Luis Ruiz <jose@wazuh.com> - 2.0.2
Jose Luis Ruiz <jose@wazuh.com>:
* Update Windows Agent to version 2.8.3
* Update packaget to Ubuntu Vivid and Wily
* Update packages to Debian Stretch and Sid
## 2015-10-13 Jose Luis Ruiz <jose@wazuh.com> - 2.0.1
Jose Luis Ruiz <jose@wazuh.com>:
* Update Windows Agent to version 2.8.1
* Fix a bug with the Windows Agent ID, now use for all systems **fqdn_rand** to generate the client.keys ID
## 2015-09-16 Jose Luis Ruiz <jose@wazuh.com> - 2.0.0
Jose Luis Ruiz <jose@wazuh.com>:
* Update for all kind of Windows
* Change repos to Wazuh, Inc.
## 2015-09-16 Michael Porter <michael.porter@lightningsource.com> - 2.0.0
Michael Porter <michael.porter@lightningsource.com>:
* Allow skipping MySQL dependency, disabling active response,
and executing rootcheck
* Windows agent support
* Use Puppet md5 support, instead of adding parser function
* Utilize centralized agent configuration
* Various clean-up and reorganization of Puppet module structure
* Utilize 'hostname' instead of 'uniqueid' for agent ID, due to uniqueid
not existing on Windows, and not necessarily being unique across the org
on Linux
## 2015-08-21 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.7.2
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* SELinux permissions fix
## 2015-08-07 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.7.0
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Use puppetlabs/mysql to manage MySQL client
## 2015-08-03 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.6.2
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Fix log directory permissions
## 2015-07-20 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.6.0
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Enable SELinux support
## 2015-07-06 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.5.4
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Fix regression in log file permissions (thanks to @paulseward)
## 2015-06-30 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.5.3
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Fix permissions on log files so logwatch on EL7 doesn't complain
* Key concat::fragment for agentkeys on $agent_name to avoid duplicated resources
## 2015-06-11 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.5.1
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Stop using andyshinn/atomic and configure Atomicorp's OSSEC repo locally
## 2015-06-10 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.4.2
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Fix regression that breaks behaviour on CentOS 6 and lower
## 2015-05-28 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.4.1
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Email notification is no longer hard-coded in ossec.conf (thanks to @earsdown)
## 2015-03-02 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.4.0
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Fix dependency problem by providing EPEL on RHEL (thanks to @otteydw for reporting)
## 2015-01-16 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.3.3
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Fix compatibility issue with PuppetServer (thanks to @d9705996)
## 2014-11-28 Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk> - 1.3.0
Jonathan Gazeley <jonathan.gazeley@bristol.ac.uk>:
* Add support for Debian "Jessie" (thanks to @ivan7farre)

View File

@@ -0,0 +1,24 @@
source 'https://rubygems.org'
group :test do
gem 'rake'
gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0'
gem 'rspec', '< 3.2.0'
gem 'rspec-puppet', git: 'https://github.com/rodjek/rspec-puppet.git'
gem 'rspec-puppet-facts'
gem 'autorun'
gem 'puppetlabs_spec_helper'
end
group :development do
gem 'puppet-blacksmith'
gem 'guard-rake'
gem 'yard'
end
group :system_tests do
gem 'beaker'
gem 'beaker-rspec'
gem 'beaker-puppet_install_helper'
end

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,111 @@
# Wazuh Puppet module
[![Slack](https://img.shields.io/badge/slack-join-blue.svg)](https://wazuh.com/community/join-us-on-slack/)
[![Email](https://img.shields.io/badge/email-join-blue.svg)](https://groups.google.com/forum/#!forum/wazuh)
[![Documentation](https://img.shields.io/badge/docs-view-green.svg)](https://documentation.wazuh.com)
[![Documentation](https://img.shields.io/badge/web-view-green.svg)](https://wazuh.com)
This module installs and configure Wazuh agent and manager.
## Documentation
* [Full documentation](http://documentation.wazuh.com)
* [Wazuh Puppet module documentation](https://documentation.wazuh.com/current/deploying-with-puppet/index.html)
* [Puppet Forge](https://forge.puppetlabs.com/wazuh/wazuh)
## Directory structure
├── wazuh-puppet
│ ├── files
│ │ ├── client.keys
│ │ ├── ossec-logrotate.te
│ │ ├── wazuh-winagent-v2.1.1-1.exe
│ ├── manifest
│ │ ├── activeresponse.pp
│ │ ├── addlog.pp
│ │ ├── agentkey.pp
│ │ ├── client.pp
│ │ ├── collect_agent_keys.pp
│ │ ├── command.pp
│ │ ├── email_alert.pp
│ │ ├── export_agent_key.pp
│ │ ├── init.pp
│ │ ├── params.pp
│ │ ├── repo.pp
│ │ ├── reports.pp
│ │ ├── server.pp
│ │
│ ├── spec
│ │ ├── classes
│ │ │ ├── client_spec.rb
│ │ │ ├── init_spec.rb
│ │ │ ├── server_spec.rb
│ │
│ │ ├── spec_helper.rb
│ ├── templates
│ │ ├── api
│ │ │ ├── config.js.erb
│ │
│ │ ├── fragments
│ │ │ ├── _activeresponse.erb
│ │ │ ├── _common.erb
│ │ │ ├── _localfile.erb
│ │ │ ├── _reports.erb
│ │ │ ├── _rootcheck_linux.erb
│ │ │ ├── _rootcheck_windows.erb
│ │ │ ├── _syscheck_linux.erb
│ │ │ ├── _syscheck_windows.erb
│ │ │ ├── _wodle_openscap.erb
│ │
│ │ ├── command.erb
│ │ ├── email_alert.erb
│ │ ├── local_decoder.xml.erb
│ │ ├── local_rules.xmk.erb
│ │ ├── ossec_shared_agent.conf.erb
│ │ ├── process_list.erb
│ │ ├── wazuh_agent.conf.erb
│ │ ├── wazuh_manager.conf.erb
|
│ ├── tests
│ │ ├── init.pp
|
│ ├── README.md
│ ├── VERSION
│ ├── CHANGELOG.md
│ ├── .travis.yml
│ ├── Gemfile
│ ├── LICENSE.txt
│ ├── Rakefile
│ ├── checksums.json
│ ├── metadata.json
## Branches
* `stable` branch on correspond to the last Wazuh-Puppet stable version.
* `master` branch contains the latest code, be aware of possible bugs on this branch.
## Contribute
If you would like to contribute to our repository, please fork our Github repository and submit a pull request.
If you are not familiar with Github, you can also share them through [our users mailing list](https://groups.google.com/d/forum/wazuh), to which you can subscribe by sending an email to `wazuh+subscribe@googlegroups.com`.
## Credits and thank you
This Puppet module has been authored by Nicolas Zin, and updated by Jonathan Gazeley and Michael Porter. Wazuh has forked it with the purpose of maintaining it. Thank you to the authors for the contribution.
## License and copyright
WAZUH
Copyright (C) 2016-2018 Wazuh Inc. (License GPLv2)
Based on OSSEC
Copyright (C) 2015 Trend Micro Inc.
## Web References
* [Wazuh website](http://wazuh.com)

View File

@@ -0,0 +1,18 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
desc "Validate manifests, templates, and ruby files"
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end

View File

@@ -0,0 +1,2 @@
WAZUH-PUPPET_VERSION="v3.9.1"
REVISION="3901"

View File

@@ -0,0 +1,32 @@
{
"CHANGELOG": "f19926f4fe829b0db46c013cbaf35b39",
"LICENCE.txt": "b234ee4d69f5fce4486a80fdaf4a4263",
"README.md": "3a1440b7e90322cbfa5c05294bb0c640",
"Rakefile": "20b80e526e351a74df2001f504e756d2",
"files/RPM-GPG-KEY.ossec.txt": "fa0cdc74d4a785c50d15f72ea5f41cd5",
"files/ossec-agent-win32-2.8.exe": "a699117d0ed77f88b3a8661644ee3efd",
"files/ossec-logrotate.te": "805a98138f4a9157768d739f47804d51",
"manifests/activeresponse.pp": "e667a4933feefa68ff0ce8836ce2e1c2",
"manifests/addlog.pp": "55973e8421221ee25fbc25486f9394ff",
"manifests/agentkey.pp": "31a3dafb35440d06782fa643545687f2",
"manifests/client.pp": "8846d9509a2d07327abf7f863db24b3c",
"manifests/command.pp": "5a5a6f6fb8e0fb33f8805aae4c24b2fa",
"manifests/email_alert.pp": "3d3f25b93b8632bb83b090aa00bceb54",
"manifests/init.pp": "7169001dff13c2989a2f5109a7308647",
"manifests/params.pp": "771406d51f9b0cbdb9cf0de09183fc6e",
"manifests/repo.pp": "9e671fc275f70156b7039d6b7422a3a4",
"manifests/server.pp": "9714ed91cf16ef098c6ad0325c5d0516",
"metadata.json": "52a211d737d06b75edb7d7dba16e98c3",
"spec/classes/init_spec.rb": "56bd154658b163252110b2f5aed81cb7",
"spec/spec_helper.rb": "a55d1e6483344f8ec6963fcb2c220372",
"templates/10_ossec.conf.erb": "dfba2404ca2b9ced29935d33411a4a79",
"templates/10_ossec_agent.conf.erb": "9fd7f4ad33f62e4146b0bac0948b4a50",
"templates/20_ossecLogfile.conf.erb": "13440a05e19d6fb9ce4e2fe5fdfdac74",
"templates/90_ossec.conf.erb": "698695c984a8d6829d3a331b8a4196ec",
"templates/99_ossec_agent.conf.erb": "386ab8ad1d31566eed64a06e0a8d4d9a",
"templates/activeresponse.erb": "8a3bd90af1c0b8199af57f37bf5314d2",
"templates/command.erb": "e37530e43ad73dbfe1e17c0d9da042f9",
"templates/email_alert.erb": "3aa50ecb0e284ed3a443ee89d21260b0",
"templates/ossec_shared_agent.conf.erb": "131307a6afdf7e83053cdbc9f6d44368",
"tests/init.pp": "2eac4e89d806c23f7d72d6ac924d1921"
}

View File

@@ -0,0 +1,10 @@
module ossec-logrotate 1.2;
require {
type var_t;
type logrotate_t;
class file { read write getattr open };
}
#============= logrotate_t ==============
allow logrotate_t var_t:file { read write getattr open };

View File

@@ -0,0 +1,20 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#Define for a specific ossec active-response
define wazuh::activeresponse(
$command_name,
$ar_location = 'local',
$ar_level = 7,
$ar_agent_id = '',
$ar_rules_id = [],
$ar_timeout = 300,
$ar_repeated_offenders = '',
) {
require wazuh::params
concat::fragment { $name:
target => 'ossec.conf',
order => 55,
content => template('wazuh/fragments/_activeresponse.erb')
}
}

View File

@@ -0,0 +1,18 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#Define a log-file to add to ossec
define wazuh::addlog(
$logfile = undef,
$logtype = 'syslog',
$logcommand = undef,
$commandalias = undef,
$frequency = undef,
) {
require wazuh::params
concat::fragment { "ossec.conf_localfile-${logfile}":
target => 'ossec.conf',
content => template('wazuh/fragments/_localfile.erb'),
order => 20,
}
}

View File

@@ -0,0 +1,23 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# utility function to fill up /var/ossec/etc/client.keys
define wazuh::agentkey(
$agent_id,
$agent_name,
$agent_ip_address,
$agent_seed = 'xaeS7ahf',
) {
require wazuh::params
if ! $agent_id { fail('wazuh::agentkey: $agent_id is missing')}
if ! $agent_seed { fail('wazuh::agentkey: $agent_seed is missing')}
$agentkey1 = md5("${agent_id} ${agent_seed}")
$agentkey2 = md5("${agent_name} ${agent_ip_address} ${agent_seed}")
concat::fragment { "var_ossec_etc_client.keys_${agent_name}_part":
target => $wazuh::params::keys_file,
order => $agent_id,
content => "${agent_id} ${agent_name} ${agent_ip_address} ${agentkey1}${agentkey2}\n",
}
}

View File

@@ -0,0 +1,265 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Setup for ossec client
class wazuh::client(
$ossec_active_response = true,
$ossec_rootcheck = true,
$ossec_rootcheck_frequency = 36000,
$ossec_rootcheck_checkports = true,
$ossec_rootcheck_checkfiles = true,
$ossec_server_ip = undef,
$ossec_server_hostname = undef,
$wazuh_manager_address = undef,
$ossec_server_port = '1514',
$ossec_server_protocol = 'udp',
$ossec_server_notify_time = undef,
$ossec_server_time_reconnect = undef,
$ossec_scanpaths = [],
$ossec_ignorepaths = [],
$ossec_ignorepaths_regex = [],
$ossec_local_files = $::wazuh::params::default_local_files,
$ossec_syscheck_frequency = 43200,
$ossec_prefilter = false,
$ossec_service_provider = $::wazuh::params::ossec_service_provider,
$ossec_config_profiles = [],
$selinux = false,
$agent_name = $::hostname,
$agent_ip_address = $::ipaddress,
$agent_group = 'default',
$manage_repo = true,
$manage_epel_repo = true,
$agent_package_name = $::wazuh::params::agent_package,
$agent_package_version = 'installed',
$agent_service_name = $::wazuh::params::agent_service,
$agent_auto_restart = 'yes',
# client_buffer configuration
$client_buffer_queue_size = 5000,
$client_buffer_events_per_second = 500,
$manage_client_keys = 'authd',
$agent_auth_password = undef,
$wazuh_manager_root_ca_pem = undef,
$wazuh_manager_root_ca_pem_path = undef,
$wazuh_agent_cert = undef,
$wazuh_agent_key = undef,
$wazuh_agent_cert_path = undef,
$wazuh_agent_key_path = undef,
$agent_seed = undef,
$max_clients = 3000,
$ar_repeated_offenders = '',
$enable_wodle_openscap = false,
$wodle_openscap_content = $::wazuh::params::wodle_openscap_content,
$service_has_status = $::wazuh::params::service_has_status,
$ossec_conf_template = 'wazuh/wazuh_agent.conf.erb',
Boolean $manage_firewall = $::wazuh::params::manage_firewall,
) inherits wazuh::params {
validate_bool(
$ossec_active_response, $ossec_rootcheck,
$selinux, $manage_repo, $manage_epel_repo
)
# This allows arrays of integers, sadly
# (commented due to stdlib version requirement)
validate_array($ossec_ignorepaths)
validate_string($agent_package_name)
validate_string($agent_service_name)
if ( ( $ossec_server_ip == undef ) and ( $ossec_server_hostname == undef ) and ( $wazuh_manager_address == undef ) ) {
fail('must pass either $ossec_server_ip or $ossec_server_hostname or $wazuh_manager_address to Class[\'wazuh::client\'].')
}
case $::kernel {
'Linux' : {
if $manage_repo {
class { 'wazuh::repo': redhat_manage_epel => $manage_epel_repo }
if $::osfamily == 'Debian' {
Class['wazuh::repo'] -> Class['apt::update'] -> Package[$agent_package_name]
} else {
Class['wazuh::repo'] -> Package[$agent_package_name]
}
}
package { $agent_package_name:
ensure => $agent_package_version, # lint:ignore:security_package_pinned_version
}
}
'windows' : {
file {
'C:/wazuh-agent-3.9.1-1.msi':
owner => 'Administrators',
group => 'Administrators',
mode => '0774',
source => 'puppet:///modules/wazuh/wazuh-agent-3.9.1-1.msi',
source_permissions => ignore
}
if ( $manage_client_keys == 'authd' ) {
package { $agent_package_name:
ensure => $agent_package_version, # lint:ignore:security_package_pinned_version
provider => 'windows',
source => 'C:/wazuh-agent-3.9.1-1.msi',
install_options => [ '/q', "ADDRESS=${ossec_server_ip}", "AUTHD_SERVER=${ossec_server_ip}" ], # silent installation
require => File['C:/wazuh-agent-3.9.1-1.msi'],
}
}
else {
package { $agent_package_name:
ensure => $agent_package_version, # lint:ignore:security_package_pinned_version
provider => 'windows',
source => 'C:/wazuh-agent-3.9.1-1.msi',
install_options => [ '/q' ], # silent installation
require => File['C:/wazuh-agent-3.9.1-1.msi'],
}
}
}
default: { fail('OS not supported') }
}
service { $agent_service_name:
ensure => running,
enable => true,
hasstatus => $service_has_status,
pattern => $agent_service_name,
provider => $ossec_service_provider,
require => Package[$agent_package_name],
}
concat { 'ossec.conf':
path => $wazuh::params::config_file,
owner => $wazuh::params::config_owner,
group => $wazuh::params::config_group,
mode => $wazuh::params::config_mode,
require => Package[$agent_package_name],
notify => Service[$agent_service_name],
}
concat::fragment {
default:
target => 'ossec.conf',
notify => Service[$agent_service_name];
'ossec.conf_header':
order => 00,
content => "<ossec_config>\n";
'ossec.conf_agent':
order => 10,
content => template($ossec_conf_template);
'ossec.conf_footer':
order => 99,
content => '</ossec_config>';
}
if ( $manage_client_keys == 'export' ) {
concat { $wazuh::params::keys_file:
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
notify => Service[$agent_service_name],
require => Package[$agent_package_name]
}
# A separate module to avoid storeconfigs warnings when not managing keys
class { 'wazuh::export_agent_key':
max_clients => $max_clients,
agent_name => $agent_name,
agent_ip_address => $agent_ip_address,
agent_seed => $agent_seed,
}
} elsif ($manage_client_keys == 'authd') {
if ($::kernel == 'Linux') {
# Is this really Linux only?
$ossec_server_address = pick($ossec_server_ip, $ossec_server_hostname)
file { $::wazuh::params::keys_file:
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
}
# https://documentation.wazuh.com/current/user-manual/registering/use-registration-service.html#verify-manager-via-ssl
$agent_auth_base_command = "/var/ossec/bin/agent-auth -m ${ossec_server_address} -A ${agent_name} -G ${agent_group} -D /var/ossec/"
if $wazuh_manager_root_ca_pem != undef {
validate_string($wazuh_manager_root_ca_pem)
file { '/var/ossec/etc/rootCA.pem':
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
content => $wazuh_manager_root_ca_pem,
require => Package[$agent_package_name],
}
$agent_auth_option_manager = '-v /var/ossec/etc/rootCA.pem'
}
if $wazuh_manager_root_ca_pem_path != undef {
validate_string($wazuh_manager_root_ca_pem)
$agent_auth_option_manager = "-v ${wazuh_manager_root_ca_pem_path}"
}
# https://documentation.wazuh.com/current/user-manual/registering/use-registration-service.html#verify-agents-via-ssl
if ($wazuh_agent_cert != undef) and ($wazuh_agent_key != undef) {
validate_string($wazuh_agent_cert)
validate_string($wazuh_agent_key)
file { '/var/ossec/etc/sslagent.cert':
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
content => $wazuh_agent_cert,
require => Package[$agent_package_name],
}
file { '/var/ossec/etc/sslagent.key':
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
content => $wazuh_agent_key,
require => Package[$agent_package_name],
}
$agent_auth_option_agent = '-x /var/ossec/etc/sslagent.cert -k /var/ossec/etc/sslagent.key'
}
if ($wazuh_agent_cert_path != undef) and ($wazuh_agent_key_path != undef) {
validate_string($wazuh_agent_cert_path)
validate_string($wazuh_agent_key_path)
$agent_auth_option_agent = "-x ${wazuh_agent_cert_path} -k ${wazuh_agent_key_path}"
}
$agent_auth_command = "${agent_auth_base_command} ${agent_auth_option_manager} ${agent_auth_option_agent}"
if $agent_auth_password {
exec { 'agent-auth-with-pwd':
command => "${agent_auth_command} -P '${agent_auth_password}'",
unless => "/bin/egrep -q '.' ${::wazuh::params::keys_file}",
require => Package[$agent_package_name],
notify => Service[$agent_service_name],
before => File[$wazuh::params::keys_file]
}
} else {
exec { 'agent-auth-without-pwd':
command => $agent_auth_command,
unless => "/bin/egrep -q '.' ${::wazuh::params::keys_file}",
require => Package[$agent_package_name],
notify => Service[$agent_service_name],
before => File[$wazuh::params::keys_file],
}
}
}
}
# SELinux
# Requires selinux module specified in metadata.json
if ($::osfamily == 'RedHat' and $selinux == true) {
selinux::module { 'ossec-logrotate':
ensure => 'present',
source_te => 'puppet:///modules/wazuh/ossec-logrotate.te',
}
}
# Manage firewall
if $manage_firewall {
include firewall
firewall { '1514 wazuh-agent':
dport => $ossec_server_port,
proto => $ossec_server_protocol,
action => 'accept',
state => [
'NEW',
'RELATED',
'ESTABLISHED'],
}
}
}

View File

@@ -0,0 +1,21 @@
#Define for a specific ossec cluster
define wazuh::cluster(
$cl_name,
$cl_node_name = 'node01',
$cl_node_type = 'master',
$cl_key = '',
$cl_port = '1516',
$cl_bin_addr = '0.0.0.0',
$cl_node = ['NODE_IP','NODE_IP2'],
$cl_hidden = 'no',
$cl_disabled = 'yes',
) {
require wazuh::params
concat::fragment { $name:
target => 'ossec.conf',
order => 95,
content => template('wazuh/fragments/_cluster.erb')
}
}

View File

@@ -0,0 +1,5 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Class to collect the agent keys
class wazuh::collect_agent_keys {
Wazuh::Agentkey<<| |>>
}

View File

@@ -0,0 +1,17 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Define an ossec command
define wazuh::command(
$command_name,
$command_executable,
$command_expect = 'srcip',
$timeout_allowed = true,
) {
require wazuh::params
if ($timeout_allowed) { $command_timeout_allowed='yes' } else { $command_timeout_allowed='no' }
concat::fragment { $name:
target => 'ossec.conf',
order => 45,
content => template('wazuh/command.erb'),
}
}

View File

@@ -0,0 +1,14 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Define an email alert
define wazuh::email_alert(
$alert_email,
$alert_group = false
) {
require wazuh::params
concat::fragment { $name:
target => 'ossec.conf',
order => 65,
content => template('wazuh/email_alert.erb'),
}
}

View File

@@ -0,0 +1,22 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#Export agent key
class wazuh::export_agent_key(
$max_clients,
$agent_name,
$agent_ip_address,
$agent_seed,
) {
wazuh::agentkey{ "ossec_agent_${agent_name}_client":
agent_id => fqdn_rand($max_clients),
agent_name => $agent_name,
agent_ip_address => $agent_ip_address,
agent_seed => $agent_seed,
}
@@wazuh::agentkey{ "ossec_agent_${agent_name}_server":
agent_id => fqdn_rand($max_clients),
agent_name => $agent_name,
agent_ip_address => $agent_ip_address,
agent_seed => $agent_seed,
}
}

View File

@@ -0,0 +1,3 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Blank container class
class wazuh { }

View File

@@ -0,0 +1,21 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#Define for a specific ossec integration
define wazuh::integration(
$hook_url = '',
$api_key = '',
$in_rule_id = '',
$in_level = 7,
$in_group = '',
$in_location = '',
$in_format = '',
$in_max_log = '',
) {
require wazuh::params
concat::fragment { $name:
target => 'ossec.conf',
order => 60,
content => template('wazuh/fragments/_integration.erb')
}
}

View File

@@ -0,0 +1,226 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Paramas file
class wazuh::params {
case $::kernel {
'Linux': {
$config_file = '/var/ossec/etc/ossec.conf'
$shared_agent_config_file = '/var/ossec/etc/shared/agent.conf'
$config_mode = '0640'
$config_owner = 'root'
$config_group = 'ossec'
$keys_file = '/var/ossec/etc/client.keys'
$keys_mode = '0640'
$keys_owner = 'root'
$keys_group = 'ossec'
$manage_firewall = false
$authd_pass_file = '/var/ossec/etc/authd.pass'
$validate_cmd_conf = '/var/ossec/bin/verify-agent-conf -f %'
$processlist_file = '/var/ossec/bin/.process_list'
$processlist_mode = '0640'
$processlist_owner = 'root'
$processlist_group = 'ossec'
# this hash is currently only covering the basic config section of config.js
# TODO: allow customization of the entire config.js
# for reference: https://documentation.wazuh.com/current/user-manual/api/configuration.html
$api_config_params = [
{'name' => 'ossec_path', 'value' => '/var/ossec'},
{'name' => 'host', 'value' => '0.0.0.0'},
{'name' => 'port', 'value' => '55000'},
{'name' => 'https', 'value' => 'no'},
{'name' => 'basic_auth', 'value' => 'yes'},
{'name' => 'BehindProxyServer', 'value' => 'no'},
]
case $::osfamily {
'Debian': {
$agent_service = 'wazuh-agent'
$agent_package = 'wazuh-agent'
$service_has_status = false
$ossec_service_provider = undef
$api_service_provider = undef
$default_local_files = [
{ 'location' => '/var/log/syslog' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/kern.log' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/auth.log' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/mail.log' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/dpkg.log', 'log_format' => 'syslog'},
{ 'location' => '/var/ossec/logs/active-responses.log', 'log_format' => 'syslog'},
]
case $::lsbdistcodename {
'xenial': {
$server_service = 'wazuh-manager'
$server_package = 'wazuh-manager'
$api_service = 'wazuh-api'
$api_package = 'wazuh-api'
$wodle_openscap_content = {
'ssg-ubuntu-1604-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_common'],
},
}
}
'jessie': {
$server_service = 'wazuh-manager'
$server_package = 'wazuh-manager'
$api_service = 'wazuh-api'
$api_package = 'wazuh-api'
$wodle_openscap_content = {
'ssg-debian-8-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_common'],
},
'cve-debian-oval.xml' => {
'type' => 'oval',
}
}
}
/^(wheezy|stretch|sid|precise|trusty|vivid|wily|xenial|bionic)$/: {
$server_service = 'wazuh-manager'
$server_package = 'wazuh-manager'
$api_service = 'wazuh-api'
$api_package = 'wazuh-api'
$wodle_openscap_content = undef
}
default: {
fail("Module ${module_name} is not supported on ${::operatingsystem}")
}
}
}
'Linux', 'RedHat': {
$agent_service = 'wazuh-agent'
$agent_package = 'wazuh-agent'
$server_service = 'wazuh-manager'
$server_package = 'wazuh-manager'
$api_service = 'wazuh-api'
$api_package = 'wazuh-api'
$service_has_status = true
$default_local_files =[
{ 'location' => '/var/log/messages' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/secure' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/maillog', 'log_format' => 'syslog'},
{ 'location' => '/var/log/yum.log' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/httpd/access_log' , 'log_format' => 'apache'},
{ 'location' => '/var/log/httpd/error_log' , 'log_format' => 'apache'},
]
case $::operatingsystem {
'Amazon': {
# Amazon is based on Centos-6 with some improvements
# taken from RHEL-7 but uses SysV-Init, not Systemd.
# Probably best to leave this undef until we can
# write/find a release-specific file.
$wodle_openscap_content = undef
}
'CentOS': {
if ( $::operatingsystemrelease =~ /^6.*/ ) {
$ossec_service_provider = 'redhat'
$api_service_provider = 'redhat'
$wodle_openscap_content = {
'ssg-centos-6-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_pci-dss', 'xccdf_org.ssgproject.content_profile_server',]
}
}
}
if ( $::operatingsystemrelease =~ /^7.*/ ) {
$ossec_service_provider = 'systemd'
$api_service_provider = 'systemd'
$wodle_openscap_content = {
'ssg-centos-7-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_pci-dss', 'xccdf_org.ssgproject.content_profile_common',]
}
}
}
}
/^(RedHat|OracleLinux)$/: {
if ( $::operatingsystemrelease =~ /^6.*/ ) {
$ossec_service_provider = 'redhat'
$api_service_provider = 'redhat'
$wodle_openscap_content = {
'ssg-rhel-6-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_pci-dss', 'xccdf_org.ssgproject.content_profile_server',]
},
'cve-redhat-6-ds.xml' => {
'type' => 'xccdf',
}
}
}
if ( $::operatingsystemrelease =~ /^7.*/ ) {
$ossec_service_provider = 'systemd'
$api_service_provider = 'systemd'
$wodle_openscap_content = {
'ssg-rhel-7-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_pci-dss', 'xccdf_org.ssgproject.content_profile_common',]
},
'cve-redhat-7-ds.xml' => {
'type' => 'xccdf',
}
}
}
}
'Fedora': {
if ( $::operatingsystemrelease =~ /^(23|24|25).*/ ) {
$ossec_service_provider = 'redhat'
$api_service_provider = 'redhat'
$wodle_openscap_content = {
'ssg-fedora-ds.xml' => {
'type' => 'xccdf',
profiles => ['xccdf_org.ssgproject.content_profile_standard', 'xccdf_org.ssgproject.content_profile_common',]
},
}
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
'windows': {
$config_file = regsubst(sprintf('c:/Program Files (x86)/ossec-agent/ossec.conf'), '\\\\', '/')
$shared_agent_config_file = regsubst(sprintf('c:/Program Files (x86)/ossec-agent/shared/agent.conf'), '\\\\', '/')
$config_owner = 'Administrator'
$config_group = 'Administrators'
$manage_firewall = false
$keys_file = regsubst(sprintf('c:/Program Files (x86)/ossec-agent/client.keys'), '\\\\', '/')
$keys_mode = '0440'
$keys_owner = 'Administrator'
$keys_group = 'Administrators'
$agent_service = 'OssecSvc'
$agent_package = 'Wazuh Agent 3.9.1'
$server_service = ''
$server_package = ''
$api_service = ''
$api_package = ''
$service_has_status = true
# TODO
$validate_cmd_conf = undef
# Pushed by shared agent config now
$default_local_files = [
{'location' => 'Security' , 'log_format' => 'eventchannel', 'query' => 'Event/System[EventID != 5145 and EventID != 5156 and EventID != 5447 and EventID != 4656 and EventID != 4658 and EventID != 4663 and EventID != 4660 and EventID != 4670 and EventID != 4690 and EventID != 4703 and EventID != 4907]'},
{'location' => 'System' , 'log_format' => 'eventlog' },
{'location' => 'active-response\active-responses.log' , 'log_format' => 'syslog' },
]
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}

View File

@@ -0,0 +1,71 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Repo installation
class wazuh::repo (
$redhat_manage_epel = true,
) {
case $::osfamily {
'Debian' : {
if ! defined(Package['apt-transport-https']) {
ensure_packages(['apt-transport-https'], {'ensure' => 'present'})
}
# apt-key added by issue #34
apt::key { 'wazuh':
id => '0DCFCA5547B19D2A6099506096B3EE5F29111145',
source => 'https://packages.wazuh.com/key/GPG-KEY-WAZUH',
server => 'pgp.mit.edu'
}
case $::lsbdistcodename {
/(jessie|wheezy|stretch|sid|precise|trusty|vivid|wily|xenial|yakketi|bionic)/: {
apt::source { 'wazuh':
ensure => present,
comment => 'This is the WAZUH Ubuntu repository',
location => 'https://packages.wazuh.com/3.x/apt',
release => 'stable',
repos => 'main',
include => {
'src' => false,
'deb' => true,
},
}
}
default: { fail('This ossec module has not been tested on your distribution (or lsb package not installed)') }
}
}
'Linux', 'Redhat' : {
case $::os[name] {
/^(CentOS|RedHat|OracleLinux|Fedora|Amazon)$/: {
if ( $::operatingsystemrelease =~ /^5.*/ ) {
$baseurl = 'https://packages.wazuh.com/3.x/yum/5/'
$gpgkey = 'http://packages.wazuh.com/key/GPG-KEY-WAZUH-5'
} else {
$baseurl = 'https://packages.wazuh.com/3.x/yum/'
$gpgkey = 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
}
}
default: { fail('This ossec module has not been tested on your distribution.') }
}
# Set up OSSEC repo
yumrepo { 'wazuh':
descr => 'WAZUH OSSEC Repository - www.wazuh.com',
enabled => true,
gpgcheck => 1,
gpgkey => $gpgkey,
baseurl => $baseurl
}
if $redhat_manage_epel {
# Set up EPEL repo
# NOTE: This relies on the 'epel' module referenced in metadata.json
package { 'inotify-tools':
ensure => present
}
include epel
Class['epel'] -> Package['inotify-tools']
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}

View File

@@ -0,0 +1,23 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#Define for a Reports section
define wazuh::reports(
Optional[String] $r_group = undef,
Optional[String] $r_category = undef,
Optional[Integer] $r_rule = undef,
Optional[Integer[1,16]] $r_level = undef,
Optional[String] $r_location = undef,
Optional[String] $r_srcip = undef,
Optional[String] $r_user = undef,
String $r_title = '',
String $r_email_to = '',
Optional[Enum['yes', 'no']] $r_showlogs = undef,
) {
require wazuh::params
concat::fragment { $name:
target => 'ossec.conf',
order => 70,
content => template('wazuh/fragments/_reports.erb')
}
}

View File

@@ -0,0 +1,293 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Main ossec server config
class wazuh::server (
$smtp_server = undef,
$ossec_emailto = [],
$ossec_emailfrom = "wazuh@${::domain}",
$ossec_active_response = true,
$ossec_rootcheck = true,
$ossec_rootcheck_frequency = 36000,
$ossec_rootcheck_checkports = true,
$ossec_rootcheck_checkfiles = true,
$ossec_global_host_information_level = 8,
$ossec_global_stat_level = 8,
$ossec_email_alert_level = 7,
$ossec_ignorepaths = [],
$ossec_ignorepaths_regex = [],
$ossec_scanpaths = [ {'path' => '/etc,/usr/bin,/usr/sbin', 'report_changes' => 'no', 'realtime' => 'no'}, {'path' => '/bin,/sbin', 'report_changes' => 'yes', 'realtime' => 'yes'} ],
$ossec_white_list = [],
$ossec_extra_rules_config = [],
$ossec_local_files = $::wazuh::params::default_local_files,
$ossec_emailnotification = true,
$ossec_email_maxperhour = '12',
$ossec_email_idsname = undef,
$ossec_syscheck_frequency = 79200,
$ossec_auto_ignore = 'yes',
$ossec_prefilter = false,
$ossec_service_provider = $::wazuh::params::ossec_service_provider,
$api_service_provider = $::wazuh::params::api_service_provider,
$ossec_server_port = '1514',
$ossec_server_protocol = 'udp',
$ossec_integratord_enabled = false,
$server_package_version = 'installed',
$api_package_version = 'installed',
$api_config_params = $::wazuh::params::api_config_params,
$manage_repos = true,
$manage_epel_repo = true,
$manage_client_keys = 'authd',
$install_wazuh_api = false,
$wazuh_api_enable_https = false,
$wazuh_api_server_crt = undef,
$wazuh_api_server_key = undef,
$manage_nodejs = true,
$nodejs_repo_url_suffix = '6.x',
$agent_auth_password = undef,
$ar_repeated_offenders = '',
$syslog_output = false,
$syslog_output_level = 2,
$syslog_output_port = 514,
$syslog_output_server = undef,
$syslog_output_format = undef,
$enable_wodle_openscap = false,
$wodle_openscap_content = $::wazuh::params::wodle_openscap_content,
$local_decoder_template = 'wazuh/local_decoder.xml.erb',
$decoder_exclude = [],
$local_rules_template = 'wazuh/local_rules.xml.erb',
$rule_exclude = [],
$shared_agent_template = 'wazuh/ossec_shared_agent.conf.erb',
$api_config_template = 'wazuh/api/config.js.erb',
$wazuh_manager_verify_manager_ssl = false,
$wazuh_manager_server_crt = undef,
$wazuh_manager_server_key = undef,
$ossec_auth_ssl_cert = undef,
$ossec_auth_ssl_key = undef,
$ossec_auth_ssl_ca = undef,
Boolean $manage_firewall = $::wazuh::params::manage_firewall,
Integer $ossec_auth_port = 1515,
Boolean $ossec_auth_use_srcip = false,
Boolean $ossec_auth_use_password = false,
Boolean $ossec_auth_force_insert = false,
Boolean $ossec_auth_purge = false,
) inherits wazuh::params {
validate_bool(
$ossec_active_response, $ossec_rootcheck,
$manage_repos, $manage_epel_repo, $syslog_output,
$install_wazuh_api, $wazuh_manager_verify_manager_ssl
)
validate_array(
$decoder_exclude, $rule_exclude
)
# This allows arrays of integers, sadly
# (commented due to stdlib version requirement)
validate_array($ossec_ignorepaths)
if ( $ossec_emailnotification ) {
if $smtp_server == undef {
fail('$ossec_emailnotification is enabled but $smtp_server was not set')
}
validate_string($smtp_server)
validate_string($ossec_emailfrom)
validate_array($ossec_emailto)
}
if $::osfamily == 'windows' {
fail('The ossec module does not yet support installing the OSSEC HIDS server on Windows')
}
if $manage_repos {
# TODO: Allow filtering of EPEL requirement
class { 'wazuh::repo': redhat_manage_epel => $manage_epel_repo }
if $::osfamily == 'Debian' {
Class['wazuh::repo'] -> Class['apt::update'] -> Package[$wazuh::params::server_package]
} else {
Class['wazuh::repo'] -> Package[$wazuh::params::server_package]
}
}
# install package
package { $wazuh::params::server_package:
ensure => $server_package_version, # lint:ignore:security_package_pinned_version
}
file {
default:
owner => $wazuh::params::config_owner,
group => $wazuh::params::config_group,
mode => $wazuh::params::config_mode,
notify => Service[$wazuh::params::server_service],
require => Package[$wazuh::params::server_package];
$wazuh::params::shared_agent_config_file:
validate_cmd => $wazuh::params::validate_cmd_conf,
content => template($shared_agent_template);
'/var/ossec/etc/rules/local_rules.xml':
content => template($local_rules_template);
'/var/ossec/etc/decoders/local_decoder.xml':
content => template($local_decoder_template);
$wazuh::params::processlist_file:
content => template('wazuh/process_list.erb');
}
service { $wazuh::params::server_service:
ensure => running,
enable => true,
hasstatus => $wazuh::params::service_has_status,
pattern => $wazuh::params::server_service,
provider => $ossec_service_provider,
require => Package[$wazuh::params::server_package],
}
concat { 'ossec.conf':
path => $wazuh::params::config_file,
owner => $wazuh::params::config_owner,
group => $wazuh::params::config_group,
mode => $wazuh::params::config_mode,
require => Package[$wazuh::params::server_package],
notify => Service[$wazuh::params::server_service],
#validate_cmd => $wazuh::params::validate_cmd_conf, # not yet implemented, see https://github.com/wazuh/wazuh/issues/86
}
concat::fragment {
default:
target => 'ossec.conf',
notify => Service[$wazuh::params::server_service];
'ossec.conf_header':
order => 00,
content => "<ossec_config>\n";
'ossec.conf_agent':
order => 10,
content => template('wazuh/wazuh_manager.conf.erb');
'ossec.conf_footer':
order => 99,
content => '</ossec_config>';
}
if ( $manage_client_keys == 'export' ) {
concat { $wazuh::params::keys_file:
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
notify => Service[$wazuh::params::server_service],
require => Package[$wazuh::params::server_package],
}
concat::fragment { 'var_ossec_etc_client.keys_end' :
target => $wazuh::params::keys_file,
order => 99,
content => "\n",
notify => Service[$wazuh::params::server_service]
}
# A separate module to avoid storeconfigs warnings when not managing keys
include wazuh::collect_agent_keys
}
if ( $manage_client_keys == 'authd') {
# TODO: ensure the authd service is started if manage_client_keys == authd
# (see https://github.com/wazuh/wazuh/issues/80)
file { $wazuh::params::authd_pass_file:
owner => $wazuh::params::keys_owner,
group => $wazuh::params::keys_group,
mode => $wazuh::params::keys_mode,
content => $agent_auth_password,
require => Package[$wazuh::params::server_package],
}
}
# https://documentation.wazuh.com/current/user-manual/registering/use-registration-service.html#verify-manager-via-ssl
if $wazuh_manager_verify_manager_ssl {
if ($wazuh_manager_server_crt != undef) and ($wazuh_manager_server_key != undef) {
validate_string(
$wazuh_manager_server_crt, $wazuh_manager_server_key
)
file { '/var/ossec/etc/sslmanager.key':
content => $wazuh_manager_server_key,
owner => 'root',
group => 'ossec',
mode => '0640',
require => Package[$wazuh::params::server_package],
notify => Service[$wazuh::params::server_service],
}
file { '/var/ossec/etc/sslmanager.cert':
content => $wazuh_manager_server_crt,
owner => 'root',
group => 'ossec',
mode => '0640',
require => Package[$wazuh::params::server_package],
notify => Service[$wazuh::params::server_service],
}
}
}
### Wazuh API
if $install_wazuh_api {
validate_bool($manage_nodejs)
if $manage_nodejs {
validate_string($nodejs_repo_url_suffix)
class { '::nodejs': repo_url_suffix => $nodejs_repo_url_suffix }
Class['nodejs'] -> Package[$wazuh::params::api_package]
}
package { $wazuh::params::api_package:
ensure => $api_package_version, # lint:ignore:security_package_pinned_version
}
if $wazuh_api_enable_https {
validate_string($wazuh_api_server_crt, $wazuh_api_server_key)
file { '/var/ossec/api/configuration/ssl/server.key':
content => $wazuh_api_server_key,
owner => 'root',
group => 'ossec',
mode => '0600',
require => Package[$wazuh::params::api_package],
notify => Service[$wazuh::params::api_service],
}
file { '/var/ossec/api/configuration/ssl/server.crt':
content => $wazuh_api_server_crt,
owner => 'root',
group => 'ossec',
mode => '0600',
require => Package[$wazuh::params::api_package],
notify => Service[$wazuh::params::api_service],
}
}
# wazuh-api config.js
# this hash is currently only covering the basic config section of config.js
# TODO: allow customization of the entire config.js
# for reference: https://documentation.wazuh.com/current/user-manual/api/configuration.html
file { '/var/ossec/api/configuration/config.js':
content => template($api_config_template),
owner => 'root',
group => 'ossec',
mode => '0750',
require => Package[$wazuh::params::api_package],
notify => Service[$wazuh::params::api_service],
}
service { $wazuh::params::api_service:
ensure => running,
enable => true,
hasstatus => $wazuh::params::service_has_status,
pattern => $wazuh::params::api_service,
provider => $api_service_provider,
require => Package[$wazuh::params::api_package],
}
}
# Manage firewall
if $manage_firewall {
include firewall
firewall { '1514 wazuh-manager':
dport => $ossec_server_port,
proto => $ossec_server_protocol,
action => 'accept',
state => [
'NEW',
'RELATED',
'ESTABLISHED'],
}
}
}

View File

@@ -0,0 +1,101 @@
{
"name": "wazuh-wazuh",
"version": "3.9.1",
"author": "WAZUH",
"summary": "Install and configure Wazuh-HIDS client and server",
"license": "Apache-2.0",
"source": "https://github.com/wazuh/wazuh-puppet",
"project_page": "https://github.com/wazuh/wazuh-puppet",
"issues_url": "https://github.com/wazuh/wazuh-puppet/issues",
"tags": ["ossec", "hids", "3.9", "wazuh"],
"operatingsystem_support": [
{
"operatingsystem": "Windows",
"operatingsystemrelease": [
"Server 2003 R2",
"Server 2008 R2",
"Server 2012",
"Server 2016",
"Server 2012 R2",
"Windows 2008",
"Windows 10"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "Fedora",
"operatingsystemrelease": [
"22",
"23",
"24",
"25"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"Precise",
"Trusty",
"Vivid",
"Wily",
"Xenial",
"Yakketi",
"Bionic"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"Wheezy",
"Jessie",
"Stretch",
"Sid"
]
}
],
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_range": ">= 1.0.0"
},
{
"name": "puppetlabs/concat",
"version_range": ">= 1.0.0"
},
{
"name": "stahnma/epel",
"version_range": ">= 1.0.0"
},
{
"name": "puppetlabs/apt",
"version_range": ">= 2.0.0"
},
{
"name": "puppet/selinux",
"version_range": ">= 0.8.0"
},
{
"name": "puppet/nodejs",
"version_range": ">= 3.0.0 < 4.0.0"
},
{
"name": "puppetlabs/firewall",
"version_range": ">= 1.7.0"
}
]
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<utility xmlns="http://www.github/cliffe/SecGen/utility"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/utility">
<name>Wazuh</name>
<author>Thomas Shaw</author>
<author>Wazuh</author>
<module_license>GPLv2</module_license>
<description>TODO</description>
<type>log_tool</type>
<platform>linux</platform>
<read_fact>component</read_fact>
<default_input into="component">
<value>server</value>
<!--<value>agent</value>-->
</default_input>
<requires>
<type>update</type>
</requires>
</utility>

View File

@@ -0,0 +1,39 @@
require 'spec_helper'
describe 'wazuh::client' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) do
facts.merge({ :concat_basedir => '/dummy' })
end
context 'with defaults for all parameters' do
it do
expect { is_expected.to compile.with_all_deps }.to raise_error(/must pass either/)
end
end
context 'with ossec_server_ip' do
let (:params) do
{
:ossec_server_ip => '127.0.0.1',
}
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('wazuh::client') }
it { is_expected.not_to contain_Concat__Fragment('ossec.conf_10').with_content(/<server-hostname>local.test<\/server-hostname>/) }
it { is_expected.to contain_Concat__Fragment('ossec.conf_10').with_content(/<server-ip>127.0.0.1<\/server-ip>/) }
end
context 'with ossec_server_hostname' do
let (:params) do
{
:ossec_server_hostname => 'local.test',
}
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('wazuh::client') }
it { is_expected.not_to contain_Concat__Fragment('ossec.conf_10').with_content(/<server-ip>127.0.0.1<\/server-ip>/) }
it { is_expected.to contain_Concat__Fragment('ossec.conf_10').with_content(/<server-hostname>local.test<\/server-hostname>/) }
end
end
end
end

View File

@@ -0,0 +1,12 @@
require 'spec_helper'
describe 'ossec' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) { facts }
context 'with defaults for all parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('ossec') }
end
end
end
end

View File

@@ -0,0 +1,25 @@
require 'spec_helper'
describe 'wazuh::server' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) do
facts.merge({ :concat_basedir => '/dummy' })
end
context 'with defaults for all parameters' do
it do
expect { is_expected.to compile.with_all_deps }.to raise_error(/Must pass smtp_server/)
end
end
context 'with valid paramaters' do
let (:params) do
{
:smtp_server => '127.0.0.1',
:ossec_emailto => 'root@localhost.localdomain',
}
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('wazuh::server') }
end
end
end
end

View File

@@ -0,0 +1,23 @@
dir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift File.join(dir, 'lib')
require 'mocha'
require 'puppet'
require 'rspec'
require 'rspec-puppet-facts'
require 'puppetlabs_spec_helper/module_spec_helper'
include RspecPuppetFacts
#require 'spec/autorun'
#Spec::Runner.configure do |config|
RSpec.configure do |config|
config.mock_with :mocha
end
# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
#class Object
# alias :must :should
#end

View File

@@ -0,0 +1,42 @@
var config = {};
// Basic configuration
<% @api_config_params.each do |config| -%>
config.<%= config['name'] %> = "<%= config['value'] %>";
<% end -%>
// Advanced configuration
// Values for API log: disabled, info, warning, error, debug (each level includes the previous level).
config.logs = "info";
// Cross-origin resource sharing. Values: yes, no.
config.cors = "yes";
// Cache (time in milliseconds)
config.cache_enabled = "yes";
config.cache_debug = "no";
config.cache_time = "750";
// Log path
config.log_path = config.ossec_path + "/logs/api.log";
// Python
config.python = [
// Default installation
{
bin: "python",
lib: ""
},
// Python 3
{
bin: "python3",
lib: ""
},
// Package 'python27' for CentOS 6
{
bin: "/opt/rh/python27/root/usr/bin/python",
lib: "/opt/rh/python27/root/usr/lib64"
}
];
// Shared library path
config.ld_library_path = config.ossec_path + "/api/framework/lib"
module.exports = config;

View File

@@ -0,0 +1,6 @@
<command>
<name><%= @command_name %></name>
<executable><%= @command_executable %></executable>
<expect><%= @command_expect %></expect>
<timeout_allowed><%= @command_timeout_allowed %></timeout_allowed>
</command>

View File

@@ -0,0 +1,4 @@
<email_alerts>
<email_to><%= @alert_email %></email_to>
<% if @alert_group != false -%><group><% @alert_group.each do |gr| -%><%= gr %>,<% end %></group><% end %>
</email_alerts>

View File

@@ -0,0 +1,15 @@
<active-response>
<command><%= @command_name %></command>
<% if @ar_agent_id != '' -%>
<agent_id><%= @ar_agent_id %></agent_id>
<% end -%>
<location><%= @ar_location %></location>
<level><%= @ar_level %></level>
<% if !@ar_rules_id.empty? -%>
<rules_id><% @ar_rules_id.each do |ruleid| -%><%= ruleid %>,<% end %></rules_id>
<% end %>
<timeout><%= @ar_timeout %></timeout>
<% if @ar_repeated_offenders != '' -%>
<repeated_offenders><%= @ar_repeated_offenders %></repeated_offenders>
<% end -%>
</active-response>

View File

@@ -0,0 +1,30 @@
<!-- Client Authentication Settings -->
<auth>
<%- if @manage_client_keys == 'authd' -%>
<disabled>no</disabled>
<port><%= @ossec_auth_port %></port>
<%- if @ossec_auth_ssl_ca -%>
<ssl_agent_ca><%= @ossec_auth_ssl_ca%></ssl_agent_ca>
<%- end -%>
<%- if @ossec_auth_ssl_cert -%>
<ssl_manager_cert><%= @ossec_auth_ssl_cert%></ssl_manager_cert>
<%- end -%>
<%- if @ossec_auth_ssl_key -%>
<ssl_manager_key><%= @ossec_auth_ssl_key%></ssl_manager_key>
<%- end -%>
<%- if @ossec_auth_use_srcip -%>
<use_source_ip>yes</use_source_ip>
<%- end -%>
<%- if @ossec_auth_use_password -%>
<use_password>yes</use_password>
<%- end -%>
<%- if @ossec_auth_force_insert -%>
<force_insert>yes</force_insert>
<%- end -%>
<%- if @ossec_auth_purge -%>
<purge>yes</purge>
<%- end -%>
<%- else -%>
<disabled>yes</disabled>
<%- end -%>
</auth>

View File

@@ -0,0 +1,17 @@
<cluster>
<name><%= @cl_name %></name>
<node_name><%= @cl_node_name %></node_name>
<node_type><%= @cl_node_type %></node_type>
<% if @cl_key != '' -%>
<key><%= @cl_key %></key>
<% end -%>
<port><%= @cl_port %></port>
<bind_addr><%= @cl_bin_addr %></bind_addr>
<nodes>
<% @cl_node.each do |node| %>
<node><%= node %></node>
<% end %>
</nodes>
<hidden><%= @cl_hidden %></hidden>
<disabled><%= @cl_disabled %></disabled>
</cluster>

View File

@@ -0,0 +1,103 @@
<!-- Most of these rules are defined in the shared agent config -->
<syscheck>
<!-- Frequency that syscheck is executed -->
<frequency><%= @ossec_syscheck_frequency %></frequency>
<scan_on_start>yes</scan_on_start>
<alert_new_files>yes</alert_new_files>
<auto_ignore><%= @ossec_auto_ignore %></auto_ignore>
<!-- Directories to check (perform all possible verifications) -->
<%- @ossec_scanpaths.each do |scanpath| -%> <directories check_all="yes" report_changes="<%= scanpath["report_changes"] %>" realtime="<%= scanpath['realtime'] %>" whodata="<%= scanpath['whodata'] || 'no' %>"><%= scanpath['path'] %></directories>
<%- end -%>
<!-- Files/directories to ignore (parameterized) -->
<%- @ossec_ignorepaths.each do |path| -%>
<ignore><%= path %></ignore>
<%- end -%>
<% @ossec_ignorepaths_regex.each do |path| -%>
<ignore type="sregex"><%= path %></ignore>
<% end -%>
<%- if @ossec_prefilter == true then %>
<prefilter_cmd>/usr/sbin/prelink -y</prefilter_cmd>
<%- end -%>
</syscheck>
<%- if @ossec_rootcheck == false then -%>
<rootcheck>
<disabled>yes</disabled>
<rootcheck>
<%- if @ossec_rootcheck_frequency then -%>
<frequency><%= @ossec_rootcheck_frequency %></frequency>
<%- end -%>
<%- if @ossec_rootcheck_checkports == false then -%>
<check_ports>no</check_ports>
<%- end -%>
<%- if @ossec_rootcheck_checkfiles == false then -%>
<check_files>no</check_files>
<%- end -%>
</rootcheck>
<%- end -%>
<%- if @ar_repeated_offenders != '' and @ossec_active_response -%>
<active-response>
<repeated_offenders><%= @ar_repeated_offenders %></repeated_offenders>
</active-response>
<%- elsif !@ossec_active_response -%>
<active-response>
<disabled>yes</disabled>
</active-response>
<%- end -%>
<!-- Files to monitor (localfiles) -->
<%- @ossec_local_files.each do |localfile| -%>
<localfile>
<log_format><%= localfile['log_format'] %></log_format>
<%- if localfile.key?('location') -%>
<location><%= localfile['location'] %></location>
<%- end -%>
<%- if localfile.key?('frequency') -%>
<frequency><%= localfile['frequency'] %></frequency>
<%- end -%>
<%- if localfile.key?('query') -%>
<query><%= localfile['query'] %></query>
<%- end -%>
<%- if localfile.key?('command') -%>
<command><%= localfile['command'] %></command>
<%- end -%>
<%- if localfile.key?('alias') -%>
<alias><%= localfile['alias'] %></alias>
<%- end -%>
<%- if localfile.key?('label') -%>
<label <%- if localfile['label'].key?('attributes') and localfile['label']['attributes'].key?('key') -%>key="<%= localfile['label']['attributes']['key'] %>"<%- end -%> ><%= localfile['label']['value']%></label>
<%- end -%>
<%- if localfile.key?('only-future-events') -%>
<only-future-events><%= localfile['only-future-events'] %></only-future-events>
<%- end -%>
<%- if localfile.key?('target') -%>
<target><%= localfile['target'] %></target>
<%- end -%>
<%- if localfile.key?('out_format') -%>
<out_format <%- if localfile['out_format'].key?('attributes') and localfile['out_format']['attributes'].key?('target') -%>target="<%= localfile['out_format']['attributes']['target'] %>"<%- end -%> ><%= localfile['out_format']['value'] %></out_format>
<%- end -%>
</localfile>
<%- end %>
<%- if @kernel == 'Linux' -%>
<localfile>
<log_format>command</log_format>
<command>df -P</command>
<frequency>360</frequency>
</localfile>
<localfile>
<log_format>full_command</log_format>
<command>netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d</command>
<alias>netstat listening ports</alias>
<frequency>360</frequency>
</localfile>
<localfile>
<log_format>full_command</log_format>
<command>last -n 20</command>
<frequency>360</frequency>
</localfile>
<%- end %>

View File

@@ -0,0 +1,23 @@
<integration>
<name><%= @name %></name>
<% if @hook_url != '' -%>
<hook_url><%= @hook_url %></hook_url>
<% end %>
<% if @api_key != '' -%>
<api_key><%= @api_key %></api_key>
<% end %>
<% if @in_rule_id != '' -%>
<rule_id><%= @in_rule_id %></rule_id>
<% end %>
<% if @in_level != '' -%>
<level><%= @in_level %></level>
<% end %>
<group><%= @in_group %></group>
<% if @in_location != '' -%>
<event_location><%= @in_location %></event_location>
<% end %>
<alert_format><%= @in_format %></alert_format>
<% if @in_max_log != '' -%>
<max_log><%= @in_max_log %></max_log>
<% end %>
</integration>

View File

@@ -0,0 +1,15 @@
<localfile>
<log_format><%= @logtype %></log_format>
<%- if @logfile -%>
<location><%= @logfile %></location>
<%- end -%>
<%- if @logcommand -%>
<command><%= @logcommand %> </command>
<%- end -%>
<%- if @commandalias -%>
<alias><%= @commandalias %> </alias>
<%- end -%>
<%- if @frequency -%>
<frequency><%= @frequency %></frequency>
<%- end -%>
</localfile>

View File

@@ -0,0 +1,28 @@
<reports>
<%- if defined?(@r_group) -%>
<group><%= @r_group %></group>
<%- end -%>
<%- if defined?(@r_category) -%>
<category><%= @r_category %></category>
<%- end -%>
<%- if defined?(@r_rule) -%>
<rule><%= @r_rule %></rule>
<%- end -%>
<%- if defined?(@r_level) -%>
<level><%= @r_level %></level>
<%- end -%>
<%- if defined?(@r_location) -%>
<location><%= @r_location %></location>
<%- end -%>
<%- if defined?(@r_srcip) -%>
<srcip><%= @r_srcip %><srcip/>
<%- end -%>
<%- if defined?(@r_user) -%>
<user><%= @r_user %></user>
<%- end -%>
<title><%= @r_title %></title>
<email_to><%= @r_email_to %></email_to>
<%- if defined?(@r_showlogs) -%>
<showlogs><%= @r_showlogs %></showlogs>
<%- end -%>
</reports>

View File

@@ -0,0 +1,25 @@
<!-- Rootcheck files (static) -->
<rootcheck>
<disabled>no</disabled>
<check_unixaudit>yes</check_unixaudit>
<check_files>yes</check_files>
<check_trojans>yes</check_trojans>
<check_dev>yes</check_dev>
<check_sys>yes</check_sys>
<check_pids>yes</check_pids>
<check_ports>yes</check_ports>
<check_if>yes</check_if>
<!-- Frequency that rootcheck is executed - every 12 hours -->
<frequency><%= @ossec_rootcheck_frequency %></frequency>
<rootkit_files>/var/ossec/etc/shared/rootkit_files.txt</rootkit_files>
<rootkit_trojans>/var/ossec/etc/shared/rootkit_trojans.txt</rootkit_trojans>
<system_audit>/var/ossec/etc/shared/system_audit_rcl.txt</system_audit>
<system_audit>/var/ossec/etc/shared/system_audit_ssh.txt</system_audit>
<system_audit>/var/ossec/etc/shared/cis_debian_linux_rcl.txt</system_audit>
<system_audit>/var/ossec/etc/shared/cis_rhel_linux_rcl.txt</system_audit>
<system_audit>/var/ossec/etc/shared/cis_rhel5_linux_rcl.txt</system_audit>
<skip_nfs>yes</skip_nfs>
</rootcheck>

View File

@@ -0,0 +1,6 @@
<!-- Rootcheck files (static) -->
<rootcheck>
<windows_audit>./shared/win_audit_rcl.txt</windows_audit>
<windows_apps>./shared/win_applications_rcl.txt</windows_apps>
<windows_malware>./shared/win_malware_rcl.txt</windows_malware>
</rootcheck>

View File

@@ -0,0 +1,21 @@
<syscheck>
<!-- Directories to check (perform all possible verifications) -->
<directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
<directories check_all="yes">/bin,/sbin,/boot</directories>
<!-- Files/directories to ignore -->
<ignore>/etc/mtab</ignore>
<ignore>/etc/mnttab</ignore>
<ignore>/etc/hosts.deny</ignore>
<ignore>/etc/mail/statistics</ignore>
<ignore>/etc/random-seed</ignore>
<ignore>/etc/adjtime</ignore>
<ignore>/etc/httpd/logs</ignore>
<ignore>/etc/utmpx</ignore>
<ignore>/etc/wtmpx</ignore>
<ignore>/etc/cups/certs</ignore>
<ignore>/etc/dumpdates</ignore>
<ignore>/etc/svc/volatile</ignore>
<ignore>/etc/puppetlabs/mcollective/facts.yaml</ignore>
<ignore>/etc/mcollective/facts.yaml</ignore>
</syscheck>

View File

@@ -0,0 +1,85 @@
<syscheck>
<!-- Default files to be monitored - system32 only. -->
<directories check_all="yes">%WINDIR%/win.ini</directories>
<directories check_all="yes">%WINDIR%/system.ini</directories>
<directories check_all="yes">C:\autoexec.bat</directories>
<directories check_all="yes">C:\config.sys</directories>
<directories check_all="yes">C:\boot.ini</directories>
<directories check_all="yes">%WINDIR%/System32/CONFIG.NT</directories>
<directories check_all="yes">%WINDIR%/System32/AUTOEXEC.NT</directories>
<directories check_all="yes">%WINDIR%/System32/at.exe</directories>
<directories check_all="yes">%WINDIR%/System32/attrib.exe</directories>
<directories check_all="yes">%WINDIR%/System32/cacls.exe</directories>
<directories check_all="yes">%WINDIR%/System32/debug.exe</directories>
<directories check_all="yes">%WINDIR%/System32/drwatson.exe</directories>
<directories check_all="yes">%WINDIR%/System32/drwtsn32.exe</directories>
<directories check_all="yes">%WINDIR%/System32/edlin.exe</directories>
<directories check_all="yes">%WINDIR%/System32/eventcreate.exe</directories>
<directories check_all="yes">%WINDIR%/System32/eventtriggers.exe</directories>
<directories check_all="yes">%WINDIR%/System32/ftp.exe</directories>
<directories check_all="yes">%WINDIR%/System32/net.exe</directories>
<directories check_all="yes">%WINDIR%/System32/net1.exe</directories>
<directories check_all="yes">%WINDIR%/System32/netsh.exe</directories>
<directories check_all="yes">%WINDIR%/System32/rcp.exe</directories>
<directories check_all="yes">%WINDIR%/System32/reg.exe</directories>
<directories check_all="yes">%WINDIR%/regedit.exe</directories>
<directories check_all="yes">%WINDIR%/System32/regedt32.exe</directories>
<directories check_all="yes">%WINDIR%/System32/regsvr32.exe</directories>
<directories check_all="yes">%WINDIR%/System32/rexec.exe</directories>
<directories check_all="yes">%WINDIR%/System32/rsh.exe</directories>
<directories check_all="yes">%WINDIR%/System32/runas.exe</directories>
<directories check_all="yes">%WINDIR%/System32/sc.exe</directories>
<directories check_all="yes">%WINDIR%/System32/subst.exe</directories>
<directories check_all="yes">%WINDIR%/System32/telnet.exe</directories>
<directories check_all="yes">%WINDIR%/System32/tftp.exe</directories>
<directories check_all="yes">%WINDIR%/System32/tlntsvr.exe</directories>
<directories check_all="yes">%WINDIR%/System32/drivers/etc</directories>
<directories check_all="yes" realtime="yes">C:\Documents and Settings/All Users/Start Menu/Programs/Startup</directories>
<directories check_all="yes" realtime="yes">C:\Users/Public/All Users/Microsoft/Windows/Start Menu/Startup</directories>
<ignore type="sregex">.log$|.htm$|.jpg$|.png$|.chm$|.pnf$|.evtx$</ignore>
<!-- Windows registry entries to monitor. -->
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\batfile</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\cmdfile</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\comfile</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\exefile</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\piffile</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\AllFilesystemObjects</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\Directory</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\Folder</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Classes\Protocols</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Policies</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Security</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\KnownDLLs</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SecurePipeServers\winreg</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\URL</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon</windows_registry>
<windows_registry>HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components</windows_registry>
<!-- Windows files to ignore (static) -->
<ignore>%WINDIR%/System32/LogFiles</ignore>
<ignore>%WINDIR%/Debug</ignore>
<ignore>%WINDIR%/WindowsUpdate.log</ignore>
<ignore>%WINDIR%/iis6.log</ignore>
<ignore>%WINDIR%/system32/wbem/Logs</ignore>
<ignore>%WINDIR%/system32/wbem/Repository</ignore>
<ignore>%WINDIR%/Prefetch</ignore>
<ignore>%WINDIR%/PCHEALTH/HELPCTR/DataColl</ignore>
<ignore>%WINDIR%/SoftwareDistribution</ignore>
<ignore>%WINDIR%/Temp</ignore>
<ignore>%WINDIR%/system32/config</ignore>
<ignore>%WINDIR%/system32/spool</ignore>
<ignore>%WINDIR%/system32/CatRoot</ignore>
<!-- Windows registry entries to ignore. -->
<registry_ignore>HKEY_LOCAL_MACHINE\Security\Policy\Secrets</registry_ignore>
<registry_ignore>HKEY_LOCAL_MACHINE\Security\SAM\Domains\Account\Users</registry_ignore>
<registry_ignore type="sregex">\Enum$</registry_ignore>
</syscheck>

View File

@@ -0,0 +1,16 @@
<wodle name="open-scap">
<disabled>no</disabled>
<timeout>1800</timeout>
<interval>1d</interval>
<scan-on-start>yes</scan-on-start>
<%- @wodle_openscap_content.each do |path, value| -%>
<content type="<%= value['type'] %>" path="<%= path %>">
<%- if value['profiles'] then -%>
<%- value['profiles'].each do |profile| -%>
<profile><%= profile %></profile>
<%- end -%>
<%- end -%>
</content>
<%- end -%>
</wodle>

View File

@@ -0,0 +1,24 @@
<!-- Local Decoders -->
<!-- Modify it at your will. -->
<!--
- Allowed static fields:
- location - where the log came from (only on FTS)
- srcuser - extracts the source username
- dstuser - extracts the destination (target) username
- user - an alias to dstuser (only one of the two can be used)
- srcip - source ip
- dstip - dst ip
- srcport - source port
- dstport - destination port
- protocol - protocol
- id - event id
- url - url of the event
- action - event action (deny, drop, accept, etc)
- status - event status (success, failure, etc)
- extra_data - Any extra data
-->
<decoder name="local_decoder_example">
<program_name>local_decoder_example</program_name>
</decoder>

View File

@@ -0,0 +1,41 @@
<!-- Modify it at your will. -->
<group name="local,syslog,sshd,">
<!-- Note that rule id 5711 is defined at the ssh_rules file
- as a ssh failed login. This is just an example
- since ip 1.1.1.1 shouldn't be used anywhere.
- Level 0 means ignore.
-->
<rule id="100001" level="5">
<if_sid>5716</if_sid>
<srcip>1.1.1.1</srcip>
<description>sshd: authentication failed from IP 1.1.1.1.</description>
<group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,</group>
</rule>
<!-- This example will ignore ssh failed logins for the user name XYZABC.
-->
<!--
<rule id="100020" level="0">
<if_sid>5711</if_sid>
<user>XYZABC</user>
<description>Example of rule that will ignore sshd </description>
<description>failed logins for user XYZABC.</description>
</rule>
-->
<!-- Specify here a list of rules to ignore. -->
<!--
<rule id="100030" level="0">
<if_sid>12345, 23456, xyz, abc</if_sid>
<description>List of rules to be ignored.</description>
</rule>
-->
</group> <!-- SYSLOG,LOCAL -->
<!-- EOF -->

View File

@@ -0,0 +1,44 @@
<agent_config>
<% if @ossec_rootcheck == false then -%>
<rootcheck>
<disabled>yes</disabled>
</rootcheck>
<% end -%>
<syscheck>
<!-- Frequency that syscheck is executed -->
<frequency><%= @ossec_syscheck_frequency %></frequency>
<disabled>no</disabled>
</syscheck>
</agent_config>
<agent_config os="Linux">
<%= scope.function_template(["wazuh/fragments/_rootcheck_linux.erb"]) %>
<%= scope.function_template(["wazuh/fragments/_syscheck_linux.erb"]) %>
<!-- Log analysis -->
<localfile>
<log_format>syslog</log_format>
<location>/var/ossec/logs/active-responses.log</location>
</localfile>
</agent_config>
<agent_config os="Windows">
<%= scope.function_template(["wazuh/fragments/_rootcheck_windows.erb"]) %>
<%= scope.function_template(["wazuh/fragments/_syscheck_windows.erb"]) %>
<localfile>
<log_format>eventlog</log_format>
<location>Application</location>
</localfile>
<localfile>
<log_format>eventlog</log_format>
<location>Security</location>
</localfile>
<localfile>
<log_format>eventlog</log_format>
<location>System</location>
</localfile>
</agent_config>

View File

@@ -0,0 +1,8 @@
# This file managed by Puppet.
# Any changes will be overwritten
<% if @syslog_output -%>
CSYSLOG_DAEMON=ossec-csyslogd
<% end -%>
<% if @ossec_integratord_enabled -%>
INTEGRATOR_DAEMON=ossec-integratord
<% end -%>

View File

@@ -0,0 +1,40 @@
<client>
<server>
<%- if @ossec_server_ip then -%>
<address><%= @ossec_server_ip %></address>
<%- end -%>
<%- if @ossec_server_hostname then -%>
<address><%= @ossec_server_hostname %></address>
<%- end -%>
<%- if @wazuh_manager_address then -%>
<address><%= @wazuh_manager_address %></address>
<%- end -%>
<%- if @ossec_server_protocol then -%>
<protocol><%= @ossec_server_protocol %></protocol>
<%- end -%>
<port><%= @ossec_server_port %></port>
</server>
<%- if @ossec_config_profiles then -%>
<config-profile><%= @ossec_config_profiles.join(',') %></config-profile>
<%- end -%>
<%- if @ossec_server_notify_time then -%>
<notify_time><%= @ossec_server_notify_time %></notify_time>
<%- end -%>
<%- if @ossec_server_time_reconnect then -%>
<time-reconnect><%= @ossec_server_time_reconnect %></time-reconnect>
<%- end -%>
<auto_restart><%= @agent_auto_restart %></auto_restart>
</client>
<client_buffer>
<!-- Agent buffer options -->
<disabled>no</disabled>
<queue_size><%= @client_buffer_queue_size %></queue_size>
<events_per_second><%= @client_buffer_events_per_second %></events_per_second>
</client_buffer>
<%= scope.function_template(["wazuh/fragments/_common.erb"]) -%>
<%- if @enable_wodle_openscap and @wodle_openscap_content -%>
<%= scope.function_template(["wazuh/fragments/_wodle_openscap.erb"]) -%>
<%- end -%>

View File

@@ -0,0 +1,79 @@
<global>
<jsonout_output>yes</jsonout_output>
<alerts_log>yes</alerts_log>
<logall>no</logall>
<logall_json>no</logall_json>
<%- if @ossec_emailnotification -%>
<email_notification>yes</email_notification>
<%- @ossec_emailto.each do |emailto| -%>
<email_to><%= emailto %></email_to>
<%- end -%>
<smtp_server><%= @smtp_server %></smtp_server>
<email_from><%= @ossec_emailfrom %></email_from>
<email_maxperhour><%= @ossec_email_maxperhour %></email_maxperhour>
<%- unless @ossec_email_idsname.nil? -%>
<email_idsname><%= @ossec_email_idsname %></email_idsname>
<%- end -%>
<%- else -%>
<email_notification>no</email_notification>
<%- end -%>
<stats><%= @ossec_global_stat_level %></stats>
<host_information><%= @ossec_global_host_information_level %></host_information>
<%- @ossec_white_list.each do |ipaddress| -%><white_list><%= ipaddress %></white_list>
<%- end -%>
</global>
<%- if @syslog_output -%>
<syslog_output>
<server><%= @syslog_output_server %></server>
<port><%= @syslog_output_port %></port>
<format><%= @syslog_output_format %></format>
<level><%= @syslog_output_level %></level>
</syslog_output>
<%- end -%>
<%- if @use_mysql -%>
<database_output>
<hostname><%= @mysql_hostname %></hostname>
<username><%= @mysql_username %></username>
<password><%= @mysql_password %></password>
<database><%= @mysql_name %></database>
<type>mysql</type>
</database_output>
<%- end -%>
<ruleset>
<!-- Default ruleset -->
<decoder_dir>ruleset/decoders</decoder_dir>
<rule_dir>ruleset/rules</rule_dir>
<rule_exclude>0215-policy_rules.xml</rule_exclude>
<%- @rule_exclude.each do |r| -%>
<rule_exclude><%= r %></rule_exclude>
<%- end -%>
<list>etc/lists/audit-keys</list>
<!-- User-defined ruleset -->
<decoder_dir>etc/decoders</decoder_dir>
<rule_dir>etc/rules</rule_dir>
<%- @decoder_exclude.each do |r| -%>
<decoder_exclude><%= r %></decoder_exclude>
<%- end -%>
</ruleset>
<remote>
<connection>secure</connection>
<port><%= @ossec_server_port %></port>
<protocol><%= @ossec_server_protocol %></protocol>
</remote>
<%= scope.function_template(["wazuh/fragments/_common.erb"]) -%>
<%= scope.function_template(["wazuh/fragments/_auth.erb"]) -%>
<%- if @enable_wodle_openscap and @wodle_openscap_content -%>
<%= scope.function_template(["wazuh/fragments/_wodle_openscap.erb"]) -%>
<%- end -%>
<alerts>
<log_alert_level>3</log_alert_level>
<email_alert_level><%= @ossec_email_alert_level %></email_alert_level>
</alerts>

View File

@@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
include ossec

View File

@@ -0,0 +1,14 @@
$secgen_parameters = secgen_functions::get_parameters($::base64_inputs_file)
$component = $secgen_parameters['component'][0]
if ($component == 'server') {
class { '::wazuh::server':
smtp_server => 'localhost',
ossec_emailto => ['user@mycompany.com'],
agent_auth_password => '6663484170b2c69451e01ba11f319533', #todo: obviously fix this - must be 32char
}
} elsif ($component == 'client') {
class { "::wazuh::client":
ossec_server_ip => "192.168.209.166",
agent_name => 'test_name',
}
}

View File

@@ -0,0 +1,48 @@
<?xml version="1.0"?>
<scenario xmlns="http://www.github/cliffe/SecGen/scenario"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/scenario">
<!-- Roadmap:
1) Get Wazuh on a single host with agent and management component installed
2) Split this out onto separate hosts
3) Identify how to configure alerts
-->
<system>
<system_name>ids_server</system_name>
<base distro="Debian 9" type="server"/>
<utility module_path=".*wazuh.*">
<input into="component">
<value>server</value>
</input>
</utility>
<network type="private_network">
<input into="IP_address">
<value>192.168.209.166</value>
</input>
</network>
</system>
<system>
<system_name>client</system_name>
<base distro="Debian 9" type="server"/>
<utility module_path=".*wazuh.*">
<input into="component">
<value>client</value>
</input>
</utility>
<network type="private_network">
<input into="IP_address">
<value>192.168.209.165</value>
</input>
</network>
</system>
</scenario>