token-validator: save ping state (0: ping ok, 1: arping only)

This commit is contained in:
nemunaire 2020-02-21 05:50:38 +01:00
parent 22a3d75645
commit c35a8f5e6b
3 changed files with 16 additions and 9 deletions

View file

@ -31,7 +31,7 @@ do
1)
PAT=baaaaaad;;
2)
PAT=baadfood;;
PAT=baadf00d;;
3)
PAT=baddcafe;;
4)
@ -41,8 +41,9 @@ do
esac
arping -I br-ext -c 1 -w 1 "${IP}" && {
ping -c 1 -w 1 -p "${PAT}" "${IP}" &
curl -k -X POST -d '{"token": "'${SECRET_KEY}'"}' "https://172.23.200.1/api/students/$sid/pong"
ping -c 1 -w 1 -p "${PAT}" "${IP}"
STATE=$?
curl -k -X POST -d '{"challenge": '${STATE}', "token": "'${SECRET_KEY}'"}' "https://172.23.200.1/api/students/$sid/pong"
}
fi
done