Merge lp:~pjdc/charms/trusty/rabbitmq-server/no-more-guest-user into lp:charms/trusty/rabbitmq-server

Proposed by Paul Collins on 2015-11-06
Status: Rejected
Rejected by: Matt Bruzek on 2015-12-15
Proposed branch: lp:~pjdc/charms/trusty/rabbitmq-server/no-more-guest-user
Merge into: lp:charms/trusty/rabbitmq-server
Diff against target: 68 lines (+39/-0)
3 files modified
config.yaml (+8/-0)
hooks/rabbit_utils.py (+12/-0)
hooks/rabbitmq_server_relations.py (+19/-0)
To merge this branch: bzr merge lp:~pjdc/charms/trusty/rabbitmq-server/no-more-guest-user
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing on 2015-12-18
Matt Bruzek (community) 2015-11-06 Disapprove on 2015-12-15
Ryan Beisner 2015-11-06 Resubmit on 2015-12-15
Review via email: mp+276831@code.launchpad.net

This proposal supersedes a proposal from 2015-11-04.

Description of the Change

rabbitmq creates a guest account by default, and in versions < 3.3.0, the guest account is usable over the network. This branch adds a config item to control the guest account, defaulting to off, i.e. "delete it".

Note that although check_rabbitmq.py defaults to the guest account, the charm creates and configures custom accounts and vhosts for monitoring purposes.

Resubmit:
 - don't try to manage the account until packages are installed
 - try to avoid collisions in the clustered case

To post a comment you must log in.
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_unit_test #12216 rabbitmq-server for pjdc mp276614
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/12216/

uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal

charm_amulet_test #7718 rabbitmq-server for pjdc mp276614
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13107588/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7718/

Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal

Here is the bit from the rmq/0 juju unit log where the guest account config failed. Also including the juju stat output for that deploy:

http://paste.ubuntu.com/13112600/

review: Needs Fixing

charm_lint_check #13162 rabbitmq-server for pjdc mp276831
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/13162/

charm_unit_test #12314 rabbitmq-server for pjdc mp276831
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/12314/

charm_amulet_test #7768 rabbitmq-server for pjdc mp276831
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/7768/

Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/1407/

review: Needs Fixing (automated testing)

charm_amulet_test #8228 rabbitmq-server for pjdc mp276831
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
Timeout occurred (2700s), printing juju status...environment: osci-sv08
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13871636/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8228/

Ryan Beisner (1chb1n) wrote :

FYI, test #8228 failed due to unrelated undercloud issue, safe to disregard that result. Re-triggering that test...

charm_amulet_test #8230 rabbitmq-server for pjdc mp276831
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13877848/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8230/

Ryan Beisner (1chb1n) wrote :

FYI, test #8230 failed due to unrelated undercloud metadata issue, safe to disregard that result.

Undercloud metadata issue seems to be resolved, retriggering test again.

Ryan Beisner (1chb1n) wrote :

FYI:

Given:
A recent change in Juju unit numbering behavior,
And: https://github.com/juju/amulet/issues/111,
And: Juju charm ci recycles a single bootstrap enviro across all test iterations in that charm:

The rmq amulet test will not pass in charm ci, but should be expected to pass in uosci since each test there gets a fresh bootstrap, and units will always start at zero.

charm_amulet_test #8243 rabbitmq-server for pjdc mp276831
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13903899/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8243/

charm_amulet_test #8246 rabbitmq-server for pjdc mp276831
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13946009/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8246/

charm_amulet_test #8298 rabbitmq-server for pjdc mp276831
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 124
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/14025794/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8298/

charm_amulet_test #8303 rabbitmq-server for pjdc mp276831
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8303/

Ryan Beisner (1chb1n) wrote :

Thanks again for your work on this, and thank you for your patience while we encountered system issued during testing. With the infrastructure issues resolved, the amulet tests for this proposal are now passing.

I've discussed the proposed changes with others on the OpenStack Engineering team, and, while this is a change in default behavior, it is viewed as an valuable improvement with no impact on Ubuntu OpenStack deployments.

This is a +1 from the OpenStack perspective. I am requesting a co-review from a peer in the Juju Ecosystem team because there is a possibility that non-OpenStack use cases are out there which relied on the previous default behavior (guest user enabled), regardless of whether or not that is good practice.

