148 Commits

Author SHA1 Message Date
Sahdev P. Zala
abd80f383e wal: fix panic when decoder not set
Handle the related panic and clarify doc.
2020-06-27 17:23:17 -04:00
cfc4n
ba7ff1eea9 auth: Customize simpleTokenTTL settings.
see https://github.com/etcd-io/etcd/issues/11978 for more detail.
2020-06-25 20:17:49 +08:00
cfc4n
999df4e5a1 auth: return incorrect result 'ErrUserNotFound' when client request without username or username was empty.
Fiexs https://github.com/etcd-io/etcd/issues/12004 .
2020-06-24 19:10:51 +08:00
tangcong
294e714489 *: fix cherry-pick conflict 2020-04-06 10:47:14 +08:00
tangcong
64fc4cc244 auth: ensure RoleGrantPermission is compatible with older versions 2020-04-06 09:20:52 +08:00
tangcong
acd9422459 auth: cleanup saveConsistentIndex in NewAuthStore 2020-04-06 09:16:58 +08:00
tangcong
e7291a1dab auth: print warning log when error is ErrAuthOldRevision 2020-04-06 09:16:58 +08:00
shawwang
06a2f816e9 auth: add new metric 'etcd_debugging_auth_revision' 2020-04-06 09:16:38 +08:00
tangcong
140bf5321d *: fix auth revision corruption bug 2020-04-06 09:16:06 +08:00
Gyuho Lee
0e96b34d9f auth: fix tests
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-14 09:32:10 -07:00
Gyuho Lee
d167714b36 *: regenerate proto
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-14 01:22:23 -07:00
Gyuho Lee
08124105ad *: use new adt.IntervalTree interface
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-09 11:15:49 -07:00
Sam Batschelet
15903736d5 auth: fix cherry-pick
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2019-01-09 13:10:32 -05:00
Sam Batschelet
c7f744d6d3 auth: disable CommonName auth for gRPC-gateway
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2019-01-08 21:01:25 +00:00
Sam Batschelet
7292963ae7 auth: fix panic using WithRoot and improve JWT coverage
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-23 23:45:24 -07:00
Hitoshi Mitake
37767bc6e2 auth: a new auth token provider nop
This commit adds a new auth token provider named nop. The nop provider
refuses every Authenticate() request so CN based authentication can
only be allowed. If the tokenOpts parameter of auth.NewTokenProvider()
is empty, the provider will be used.
2018-05-23 15:48:39 -07:00
Gyuho Lee
1f191a0e34 auth: use NewIncomingContext for "WithRoot"
"WithRoot" is only used within local node, and
"AuthInfoFromCtx" expects token from incoming context.
Embed token with "NewIncomingContext" so that token
can be found in "AuthInfoFromCtx".

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-14 21:45:16 -08:00
Gyuho Lee
bcd5390b35 *: regenerate protobuf, grpc-gateway
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-07 21:31:13 -08:00
Gyuho Lee
645c7c9a92 auth: use "sort.Strings" instead of StringSlice
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-04 14:09:27 -08:00
Hitoshi Mitake
f649132a5a auth, etcdserver: follow the correct usage of context
The keys of context shouldn't be string. They should be a struct of
their own type.

Fix https://github.com/coreos/etcd/issues/8826
2017-11-21 15:31:19 +09:00
Gyu-Ho Lee
38942a2a51 auth: clean up mutex lock/unlocks
Only hold locks when needed.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-06 13:17:29 -08:00
Gyu-Ho Lee
568b856be8 auth: pre-allocate slices in store
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-06 09:16:15 -08:00
Hitoshi Mitake
da0a387aac auth: use binary search for checking root permission
authpb.User.Roles is sorted so we don't need a linear search for
checking the user has a root role or not.
2017-10-25 13:16:37 +09:00
Joe Betz
d3c9643761 auth: Fix simpleToken to respect disabled state for assign 2017-10-13 21:44:07 -07:00
Gyu-Ho Lee
f65aee0759 *: replace 'golang.org/x/net/context' with 'context'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
Gyu-Ho Lee
35b11bf438 auth: replace NewContext with NewOutgoingContext
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-17 19:46:19 -07:00
Hitoshi Mitake
e0c33ef881 auth, etcdserver: allow users to know their roles and permissions
Current UserGet() and RoleGet() RPCs require admin permission. It
means that users cannot know which roles they belong to and what
permissions the roles have. This commit change the semantics and now
users can know their roles and permissions.
2017-06-26 22:20:41 -07:00
Xiang Li
44a6c2121b Merge pull request #7999 from hexfusion/grpc-gateway-auth
auth: support "authorization" token for grpc-gateway
2017-06-15 19:22:00 -07:00
Gyu-Ho Lee
5e059fd8dc *: use metadata Incoming/OutgoingContext
Fix https://github.com/coreos/etcd/issues/7888.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-15 16:41:23 -07:00
Sam Batschelet
0caab26310 auth: support "authorization" token for grpc-gateway 2017-06-14 20:11:39 -04:00
Hitoshi Mitake
fa4903c83c Merge pull request #8031 from mitake/lease-revoke-auth
protecting lease revoking with auth
2017-06-08 13:34:14 +09:00
Hitoshi Mitake
0c655902f2 auth, etcdserver: protect revoking lease with auth
Currently clients can revoke any lease without permission. This commit
lets etcdserver protect revoking with write permission.

