1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#!/bin/sh
# make sure script does not hang forever
if [ -z "$1" ]; then
exec timeout -k 60 120 $0 timeout
fi
set -e
printf "=== config ===\n"
booth-keygen
cat <<EOF | tee /etc/booth/booth.conf
authfile = /etc/booth/authkey
site = 127.0.0.1
site = 127.0.0.2
site = 127.0.0.3
ticket = "ticket-A"
EOF
printf "\n=== service ===\n"
systemctl daemon-reload
systemctl restart booth
for i in `seq 1 60`; do
if systemctl status booth@booth; then
break
fi
sleep 1
done
boothd daemon -D -s 127.0.0.2 2>&1
boothd daemon -D -s 127.0.0.3 2>&1
printf "\n=== status ===\n"
for i in `seq 1 60`; do
if booth status; then
break
fi
sleep 1
done
booth list
printf "\n=== grant ===\n"
booth grant ticket-A 2>&1
booth list
printf "\n=== revoke ===\n"
booth revoke ticket-A 2>&1
booth list
printf "\n=== geostore ===\n"
geostore set status GOOD 2>&1
geostore get status
geostore list
geostore delete status
printf "\n=== authkey2 ===\n"
booth-keygen /etc/booth/authkey2
sed 's/authkey/authkey2/' < /etc/booth/booth.conf > /etc/booth/booth.conf2
if booth list -c /etc/booth/booth.conf2 2>&1; then
echo authkey2 should fail to authenticate
exit 1
fi
|