As a reminder, the review-queue (vapour) tests are failing, unrelated to the changes proposed by pjfc. https://github.com/juju/amulet/issues/111

review: Approve
Ryan Beisner (1chb1n) wrote :

It occurs to me that we should really have test coverage for the added feature. Unit and Amulet tests should accompany the proposed changes.

review: Needs Information
Ryan Beisner (1chb1n) wrote :

* Need to add unit + amulet test coverage for the new/changed features.

* This proposed change should be targeted to the "next" (development) branch of the rabbitmq-server charm [1], per the development norms [2]

* Upon further review, and even though these changes work well with the current Juju version (1.25.0), this will likely break deployments on older versions Juju in that:

--It is not safe to assume non-clustered configuration when leadership election support is absent. The charm may indeed be clustered, even though the LE feature may not be present in the older version of Juju.

[1] https://code.launchpad.net/~openstack-charmers/charms/trusty/rabbitmq-server/next

[2] https://wiki.ubuntu.com/ServerTeam/OpenStackCharms

review: Resubmit
Matt Bruzek (mbruzek) wrote :

According to Ryan's comments this merge needs to be re-created at a different target. I am going to set this charm to rejected. Please resubmit the charm at the correct target.

review: Disapprove
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-lxc/1770/

review: Needs Fixing (automated testing)
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/1748/

review: Needs Fixing (automated testing)

Unmerged revisions

112. By Paul Collins on 2015-11-05

enable-legacy-guest-account: handle clustered configurations

111. By Paul Collins on 2015-11-05

process enable-legacy-guest-account *after* rabbit is installed

110. By Paul Collins on 2015-11-04

add config item "enable-legacy-guest-account", and obey it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-10-22 13:24:30 +0000
3+++ config.yaml 2015-11-06 00:09:39 +0000
4@@ -209,3 +209,11 @@
5 - ['/', 'queue1', 10, 20]
6 - ['/', 'queue2', 200, 300]
7 Wildcards '*' are accepted to monitor all vhosts and/or queues
8+ enable-legacy-guest-account:
9+ type: boolean
10+ default: False
11+ description: |
12+ rabbitmq creates a "guest" account by default,
13+ which this charm will delete.
14+ .
15+ Set this config item to "true" to restore the account.
16
17=== modified file 'hooks/rabbit_utils.py'
18--- hooks/rabbit_utils.py 2015-10-22 13:24:30 +0000
19+++ hooks/rabbit_utils.py 2015-11-06 00:09:39 +0000
20@@ -185,6 +185,18 @@
21 rabbitmqctl('set_user_tags', user)
22
23
24+def delete_user(user):
25+ exists, is_admin = user_exists(user)
26+
27+ if exists:
28+ log('Deleting user (%s).' % user)
29+ rabbitmqctl('delete_user', user)
30+ return True
31+ else:
32+ log('Not deleting non-existent user (%s).' % user)
33+ return False
34+
35+
36 def grant_permissions(user, vhost):
37 log("Granting permissions", level='DEBUG')
38 rabbitmqctl('set_permissions', '-p',
39
40=== modified file 'hooks/rabbitmq_server_relations.py'
41--- hooks/rabbitmq_server_relations.py 2015-10-29 12:10:35 +0000
42+++ hooks/rabbitmq_server_relations.py 2015-11-06 00:09:39 +0000
43@@ -649,6 +649,25 @@
44 status_set('maintenance', 'Installing/upgrading RabbitMQ packages')
45 apt_install(rabbit.PACKAGES, fatal=True)
46
47+ manage_guest = None
48+ try:
49+ manage_guest = is_leader()
50+ if manage_guest:
51+ log('managing guest account')
52+ else:
53+ log('not managing guest account')
54+ except NotImplementedError:
55+ manage_guest = True
56+ log('managing guest account: is_leader() not implemented: assuming non-clustered configuration')
57+
58+ if manage_guest:
59+ status_set('maintenance', 'Managing RabbitMQ guest account')
60+ if config('enable-legacy-guest-account'):
61+ rabbit.create_user('guest', 'guest', admin=True)
62+ else:
63+ rabbit.delete_user('guest')
64+
65+ status_set('maintenance', 'Configuring RabbitMQ')
66 open_port(5672)
67
68 chown(RABBIT_DIR, rabbit.RABBIT_USER, rabbit.RABBIT_USER)

Subscribers

People subscribed via source and target branches