Skip to content

update sentinel doc for adding ACL authentication#1417

Merged
itamarhaber merged 6 commits intoredis:masterfrom
hwware:sentinel_acl
Oct 25, 2020
Merged

update sentinel doc for adding ACL authentication#1417
itamarhaber merged 6 commits intoredis:masterfrom
hwware:sentinel_acl

Conversation

@hwware
Copy link
Contributor

@hwware hwware commented Oct 13, 2020

Note: This PR is for review only since In line 790 I left a placeholder for the redis version for releasing ACL on Sentinel. We can replace it with correct version once this is released.

@oranagra
Copy link
Member

i tried to improve a bit, not sure if i did good.
@itamarhaber please have a look and comment.


With Redis 6.2, Sentinel instances can be configured with ACL authentication, so clients need to provide both a user and a password. As with password-only authentication, the same ACL user is used to authenticate both incoming clients and outgoing Sentinel connections. You can create and manage the Sentinel ACL user on all instances with regular [ACL directives](/topics/acl), for example:

ACL SETUSER my-sentinel-user on >my-sentinel-password +@all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hwware is this a good example? Perhaps something more restrictive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itamarhaber oh yes, maybe give just enough permission for the sentinel user, let me test this.. thanks for catching up this.

@itamarhaber
Copy link
Member

Also tried improving - one pending question.

@oranagra
Copy link
Member

@itamarhaber

As with password-only authentication, the same ACL user is used to authenticate both incoming clients and outgoing Sentinel connections.

that seems wrong to me.

  1. with the new sentinel-pass thingy, we now have separate control on the outgoing AUTH (sentinel-pass), and the incoming one (requirepass or ACL). that's true even if you don't use ACL users, and just have password, right?
  2. i'd like to discourage the use of requirepass entirely, i.e. people are expected to only use sentinel-pass even on systems with a single user and no ACL.

although now that i think of it, it may be cumbersome to use (comparing to the old single field that controls all). so we should at least discourage the use of requirepass with ACL, since we know it causes problems (redis/redis#7883)

@hwware
Copy link
Contributor Author

hwware commented Oct 22, 2020

Hi @oranagra, I think the first point you mentioned make sense to me, since the sentinel-user and pass controls how this sentinel auth with others for the outbound traffic, and the inbound traffic will be controlled by acl or requirepass config in current sentinel. However since sentinels in a cluster need to talk with each other, normally they should be configured with the same acl user and same sentinel-user and pass settings. Maybe we should say something more specific on this.
regarding the second one, I think we can mention something like it is not recommended that requirepass use together with ACL in https://github.com/redis/redis/blob/unstable/redis.conf#L795 and the sentinel conf, how do you think?

@itamarhaber
Copy link
Member

Ok, I think we're good now - please review @hwware @oranagra (sorry, got a little carried away :))

Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we missing a mention about ACL in the top of the Sentinel and Redis authentication section? it looks like the auth-user option isn't documented at all!

Comment on lines 588 to 596
* **ACL** This command manages the Sentinel Access Control List entries. For more information refer to the [ACL](/topics/acl) documentation page and the [_Configuring Sentinel instances with authentication_ section](#configuring-sentinel-instances-with-authentication).
* **AUTH** Authenticate a client connection. For more information refer to the `AUTH` command and the [_Configuring Sentinel instances with authentication_ section](#configuring-sentinel-instances-with-authentication).
* **CLIENT** This command manages client connections. For more information refer to the its subcommands' pages.
* **COMMAND** This command returns information about commands. For more information refer to the `COMMAND` command and its various subcommands.
* **HELLO** Switch the connection's protocol. For more information refer to the `HELLO` command.
* **INFO** Return information and statistics about the Sentinel server. For more information see the `INFO` command.
* **PING** This command simply returns PONG.
* **SENTINEL masters** Show a list of monitored masters and their state.
* **SENTINEL master `<master name>`** Show the state and info of the specified master.
* **SENTINEL replicas `<master name>`** Show a list of replicas for this master, and their state.
* **SENTINEL sentinels `<master name>`** Show a list of sentinel instances for this master, and their state.
* **SENTINEL get-master-addr-by-name `<master name>`** Return the ip and port number of the master with that name. If a failover is in progress or terminated successfully for this master it returns the address and port of the promoted replica.
* **SENTINEL reset `<pattern>`** This command will reset all the masters with matching name. The pattern argument is a glob-style pattern. The reset process clears any previous state in a master (including a failover in progress), and removes every replica and sentinel already discovered and associated with the master.
* **SENTINEL failover `<master name>`** Force a failover as if the master was not reachable, and without asking for agreement to other Sentinels (however a new version of the configuration will be published so that the other Sentinels will update their configurations).
* **SENTINEL ckquorum `<master name>`** Check if the current Sentinel configuration is able to reach the quorum needed to failover a master, and the majority needed to authorize the failover. This command should be used in monitoring systems to check if a Sentinel deployment is ok.
* **SENTINEL flushconfig** Force Sentinel to rewrite its configuration on disk, including the current Sentinel state. Normally Sentinel rewrites the configuration every time something changes in its state (in the context of the subset of the state which is persisted on disk across restart). However sometimes it is possible that the configuration file is lost because of operation errors, disk failures, package upgrade scripts or configuration managers. In those cases a way to to force Sentinel to rewrite the configuration file is handy. This command works even if the previous configuration file is completely missing.
* **ROLE** This command returns the string "sentinel" and a list of monitored masters. For more information refer to the `ROLE` command.
* **SHUTDOWN** Shut down the Sentinel instance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was a little bit hard to review.
for some reason github shows that you changed all the lines about the SENTINEL commands.
but comparing them one by one i see they are unchanged, and all you did is add the section at the top with the generic management APIs.

I see you also added COMMAND which is not yet merged, but we can assume is gonna be soon.
i suppose we need a versioning paragraph here to mention that ACL and COMMAND are new to 6.2.

also, i see all the PUBSUB commands are missing from this list. they are documented below, but maybe this list should have some note and a link to the other section.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I uppercased the subcommands in these lines, perhaps that's why.

WRT COMMAND - exactly.

Pub/Sub - as it is covered in another section I didn't put it in, but I also felt it was missing in terms of completeness. Will add.


Lastly, for authenticating incoming client connections, you can create a restricted Sentinel user like this:

127.0.0.1:5000> ACL SETUSER sentinel-user ON >user-password -@all +@connection +SENTINEL|MASTERS +SENTINEL|MASTER +SENTINEL|GET-MASTER-ADDR-BY-NAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can someone confirm that this line would be enough for sentinels to talk to each other and to their job?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually for incoming client connections and should be enough for discoverability, but an affirmation would be good.

@itamarhaber
Copy link
Member

You're totally right about auth-user - I saw it was missing and forgot to add it. Fixing.

@itamarhaber itamarhaber requested a review from oranagra October 24, 2020 18:45
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM..
i suppose someone needs to take another look at the live web version after this is merged to make sure the formatting works, and the reading flow and headers make sense.

@itamarhaber itamarhaber merged commit c387a8f into redis:master Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants