162b4a73 |
1 | #!/bin/bash -e |
2 | |
3 | # disable debug !/bin/bash -ex |
e1441848 |
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 |
f1981b02 |
15 | cat /tmp/kadmin.out | grep '\(is too short while changing\|does not contain enough\)' && \ |
08839fa8 |
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 \ |
f1981b02 |
20 | -s "your ~/.mire-password is too short or not complex enough" $USER@hcoop.net) || \ |
08839fa8 |
21 | true |
e1441848 |
22 | cat /tmp/kadmin.out | grep '\(Password for .* changed\|Cannot reuse password while changing password\)' |
23 | sudo rm -f /tmp/kadmin.out |