|
|
f778fe |
From 75488b2abdedb58715a21e365573a64e4ab1c324 Mon Sep 17 00:00:00 2001
|
|
|
f778fe |
From: Ondrej Mular <omular@redhat.com>
|
|
|
f778fe |
Date: Tue, 30 May 2017 16:47:55 +0200
|
|
|
f778fe |
Subject: [PATCH] squash bz1165821 pcs CLI/GUI should be capable of
|
|
|
f778fe |
|
|
|
f778fe |
e60e02d store binary data in the corosync authkey file
|
|
|
f778fe |
|
|
|
f778fe |
bf45303 cli: add option --no-hardened to 'cluster setup'
|
|
|
f778fe |
|
|
|
f778fe |
97dff2f web UI: add option to create not hardened cluster
|
|
|
f778fe |
---
|
|
|
f778fe |
pcs/cli/common/parse_args.py | 2 +-
|
|
|
f778fe |
pcs/cluster.py | 23 ++++++++++++++++-------
|
|
|
f778fe |
pcs/lib/tools.py | 5 ++++-
|
|
|
f778fe |
pcs/pcs.8 | 4 +++-
|
|
|
f778fe |
pcs/usage.py | 3 +++
|
|
|
f778fe |
pcs/utils.py | 1 +
|
|
|
f778fe |
pcsd/pcs.rb | 1 +
|
|
|
f778fe |
pcsd/pcsd.rb | 3 ++-
|
|
|
f778fe |
pcsd/remote.rb | 3 +++
|
|
|
f778fe |
pcsd/views/manage.erb | 9 +++++++++
|
|
|
f778fe |
10 files changed, 43 insertions(+), 11 deletions(-)
|
|
|
f778fe |
|
|
|
f778fe |
diff --git a/pcs/cli/common/parse_args.py b/pcs/cli/common/parse_args.py
|
|
|
f778fe |
index e2250c7..5b87fbc 100644
|
|
|
f778fe |
--- a/pcs/cli/common/parse_args.py
|
|
|
f778fe |
+++ b/pcs/cli/common/parse_args.py
|
|
|
f778fe |
@@ -32,7 +32,7 @@ PCS_LONG_OPTIONS = [
|
|
|
f778fe |
"miss_count_const=", "fail_recv_const=",
|
|
|
f778fe |
"corosync_conf=", "cluster_conf=",
|
|
|
f778fe |
"booth-conf=", "booth-key=",
|
|
|
f778fe |
- "remote", "watchdog=", "device=",
|
|
|
f778fe |
+ "remote", "watchdog=", "device=", "no-hardened",
|
|
|
f778fe |
#in pcs status - do not display resorce status on inactive node
|
|
|
f778fe |
"hide-inactive",
|
|
|
f778fe |
# pcs resource (un)manage - enable or disable monitor operations
|
|
|
f778fe |
diff --git a/pcs/cluster.py b/pcs/cluster.py
|
|
|
f778fe |
index 0fc5e2c..0a9289b 100644
|
|
|
f778fe |
--- a/pcs/cluster.py
|
|
|
f778fe |
+++ b/pcs/cluster.py
|
|
|
f778fe |
@@ -70,7 +70,11 @@ from pcs.lib.node import NodeAddresses, NodeAddressesList
|
|
|
f778fe |
from pcs.lib.nodes_task import check_corosync_offline_on_nodes, distribute_files
|
|
|
f778fe |
from pcs.lib import node_communication_format
|
|
|
f778fe |
import pcs.lib.pacemaker.live as lib_pacemaker
|
|
|
f778fe |
-from pcs.lib.tools import environment_file_to_dict, generate_key
|
|
|
f778fe |
+from pcs.lib.tools import (
|
|
|
f778fe |
+ environment_file_to_dict,
|
|
|
f778fe |
+ generate_binary_key,
|
|
|
f778fe |
+ generate_key,
|
|
|
f778fe |
+)
|
|
|
f778fe |
|
|
|
f778fe |
def cluster_cmd(argv):
|
|
|
f778fe |
if len(argv) == 0:
|
|
|
f778fe |
@@ -381,7 +385,8 @@ def cluster_setup(argv):
|
|
|
f778fe |
node_list,
|
|
|
f778fe |
options["transport_options"],
|
|
|
f778fe |
options["totem_options"],
|
|
|
f778fe |
- options["quorum_options"]
|
|
|
f778fe |
+ options["quorum_options"],
|
|
|
f778fe |
+ modifiers["hardened"]
|
|
|
f778fe |
)
|
|
|
f778fe |
process_library_reports(messages)
|
|
|
f778fe |
|
|
|
f778fe |
@@ -453,11 +458,12 @@ def cluster_setup(argv):
|
|
|
f778fe |
file_definitions.update(
|
|
|
f778fe |
node_communication_format.pcmk_authkey_file(generate_key())
|
|
|
f778fe |
)
|
|
|
f778fe |
- file_definitions.update(
|
|
|
f778fe |
- node_communication_format.corosync_authkey_file(
|
|
|
f778fe |
- generate_key(random_bytes_count=128)
|
|
|
f778fe |
+ if modifiers["hardened"]:
|
|
|
f778fe |
+ file_definitions.update(
|
|
|
f778fe |
+ node_communication_format.corosync_authkey_file(
|
|
|
f778fe |
+ generate_binary_key(random_bytes_count=128)
|
|
|
f778fe |
+ )
|
|
|
f778fe |
)
|
|
|
f778fe |
- )
|
|
|
f778fe |
|
|
|
f778fe |
distribute_files(
|
|
|
f778fe |
lib_env.node_communicator(),
|
|
|
f778fe |
@@ -736,7 +742,8 @@ def cluster_setup_parse_options_cman(options, force=False):
|
|
|
f778fe |
return parsed, messages
|
|
|
f778fe |
|
|
|
f778fe |
def cluster_setup_create_corosync_conf(
|
|
|
f778fe |
- cluster_name, node_list, transport_options, totem_options, quorum_options
|
|
|
f778fe |
+ cluster_name, node_list, transport_options, totem_options, quorum_options,
|
|
|
f778fe |
+ is_hardened
|
|
|
f778fe |
):
|
|
|
f778fe |
messages = []
|
|
|
f778fe |
|
|
|
f778fe |
@@ -752,6 +759,8 @@ def cluster_setup_create_corosync_conf(
|
|
|
f778fe |
|
|
|
f778fe |
totem_section.add_attribute("version", "2")
|
|
|
f778fe |
totem_section.add_attribute("cluster_name", cluster_name)
|
|
|
f778fe |
+ if not is_hardened:
|
|
|
f778fe |
+ totem_section.add_attribute("secauth", "off")
|
|
|
f778fe |
|
|
|
f778fe |
transport_options_names = (
|
|
|
f778fe |
"transport",
|
|
|
f778fe |
diff --git a/pcs/lib/tools.py b/pcs/lib/tools.py
|
|
|
f778fe |
index cd2d7f9..b9d7505 100644
|
|
|
f778fe |
--- a/pcs/lib/tools.py
|
|
|
f778fe |
+++ b/pcs/lib/tools.py
|
|
|
f778fe |
@@ -9,7 +9,10 @@ import os
|
|
|
f778fe |
|
|
|
f778fe |
|
|
|
f778fe |
def generate_key(random_bytes_count=32):
|
|
|
f778fe |
- return binascii.hexlify(os.urandom(random_bytes_count))
|
|
|
f778fe |
+ return binascii.hexlify(generate_binary_key(random_bytes_count))
|
|
|
f778fe |
+
|
|
|
f778fe |
+def generate_binary_key(random_bytes_count):
|
|
|
f778fe |
+ return os.urandom(random_bytes_count)
|
|
|
f778fe |
|
|
|
f778fe |
def environment_file_to_dict(config):
|
|
|
f778fe |
"""
|
|
|
f778fe |
diff --git a/pcs/pcs.8 b/pcs/pcs.8
|
|
|
f778fe |
index 4edfc72..aee8b3a 100644
|
|
|
f778fe |
--- a/pcs/pcs.8
|
|
|
f778fe |
+++ b/pcs/pcs.8
|
|
|
f778fe |
@@ -205,7 +205,7 @@ Add specified utilization options to specified resource. If resource is not spec
|
|
|
f778fe |
auth [node] [...] [\fB\-u\fR username] [\fB\-p\fR password] [\fB\-\-force\fR] [\fB\-\-local\fR]
|
|
|
f778fe |
Authenticate pcs to pcsd on nodes specified, or on all nodes configured in the local cluster if no nodes are specified (authorization tokens are stored in ~/.pcs/tokens or /var/lib/pcsd/tokens for root). By default all nodes are also authenticated to each other, using \fB\-\-local\fR only authenticates the local node (and does not authenticate the remote nodes with each other). Using \fB\-\-force\fR forces re\-authentication to occur.
|
|
|
f778fe |
.TP
|
|
|
f778fe |
-setup [\fB\-\-start\fR [\fB\-\-wait\fR[=<n>]]] [\fB\-\-local\fR] [\fB\-\-enable\fR] \fB\-\-name\fR <cluster name> <node1[,node1\-altaddr]> [<node2[,node2\-altaddr]>] [...] [\fB\-\-transport\fR udpu|udp] [\fB\-\-rrpmode\fR active|passive] [\fB\-\-addr0\fR <addr/net> [[[\fB\-\-mcast0\fR <address>] [\fB\-\-mcastport0\fR <port>] [\fB\-\-ttl0\fR <ttl>]] | [\fB\-\-broadcast0\fR]] [\fB\-\-addr1\fR <addr/net> [[[\fB\-\-mcast1\fR <address>] [\fB\-\-mcastport1\fR <port>] [\fB\-\-ttl1\fR <ttl>]] | [\fB\-\-broadcast1\fR]]]] [\fB\-\-wait_for_all\fR=<0|1>] [\fB\-\-auto_tie_breaker\fR=<0|1>] [\fB\-\-last_man_standing\fR=<0|1> [\fB\-\-last_man_standing_window\fR=<time in ms>]] [\fB\-\-ipv6\fR] [\fB\-\-token\fR <timeout>] [\fB\-\-token_coefficient\fR <timeout>] [\fB\-\-join\fR <timeout>] [\fB\-\-consensus\fR <timeout>] [\fB\-\-miss_count_const\fR <count>] [\fB\-\-fail_recv_const\fR <failures>]
|
|
|
f778fe |
+setup [\fB\-\-start\fR [\fB\-\-wait\fR[=<n>]]] [\fB\-\-local\fR] [\fB\-\-enable\fR] \fB\-\-name\fR <cluster name> <node1[,node1\-altaddr]> [<node2[,node2\-altaddr]>] [...] [\fB\-\-transport\fR udpu|udp] [\fB\-\-rrpmode\fR active|passive] [\fB\-\-addr0\fR <addr/net> [[[\fB\-\-mcast0\fR <address>] [\fB\-\-mcastport0\fR <port>] [\fB\-\-ttl0\fR <ttl>]] | [\fB\-\-broadcast0\fR]] [\fB\-\-addr1\fR <addr/net> [[[\fB\-\-mcast1\fR <address>] [\fB\-\-mcastport1\fR <port>] [\fB\-\-ttl1\fR <ttl>]] | [\fB\-\-broadcast1\fR]]]] [\fB\-\-wait_for_all\fR=<0|1>] [\fB\-\-auto_tie_breaker\fR=<0|1>] [\fB\-\-last_man_standing\fR=<0|1> [\fB\-\-last_man_standing_window\fR=<time in ms>]] [\fB\-\-ipv6\fR] [\fB\-\-token\fR <timeout>] [\fB\-\-token_coefficient\fR <timeout>] [\fB\-\-join\fR <timeout>] [\fB\-\-consensus\fR <timeout>] [\fB\-\-miss_count_const\fR <count>] [\fB\-\-fail_recv_const\fR <failures>] [\fB\-\-no\-hardened\fR]
|
|
|
f778fe |
Configure corosync and sync configuration out to listed nodes. \fB\-\-local\fR will only perform changes on the local node, \fB\-\-start\fR will also start the cluster on the specified nodes, \fB\-\-wait\fR will wait up to 'n' seconds for the nodes to start, \fB\-\-enable\fR will enable corosync and pacemaker on node startup, \fB\-\-transport\fR allows specification of corosync transport (default: udpu; udp for CMAN clusters), \fB\-\-rrpmode\fR allows you to set the RRP mode of the system. Currently only 'passive' is supported or tested (using 'active' is not recommended). The \fB\-\-wait_for_all\fR, \fB\-\-auto_tie_breaker\fR, \fB\-\-last_man_standing\fR, \fB\-\-last_man_standing_window\fR options are all documented in corosync's votequorum(5) man page. These options are not supported on CMAN clusters.
|
|
|
f778fe |
|
|
|
f778fe |
\fB\-\-ipv6\fR will configure corosync to use ipv6 (instead of ipv4). This option is not supported on CMAN clusters.
|
|
|
f778fe |
@@ -222,6 +222,8 @@ Configure corosync and sync configuration out to listed nodes. \fB\-\-local\fR w
|
|
|
f778fe |
|
|
|
f778fe |
\fB\-\-fail_recv_const\fR <failures> specifies how many rotations of the token without receiving any messages when messages should be received may occur before a new configuration is formed (default 2500 failures)
|
|
|
f778fe |
|
|
|
f778fe |
+If \fB\-\-no\-hardened\fR is specified, the cluster will be set up in way that all corosync communication will be encrypted.
|
|
|
f778fe |
+
|
|
|
f778fe |
|
|
|
f778fe |
Configuring Redundant Ring Protocol (RRP)
|
|
|
f778fe |
|
|
|
f778fe |
diff --git a/pcs/usage.py b/pcs/usage.py
|
|
|
f778fe |
index c73a103..c1ab00f 100644
|
|
|
f778fe |
--- a/pcs/usage.py
|
|
|
f778fe |
+++ b/pcs/usage.py
|
|
|
f778fe |
@@ -576,6 +576,7 @@ Commands:
|
|
|
f778fe |
[--ipv6] [--token <timeout>] [--token_coefficient <timeout>]
|
|
|
f778fe |
[--join <timeout>] [--consensus <timeout>]
|
|
|
f778fe |
[--miss_count_const <count>] [--fail_recv_const <failures>]
|
|
|
f778fe |
+ [--no-hardened]
|
|
|
f778fe |
Configure corosync and sync configuration out to listed nodes.
|
|
|
f778fe |
--local will only perform changes on the local node,
|
|
|
f778fe |
--start will also start the cluster on the specified nodes,
|
|
|
f778fe |
@@ -611,6 +612,8 @@ Commands:
|
|
|
f778fe |
without receiving any messages when messages should be received
|
|
|
f778fe |
may occur before a new configuration is formed
|
|
|
f778fe |
(default 2500 failures)
|
|
|
f778fe |
+ If --no-hardened is specified, the cluster will be set up in way that all
|
|
|
f778fe |
+ corosync communication will be encrypted.
|
|
|
f778fe |
|
|
|
f778fe |
Configuring Redundant Ring Protocol (RRP)
|
|
|
f778fe |
|
|
|
f778fe |
diff --git a/pcs/utils.py b/pcs/utils.py
|
|
|
f778fe |
index 6515e5f..eec832f 100644
|
|
|
f778fe |
--- a/pcs/utils.py
|
|
|
f778fe |
+++ b/pcs/utils.py
|
|
|
f778fe |
@@ -2882,6 +2882,7 @@ def get_modificators():
|
|
|
f778fe |
"force": "--force" in pcs_options,
|
|
|
f778fe |
"full": "--full" in pcs_options,
|
|
|
f778fe |
"group": pcs_options.get("--group", None),
|
|
|
f778fe |
+ "hardened": "--no-hardened" not in pcs_options,
|
|
|
f778fe |
"monitor": "--monitor" in pcs_options,
|
|
|
f778fe |
"name": pcs_options.get("--name", None),
|
|
|
f778fe |
"no-default-ops": "--no-default-ops" in pcs_options,
|
|
|
f778fe |
diff --git a/pcsd/pcs.rb b/pcsd/pcs.rb
|
|
|
f778fe |
index 9764a43..878296b 100644
|
|
|
f778fe |
--- a/pcsd/pcs.rb
|
|
|
f778fe |
+++ b/pcsd/pcs.rb
|
|
|
f778fe |
@@ -1835,6 +1835,7 @@ def get_node_status(auth_user, cib_dom)
|
|
|
f778fe |
'moving_resource_in_group',
|
|
|
f778fe |
'unmanaged_resource',
|
|
|
f778fe |
'alerts',
|
|
|
f778fe |
+ 'hardened_cluster',
|
|
|
f778fe |
]
|
|
|
f778fe |
}
|
|
|
f778fe |
|
|
|
f778fe |
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
|
|
|
f778fe |
index 33d999d..4d1964d 100644
|
|
|
f778fe |
--- a/pcsd/pcsd.rb
|
|
|
f778fe |
+++ b/pcsd/pcsd.rb
|
|
|
f778fe |
@@ -568,7 +568,8 @@ already been added to pcsd. You may not add two clusters with the same name int
|
|
|
f778fe |
{
|
|
|
f778fe |
:clustername => @cluster_name,
|
|
|
f778fe |
:nodes => @nodes_rrp.join(';'),
|
|
|
f778fe |
- :options => options.to_json
|
|
|
f778fe |
+ :options => options.to_json,
|
|
|
f778fe |
+ :no_hardened => params[:no_hardened],
|
|
|
f778fe |
},
|
|
|
f778fe |
true,
|
|
|
f778fe |
nil,
|
|
|
f778fe |
diff --git a/pcsd/remote.rb b/pcsd/remote.rb
|
|
|
f778fe |
index f353980..e37abb7 100644
|
|
|
f778fe |
--- a/pcsd/remote.rb
|
|
|
f778fe |
+++ b/pcsd/remote.rb
|
|
|
f778fe |
@@ -964,6 +964,9 @@ def setup_cluster(params, request, auth_user)
|
|
|
f778fe |
end
|
|
|
f778fe |
nodes_options = nodes + options
|
|
|
f778fe |
nodes_options += options_udp if transport_udp
|
|
|
f778fe |
+ if params[:no_hardened] == "1"
|
|
|
f778fe |
+ nodes_options << "--no-hardened"
|
|
|
f778fe |
+ end
|
|
|
f778fe |
stdout, stderr, retval = run_cmd(
|
|
|
f778fe |
auth_user, PCS, "cluster", "setup", "--enable", "--start", "--async",
|
|
|
f778fe |
"--name", params[:clustername], *nodes_options
|
|
|
f778fe |
diff --git a/pcsd/views/manage.erb b/pcsd/views/manage.erb
|
|
|
f778fe |
index 39ab41f..a055449 100644
|
|
|
f778fe |
--- a/pcsd/views/manage.erb
|
|
|
f778fe |
+++ b/pcsd/views/manage.erb
|
|
|
f778fe |
@@ -222,6 +222,9 @@
|
|
|
f778fe |
|
|
|
f778fe |
<% transport_desc = "\
|
|
|
f778fe |
Enables either udpu (unicast) or udp (multicast) cluster communication (default: udpu)"%>
|
|
|
f778fe |
+ <% hardened_desc = "\
|
|
|
f778fe |
+Create cluster with encrypted corosync communication. This option may not work \
|
|
|
f778fe |
+with pcs version lower than 0.9.159." %>
|
|
|
f778fe |
<% wait_for_all_desc = "\
|
|
|
f778fe |
Enables Wait For All (WFA) feature (default: off).
|
|
|
f778fe |
|
|
|
f778fe |
@@ -345,6 +348,12 @@ Specify ring 1 address for each node if you want to use RRP." %>
|
|
|
f778fe |
</select>
|
|
|
f778fe |
|
|
|
f778fe |
|
|
|
f778fe |
+ Hardened:
|
|
|
f778fe |
+
|
|
|
f778fe |
+ <label><input type="radio" name="no_hardened" value="0" checked="checked">Yes</label>
|
|
|
f778fe |
+ <label><input type="radio" name="no_hardened" value="1">No</label>
|
|
|
f778fe |
+
|
|
|
f778fe |
+
|
|
|
f778fe |
Wait for All:<input type=checkbox name="config-wait_for_all">
|
|
|
f778fe |
Auto Tie Breaker:<input type=checkbox name="config-auto_tie_breaker">
|
|
|
f778fe |
Last Man Standing:<input type=checkbox name="config-last_man_standing">
|
|
|
f778fe |
--
|
|
|
f778fe |
1.8.3.1
|
|
|
f778fe |
|