s3: Wait longer after failure, pick up any failed pieces later.
[clinton/scripts.git] / change-user-password
1 #!/bin/bash -e
2
3 # disable debug !/bin/bash -ex
4 #
5 # Finally, set password for main user's principal
6 # Aborting this operation is harmless. Just re-invoke cpw.
7 #
8 # kadmin.local doesn't report errors properly, so we have to
9 # check manually
10 #
11 USER=$1
12 sudo rm -f /tmp/kadmin.out
13 sudo kadmin.local -p root/admin -q "cpw $USER@HCOOP.NET" \
14 2>&1 | tee /tmp/kadmin.out
15 cat /tmp/kadmin.out | grep '\(is too short while changing\|does not contain enough\)' && \
16 (echo == sending complaint to $USER@hcoop.net ====================================================;\
17 echo 'please change it' |\
18 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
19 -c admins@hcoop.net \
20 -s "your ~/.mire-password is too short or not complex enough" $USER@hcoop.net) || \
21 true
22 cat /tmp/kadmin.out | grep '\(Password for .* changed\|Cannot reuse password while changing password\)'
23 sudo rm -f /tmp/kadmin.out