Commit Graph

48 Commits (0b95e8cef14a92a8a063eda2406ab0a939cc3f60)

Author SHA1 Message Date
Piotr Tabor 28f2b07623 *: Update references to code moved to the api/ dir.
Follow up to file-moves done in the previous commit.

The commit contains purely mechanical consequences of execution (apart
of scripts/genproto.sh):

  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/api/v3rpc/rpctypes|v3/api/v3rpc/rpctypes|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/version|v3/api/version|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/mvcc/mvccpb|v3/api/mvccpb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/etcdserverpb|v3/api/etcdserverpb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/api/membership/membershippb|v3/api/membershippb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/auth/authpb|v3/api/authpb|g'

  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/mvcc/mvccpb/kv.proto|/api/mvccpb/kv.proto|g'
  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/auth/authpb/auth.proto|/api/authpb/auth.proto|g'
  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/etcdserver/api/membership/membershippb/membership.proto|/api/membershippb/membership.proto|g'

  I also modified manually paths in scripts/genproto.sh.

  % go fmt ./...
2020-10-06 11:56:16 +02:00
CFC4N 8050881aaf
clientv3:get AuthToken gracefully without extra connection. (#12165)
* etcdserver: check authinfo if it is not InternalAuthenticateRequest.

* credentials: let GetRequestMetadata() return nil when authToken isn't initialized.

* clientv3: get AuthToken gracefully without extra connection.
2020-09-25 11:01:54 -07:00
Jan Kuri 7f27697df9
v3client: implement clientv3.Auth interface (#12140) 2020-07-20 16:53:25 -07:00
Brandon Philips 96cce208c2 go.mod: use go.etcd.io/etcd/v3 versioning
This change makes the etcd package compatible with the existing Go
ecosystem for module versioning.

Used this tool to update package imports:
  https://github.com/KSubedi/gomove
2020-04-28 00:57:35 +00:00
Vern Burton 071e70cdc4
*: add a new API and command for checking auth status (#11536)
This changes have started at etcdctl under auth.go, and make changes to stub out everything down into the internal raft.  Made changes to the .proto files and regenerated them so that the local version would build successfully.
2020-02-05 19:27:42 -08:00
Hitoshi Mitake 5a67dd788d *: support creating a user without password
This commit adds a feature for creating a user without password. The
purpose of the feature is reducing attack surface by configuring bad
passwords (CN based auth will be allowed for the user).

The feature can be used with `--no-password` of `etcdctl user add`
command.

Fix https://github.com/coreos/etcd/issues/9590
2019-05-30 21:59:30 +09:00
Gyuho Lee 34bd797e67 *: revert module import paths
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
shivaramr 9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
Gyuho Lee 2ac04381a2 clientv3: update Go import paths to "go.etcd.io"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Joe Betz 9304d1abd1 clientv3: Fix TLS test failures by returning DeadlineExceeded error from dial without any additional wrapping 2018-06-15 13:41:28 -07:00
Gyuho Lee 037d7b4abe clientv3: dial with context when creating authenticator
Otherwise, "grpc.Dial" blocks when "grpc.WithTimeout" dial
option gets deprecated.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 13:41:28 -07:00
Hitoshi Mitake b1dd19a7aa *: don't use string literals directly in grpc metadata
Current etcd code uses the string literals ("token", "authorization")
as field names of grpc and swappger metadata for passing token. It is
difficult to maintain so this commit introduces new constants for the
purpose.
2018-03-15 14:17:34 +09:00
Hitoshi Mitake 752963beea *: unify type of key and rangeEnd in AuthRoleRevokePermissionRequest
Fix https://github.com/coreos/etcd/issues/9424
2018-03-14 14:38:20 +09:00
Gyuho Lee bb95d190c1 *: revert "internal/auth" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Hitoshi Mitake 6c91766490 *: move "auth" to "internal/auth" 2018-01-29 14:57:35 +09:00
Gyuho Lee 497412c588 clientv3: call other APIs with default gRPC call options
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 10:58:05 -08:00
Gyu-Ho Lee 54ef60d033 clientv3: remove redundant retries in Auth, set FailFast=true
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 16:03:12 -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 9bc3c0bd05 clientv3: remove unused fields from 'auth'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-04 08:17:36 -07:00
Xiang Li 9205a242b9 clientv3: do not retry on mutable operations 2016-10-20 10:48:10 -07:00
Iwasaki Yudai 6a33f0ffd5 clientv3: make balancer respect FastFail
The simpleBalancer.Get() blocks grpc.Invoke() even when the Invoke() is called
with the FailFast option. Therefore currently any requests with the
FastFail option actually doesn't fail fast. They get blocked when there is
no endpoints available.
Get() method needs to respect the BlockingWait option when
picks up an endpoint address from the list and fail immediately when the option is
enabled and no endpoint is available.
2016-10-17 14:11:51 -07:00
Hitoshi Mitake 4211c0b7af etcdctl, clientv3: improve printing of role get for prefix permission
This commit improves printing of role get command for prefix
permission. If a range permission corresponds to a prefix permission,
it is explicitly printed for a user. Below is an example of the new
printing:

$ ETCDCTL_API=3 bin/etcdctl --user root:p role get r1
Role r1
KV Read:
        [/dir/, /dir0) (prefix /dir/)
        [k1, k5)
KV Write:
        [/dir/, /dir0) (prefix /dir/)
        [k1, k5)
2016-09-14 16:10:32 +09:00
Anthony Romano 3eadf964f4 clientv3: use failfast and retry wrappers for at-most-once rpcs 2016-08-16 10:49:50 -07:00
Anthony Romano d8f0ef0e80 clientv3: use grpc.FailFast(false) for all calls 2016-07-14 17:58:58 -07:00
Hitoshi Mitake 18253e2723 *: support getting all users and roles in auth v3
This commit expands RPCs for getting user and role and support list up
all users and roles. etcdctl v3 is now support getting all users and
roles with the newly added option --all e.g. etcdctl user get --all
2016-06-17 16:22:41 +09:00
Hitoshi Mitake 253e313c09 *: support granting and revoking range
This commit adds a feature for granting and revoking range of keys,
not a single key.

Example:
$ ETCDCTL_API=3 bin/etcdctl role grant r1 readwrite k1 k3
Role r1 updated
$ ETCDCTL_API=3 bin/etcdctl role get r1
Role r1
KV Read:
        [a, b)
        [k1, k3)
        [k2, k4)
KV Write:
        [a, b)
        [k1, k3)
        [k2, k4)
$ ETCDCTL_API=3 bin/etcdctl --user u1:p get k1 k4
k1
v1
$ ETCDCTL_API=3 bin/etcdctl --user u1:p get k1 k5
Error:  etcdserver: permission denied
2016-06-08 14:58:25 -07:00
Anthony Romano 62f8ec25c0 clientv3: use grpc reconnection logic 2016-06-08 01:04:59 -07:00
Xiang Li 83ce1051ff auth: make naming consistent 2016-06-07 10:54:50 -07:00
Hitoshi Mitake 94f22e8a07 *: rename RPCs and structs related to revoking
This commit renames RPCs and structs related to revoking.
1. UserRevoke -> UserRevokeRole
2. RoleRevoke -> RoleRevokePermission
2016-06-05 16:57:23 +09:00
Hitoshi Mitake c7a1423d45 *: support deleting a role in auth v3
This commit implements RoleDelete() RPC for supporting deleting a role
in auth v3. It also adds a new subcommand "role delete" to etcdctl.
2016-06-04 13:42:45 +09:00
Hitoshi Mitake 0cb1343109 *: support revoking a key from a role in auth v3
This commit implements RoleRevoke() RPC for supporting revoking a key
from a role in auth v3. It also adds a new subcommand "role revoke" to
etcdctl.
2016-06-04 13:42:45 +09:00
Hitoshi Mitake 957b07c408 *: support revoking a role from a user in auth v3
This commit implements UserRevoke() RPC for supporting revoking a role
from a user in auth v3. It also adds a new subcommand "user revoke" to
etcdctl.
2016-06-04 13:39:26 +09:00
Hitoshi Mitake 10ee69b44c *: support getting role in auth v3
This commit implements RoleGet() RPC of etcdserver and adds a new
subcommand "role get" to etcdctl v3. It will list up permissions that
are granted to a given role.

$ ETCDCTL_API=3 bin/etcdctl role get r1
Role r1
KV Read:
        b
        d
KV Write:
        a
        c
        d
2016-06-03 13:03:54 +09:00
Hitoshi Mitake 5609fdb9a8 *: support getting user in etcdctl v3
This commit adds a new subcommand "user get" to etcdctl v3. It will
list up roles that are granted to a given user.

Example:
$ ETCDCTL_API=3 bin/etcdctl user get u1
User: u1
Roles: r1 r2 r3

This commit also modifies the layout of InternalRaftRequest for
frequent update of auth related members.
2016-06-02 12:10:19 +09:00
Hitoshi Mitake 6259318521 *: attach auth token as a gRPC credential
This commit adds a functionality of attaching an auth token to gRPC
connection as a per RPC credential.

For doing this, this commit lets clientv3.Client.Dial() create a
dedicated gRPC connection for doing authentication. With the dedicated
connection, the client calls Authenticate() RPC and obtain its
token. The token is attached to the main gRPC connection with
grpc.WithPerRPCCredentials().

This commit also adds a new option --username to etcdctl (v3). With
this option, etcdctl attaches its auth token to the main gRPC
connection (currently it is not used at all).
2016-05-17 13:26:12 +09:00
Gyu-Ho Lee fd9e07a529 clientv3: update LICENSE header 2016-05-12 20:50:58 -07:00
Ajit Yagaty adc981c53d auth: Adding support for "auth disable" command.
Added support for the auth disable command in the server, added the
etcdctl command and a respective testcase.
2016-05-07 19:21:49 -07:00
Gyu-Ho Lee 6049c95dc9 clientv3: auth with rpctypes.Error 2016-04-29 12:00:26 -07:00
Hitoshi Mitake 131e3806bb *: support authenticate in v3 auth
This commit implements Authenticate() API of the auth package. It does
authentication based on its authUsers bucket and generate a token for
succeeding RPCs.
2016-04-21 12:32:19 +09:00
Hitoshi Mitake 7ba2646d37 *: support granting a role to a user in v3 auth 2016-04-11 15:53:30 +09:00
Hitoshi Mitake 02033b4c47 *: support granting key permission to role in v3 auth 2016-04-11 12:23:19 +09:00
Hitoshi Mitake 2b17a3919c *: support adding role in auth v3 2016-04-05 09:28:17 +09:00
Hitoshi Mitake 73166b41e9 *: support changing password in v3 auth
This commit adds a functionality for updating password of existing
users.
2016-03-31 15:28:15 +09:00
Hitoshi Mitake d8888ded12 *: support deleting user in v3 auth
This commit adds a functionality of user deletion. It can be invoked
with the new user delete command.

Example usage:
$ ETCDCTL_API=3 etcdctl user delete usr1
2016-03-31 13:18:51 +09:00
Hitoshi Mitake 987568c65c *: add Auth prefix to auth related requests and responses 2016-03-29 14:32:19 +09:00
Hitoshi Mitake 8874545a1e *: support adding user in v3 auth
This commit adds a new subcommand "user add" to etcdctlv3. With the
command users can create a user for the authentication.

Example of usage:
$ etcdctlv3 user add user1
Password of user1:
Type password of user1 again for confirmation:
2016-03-27 18:11:42 +09:00
Anthony Romano bd832e5b0a *: migrate Godeps to vendor/ 2016-03-22 17:10:28 -07:00
Hitoshi Mitake 379d04ea53 clientv3: a new interface Auth for auth related RPCs 2016-03-02 15:17:59 +09:00