summaryrefslogtreecommitdiffstats
path: root/test/security/check_for_http_endpoints.sh
diff options
context:
space:
mode:
authorLucjan Bryndza <lbryndza@samsung.com>2019-05-29 16:02:46 +0200
committerLucjan Bryndza <l.bryndza@samsung.com>2019-05-29 17:32:23 +0200
commitc43f25d5a256091c17d4f15d1c9287906cd4a7b7 (patch)
tree5f27e44b5ec45cc3e92af843eff6543bc6681db7 /test/security/check_for_http_endpoints.sh
parente84c265f95d046c8514dbb0091dec873e912d8bc (diff)
Search endpoint script fail silently
When nmap or other commands are not installed on the system script fail silently without any information Signed-off-by: Lucjan Bryndza <l.bryndza@samsung.com> Change-Id: I599b987e223f88617aefa2c0de6cdcbbf3ff50b7 Issue-ID: SECCOM-231
Diffstat (limited to 'test/security/check_for_http_endpoints.sh')
-rwxr-xr-xtest/security/check_for_http_endpoints.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/security/check_for_http_endpoints.sh b/test/security/check_for_http_endpoints.sh
index c0da42858..5c2ba20c3 100755
--- a/test/security/check_for_http_endpoints.sh
+++ b/test/security/check_for_http_endpoints.sh
@@ -29,6 +29,17 @@
# Output: List of pods exposing http endpoints
#
+#Prerequisities commands list
+REQ_APPS=(kubectl nmap awk column sort paste grep wc)
+
+# Check for prerequisites apps
+for cmd in "${REQ_APPS[@]}"; do
+ if ! [ -x "$(command -v "$cmd")" ]; then
+ echo "Error: command $cmd is not installed"
+ exit 1
+ fi
+done
+
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <k8s-namespace>"
exit 1