User first node for port scanning instead of last one 06/86206/1
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 24 Apr 2019 21:53:24 +0000 (23:53 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 24 Apr 2019 22:01:18 +0000 (00:01 +0200)
It is more obvious to use first node in cluster instead of
last one. Additionally in some cases nodes listed in the end
may not expose all open ports (like it is in integration lab).

Issue-ID: SECCOM-231
Change-Id: I200998b2e7b3a6de9b5f464e59e3b7dbbc0a656c
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
test/security/check_for_http_endpoints.sh

index 19be2ac..37e55da 100755 (executable)
@@ -47,7 +47,7 @@ SVCS=`awk '{print $2}' <<<"$PORTS_SVCS"`
 PORT_LIST=`tr "\\n" "," <<<"$PORTS" | sed 's/,$//'; echo ''`
 
 # Get IP addres of some cluster node
-K8S_NODE=`kubectl describe nodes \`kubectl get nodes | tail -n 1 | awk '{print $1}'\` | grep ExternalIP | awk '{print $2}'`
+K8S_NODE=`kubectl describe nodes \`kubectl get nodes | grep -v NAME | head -n 1 | awk '{print $1}'\` | grep ExternalIP | awk '{print $2}'`
 
 # perform scan
 SCAN_RESULT=`nmap $K8S_NODE -sV -p $PORT_LIST 2>/dev/null | grep \tcp`