From 0049f2b67b084006244f73a9a94979ba524a3bdd Mon Sep 17 00:00:00 2001 From: Ondrej Mular Date: Mon, 5 Jun 2017 10:14:16 +0200 Subject: [PATCH] squash bz1165821 pcs CLI/GUI should be capable of ab3b909 change flag for hardened cluster to --encryption setup cluster wo corosync encryption by default --- pcs/cli/common/parse_args.py | 2 +- pcs/cluster.py | 12 +++++++----- pcs/pcs.8 | 4 ++-- pcs/test/test_cluster.py | 24 ++++++++++++++++++++++++ pcs/usage.py | 6 +++--- pcs/utils.py | 2 +- pcsd/pcsd.rb | 2 +- pcsd/remote.rb | 4 ++-- pcsd/views/manage.erb | 11 +++++++---- 9 files changed, 48 insertions(+), 19 deletions(-) diff --git a/pcs/cli/common/parse_args.py b/pcs/cli/common/parse_args.py index 5b87fbc..d72a6d4 100644 --- a/pcs/cli/common/parse_args.py +++ b/pcs/cli/common/parse_args.py @@ -32,7 +32,7 @@ PCS_LONG_OPTIONS = [ "miss_count_const=", "fail_recv_const=", "corosync_conf=", "cluster_conf=", "booth-conf=", "booth-key=", - "remote", "watchdog=", "device=", "no-hardened", + "remote", "watchdog=", "device=", "encryption=", #in pcs status - do not display resorce status on inactive node "hide-inactive", # pcs resource (un)manage - enable or disable monitor operations diff --git a/pcs/cluster.py b/pcs/cluster.py index 0a9289b..d896b0c 100644 --- a/pcs/cluster.py +++ b/pcs/cluster.py @@ -303,6 +303,8 @@ def cluster_certkey(argv): def cluster_setup(argv): modifiers = utils.get_modificators() + if modifiers["encryption"] not in ["0", "1"]: + utils.err("Invalid value for option --encryption") if len(argv) < 2: usage.cluster(["setup"]) sys.exit(1) @@ -386,7 +388,7 @@ def cluster_setup(argv): options["transport_options"], options["totem_options"], options["quorum_options"], - modifiers["hardened"] + modifiers["encryption"] == "1" ) process_library_reports(messages) @@ -458,7 +460,7 @@ def cluster_setup(argv): file_definitions.update( node_communication_format.pcmk_authkey_file(generate_key()) ) - if modifiers["hardened"]: + if modifiers["encryption"] == "1": file_definitions.update( node_communication_format.corosync_authkey_file( generate_binary_key(random_bytes_count=128) @@ -743,7 +745,7 @@ def cluster_setup_parse_options_cman(options, force=False): def cluster_setup_create_corosync_conf( cluster_name, node_list, transport_options, totem_options, quorum_options, - is_hardened + encrypted ): messages = [] @@ -758,9 +760,9 @@ def cluster_setup_create_corosync_conf( corosync_conf.add_section(logging_section) totem_section.add_attribute("version", "2") - totem_section.add_attribute("cluster_name", cluster_name) - if not is_hardened: + if not encrypted: totem_section.add_attribute("secauth", "off") + totem_section.add_attribute("cluster_name", cluster_name) transport_options_names = ( "transport", diff --git a/pcs/pcs.8 b/pcs/pcs.8 index aee8b3a..446e7b3 100644 --- a/pcs/pcs.8 +++ b/pcs/pcs.8 @@ -205,7 +205,7 @@ Add specified utilization options to specified resource. If resource is not spec auth [node] [...] [\fB\-u\fR username] [\fB\-p\fR password] [\fB\-\-force\fR] [\fB\-\-local\fR] 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. .TP -setup [\fB\-\-start\fR [\fB\-\-wait\fR[=]]] [\fB\-\-local\fR] [\fB\-\-enable\fR] \fB\-\-name\fR [] [...] [\fB\-\-transport\fR udpu|udp] [\fB\-\-rrpmode\fR active|passive] [\fB\-\-addr0\fR [[[\fB\-\-mcast0\fR
] [\fB\-\-mcastport0\fR ] [\fB\-\-ttl0\fR ]] | [\fB\-\-broadcast0\fR]] [\fB\-\-addr1\fR [[[\fB\-\-mcast1\fR
] [\fB\-\-mcastport1\fR ] [\fB\-\-ttl1\fR ]] | [\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=