Skip to content

Commit ac8dfa0

Browse files
authored
Merge pull request #728 from stackhpc/merge-yoga-zed
Merge yoga zed
2 parents 257e8e6 + 737b719 commit ac8dfa0

29 files changed

+2077
-60
lines changed

doc/source/configuration/monitoring.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,39 @@ mgrs group and list them as the endpoints for prometheus. Additionally,
136136
depending on your configuration, you may need set the
137137
``kolla_enable_prometheus_ceph_mgr_exporter`` variable to ``true`` in order to
138138
enable the ceph mgr exporter.
139+
140+
OpenStack Capacity
141+
==================
142+
143+
OpenStack Capacity allows you to see how much space you have avaliable
144+
in your cloud. StackHPC Kayobe Config includes this exporter by default
145+
and it's necessary that some variables are set to allow deployment.
146+
147+
To successfully deploy OpenStack Capacity, you are required to specify
148+
the OpenStack application credentials in ``kayobe/secrets.yml`` as:
149+
150+
.. code-block:: yaml
151+
152+
secrets_os_exporter_auth_url: <some_auth_url>
153+
secrets_os_exporter_credential_id: <some_credential_id>
154+
secrets_os_exporter_credential_secret: <some_credential_secret>
155+
156+
After defining your credentials, You may deploy OpenStack Capacity
157+
using the ``ansible/deploy-os-capacity-exporter.yml`` Ansible playbook
158+
via Kayobe.
159+
160+
.. code-block:: console
161+
162+
kayobe playbook run ansible/deploy-os-capacity-exporter.yml
163+
164+
It is required that you re-configure the Prometheus, Grafana and HAProxy
165+
services following deployment, to do this run the following Kayobe command.
166+
167+
.. code-block:: console
168+
169+
kayobe overcloud service reconfigure -kt grafana,prometheus,haproxy
170+
171+
If you notice ``HaproxyServerDown`` or ``HaproxyBackendDown`` prometheus
172+
alerts after deployment it's likely the os_exporter secrets have not been
173+
set correctly, double check you have entered the correct authentication
174+
information appropiate to your cloud and re-deploy.

doc/source/configuration/vault.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ Configure Barbican
296296
[vault_plugin]
297297
vault_url = https://{{ kolla_internal_vip_address }}:8200
298298
use_ssl = True
299+
ssl_ca_crt_file = {% raw %}{{ openstack_cacert }}{% endraw %}
299300
approle_role_id = {{ secrets_barbican_approle_role_id }}
300301
approle_secret_id = {{ secrets_barbican_approle_secret_id }}
301302
kv_mountpoint = barbican

doc/source/configuration/wazuh.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ Define VM sizing in ``etc/kayobe/inventory/group_vars/wazuh-manager/infra-vms``:
5757
infra_vm_data_capacity: "200G"
5858
5959
60-
Optional: define LVM volumes ``etc/kayobe/inventory/group_vars/wazuh-manager/lvm``:
60+
Optional: define LVM volumes in ``etc/kayobe/inventory/group_vars/wazuh-manager/lvm``.
61+
``/var/ossec`` often requires greater storage space, and ``/var/lib/wazuh-indexer``
62+
may be beneficial too.
6163

6264
.. code-block:: console
6365
@@ -73,7 +75,7 @@ Optional: define LVM volumes ``etc/kayobe/inventory/group_vars/wazuh-manager/lvm
7375
size: "100%VG"
7476
filesystem: "ext4"
7577
mount: true
76-
mntp: /var/lib/elasticsearch”
78+
mntp: "/var/ossec"
7779
create: true
7880
7981
@@ -249,7 +251,7 @@ It will be used by wazuh secrets playbook to generate wazuh secrets vault file.
249251
.. code-block:: console
250252
251253
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/wazuh-secrets.yml
252-
ansible-vault encrypt --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/inventory/group_vars/wazuh/wazuh-manager/wazuh-secrets
254+
ansible-vault encrypt --vault-password-file ~/vault.pass $KAYOBE_CONFIG_PATH/wazuh-secrets.yml
253255
254256
255257
TLS (optional)
@@ -288,6 +290,21 @@ Example OpenSSL rune to convert to PKCS#8:
288290

