2
. $(dirname $0)/../../include.rc
3
. $(dirname $0)/../../volume.rc
12
TEST $CLI volume create $V0 $H0:$B0/$V0
14
# Set auth.allow to dummy hostname so it *doesn't* include ourselves.
15
TEST $CLI volume set $V0 auth.allow example.org
16
TEST $CLI volume start $V0
18
# "System getspec" will include the username and password if the request comes
19
# from a server (which we are). Unfortunately, this will cause authentication
20
# to succeed in auth.login regardless of whether auth.addr is working properly
21
# or not, which is useless to us. To get a proper test, strip out those lines.
22
$CLI system getspec $V0 | sed -e /username/d -e /password/d > fubar.vol
24
# This mount should fail because auth.allow doesn't include us.
25
TEST $GFS -f fubar.vol $M0
27
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0
29
# Add tests when only username is present, but not password
30
# "System getspec" will include the username and password if the request comes
31
# from a server (which we are). Unfortunately, this will cause authentication
32
# to succeed in auth.login regardless of whether auth.addr is working properly
33
# or not, which is useless to us. To get a proper test, strip out those lines.
34
$CLI system getspec $V0 | sed -e /password/d > fubar.vol
36
# This mount should fail because auth.allow doesn't include our password.
37
TEST $GFS -f fubar.vol $M0
39
# If we had DONT_EXPECT_WITHIN we could use that, but we don't.
40
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0
42
# Now, add a test for login failure when server doesn't have the password entry
43
# Add tests when only username is present, but not password
44
# "System getspec" will include the username and password if the request comes
45
# from a server (which we are). Unfortunately, this will cause authentication
46
# to succeed in auth.login regardless of whether auth.addr is working properly
47
# or not, which is useless to us. To get a proper test, strip out those lines.
48
$CLI system getspec $V0 > fubar.vol
49
TEST $CLI volume stop $V0
51
sed -i -e '/password /d' /var/lib/glusterd/vols/$V0/$V0.*$V0.vol
53
TEST $CLI volume start $V0
55
# This mount should fail because auth.allow doesn't include our password.
56
TEST $GFS -f fubar.vol $M0
58
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0
60
# Set auth.allow to include us. This mount should therefore succeed.
61
TEST $CLI volume set $V0 auth.allow $H0
62
$CLI system getspec $V0 | sed -e /password/d > fubar.vol
64
TEST $GFS -f fubar.vol $M0
65
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 1 check_mounted $M0
67
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
69
# Set auth.reject to include us. This mount should therefore fail.
70
TEST $CLI volume stop $V0
72
TEST $CLI volume set $V0 auth.allow "\*"
73
TEST $CLI volume set $V0 auth.reject $H0
74
TEST $CLI volume start $V0
76
# Do this, so login module is not in picture
77
$CLI system getspec $V0 | sed -e /password/d > fubar.vol
79
TEST $GFS -f fubar.vol $M0
80
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0