From dfa19bc34834a4c938e6bb191ec505528277e74b Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Fri, 18 Dec 2020 18:14:38 +0100 Subject: [PATCH 1/8] Add goss verifications --- .goss.yaml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .goss.yaml diff --git a/.goss.yaml b/.goss.yaml new file mode 100644 index 00000000..b2f5864d --- /dev/null +++ b/.goss.yaml @@ -0,0 +1,81 @@ +file: + /etc/filebeat/filebeat.yml: + exists: true + mode: "0644" + owner: root + group: root + filetype: file + contains: [] + /var/ossec/bin/ossec-control: + exists: true + mode: "0750" + owner: root + group: root + filetype: file + contains: [] + /var/ossec/etc/ossec.conf: + exists: true + mode: "0660" + owner: root + group: ossec + filetype: file + contains: [] +package: + filebeat: + installed: true + versions: + - 7.9.1 + wazuh-manager: + installed: true + versions: + - 4.0.3 +port: + tcp:1514: + listening: true + ip: + - 0.0.0.0 + tcp:1515: + listening: true + ip: + - 0.0.0.0 + tcp:55000: + listening: true + ip: + - 0.0.0.0 +user: + ossec: + exists: true + groups: + - ossec + home: /var/ossec + shell: /sbin/nologin + ossecm: + exists: true + groups: + - ossec + home: /var/ossec + shell: /sbin/nologin + ossecr: + exists: true + groups: + - ossec + home: /var/ossec + shell: /sbin/nologin +group: + ossec: + exists: true +process: + filebeat: + running: true + ossec-analysisd: + running: true + ossec-authd: + running: true + ossec-syscheckd: + running: true + s6-supervise: + running: true + wazuh-db: + running: true + wazuh-modulesd: + running: true From 0ed25bab2dee77fb3fe45167a8eb1b4e78730930 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Fri, 18 Dec 2020 18:15:11 +0100 Subject: [PATCH 2/8] Add Goss Actions --- .github/workflows/push.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ec83402f..ca68f3fa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -6,9 +6,25 @@ jobs: build-stack: runs-on: ubuntu-latest steps: + - name: Check out code uses: actions/checkout@v2 + - name: Build the docker-compose stack run: docker-compose -f build-from-sources.yml up -d --build + - name: Check running containers run: docker ps -a + + - name: Shutdown the stack + run: docker-compose -f build-from-sources.yml kill + + - name: Install Goss + uses: e1himself/goss-installation-action@v1.0.3 + with: + version: v0.3.16 + + - name: Execute Goss tests + run: dgoss run wazuh/wazuh-odfe:dev-version + env: + GOSS_FILE: .goss.yaml From 4955c0d5bc877dc2a098466ab24433997f01bd1e Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Fri, 18 Dec 2020 18:18:35 +0100 Subject: [PATCH 3/8] Fix yaml syntax --- .github/workflows/push.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ca68f3fa..e3fa3448 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -20,11 +20,11 @@ jobs: run: docker-compose -f build-from-sources.yml kill - name: Install Goss - uses: e1himself/goss-installation-action@v1.0.3 - with: - version: v0.3.16 + uses: e1himself/goss-installation-action@v1.0.3 + with: + version: v0.3.16 - name: Execute Goss tests - run: dgoss run wazuh/wazuh-odfe:dev-version - env: - GOSS_FILE: .goss.yaml + run: dgoss run wazuh/wazuh-odfe:dev-version + env: + GOSS_FILE: .goss.yaml From 5e5f13c1ff9a3888feb1ee928dc4b27e55557023 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Fri, 18 Dec 2020 18:27:47 +0100 Subject: [PATCH 4/8] Include GOSS_SLEEP --- .github/workflows/push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e3fa3448..bf899155 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -27,4 +27,5 @@ jobs: - name: Execute Goss tests run: dgoss run wazuh/wazuh-odfe:dev-version env: + GOSS_SLEEP: 30 GOSS_FILE: .goss.yaml From a0e7553aa57755f16ea81a60c4aefec13454cb1d Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Thu, 7 Jan 2021 13:36:55 +0100 Subject: [PATCH 5/8] Port all tests from Ansible repo --- .goss.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.goss.yaml b/.goss.yaml index b2f5864d..cabb680b 100644 --- a/.goss.yaml +++ b/.goss.yaml @@ -13,6 +13,13 @@ file: group: root filetype: file contains: [] + /var/ossec/etc/lists/audit-keys: + exists: true + mode: "0660" + owner: ossec + group: ossec + filetype: file + contains: [] /var/ossec/etc/ossec.conf: exists: true mode: "0660" @@ -20,6 +27,27 @@ file: group: ossec filetype: file contains: [] + /var/ossec/etc/rules/local_rules.xml: + exists: true + mode: "0660" + owner: ossec + group: ossec + filetype: file + contains: [] + /var/ossec/etc/sslmanager.cert: + exists: true + mode: "0640" + owner: root + group: root + filetype: file + contains: [] + /var/ossec/etc/sslmanager.key: + exists: true + mode: "0640" + owner: root + group: root + filetype: file + contains: [] package: filebeat: installed: true @@ -71,6 +99,12 @@ process: running: true ossec-authd: running: true + ossec-execd: + running: true + ossec-monitord: + running: true + ossec-remoted: + running: true ossec-syscheckd: running: true s6-supervise: From 309fa27bc21a1fbfbc428e72b69a43f82af92244 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Thu, 7 Jan 2021 16:10:24 +0100 Subject: [PATCH 6/8] Add Goss tests for Kibana image --- .goss.kibana.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .goss.kibana.yaml diff --git a/.goss.kibana.yaml b/.goss.kibana.yaml new file mode 100644 index 00000000..24503b7e --- /dev/null +++ b/.goss.kibana.yaml @@ -0,0 +1,25 @@ +file: + /usr/share/kibana/config/kibana.yml: + exists: true + mode: "0664" + owner: kibana + group: root + filetype: file + contains: [] + /usr/share/kibana/optimize/wazuh/config/wazuh.yml: + exists: true + mode: "0644" + owner: kibana + group: kibana + filetype: file + contains: [] +user: + kibana: + exists: true + groups: + - kibana + home: /usr/share/kibana + shell: /bin/bash +group: + kibana: + exists: true From 3a028ae5470c983af8a1983bb39192c1eb097177 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Thu, 7 Jan 2021 16:11:49 +0100 Subject: [PATCH 7/8] Execute tests for kibana image --- .github/workflows/push.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index bf899155..4637f903 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -24,8 +24,13 @@ jobs: with: version: v0.3.16 - - name: Execute Goss tests + - name: Execute Goss tests (wazuh-odfe) run: dgoss run wazuh/wazuh-odfe:dev-version env: GOSS_SLEEP: 30 GOSS_FILE: .goss.yaml + + - name: Execute Goss tests (wazuh-kibana-odfe) + run: dgoss run wazuh/wazuh-kibana-odfe:dev-version + env: + GOSS_FILE: .goss.kibana.yaml From 9dc8e256c6d171e667275fb040b67ac376c252f2 Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez <1380243+xr09@users.noreply.github.com> Date: Thu, 7 Jan 2021 16:44:18 +0100 Subject: [PATCH 8/8] Add tests for Kibana customizations --- .goss.kibana.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.goss.kibana.yaml b/.goss.kibana.yaml index 24503b7e..b5c0ea6b 100644 --- a/.goss.kibana.yaml +++ b/.goss.kibana.yaml @@ -6,6 +6,27 @@ file: group: root filetype: file contains: [] + /usr/share/kibana/optimize/bundles/light_theme.style.css: + exists: true + mode: "0664" + owner: kibana + group: root + filetype: file + contains: [] + /usr/share/kibana/optimize/bundles/wazuh_logo_circle.svg: + exists: true + mode: "0644" + owner: kibana + group: root + filetype: file + contains: [] + /usr/share/kibana/optimize/bundles/wazuh_wazuh_bg.svg: + exists: true + mode: "0644" + owner: kibana + group: root + filetype: file + contains: [] /usr/share/kibana/optimize/wazuh/config/wazuh.yml: exists: true mode: "0644" @@ -13,6 +34,13 @@ file: group: kibana filetype: file contains: [] + /usr/share/kibana/src/legacy/ui/ui_render/bootstrap/template.js.hbs: + exists: true + mode: "0664" + owner: kibana + group: root + filetype: file + contains: [] user: kibana: exists: true