8045 Commits

Author SHA1 Message Date
Salvatore Sanfilippo
e973611e01 Merge pull request #5836 from soloestoy/fix-acl-warning
ACL: show categories in COMMAND reply
2019-02-13 18:59:59 +01:00
zhaozhao.zz
3eb2f4ca14 ACL: show categories in COMMAND reply
Adding another new filed categories at the end of
command reply, it's easy to read and distinguish
flags and categories, also compatible with old format.
2019-02-14 00:13:01 +08:00
antirez
ddff560cac ACL: tag LASTSAVE as dangerous.
That's not REALLY needed, but... right now with LASTSAVE being the only
command tagged as "admin" but not "dangerous" what happens is that after
rewrites the rewrite engine will produce from the rules:

    user default on +@all ~* -@dangerous nopass

The rewrite:

    user default on nopass ~* +@all -@admin -@dangerous +lastsave

Which is correct but will have users wondering about why LASTSAVE has
something special.

Since LASTSAVE after all also leaks information about the underlying
server configuration, that may not be great for SAAS vendors, let's tag
it as dangerous as well and forget about this issue :-)
2019-02-13 16:30:44 +01:00
zhaozhao.zz
0eee72b620 ACL: fix cat type format warning 2019-02-13 11:47:10 +08:00
antirez
2c38dc6831 ACL: Document masteruser option in redis.conf. 2019-02-12 18:23:00 +01:00
antirez
1c15e0ff20 ACL: fix setting of FAST flag. 2019-02-12 17:06:26 +01:00
antirez
d78a6fdcbd ACL: CAT subcommand implemented. 2019-02-12 17:02:45 +01:00
Guy Benoish
9cd3b12cdf Trim SDS free space of retained module strings
In some cases processMultibulkBuffer uses sdsMakeRoomFor to
expand the querybuf, but later in some cases it uses that query
buffer as is for an argv element (see "Optimization"), which means
that the sds in argv may have a lot of wasted space, and then in case
modules keep that argv RedisString inside their data structure, this
space waste will remain for long (until restarted from rdb).
2019-02-12 14:21:21 +01:00
Salvatore Sanfilippo
19696ba011 Merge pull request #5833 from soloestoy/masteruser
ACL: add masteruser configuration for replication
2019-02-12 10:27:59 +01:00
zhaozhao.zz
de0f42bff3 ACL: add masteruser configuration for replication
In mostly production environment, normal user's behavior should be
limited.

Now in redis ACL mechanism we can do it like that:

    user default on +@all ~* -@dangerous nopass
    user admin on +@all ~* >someSeriousPassword

Then the default normal user can not execute dangerous commands like
FLUSHALL/KEYS.

But some admin commands are in dangerous category too like PSYNC,
and the configurations above will forbid replica from sync with master.

Finally I think we could add a new configuration for replication,
it is masteruser option, like this:

    masteruser admin
    masterauth someSeriousPassword

Then replica will try AUTH admin someSeriousPassword and get privilege
to execute PSYNC. If masteruser is NULL, replica would AUTH with only
masterauth like before.
2019-02-12 17:12:37 +08:00
antirez
34f11c811d ACL: when client->user is NULL the client is a superuser.
Related to #5832.
2019-02-12 09:44:30 +01:00
antirez
bece806662 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-02-12 09:43:50 +01:00
Salvatore Sanfilippo
be28ee2258 Merge pull request #5832 from soloestoy/show-client-user
ACL: show client's user
2019-02-12 09:42:14 +01:00
zhaozhao.zz
9150d9246e ACL: show client's user 2019-02-12 16:03:58 +08:00
Salvatore Sanfilippo
da3fcfae0b Merge pull request #5831 from lamby/x32-warnings
Don't assume the __x86_64__ pointer size to avoid warnings on x32
2019-02-11 17:17:14 +01:00
Chris Lamb
d2c38031dc Don't assume the __x86_64__ pointer size to avoid warnings on x32.
__x86_64__ is defined on the on the x32 architecture and the conditionals in
debug.c therefore assume the size of (void*) etc:

  debug.c: In function 'getMcontextEip':
  debug.c:757:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       return (void*) uc->uc_mcontext.gregs[16]; /* Linux 64 */
              ^
  debug.c: In function 'logRegisters':
  debug.c:920:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       logStackContent((void**)uc->uc_mcontext.gregs[15]);

We can remedy this by checking for __ILP32__ first. See:

  https://wiki.debian.org/ArchitectureSpecificsMemo

... for more info.
2019-02-11 17:12:27 +01:00
antirez
7983f6e884 ACL: return error when removing a non existing password.
Otherwise it's very simple for an human mistake to think a password is
removed because of a typo in the ACL SETUSER myuser <somepass command
line.
2019-02-11 17:01:58 +01:00
antirez
46243329d4 ACL: refactor+fix AUTH check in processCommand().
The part that is fixed is that now if the default user is off whatever
is its configuration the user is not considered authenticated.
2019-02-11 16:47:02 +01:00
antirez
3822a465f2 ACL: ACLFreeUserAndKillClients(): free user later.
Soon or later we may have code in freeClient() that may have to deal
with ACLs. Imagine for instance the command proposed multiple times (not
sure if this will ever be accepted but still...):

    ONCLOSE DEL mykey

