Skip to content

Commit c06a4a2

Browse files
committed
Security tool detection prints as single message
1 parent fd02758 commit c06a4a2

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

pkg-new/preflights/host-preflight.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,24 @@ spec:
254254
- sdcss-kmod
255255
- sdcss
256256
- sdcss-scripts
257+
- run:
258+
collectorName: security-tools-installed
259+
command: sh
260+
args:
261+
- -c
262+
- |
263+
pkgs="sdcss-kmod sdcss sdcss-scripts"
264+
installed=""
265+
if command -v dpkg >/dev/null 2>&1; then
266+
for p in $pkgs; do
267+
dpkg -l "$p" >/dev/null 2>&1 && installed="$installed$p\n"
268+
done
269+
elif command -v rpm >/dev/null 2>&1; then
270+
for p in $pkgs; do
271+
rpm -q "$p" >/dev/null 2>&1 && installed="$installed$p\n"
272+
done
273+
fi
274+
printf "%b" "$installed" | sed '/^$/d'
257275
analyzers:
258276
- cpu:
259277
checkName: CPU
@@ -1356,12 +1374,18 @@ spec:
13561374
{{ "{{" }} .Detected {{ "}}" }}
13571375
13581376
These types of tools have been known to interfere with Kubernetes operation in various ways. If you experience an installation problem, you may need to disable these tools temporarily as part of the troubleshooting process to identify if any system administrator exceptions may be required to maintain necessary internal Kubernetes operations.
1359-
- systemPackages:
1377+
- textAnalyze:
13601378
checkName: "Detected Security Packages"
1361-
collectorName: security-tools-packages
1379+
fileName: host-collectors/run-host/security-tools-installed.txt
1380+
regexGroups: '(?ms)(?P<Installed>.*)'
1381+
ignoreIfNoFiles: true
13621382
outcomes:
1363-
- warn:
1364-
when: '{{ "{{" }} .IsInstalled {{ "}}" }}'
1365-
message: Package {{ "{{" }} .Name {{ "}}" }} is installed. This tool can interfere with kubernetes operation. Ensure the tool is either disabled or configured to not interfere with kubernetes operation.
13661383
- pass:
1367-
message: Package {{ "{{" }} .Name {{ "}}" }} is not installed
1384+
when: "Installed == ''"
1385+
message: "No security packages detected."
1386+
- warn:
1387+
message: |-
1388+
The following security packages were detected:
1389+
{{ "{{" }} .Installed {{ "}}" }}
1390+
1391+
These packages can interfere with Kubernetes operation. Ensure they are disabled or configured to not interfere with required Kubernetes traffic and processes.

0 commit comments

Comments
 (0)