Skip to content

Commit d21823b

Browse files
authored
Merge pull request #581 from wazuh/566-FixDashboardVariables-to4.4
4.4 branch update with changes applied in 4.3
2 parents 02bcf5e + dd7060b commit d21823b

File tree

7 files changed

+57
-34
lines changed

7 files changed

+57
-34
lines changed

manifests/dashboard.pp

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
$dashboard_package = 'wazuh-dashboard',
55
$dashboard_service = 'wazuh-dashboard',
66
$dashboard_version = '4.4.0',
7-
$dashboard_user = 'admin',
8-
$dashboard_password = 'admin',
97
$indexer_server_ip = 'localhost',
108
$indexer_server_port = '9200',
119
$dashboard_path_certs = '/etc/wazuh-dashboard/certs',
@@ -14,19 +12,20 @@
1412

1513
$dashboard_server_port = '443',
1614
$dashboard_server_host = '0.0.0.0',
17-
$dashboard_server_hosts = "https://${indexer_server_ip}:${indexer_server_port}",
15+
$indexer_server_host = "https://${indexer_server_ip}:${indexer_server_port}",
1816
$dashboard_wazuh_api_credentials = [
1917
{
2018
'id' => 'default',
2119
'url' => 'https://localhost',
2220
'port' => '55000',
23-
'user' => 'foo',
24-
'password' => 'bar',
21+
'user' => 'wazuh-wui',
22+
'password' => 'wazuh-wui',
2523
},
2624
],
2725

2826
$manage_repos = false, # Change to true when manager is not present.
2927
) {
28+
3029
if $manage_repos {
3130
include wazuh::repo
3231

@@ -84,19 +83,13 @@
8483
}
8584

8685
# TODO: Fully manage the opensearch_dashboards.yml and a template file resource
87-
file_line { 'Setting host for wazuh-dashboard':
88-
path => '/etc/wazuh-dashboard/opensearch_dashboards.yml',
89-
line => "server.host: ${dashboard_server_host}",
90-
match => "^server.host:\s",
86+
file { '/etc/wazuh-dashboard/opensearch_dashboards.yml':
87+
owner => 'wazuh-dashboard',
88+
group => 'wazuh-dashboard',
89+
mode => '0640',
90+
content => template('wazuh/opensearch_dashboards_yml.erb'),
9191
require => Package['wazuh-dashboard'],
92-
notify => Service['wazuh-dashboard'],
93-
}
94-
file_line { 'Setting port for wazuh-dashboard':
95-
path => '/etc/wazuh-dashboard/opensearch_dashboards.yml',
96-
line => "server.port: ${dashboard_server_port}",
97-
match => "^server.port:\s",
98-
require => Package['wazuh-dashboard'],
99-
notify => Service['wazuh-dashboard'],
92+
notify => Service['wazuh-dashboard']
10093
}
10194

10295
service { 'wazuh-dashboard':
@@ -105,4 +98,23 @@
10598
hasrestart => true,
10699
name => $dashboard_service,
107100
}
101+
102+
file { ['/usr/share/wazuh-dashboard/data/wazuh/',
103+
'/usr/share/wazuh-dashboard/data/wazuh/config/']:
104+
ensure => 'directory',
105+
owner => 'wazuh-dashboard',
106+
group => 'wazuh-dashboard',
107+
mode => '0600',
108+
require => Package['wazuh-dashboard'],
109+
notify => Service['wazuh-dashboard'],
110+
}
111+
112+
file { '/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml':
113+
owner => 'wazuh-dashboard',
114+
group => 'wazuh-dashboard',
115+
mode => '0600',
116+
content => template('wazuh/wazuh_yml.erb'),
117+
require => Package['wazuh-dashboard'],
118+
notify => Service['wazuh-dashboard'],
119+
}
108120
}

manifests/filebeat_oss.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
# TODO: Include file into the wazuh/wazuh-puppet project or use file { checksum => '..' } for this instead of the exec construct.
4848
exec { 'cleanup /etc/filebeat/wazuh-template.json':
4949
command => '/bin/rm /etc/filebeat/wazuh-template.json',
50-
unless => "/bin/cmp -s '/etc/filebeat/wazuh-template.json' <(curl -s https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json)",
50+
onlyif => '/bin/test -f /etc/filebeat/wazuh-template.json',
51+
unless => "/bin/curl -s 'https://raw.githubusercontent.com/wazuh/wazuh/${wazuh_extensions_version}/extensions/elasticsearch/7.x/wazuh-template.json' | /bin/cmp -s '/etc/filebeat/wazuh-template.json'",
5152
}
5253
-> file { '/etc/filebeat/wazuh-template.json':
5354
owner => 'root',
@@ -113,4 +114,4 @@
113114
name => $filebeat_oss_service,
114115
require => Package['filebeat'],
115116
}
116-
}
117+
}