Accumulating commands to run when a client is disconnected. Now the
function is compatible with such use cases.

Related to #5829.
2019-02-11 16:28:31 +01:00
zhaozhao.zz
5cfa46fd14 ACL: kill the old users clients after load aclfile 2019-02-11 16:26:00 +01:00
antirez
48423054ea ACL: add command fingerprint for CAT subcommand. 2019-02-08 12:40:42 +01:00
antirez
fcd5ff1a76 ACL: add arity check in ACL command where missing. 2019-02-08 12:38:41 +01:00
antirez
66fd5e058f ACL: ignore modules commands when adding categories.
We can't trust modules commands flagging, so module commands must be
always explicitly added, with the exception of +@all that will include
everything. However something like +@readonly should not include command
from modules that may be potentially dangerous: our categories must be
safe and reliable and modules may not be like that.
2019-02-08 11:50:39 +01:00
antirez
4a7062f9bd ACL: some documentation inside redis.conf. 2019-02-08 09:52:07 +01:00
antirez
87ce87e68c ACL: load ACL file at startup. Prevent silly configurations. 2019-02-07 17:20:03 +01:00
antirez
b1db13d8fa ACL: ACLLoadFromFile(): several errors fixed to make it work. 2019-02-07 17:07:51 +01:00
antirez
434489abb7 ACL: ACLLoadFromFile(), restore DefaultUser global. 2019-02-07 17:00:35 +01:00
antirez
68d127d7b6 ACL: fix fgets wrong buffer size. 2019-02-07 16:53:41 +01:00
antirez
735cb69f12 ACL: add assertion and fix comment typo. 2019-02-07 16:47:14 +01:00
antirez
61c7688b75 ACL: fix a few ACLLoadFromFile() errors and finish ACLFreeUsersSet(). 2019-02-07 16:20:49 +01:00
antirez
f7b86d2b8f ACL: WIP: preserve the old config on loading errors. 2019-02-07 12:57:21 +01:00
antirez
dfb8b08f30 ACL: implement LOAD subcommand plus some minor rafactoring. 2019-02-07 12:20:30 +01:00
antirez
a980f6168e ACL: fix and complete ACLLoadFromFile() loading step. 2019-02-07 12:04:25 +01:00
antirez
dc8605f944 ACL: now ACLLoadFromFile() validates against fake user. 2019-02-06 16:44:55 +01:00
antirez
1922f590d2 ACL: refactoring creation of unlinked users. 2019-02-06 16:19:17 +01:00
antirez
1050774a5b ACL: initial design for ACLLoadFromFile() function. 2019-02-06 12:39:11 +01:00
antirez
e9d231d4c6 ACL: redis.conf: mark old ACL-alike stuff as deprecated. 2019-02-05 17:59:05 +01:00
antirez
53318b9e3f ACL: ability to configure an external ACL file. 2019-02-05 17:49:52 +01:00
antirez
83bb71e27c ACL: change behavior of redefined user. Last line counts. 2019-02-05 10:52:05 +01:00
antirez
1bdc63cc01 ACL: implement rewriting of users in redis.conf. 2019-02-05 10:48:17 +01:00
antirez
3aaed6dc39 ACL: fix user/rule inverted error message. 2019-02-04 16:58:35 +01:00
antirez
b67e46953b ACL: load the defined users at server startup. 2019-02-04 16:39:07 +01:00
antirez
e3c8db819b ACL: implement ACLLoadConfiguredUsers(). 2019-02-04 16:35:15 +01:00
antirez
7e4b4cd327 ACL: better error reporting in users configuration errors. 2019-02-04 13:04:35 +01:00
antirez
8dce634f5c ACL: make ACLAppendUserForLoading() able to report bad argument. 2019-02-04 13:00:58 +01:00
antirez
73efcef7cb ACL: initial appending of users in user loading list. 2019-02-04 12:55:48 +01:00
antirez
be0e1c0363 ACL: implement ACLAppendUserForLoading(). 2019-02-01 13:02:59 +01:00
antirez
276a5f296c ACL: skeleton and first ideas for postponed user loading. 2019-02-01 12:20:09 +01:00
antirez
c68174b5e5 ACL: set modules help clients to the root user.
It does not make much sense to limit what modules can do: the admin
should instead limit what module commnads an user may call. So
RedisModule_Call() and other module operations should be able to execute
everything they want: the limitation should be posed by the API exported
by the module itself.
2019-02-01 11:37:28 +01:00
antirez
ee57594c0f ACL: assign ACL command ID to modules commands. 2019-02-01 08:17:24 +01:00