From 375c356c94345e7ba06fa2e0ec12c93dc0cb3797 Mon Sep 17 00:00:00 2001 From: Eduardo Folly Date: Thu, 25 Apr 2024 10:22:22 -0300 Subject: [PATCH] Adding messages. --- .github/workflows/test.yml | 2 +- test.sh | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1b1b9ad..7da15eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: tests: name: Tests runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 5 strategy: matrix: alpine: diff --git a/test.sh b/test.sh index 0a07373..2b5d7f4 100755 --- a/test.sh +++ b/test.sh @@ -35,11 +35,12 @@ SNMP_V3_USER="testainers" # SNMPv2c # ########### +echo "SNMPv2c" docker run --rm --name "$CONTAINER_NAME" -p "$PORT:161/udp" -d "$IMAGE_NAME" - sleep 2 # SNMPv2c - Walk +echo "SNMPv2c - Walk" snmpwalk -v 2c -c public "$HOST:$PORT" "$WALK" >/dev/null 2>&1 if [ $? -ne 0 ]; then @@ -47,6 +48,7 @@ if [ $? -ne 0 ]; then fi # SNMPv2c - Get +echo "SNMPv2c - Get" RESULT=$(snmpget -v2c -c public -Ovq "$HOST:$PORT" "$GET") if [ "$RESULT" != "At flying circus" ]; then @@ -54,6 +56,7 @@ if [ "$RESULT" != "At flying circus" ]; then fi # SNMPv2c - GetNext +echo "SNMPv2c - GetNext" RESULT=$(snmpgetnext -v2c -c public -Ovq "$HOST:$PORT" "$GET") if [ "$RESULT" != "72" ]; then @@ -61,6 +64,7 @@ if [ "$RESULT" != "72" ]; then fi # SNMPv3 - Get - Need to fail +echo "SNMPv3 - Get" snmpget -v3 -Ovq -u "$SNMP_V3_USER" -l noAuthNoPriv \ "$HOST:$PORT" "$GET" >/dev/null 2>&1 @@ -69,8 +73,8 @@ if [ $? -eq 0 ]; then fi # Stop Container +echo "Stop Container" docker stop -t 1 "$CONTAINER_NAME" - sleep 2 ############################## @@ -84,17 +88,19 @@ sleep 2 ################################ SNMP_V3_AUTH_PROTOCOL="SHA" -SNMP_V3_AUTH_PWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) +# SNMP_V3_AUTH_PWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) +SNMP_V3_AUTH_PWD="a1b2c3d4e5f6" +echo "SNMPv3 with auth and NO priv" docker run --rm --name "$CONTAINER_NAME" -p "$PORT:161/udp" -d \ -e SNMP_V3_USER=$SNMP_V3_USER \ -e SNMP_V3_AUTH_PROTOCOL=$SNMP_V3_AUTH_PROTOCOL \ -e SNMP_V3_AUTH_PWD=$SNMP_V3_AUTH_PWD \ "$IMAGE_NAME" - sleep 2 # SNMPv3 - Walk +echo "SNMPv3 - Walk" snmpwalk -v3 -On -u "$SNMP_V3_USER" \ -l authNoPriv \ -a "$SNMP_V3_AUTH_PROTOCOL" \ @@ -106,6 +112,7 @@ if [ $? -ne 0 ]; then fi # SNMPv3 - Get +echo "SNMPv3 - Get" RESULT=$(snmpget -v3 -Ovq -u "$SNMP_V3_USER" \ -l authNoPriv \ -a "$SNMP_V3_AUTH_PROTOCOL" \ @@ -117,6 +124,7 @@ if [ "$RESULT" != "At flying circus" ]; then fi # SNMPv3 - GetNext +echo "SNMPv3 - GetNext" RESULT=$(snmpgetnext -v3 -Ovq -u "$SNMP_V3_USER" \ -l authNoPriv \ -a "$SNMP_V3_AUTH_PROTOCOL" \ @@ -128,6 +136,7 @@ if [ "$RESULT" != "72" ]; then fi # Stop Container +echo "Stop Container" docker stop -t 1 "$CONTAINER_NAME" sleep 2 @@ -137,8 +146,10 @@ sleep 2 ##################################### SNMP_V3_PRIV_PROTOCOL="AES" -SNMP_V3_PRIV_PWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) +# SNMP_V3_PRIV_PWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) +SNMP_V3_PRIV_PWD="f6e5d4c3b2a1" +echo "SNMPv3 with auth and with privacy" docker run --rm --name "$CONTAINER_NAME" -p "$PORT:161/udp" -d \ -e SNMP_V3_USER=$SNMP_V3_USER \ -e SNMP_V3_AUTH_PROTOCOL=$SNMP_V3_AUTH_PROTOCOL \ @@ -146,10 +157,10 @@ docker run --rm --name "$CONTAINER_NAME" -p "$PORT:161/udp" -d \ -e SNMP_V3_PRIV_PROTOCOL=$SNMP_V3_PRIV_PROTOCOL \ -e SNMP_V3_PRIV_PWD=$SNMP_V3_PRIV_PWD \ "$IMAGE_NAME" - sleep 2 # SNMPv3 - Walk +echo "SNMPv3 - Walk" snmpwalk -v3 -On -u "$SNMP_V3_USER" \ -l authPriv \ -a "$SNMP_V3_AUTH_PROTOCOL" \ @@ -163,6 +174,7 @@ if [ $? -ne 0 ]; then fi # SNMPv3 - Get +echo "SNMPv3 - Get" RESULT=$(snmpget -v3 -Ovq -u "$SNMP_V3_USER" \ -l authPriv \ -a "$SNMP_V3_AUTH_PROTOCOL" \ @@ -176,6 +188,7 @@ if [ "$RESULT" != "At flying circus" ]; then fi # SNMPv3 - GetNext +echo "SNMPv3 - GetNext" RESULT=$(snmpgetnext -v3 -Ovq -u "$SNMP_V3_USER" \ -l authPriv \ -a "$SNMP_V3_AUTH_PROTOCOL" \ @@ -189,6 +202,7 @@ if [ "$RESULT" != "72" ]; then fi # Stop container +echo "Stop Container" docker stop -t 1 "$CONTAINER_NAME" sleep 2