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