summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2014-06-19 15:31:46 +0530
committerVijay Bellur <vbellur@redhat.com>2014-09-24 00:00:13 -0700
commitb0f98446d5b465c3fc88569396fe3c6b5793aed5 (patch)
treee0c18c46c9d346092fb6eb83ce774fd8303f25be /tests
parentc4440ab8c7417a3bcaadf1cb150476d5ff6a1325 (diff)
glusterd: Authenticate management handshake requests
Backport of 371bb42 glusterd: Authenticate management handshake requests from master. Management handshake requests, which are used to validate op-version supported by the peers, are now only allowed if, - the glusterd doesn't have any other peer, or - the request was sent by another peer. This prevents the op-version of a peer being changed because of a connection attempt by an invalid peer. BUG: 1144978 Change-Id: I5a909dad37e9873efe8b75dad41b7af71ce91c3d Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/8819 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/bug-1109741-auth-mgmt-handshake.t50
-rwxr-xr-xtests/cluster.rc12
2 files changed, 58 insertions, 4 deletions
diff --git a/tests/bugs/bug-1109741-auth-mgmt-handshake.t b/tests/bugs/bug-1109741-auth-mgmt-handshake.t
new file mode 100644
index 00000000000..42a8eb3ed82
--- /dev/null
+++ b/tests/bugs/bug-1109741-auth-mgmt-handshake.t
@@ -0,0 +1,50 @@
+#! /bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../cluster.rc
+
+# The test will attempt to verify that management handshake requests to
+# GlusterD are authenticated before being allowed to change a GlusterD's
+# op-version
+#
+# 1. Launch 3 glusterds
+# 2. Probe 2 of them to form a cluster. This should succeed.
+# 3. Probe either of the first two GlusterD's from the 3rd GlusterD. This should fail.
+# 4. a. Reduce the op-version of 3rd GlusterD and restart it.
+# b. Probe either of the first two GlusterD's from the 3rd GlusterD. This should fail.
+# 5. Check current op-version of first two GlusterDs. It shouldn't have changed.
+# 6. Probe third GlusterD from the cluster. This should succeed.
+
+
+cleanup
+
+TEST launch_cluster 3
+
+TEST $CLI_1 peer probe $H2
+
+TEST ! $CLI_3 peer probe $H1
+
+GD1_WD=$($CLI_1 system getwd)
+OP_VERS_ORIG=$(grep 'operating-version' ${GD1_WD}/glusterd.info | cut -d '=' -f 2)
+
+TEST $CLI_3 system uuid get # Needed for glusterd.info to be created
+
+GD3_WD=$($CLI_3 system getwd)
+TEST sed -rnie "'s/(operating-version=)\w+/\130600/gip'" ${GD3_WD}/glusterd.info
+
+TEST kill_glusterd 3
+TEST start_glusterd 3
+
+TEST ! $CLI_3 peer probe $H1
+
+OP_VERS_NEW=$(grep 'operating-version' ${GD1_WD}/glusterd.info | cut -d '=' -f 2)
+TEST [[ $OP_VERS_ORIG == $OP_VERS_NEW ]]
+
+TEST $CLI_1 peer probe $H3
+
+kill_node 1
+kill_node 2
+kill_node 3
+
+cleanup;
+
diff --git a/tests/cluster.rc b/tests/cluster.rc
index 365f9a2ddfd..546b21400fa 100755
--- a/tests/cluster.rc
+++ b/tests/cluster.rc
@@ -61,13 +61,17 @@ function define_glusterds() {
done
}
+function start_glusterd() {
+ local g
+ local index=$1
-function start_glusterds() {
- local g;
+ g="glusterd_${index}"
+ ${!g}
+}
+function start_glusterds() {
for i in `seq 1 $CLUSTER_COUNT`; do
- g="glusterd_$i";
- ${!g};
+ start_glusterd $i
done
}