glusterfs

Форк
0
/
bug-1321578.t 
82 строки · 2.9 Кб
1
#!/bin/bash
2
. $(dirname $0)/../../include.rc
3
. $(dirname $0)/../../volume.rc
4

5
check_mounted () {
6
	df | grep $1 | wc -l
7
}
8

9
CHECK_MOUNT_TIMEOUT=7
10

11
TEST glusterd
12
TEST $CLI volume create $V0 $H0:$B0/$V0
13

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
17

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
23

24
# This mount should fail because auth.allow doesn't include us.
25
TEST $GFS -f fubar.vol $M0
26

27
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0
28

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
35

36
# This mount should fail because auth.allow doesn't include our password.
37
TEST $GFS -f fubar.vol $M0
38

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
41

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
50

51
sed -i -e '/password /d' /var/lib/glusterd/vols/$V0/$V0.*$V0.vol
52

53
TEST $CLI volume start $V0
54

55
# This mount should fail because auth.allow doesn't include our password.
56
TEST $GFS -f fubar.vol $M0
57

58
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0
59

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
63

64
TEST $GFS -f fubar.vol $M0
65
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 1 check_mounted $M0
66

67
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
68

69
# Set auth.reject to include us.  This mount should therefore fail.
70
TEST $CLI volume stop $V0
71

72
TEST $CLI volume set $V0 auth.allow "\*"
73
TEST $CLI volume set $V0 auth.reject $H0
74
TEST $CLI volume start $V0
75

76
# Do this, so login module is not in picture
77
$CLI system getspec $V0 | sed -e /password/d > fubar.vol
78

79
TEST $GFS -f fubar.vol $M0
80
EXPECT_WITHIN $CHECK_MOUNT_TIMEOUT 0 check_mounted $M0
81

82
cleanup
83

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.