This commit adds a mechanism for generating internal token. It is used
for indicating that LeaseRevoke was issued internally so it should be
able to delete any attached keys.
2017-06-07 17:46:14 -07:00
Anthony Romano
8d8d1d225a auth: add JWT tests 2017-06-07 16:49:02 -07:00
Anthony Romano
fe727f3106 auth: reject empty signing method for JWT token provider 2017-06-07 16:49:02 -07:00
Hitoshi Mitake
e1306bff8f *: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled
Fix https://github.com/coreos/etcd/issues/7724
2017-04-19 11:27:14 +09:00
Anthony Romano
fdf7798137 auth: fix race on stopping simple token keeper
run goroutine was resetting a field for no reason and without holding a lock.
This patch cleans up the run goroutine management to make the start/stop path
less racey in general.
2017-04-14 09:50:33 -07:00
Anthony Romano
18bccb4285 auth: protect simpleToken with single mutex and check if enabled
Dual locking doesn't really give a convincing performance improvement and
the lock ordering makes it impossible to safely check if the TTL keeper
is enabled or not.

Fixes #7722
2017-04-12 13:40:09 -07:00
Anthony Romano
78a5eb79b5 *: add swagger and grpc-gateway assets for v3lock and v3election 2017-04-10 15:21:07 -07:00
Hitoshi Mitake
c4a45c5713 auth, adt: introduce a new type BytesAffineComparable
It will be useful for avoiding a cost of casting from string to
[]byte. The permission checker is the first user of the type.
2017-04-05 13:17:24 +09:00
Hitoshi Mitake
63355062dc Merge pull request #7649 from mitake/range-open-ended
etcdctl: add a new option --open-ended for unlimited range permission
2017-04-05 11:03:52 +09:00
Gyu-Ho Lee
3edd36315d auth: use atomic access to 'authStore.revision'
Fix https://github.com/coreos/etcd/issues/7660.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-04 13:16:02 -07:00
Hitoshi Mitake
0a7fc7cd34 etcdctl: add a new option --from-key for unlimited range permission
This commit adds a new option --from-key to the command etcdctl role
grant-permission. If the option is passed, an open ended permission
will be granted to a role e.g. from start-key to any keys those are
larger than start-key.

Example:
$ ETCDCTL_API=3 bin/etcdctl --user root:p role grant r1 readwrite a b
$ ETCDCTL_API=3 bin/etcdctl --user root:p role grant --from-key r1 readwrite c
$ ETCDCTL_API=3 bin/etcdctl --user root:p role get r1
Role r1
KV Read:
        [a, b) (prefix a)
        [c, <open ended>
KV Write:
        [a, b) (prefix a)
        [c, <open ended>

Note that a closed parenthesis doesn't follow the above <open ended>
for indicating that the role has an open ended permission ("<open
ended>" is a valid range end).

Fixes https://github.com/coreos/etcd/issues/7468
2017-04-04 17:28:59 +09:00
Anthony Romano
f67bdc2eed *: support checking that an interval tree's keys cover an entire interval 2017-04-03 15:38:07 -07:00
Hitoshi Mitake
ad2111a6f4 auth: store cached permission information in a form of interval tree
This commit change the type of cached permission information from the
home made thing to interval tree. It improves computational complexity
of permission checking from O(n) to O(lg n).
2017-03-24 09:36:14 +09:00
Hitoshi Mitake
c40b86bcde auth, etcdserver: forbid invalid auth management
If auth is enabled,
1. deleting the user root
2. revoking the role root from the user root
must not be allowed. This commit forbids them.
2017-03-23 16:47:58 +09:00
Hitoshi Mitake
068d806bde *: revoke a deleted role
This commit resolves a TODO of auth store:
Current scheme of role deletion allows existing users to have the
deleted roles. Assume a case like below:
create a role r1
create a user u1 and grant r1 to u1
delete r1

After this sequence, u1 is still granted the role r1. So if admin
create a new role with the name r1, The new r1 is automatically
granted u1. In some cases, it would be confusing. So we need to
revoke the deleted role from all users.
2017-03-23 16:44:19 +09:00
Anthony Romano
4409932132 auth: test concurrent authentication 2017-03-13 21:11:35 -07:00
Anthony Romano
1b1fabef8f auth: get rid of deadlocking channel passing scheme in simpleTokenTTL
Just use the mutex instead.

Fixes #7471
2017-03-13 21:11:35 -07:00
Anthony Romano
52bc997e0b auth: nil check AuthInfo when checking admin permissions
If the context does not include auth information, get authinfo will
return a nil auth info and a nil error. This is then passed to
IsAdminPermitted, which would dereference the nil auth info.
2017-03-10 11:07:11 -08:00
Gyu-Ho Lee
beb58c434c *: fix minor typos
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-08 16:21:52 -08:00