Bug 1303803

Summary: rabbitmq resource-agents wipes too much data on recovery and kills additional users configuration
Product: Red Hat Enterprise Linux 7 Reporter: Chris Lincoln <clincoln>
Component: resource-agentsAssignee: Peter Lemenkov <plemenko>
Status: CLOSED ERRATA QA Contact: Leonid Natapov <lnatapov>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: adrianlzt, agk, amoralej, athomas, cluster-maint, dchia, dmaley, fdinitto, jeckersb, mburns, mcornea, mfuruta, oalbrigt, plemenko, rhel-osp-director-maint, sknauss, xiaoxwan
Target Milestone: pre-dev-freezeKeywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://github.com/lemenkov/resource-agents/tree/dont_wipe_users
Whiteboard:
Fixed In Version: resource-agents-3.9.5-65.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1316633 (view as bug list) Environment:
Last Closed: 2016-11-04 00:01:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1316633    
Attachments:
Description Flags
Initial patch none

Description Chris Lincoln 2016-02-02 02:46:18 UTC
Description of problem:
Ability to create RabbitMQ users that sustain across resource restarts. Justification is for monitoring capabilities that don't use the RabbitMQ admin user, and not using the guest account with its randomized password (i.e., create a specific monitor user with a specific password).

Comment 2 John Eckersberg 2016-02-10 18:17:41 UTC
This should be a pretty simple fix if I understand what the problem
is.  What happens currently in the resource agent is roughly:

- Start node

- If it's the only one up so far, then do nothing and wait for other
  nodes.  If at least one other node is already up, join cluster with
  the other node.

- If the cluster join fails, then blow away mnesia (literally rm -rf
  /var/lib/rabbitmq/mnesia/*) and try again.  Unfortunately mnesia is
  also where the user config is stored, so this is where the users get
  lost.

So, we just need to be less heavy-handed when attempting to right the
cluster.  Some combination of the rabbitmqctl commands
forget_cluster_node [--offline] / update_cluster_nodes / force_boot
should let us patch things up without completely removing mnesia and
all of the users with it.

Comment 3 Peter Lemenkov 2016-02-23 14:59:43 UTC
Indeed we shouldn't remove so much data while restarting.

Comment 4 Peter Lemenkov 2016-02-24 16:36:57 UTC
Ok, we almost there. Thanks to the recently built resource-agents-3.9.5-54.el7_2.7.x86_64 it's much easy to fix the cluster now. No need to wipe out Mnesia entirely.

I'm going to propose a fix soon.

Comment 5 Peter Lemenkov 2016-02-29 11:19:34 UTC
Hello All!
I've got a patch which fixes that. I'm going to test it a little and provide a test build in a 4-6 hours.

This patch restores only "users" (rabbit_user) table. Other tables will be purged.

Comment 8 Peter Lemenkov 2016-03-01 10:47:42 UTC
Created attachment 1131859 [details]
Initial patch

A proposed solution

Comment 17 Leonid Natapov 2016-03-16 13:22:50 UTC
resource-agents-3.9.5-67.el7

tested according comment #7. User still exist after resource restart.

Comment 18 Peter Lemenkov 2016-04-11 09:03:50 UTC
*** Bug 1297859 has been marked as a duplicate of this bug. ***

Comment 19 adrianlzt 2016-05-10 15:38:33 UTC
We use to add a monitoring user like:

rabbitmqctl add_user nagios PASSWORD
rabbitmqctl set_user_tags nagios monitoring
rabbitmqctl set_permissions nagios ".*" ".*" ".*"

Every time RabbitMQ is restarted, permissions are lost for this user.

PR to backup also this perms:
https://github.com/lemenkov/resource-agents/pull/1

Comment 20 Peter Lemenkov 2016-05-18 12:59:42 UTC
(In reply to adrianlzt from comment #19)
> We use to add a monitoring user like:
> 
> rabbitmqctl add_user nagios PASSWORD
> rabbitmqctl set_user_tags nagios monitoring
> rabbitmqctl set_permissions nagios ".*" ".*" ".*"
> 
> Every time RabbitMQ is restarted, permissions are lost for this user.
> 
> PR to backup also this perms:
> https://github.com/lemenkov/resource-agents/pull/1

Thanks for the addition! I'll merge it shortly.

Comment 22 xiaoxwan 2016-08-31 09:21:57 UTC
(In reply to Peter Lemenkov from comment #20)
> (In reply to adrianlzt from comment #19)
> > We use to add a monitoring user like:
> > 
> > rabbitmqctl add_user nagios PASSWORD
> > rabbitmqctl set_user_tags nagios monitoring
> > rabbitmqctl set_permissions nagios ".*" ".*" ".*"
> > 
> > Every time RabbitMQ is restarted, permissions are lost for this user.
> > 
> > PR to backup also this perms:
> > https://github.com/lemenkov/resource-agents/pull/1
> 
> Thanks for the addition! I'll merge it shortly.

I didn't saw the code about userperm in: 
https://github.com/ClusterLabs/resource-agents/master . 
Did we solved this problem there?

Comment 23 Peter Lemenkov 2016-08-31 15:44:29 UTC
(In reply to xiaoxwan from comment #22)
 
> I didn't saw the code about userperm in: 
> https://github.com/ClusterLabs/resource-agents/master . 
> Did we solved this problem there?

No not yet.

Comment 26 errata-xmlrpc 2016-11-04 00:01:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2174.html

Comment 27 Red Hat Bugzilla 2023-09-14 03:17:08 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days