Debian Codegraph @

tests/usertools/chpasswd-PAM/20_chpasswd_password_SHA256_rounds_900/chpasswd.test

raw
1 #!/bin/sh
2
3 set -e
4
5 cd $(dirname $0)
6
7 . ../../../common/config.sh
8 . ../../../common/log.sh
9
10 log_start "$0" "chpasswd can use create SHA256 passwords and use at least 1000 rounds"
11
12 save_config
13
14 # restore the files on exit
15 trap 'log_status "$0" "FAILURE"; restore_config' 0
16
17 change_config
18
19 echo -n "Change nobody and lp's password (chpasswd --crypt-method SHA256 -s 900)..."
20 echo 'nobody:test
21 lp:test2' | chpasswd --crypt-method SHA256 -s 900
22 echo "OK"
23
24 echo -n "Check the passwd file..."
25 ../../../common/compare_file.pl config/etc/passwd /etc/passwd
26 echo "OK"
27 echo -n "Check the group file..."
28 ../../../common/compare_file.pl config/etc/group /etc/group
29 echo "OK"
30 echo -n "Check the shadow file..."
31 ../../../common/compare_file.pl data/shadow /etc/shadow
32 grep nobody /etc/shadow | grep -q ':\$5\$rounds=1000\$'
33 echo "OK"
34 echo -n "Check the gshadow file..."
35 ../../../common/compare_file.pl config/etc/gshadow /etc/gshadow
36 echo "OK"
37
38 log_status "$0" "SUCCESS"
39 restore_config
40 trap '' 0
41