manifests/indexer.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Setup for Wazuh Indexer
33
class wazuh::indexer (
44
# opensearch.yml configuration
5+
$indexer_network_host = '0.0.0.0',
56
$indexer_cluster_name = 'wazuh-cluster',
67
$indexer_node_name = 'node-1',
78
$indexer_node_max_local_storage_nodes = '1',
@@ -21,7 +22,7 @@
2122
$indexer_cluster_initial_master_nodes = ['node-1'],
2223

2324
$manage_repos = false, # Change to true when manager is not present.
24-
25+
2526
# JVM options
2627
$jvm_options_memory = '1g',
2728
) {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
server.host: <%= @dashboard_server_host %>
2+
server.port: <%= @dashboard_server_port %>
3+
opensearch.hosts: <%= @indexer_server_host %>
4+
opensearch.ssl.verificationMode: certificate
5+
#opensearch.username:
6+
#opensearch.password:
7+
opensearch.requestHeadersWhitelist: ["securitytenant","Authorization"]
8+
opensearch_security.multitenancy.enabled: false
9+
opensearch_security.readonly_mode.roles: ["kibana_read_only"]
10+
server.ssl.enabled: true
11+
server.ssl.key: "/etc/wazuh-dashboard/certs/dashboard-key.pem"
12+
server.ssl.certificate: "/etc/wazuh-dashboard/certs/dashboard.pem"
13+
opensearch.ssl.certificateAuthorities: ["/etc/wazuh-dashboard/certs/root-ca.pem"]
14+
uiSettings.overrides.defaultRoute: /app/wazuh

templates/wazuh_api_yml.erb

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ https:
1717
# Values for API log level: disabled, info, warning, error, debug, debug2 (each level includes the previous level).
1818
logs:
1919
level: <%= @wazuh_api_logs_level %>
20-
format: <%= @wazuh_api_logs_format %>
2120
# Cross-origin resource sharing: https://github.com/aio-libs/aiohttp-cors#usage
2221
cors:
2322
enabled: <%= @wazuh_api_cors_enabled %>
@@ -39,14 +38,10 @@ drop_privileges: <%= @wazuh_api_drop_privileges %>
3938
# Enable features under development
4039
experimental_features: <%= @wazuh_api_experimental_features %>
4140
# Enable remote commands
42-
upload_configuration:
43-
remote_commands:
44-
localfile:
45-
allow: <%= @remote_commands_localfile %>
46-
exceptions: <%= @remote_commands_localfile_exceptions %>
47-
wodle_command:
48-
allow: <%= @remote_commands_wodle %>
49-
exceptions: <%= @remote_commands_wodle_exceptions %>
50-
limits:
51-
eps:
52-
allow: <%= @limits_eps %>
41+
remote_commands:
42+
localfile:
43+
enabled: <%= @remote_commands_localfile %>
44+
exceptions: <%= @remote_commands_localfile_exceptions %>
45+
wodle_command:
46+
enabled: <%= @remote_commands_wodle %>
47+
exceptions: <%= @remote_commands_wodle_exceptions %>

templates/wazuh_indexer_yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
network.host: "0.0.0.0"
1+
network.host: "<%= @indexer_network_host %>"
22
node.name: "<%= @indexer_node_name %>"
33
cluster.initial_master_nodes:
44
<% @indexer_cluster_initial_master_nodes.each do |node| -%>

templates/wazuh_yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
# user: <user>
125125
# password: <password>
126126
hosts:
127-
<% @kibana_wazuh_api_credentials.each do |api_profile| -%>
127+
<% @dashboard_wazuh_api_credentials.each do |api_profile| -%>
128128
- <%= api_profile['id'] %>:
129129
url: <%= api_profile['url'] %>
130130
port: <%= api_profile['port'] %>

0 commit comments

Comments
 (0)