ACL DIGEST · Valkey

ACL DIGEST

Returns a fingerprint of the ACL rules currently in effect.

Usage

ACL DIGEST

Description

Return a fingerprint of the ACL rules currently in effect, as a hexadecimal string. The digest depends only on the rules in effect and not on the order the users and roles were created in, so two servers configured alike report the same digest.

The digest covers everything ACL LIST reports: the user names, their flags, their password hashes, and their command, key and channel rules, and the roles with their rules. Any change to any user or role changes the digest. Changing a role’s rules with ACL SETROLE changes it too, even though the lines of the users that hold the role stay the same. The reply is the same size however many users and roles are configured.

This is meant for confirming which revision of an ACL a server is running. A client that manages users through an ACL file can read the digest before and after an ACL LOAD to tell whether the file it wrote is the one now in effect. Comparing the rules themselves is impractical, because the server reports them in its own normalized form rather than the form they were written in, so a client would need its own copy of the rule parser to compare them.

Reply

String: the digest of the ACL rules currently in effect, as a hexadecimal string.

Complexity

O(N). Where N is the number of configured users and roles.

ACL Categories

@admin @dangerous @slow

Examples

127.0.0.1:6379> ACL DIGEST
"19566a9119379147926cb177af97ea4c8cc6cd5ef252ae6e6a0c587ae174e731"
127.0.0.1:6379> ACL SETUSER alice on >alice ~key:* +get
OK
127.0.0.1:6379> ACL DIGEST
"b7fe19e1064127c9739f0a9cb0efaac7a2e7e7e788ef2f9ff55bf68806ebd43b"
127.0.0.1:6379> ACL DELUSER alice
(integer) 1
127.0.0.1:6379> ACL DIGEST
"19566a9119379147926cb177af97ea4c8cc6cd5ef252ae6e6a0c587ae174e731"

Editing a role changes the digest, although the line of the user that holds it does not change:

127.0.0.1:6379> ACL SETROLE reader ~data:* +get
OK
127.0.0.1:6379> ACL SETUSER bob on >bob role=reader
OK
127.0.0.1:6379> ACL DIGEST
"fae16b1655b7c98804f3c98b6e7521bd425bc42dd7fedd8d2490d593609ece3f"
127.0.0.1:6379> ACL SETROLE reader +set
OK
127.0.0.1:6379> ACL DIGEST
"6ea056a39eb57b0bc9a85f0c640913946216f6b44563dba043ab489f81c9d47f"

History

See also

ACL, ACL CAT, ACL DELROLE, ACL DELUSER, ACL DRYRUN, ACL GENPASS, ACL GETROLE, ACL GETUSER, ACL HELP, ACL LIST, ACL LOAD, ACL LOG, ACL ROLES, ACL SAVE, ACL SETROLE, ACL SETUSER, ACL USERS, ACL WHOAMI, BGREWRITEAOF, BGSAVE, COMMAND, COMMAND COUNT, COMMAND DOCS, COMMAND GETKEYS, COMMAND GETKEYSANDFLAGS, COMMAND HELP, COMMAND INFO, COMMAND LIST, COMMANDLOG, COMMANDLOG GET, COMMANDLOG HELP, COMMANDLOG LEN, COMMANDLOG RESET, CONFIG, CONFIG GET, CONFIG HELP, CONFIG RESETSTAT, CONFIG REWRITE, CONFIG SET, DBSIZE, DEBUG, FAILOVER, FLUSHALL, FLUSHDB, HOTKEYS, HOTKEYS GET, HOTKEYS HELP, HOTKEYS RESET, INFO, LASTSAVE, LATENCY, LATENCY DOCTOR, LATENCY GRAPH, LATENCY HELP, LATENCY HISTOGRAM, LATENCY HISTORY, LATENCY LATEST, LATENCY RESET, LOLWUT, MEMORY, MEMORY DOCTOR, MEMORY HELP, MEMORY MALLOC-STATS, MEMORY PURGE, MEMORY STATS, MEMORY USAGE, MODULE, MODULE HELP, MODULE LIST, MODULE LOAD, MODULE LOADEX, MODULE UNLOAD, MONITOR, PSYNC, REPLCONF, REPLICAOF, RESTORE-ASKING, ROLE, SAVE, SHUTDOWN, SLOWLOG, SLOWLOG GET, SLOWLOG HELP, SLOWLOG LEN, SLOWLOG RESET, SWAPDB, SYNC, TIME.