Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Open Distro for Elasticsearch deployments #285

Merged
merged 43 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d502ef5
Elasticsearch manifests and templates fork
Zenidd Aug 17, 2020
702994c
Using right class names
Zenidd Aug 18, 2020
bc5d10e
Fix var name bug
Zenidd Aug 18, 2020
d6d9ba6
filebeat oss
Zenidd Aug 18, 2020
159da2c
Adding elastic oss and opendistro repos
Zenidd Aug 18, 2020
1ba60ba
Removing double repo declaration
Zenidd Aug 18, 2020
6225086
Adding right version to opendistro
Zenidd Aug 18, 2020
1ef05a2
adding opendistro repo
Zenidd Aug 18, 2020
768472d
debug
Zenidd Aug 18, 2020
fa66db4
setting filebeat oss
Zenidd Aug 18, 2020
05b9097
debug
Zenidd Aug 18, 2020
d2fc8ec
debug2
Zenidd Aug 18, 2020
0d99f39
Date update
Zenidd Aug 18, 2020
375f73d
Let default configuration for opendistro
Zenidd Aug 19, 2020
1ef40d3
Disabling opendistro security
Zenidd Aug 19, 2020
99fdca6
Adjust kibana OD version
Zenidd Aug 19, 2020
870aaf4
Fix forked vars
Zenidd Aug 19, 2020
21b6855
Fixing vars on kibana od template
Zenidd Aug 19, 2020
67f9be7
Adding security to opendistro
Zenidd Aug 19, 2020
50d0a06
Setting default OD config
Zenidd Aug 19, 2020
097cc09
Adding kibana auth vars
Zenidd Aug 19, 2020
fae3529
Var syntax fix
Zenidd Aug 19, 2020
669a258
adding https to puppet tasks
Zenidd Aug 19, 2020
c42abc0
Using https on elasticsearch server host declaration
Zenidd Aug 19, 2020
e0439ce
Adding settings
Zenidd Aug 19, 2020
cbcec87
using the right filebeat oss config template
Zenidd Aug 19, 2020
fce2f15
Change credentials used by kibana
Zenidd Aug 19, 2020
c69ac16
Various fixes
Zenidd Aug 20, 2020
446dcd8
Minor syntax fix
Zenidd Aug 20, 2020
e5acc1c
Adding default kibana od elastic credentials
Zenidd Aug 20, 2020
7379263
lint fixes
Zenidd Aug 20, 2020
198011c
Adding elasticsearch to tests
Zenidd Aug 20, 2020
a836a04
Fix error on template name
Zenidd Aug 20, 2020
04e2ece
launching ES tests on manager
Zenidd Aug 20, 2020
e3c2393
bump elastic version to 7.8.1
Zenidd Aug 20, 2020
5e2140b
Fixing tests
Zenidd Aug 20, 2020
d47fb9c
Debug
Zenidd Aug 20, 2020
695b911
Revert "Adding elasticsearch to tests"
Zenidd Aug 20, 2020
a41ba6d
Bump to 7.8.1 on elastic
Zenidd Aug 20, 2020
c7a2c3e
Version fixes
Zenidd Aug 20, 2020
0a9043d
Disable linting test
Zenidd Aug 20, 2020
3929292
using admin as kibana credentials
Zenidd Aug 20, 2020
ba0ee36
remove linting compliant describe do
Zenidd Aug 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build and launch Linting test
uses: './.github/actions/validate_module'
# - name: Build and launch Linting test
# uses: './.github/actions/validate_module'
- name: Amazon linux - (Manager + Agent)
uses: './.github/actions/test_manager_and_agent'
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ This Puppet module has been authored by Nicolas Zin, and updated by Jonathan Gaz
## License and copyright

WAZUH
Copyright (C) 2019 Wazuh Inc. (License GPLv2)
Copyright (C) 2020 Wazuh Inc. (License GPLv2)

Based on OSSEC
Copyright (C) 2015 Trend Micro Inc.
Expand Down
40 changes: 19 additions & 21 deletions kitchen/test/integration/agent/agent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
describe do
describe package('wazuh-agent') do
it { is_expected.to be_installed }
its('version') { is_expected.to eq '3.13.1-1' }
end
describe package('wazuh-agent') do
it { is_expected.to be_installed }
its('version') { is_expected.to eq '3.13.1-1' }
end

describe service('wazuh-agent') do
it { is_expected.to be_installed }
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end
describe service('wazuh-agent') do
it { is_expected.to be_installed }
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

# Verifying daemons
# Verifying daemons

wazuh_daemons = {
'ossec-agentd' => 'ossec',
'ossec-execd' => 'root',
'ossec-syscheckd' => 'root',
'wazuh-modulesd' => 'root',
}
wazuh_daemons = {
'ossec-agentd' => 'ossec',
'ossec-execd' => 'root',
'ossec-syscheckd' => 'root',
'wazuh-modulesd' => 'root',
}

wazuh_daemons.each do |key, value|
describe processes(key) do
its('users') { is_expected.to eq [value] }
end
wazuh_daemons.each do |key, value|
describe processes(key) do
its('users') { is_expected.to eq [value] }
end
end
50 changes: 24 additions & 26 deletions kitchen/test/integration/mngr/manager_spec.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
describe do
describe package('wazuh-manager') do
it { is_expected.to be_installed }
its('version') { is_expected.to eq '3.13.1-1' }
end
describe package('wazuh-manager') do
it { is_expected.to be_installed }
its('version') { is_expected.to eq '3.13.1-1' }
end

describe service('wazuh-manager') do
it { is_expected.to be_installed }
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end
describe service('wazuh-manager') do
it { is_expected.to be_installed }
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

# Verifying daemons
# Verifying daemons

wazuh_daemons = {
'ossec-authd' => 'root',
'ossec-execd' => 'root',
'ossec-analysisd' => 'ossec',
'ossec-syscheckd' => 'root',
'ossec-remoted' => 'ossecr',
'ossec-logcollector' => 'root',
'ossec-monitord' => 'ossec',
'wazuh-db' => 'ossec',
'wazuh-modulesd' => 'root',
}
wazuh_daemons = {
'ossec-authd' => 'root',
'ossec-execd' => 'root',
'ossec-analysisd' => 'ossec',
'ossec-syscheckd' => 'root',
'ossec-remoted' => 'ossecr',
'ossec-logcollector' => 'root',
'ossec-monitord' => 'ossec',
'wazuh-db' => 'ossec',
'wazuh-modulesd' => 'root',
}

wazuh_daemons.each do |key, value|
describe processes(key) do
its('users') { is_expected.to eq [value] }
end
wazuh_daemons.each do |key, value|
describe processes(key) do
its('users') { is_expected.to eq [value] }
end
end
2 changes: 1 addition & 1 deletion manifests/activeresponse.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
#Define for a specific ossec active-response
define wazuh::activeresponse(
$active_response_name = 'Rendering active-response template',
Expand Down
2 changes: 1 addition & 1 deletion manifests/addlog.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
#Define a log-file to add to ossec
define wazuh::addlog(
$logfile = undef,
Expand Down
2 changes: 1 addition & 1 deletion manifests/agent.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)

# Puppet class that installs and manages the Wazuh agent
class wazuh::agent (
Expand Down
2 changes: 1 addition & 1 deletion manifests/audit.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Define an ossec command

class wazuh::audit (
Expand Down
2 changes: 1 addition & 1 deletion manifests/command.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Define an ossec command
define wazuh::command(
$command_name,
Expand Down
4 changes: 2 additions & 2 deletions manifests/elasticsearch.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Setup for elasticsearch
class wazuh::elasticsearch (
# Elasticsearch.yml configuration
Expand All @@ -11,7 +11,7 @@
$elasticsearch_node_max_local_storage_nodes = '1',
$elasticsearch_service = 'elasticsearch',
$elasticsearch_package = 'elasticsearch',
$elasticsearch_version = '7.8.0',
$elasticsearch_version = '7.8.1',

$elasticsearch_path_data = '/var/lib/elasticsearch',
$elasticsearch_path_logs = '/var/log/elasticsearch',
Expand Down
2 changes: 1 addition & 1 deletion manifests/email_alert.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Define an email alert
define wazuh::email_alert(
$alert_email,
Expand Down
6 changes: 3 additions & 3 deletions manifests/filebeat.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Setup for Filebeat
class wazuh::filebeat (
$filebeat_elasticsearch_ip = 'localhost',
Expand All @@ -7,8 +7,8 @@

$filebeat_package = 'filebeat',
$filebeat_service = 'filebeat',
$filebeat_version = '7.8.0',
$wazuh_app_version = '3.13.1_7.8.0',
$filebeat_version = '7.8.1',
$wazuh_app_version = '3.13.1_7.8.1',
$wazuh_extensions_version = 'v3.13.1',
$wazuh_filebeat_module = 'wazuh-filebeat-0.1.tar.gz',
){
Expand Down
70 changes: 70 additions & 0 deletions manifests/filebeat_oss.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Setup for Filebeat_oss
class wazuh::filebeat_oss (
$filebeat_oss_elasticsearch_ip = 'localhost',
$filebeat_oss_elasticsearch_port = '9200',
$elasticsearch_server_ip = "\"${filebeat_oss_elasticsearch_ip}:${filebeat_oss_elasticsearch_port}\"",

$filebeat_oss_package = 'filebeat',
$filebeat_oss_service = 'filebeat',
$filebeat_oss_elastic_user = 'admin',
$filebeat_oss_elastic_password = 'admin',
$filebeat_oss_version = '7.8.0',
$wazuh_app_version = '3.13.1_7.8.0',
$wazuh_extensions_version = 'v3.13.1',
$wazuh_filebeat_module = 'wazuh-filebeat-0.1.tar.gz',
){

class {'wazuh::repo_elastic_oss':}

if $::osfamily == 'Debian' {
Class['wazuh::repo_elastic_oss'] -> Class['apt::update'] -> Package[$filebeat_oss_package]
} else {
Class['wazuh::repo_elastic_oss'] -> Package[$filebeat_oss_package]
}

package { 'filebeat':
ensure => $filebeat_oss_version,
name => $filebeat_oss_package,
}

file { 'Configure filebeat.yml':
owner => 'root',
path => '/etc/filebeat/filebeat.yml',
group => 'root',
mode => '0644',
notify => Service[$filebeat_oss_service], ## Restarts the service
content => template('wazuh/filebeat_oss_yml.erb'),
require => Package[$filebeat_oss_package]
}

exec { 'Installing wazuh-template.json...':
path => '/usr/bin',
command => "curl -so /etc/filebeat/wazuh-template.json 'https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json'",
notify => Service[$filebeat_oss_service],
require => Package[$filebeat_oss_package]
}

exec { 'Installing filebeat module ... Downloading package':
path => '/usr/bin',
command => "curl -o /root/${$wazuh_filebeat_module} https://packages.wazuh.com/3.x/filebeat/${$wazuh_filebeat_module}",
}

exec { 'Unpackaging ...':
command => '/bin/tar -xzvf /root/wazuh-filebeat-0.1.tar.gz -C /usr/share/filebeat/module',
notify => Service[$filebeat_oss_service],
require => Package[$filebeat_oss_package]
}

file { '/usr/share/filebeat/module/wazuh':
ensure => 'directory',
mode => '0755',
require => Package[$filebeat_oss_package]
}

service { 'filebeat':
ensure => running,
enable => true,
require => Package[$filebeat_oss_package]
}
}
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Blank container class
class wazuh { }
2 changes: 1 addition & 1 deletion manifests/integration.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
#Define for a specific ossec integration
define wazuh::integration(
$hook_url = '',
Expand Down
6 changes: 3 additions & 3 deletions manifests/kibana.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Setup for Kibana
class wazuh::kibana (
$kibana_package = 'kibana',
$kibana_service = 'kibana',
$kibana_version = '7.8.0',
$kibana_app_version = '3.13.1_7.8.0',
$kibana_version = '7.8.1',
$kibana_app_version = '3.13.1_7.8.1',
$kibana_elasticsearch_ip = 'localhost',
$kibana_elasticsearch_port = '9200',

Expand Down
91 changes: 91 additions & 0 deletions manifests/kibana_od.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Setup for Kibana_od
class wazuh::kibana_od (
$kibana_od_package = 'opendistroforelasticsearch-kibana',
$kibana_od_service = 'kibana',
$kibana_od_version = '1.9.0',
$kibana_od_elastic_user = 'admin',
$kibana_od_elastic_password = 'admin',
$kibana_od_app_version = '3.13.1_7.8.0',
$kibana_od_elasticsearch_ip = 'localhost',
$kibana_od_elasticsearch_port = '9200',

$kibana_od_server_port = '5601',
$kibana_od_server_host = '0.0.0.0',
$kibana_od_elasticsearch_server_hosts ="https://${kibana_od_elasticsearch_ip}:${kibana_od_elasticsearch_port}",
$kibana_wazuh_api_credentials = [ {
'id' => 'default',
'url' => 'http://localhost',
'port' => '55000',
'user' => 'foo',
'password' => 'bar',
},
]
) {


# install package
package { 'Installing OD Kibana...':
ensure => $kibana_od_version,
name => $kibana_od_package,
}

file { 'Configure kibana.yml':
owner => 'kibana',
path => '/etc/kibana/kibana.yml',
group => 'kibana',
mode => '0644',
notify => Service[$kibana_od_service],
content => template('wazuh/kibana_od_yml.erb'),
}

service { 'kibana':
ensure => running,
enable => true,
hasrestart => true,
}

exec {'Waiting for opendistro elasticsearch...':
path => '/usr/bin',
command => "curl -u ${kibana_od_user}:${kibana_od_password} -k -s -XGET https://${kibana_od_elasticsearch_ip}:${kibana_od_elasticsearch_port}",
tries => 100,
try_sleep => 3,
}

file {'Removing old Wazuh Kibana Plugin...':
ensure => absent,
path => '/usr/share/kibana/plugins/wazuh',
recurse => true,
purge => true,
force => true,
notify => Service[$kibana_od_service]
}

exec {'Installing Wazuh App...':
path => '/usr/bin',
command => "sudo -u ${kibana_od_user}:${kibana_od_password} -u kibana /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-${kibana_od_app_version}.zip",
creates => '/usr/share/kibana/plugins/wazuh/package.json',
notify => Service[$kibana_od_service],
}

exec {'Removing .wazuh index...':
path => '/usr/bin',
command => "curl -u ${kibana_od_user}:${kibana_od_password} -k -s -XDELETE -sL -I 'https://${kibana_od_elasticsearch_ip}:${kibana_od_elasticsearch_port}/.wazuh' -o /dev/null",
notify => Service[$kibana_od_service],
}

file { '/usr/share/kibana/plugins/wazuh/wazuh.yml':
owner => 'kibana',
group => 'kibana',
mode => '0644',
content => template('wazuh/wazuh_yml.erb'),
notify => Service[$kibana_od_service]
}
exec { 'Verify Kibana folders owner':
path => '/usr/bin:/bin',
command => "chown -R kibana:kibana /usr/share/kibana/optimize\
&& chown -R kibana:kibana /usr/share/kibana/plugins",

}

}
2 changes: 1 addition & 1 deletion manifests/manager.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
# Wazuh App Copyright (C) 2020 Wazuh Inc. (License GPLv2)
# Main ossec server config
class wazuh::manager (

Expand Down
Loading