289291
TODO: document how to use a local certificate. Do we need to override all certificates?
290292

293+
Custom SCA Policies (optional)
294+
------------------------------
295+
296+
Wazuh ships with a large selection of Security Configuration Assessment
297+
rulesets. However, you may find you want to add more. This can be achieved via
298+
`custom policies <https://documentation.wazuh.com/current/user-manual/capabilities/sec-config-assessment/how-to-configure.html>`_.
299+
300+
SKC supports this automatically, just add the policy file from this PR to
301+
``{{ kayobe_env_config_path }}/wazuh/custom_sca_policies``.
302+
303+
Currently, Wazuh does not ship with a CIS benchmark for Rocky 9. You can find
304+
the in-development policy here: https://github.com/wazuh/wazuh/pull/17810 To
305+
include this in your deployment, simply copy it to
306+
``{{ kayobe_env_config_path }}/wazuh/custom_sca_policies/cis_rocky_linux_9.yml``.
307+
291308
Deploy
292309
------
293310

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
- hosts: monitoring
3+
gather_facts: false
4+
5+
tasks:
6+
- name: Create os-capacity directory
7+
ansible.builtin.file:
8+
path: /opt/kayobe/os-capacity/
9+
state: directory
10+
11+
- name: Template clouds.yml
12+
ansible.builtin.template:
13+
src: templates/os_capacity-clouds.yml.j2
14+
dest: /opt/kayobe/os-capacity/clouds.yaml
15+
16+
- name: Ensure os_capacity container is running
17+
docker_container:
18+
name: os_capacity
19+
image: ghcr.io/stackhpc/os-capacity:master
20+
env:
21+
OS_CLOUD: openstack
22+
OS_CLIENT_CONFIG_FILE: /etc/openstack/clouds.yaml
23+
mounts:
24+
- type: bind
25+
source: /opt/kayobe/os-capacity/
26+
target: /etc/openstack/
27+
network_mode: host
28+
restart_policy: unless-stopped
29+
become: true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
clouds:
2+
openstack:
3+
auth:
4+
auth_url: "{{ secrets_os_exporter_auth_url }}"
5+
application_credential_id: "{{ secrets_os_exporter_credential_id }}"
6+
application_credential_secret: "{{ secrets_os_exporter_credential_secret }}"
7+
region_name: "RegionOne"
8+
interface: "internal"
9+
identity_api_version: 3
10+
auth_type: "v3applicationcredential"

etc/kayobe/ansible/vault-deploy-barbican.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,16 @@
8282
copy:
8383
content: "{{ barbican_role_id.id }}"
8484
dest: "{{ stackhpc_barbican_role_id_file_path | default('~/barbican-role-id') }}"
85-
when: stackhpc_write_barbican_role_id_to_file | bool | default(false)
85+
when: stackhpc_write_barbican_role_id_to_file | default(false) | bool
8686

8787
- name: Check if barbican Approle Secret ID is defined
88-
hashivault_approle_role_secret_list:
88+
hashivault_approle_role_secret_get:
8989
url: "{{ vault_api_addr }}"
9090
ca_cert: "{{ vault_ca_cert }}"
9191
token: "{{ vault_keys.root_token }}"
92+
secret: "{{ secrets_barbican_approle_secret_id }}"
9293
name: barbican
93-
register: barbican_approle_secret_list
94+
register: barbican_approle_secret_get
9495

9596
- name: Ensure barbican AppRole Secret ID is defined
9697
hashivault_approle_role_secret:
@@ -99,4 +100,4 @@
99100
token: "{{ vault_keys.root_token }}"
100101
secret: "{{ secrets_barbican_approle_secret_id }}"
101102
name: barbican
102-
when: barbican_approle_secret_list.secrets is match(secrets_barbican_approle_secret_id)
103+
when: barbican_approle_secret_get.status == "absent"

etc/kayobe/ansible/wazuh-manager.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,63 @@
1717
- role: "{{ playbook_dir }}/roles/wazuh-ansible/wazuh-ansible/roles/wazuh/ansible-filebeat-oss"
1818
- role: "{{ playbook_dir }}/roles/wazuh-ansible/wazuh-ansible/roles/wazuh/wazuh-dashboard"
1919
post_tasks:
20+
- block:
21+
- name: Check if custom SCA policies directory exists
22+
stat:
23+
path: "{{ local_custom_sca_policies_path }}"
24+
register: custom_sca_policies_folder
25+
delegate_to: localhost
26+
become: no
27+
28+
- name: Gather list of custom SCA policies
29+
find:
30+
paths: "{{ local_custom_sca_policies_path }}"
31+
patterns: '*.yml'
32+
delegate_to: localhost
33+
register: custom_sca_policies
34+
when: custom_sca_policies_folder.stat.exists
35+
36+
- name: Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
37+
blockinfile:
38+
path: "/var/ossec/etc/local_internal_options.conf"
39+
state: present
40+
owner: wazuh
41+
group: wazuh
42+
block: |
43+
sca.remote_commands=1
44+
when: custom_sca_policies.files | length > 0
45+
46+
- name: Copy custom SCA policy files to Wazuh manager
47+
copy:
48+
# Note the trailing slash to copy directory contents
49+
src: "{{ local_custom_sca_policies_path }}/"
50+
dest: "/var/ossec/etc/shared/default/"
51+
owner: wazuh
52+
group: wazuh
53+
when: custom_sca_policies.files | length > 0
54+
55+
- name: Add custom policy definition(s) to the shared Agent config
56+
blockinfile:
57+
path: "/var/ossec/etc/shared/default/agent.conf"
58+
state: present
59+
owner: wazuh
60+
group: wazuh
61+
marker: "{mark} ANSIBLE MANAGED BLOCK Custom SCA Policies"
62+
insertafter: "<!-- Shared agent configuration here -->"
63+
block: |
64+
{% filter indent(width=2, first=true) %}
65+
<sca>
66+
<policies>
67+
{% for item in custom_sca_policies.files %}
68+
<policy>etc/shared/{{ item.path | basename }}</policy>
69+
{% endfor %}
70+
</policies>
71+
</sca>
72+
{% endfilter %}
73+
when: custom_sca_policies.files | length > 0
74+
notify:
75+
- Restart wazuh
76+
2077
- name: Set http/s_proxy vars in ossec-init.conf for vulnerability detector
2178
blockinfile:
2279
path: "/var/ossec/etc/ossec.conf"

etc/kayobe/environments/ci-aio/automated-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cat << EOF | sudo tee -a /etc/hosts
66
10.205.3.187 pulp-server pulp-server.internal.sms-cloud
77
EOF
88

9-
if [ sudo vgdisplay | grep -q lvm2 ]; then
9+
if sudo vgdisplay | grep -q lvm2; then
1010
sudo lvextend -L 4G /dev/rootvg/lv_home -r || true
1111
sudo lvextend -L 4G /dev/rootvg/lv_tmp -r || true
1212
fi

etc/kayobe/environments/ci-multinode/kolla/config/barbican.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ enabled_secretstore_plugins=vault_plugin
77
[vault_plugin]
88
vault_url = https://{{ kolla_internal_vip_address }}:8200
99
use_ssl = True
10+
ssl_ca_crt_file = {% raw %}{{ openstack_cacert }}{% endraw %}
1011
approle_role_id = {{ secrets_barbican_approle_role_id }}
1112
approle_secret_id = {{ secrets_barbican_approle_secret_id }}
1213
kv_mountpoint = barbican

etc/kayobe/inventory/group_vars/wazuh-manager/wazuh-manager

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ local_certs_path: "{{ playbook_dir }}/wazuh/certificates"
2424
# Ansible control host custom certificates directory
2525
local_custom_certs_path: "{{ playbook_dir }}/wazuh/custom_certificates"
2626

27+
# Ansible custom SCA policies directory
28+
local_custom_sca_policies_path: "{{ kayobe_env_config_path }}/wazuh/custom_sca_policies"
29+
2730
# Indexer variables
2831
indexer_node_name: "{{ inventory_hostname }}"
2932

0 commit comments

Comments
 (0)