Page MenuHomePhabricator

Improve user management for AQS Cassandra
Open, LowPublic5 Estimated Story Points

Description

After a chat with @JAllemandou and @Eevans we agreed that the AQS clusters should migrate to a better user management scheme. We are currently using the admin 'cassandra' user for Restbase reads and also for writes, that has multiple downsides:

  1. requires QUORUM during user authentication, not really great for performances (as opposed to local one for simple users);
  2. does not protect the system.auth table properly.

The migration procedure should be something like:

  • Set an new application_username and application_password (to create $CASSANDRA_CONF/user_aqs.cql on nodes)
  • Run cqlsh -u cassandra -f $CASSANDRA_CONF/user_aqs.cql $HOSTNAME (creates user)
  • Change restbase::cassandra_user (configuring AQS service to use the aqs user)
  • Set a new super_password for the Cassandra username (in private.git) for templating of $CASSANDRA_CONF/cqlshrc
  • Update the super password in Cassandra to match $CASSANDRA_CONF/cqlshrc
  • Set an new application_username and application_password (to create $CASSANDRA_CONF/user_aqsloader.cql on nodes)

We definitely want to do it for aqs100[456] but aqs100[123] will need extra care because live.

Event Timeline

Nuria changed the point value for this task from 0 to 5.Aug 4 2016, 5:19 PM

Interesting reading: https://issues.apache.org/jira/browse/CASSANDRA-5310

QUORUM is only used for default superuser ('cassandra'), for other users ONE is used. You are not supposed to use 'cassandra' user directly, except to create another superuser and use that one from that point on.

This is probably why the password caching increase on aqs100[123] gave so much performance improvements.

Change 303772 had a related patch set uploaded (by Elukey):
Add fake aqs Cassandra user's password

https://gerrit.wikimedia.org/r/303772

Change 303772 merged by Elukey:
Add fake aqs Cassandra user's password

https://gerrit.wikimedia.org/r/303772

Change 303774 had a related patch set uploaded (by Elukey):
Add the configuration needed to prepare a new AQS Cassandra user creation

https://gerrit.wikimedia.org/r/303774

Change 303774 merged by Elukey:
Add the configuration needed to prepare a new AQS Cassandra user creation

https://gerrit.wikimedia.org/r/303774

Change 303783 had a related patch set uploaded (by Elukey):
Include the password::aqs namespace in the AQS role

https://gerrit.wikimedia.org/r/303783

Change 303783 merged by Elukey:
Include the password::aqs namespace in the AQS role

https://gerrit.wikimedia.org/r/303783

Change 303786 had a related patch set uploaded (by Elukey):
Move the include of cassandra/aqs passwords up to solve a priority issue

https://gerrit.wikimedia.org/r/303786

Change 303786 merged by Elukey:
Move the include of cassandra/aqs passwords up to solve a priority issue

https://gerrit.wikimedia.org/r/303786

aqs user added to aqs100[456] and verified that it returns data on each instance with the following query:

elukey@aqs1004:~$ cat showdata.cql
select project from "local_group_default_T_pageviews_per_article_flat".data limit 10;
elukey@aqs1004:~$ cqlsh -u aqs -f showdata.cql aqs1004-a.eqiad.wmnet

Change 303792 had a related patch set uploaded (by Elukey):
Change the AQS restbase user from 'cassandra' to 'aqs'

https://gerrit.wikimedia.org/r/303792

Change 303792 merged by Elukey:
Change the AQS restbase user from 'cassandra' to 'aqs'

https://gerrit.wikimedia.org/r/303792

New cluster switched, installed the new user in the current one (aqs100[123]) and tested:

elukey@aqs1001:~$ cqlsh -u aqs -f showdata.cql aqs1001.eqiad.wmnet
Password:

 project
---------------
 en.wikisource
  ja.wikipedia
  hu.wikipedia
  fr.wikipedia
  fr.wikipedia
  fr.wikipedia
  fr.wikipedia
 bg.wiktionary
  en.wikipedia
  en.wikipedia

(10 rows)
elukey@aqs1001:~$ cqlsh -u aqs -f showdata.cql aqs1002.eqiad.wmnet
Password:

 project
---------------
 en.wikisource
  ja.wikipedia
  hu.wikipedia
  fr.wikipedia
  fr.wikipedia
  fr.wikipedia
  fr.wikipedia
 bg.wiktionary
  en.wikipedia
  en.wikipedia

(10 rows)
elukey@aqs1001:~$ cqlsh -u aqs -f showdata.cql aqs1003.eqiad.wmnet
Password:

 project
---------------
 en.wikisource
  ja.wikipedia
  hu.wikipedia
  fr.wikipedia
  fr.wikipedia
  fr.wikipedia
  fr.wikipedia
 bg.wiktionary
  en.wikipedia
  en.wikipedia

(10 rows)

Change 303798 had a related patch set uploaded (by Elukey):
Switch the AQS restbase use from 'cassandra' to aqs

https://gerrit.wikimedia.org/r/303798

Mentioned in SAL [2016-08-09T15:59:50Z] <elukey> switching restbase/cassandra user on aqs100[123] to aqs (T142073) - https://gerrit.wikimedia.org/r/303798 will be applied to one node at the time with depool/pool

Change 303798 merged by Elukey:
Switch the AQS restbase use from 'cassandra' to 'aqs'

https://gerrit.wikimedia.org/r/303798

Remaining steps:

  1. establish how to distribute the new user/password credentials to oozie;
  2. move oozie away from the 'cassandra' user, either using the newly created 'aqs' user or creating a new one;
  3. replace the current cassandra admin password with another one.
mforns lowered the priority of this task from Medium to Low.Apr 16 2018, 4:25 PM
elukey added a parent task: Restricted Task.Jul 25 2018, 8:58 AM
Milimetric renamed this task from Improve user management for AQS to Improve user management for AQS Cassandra.Oct 22 2018, 3:43 PM

@Eevans Is this request still relevant given the latest AQS plans?

@Eevans Is this request still relevant given the latest AQS plans?

It is, yeah.

It looks like it is partially complete. RESTBase (aka "The AQS Service") is using its own (non-privileged) dedicated user now, but the superuser password still needs to be changed. Additionally, what was originally done with adduser.cql mentioned above, now has a new convention, and the aqsloader user needs to avail itself of that as well (that user existed when this ticket was created; I think that was just an oversight).

I will update the ticket description to reflect this, and put this ticket on the Cassandra board so it isn't forgotten about.