Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"error":"etcdserver: user name is empty","code":3 #8399

Closed
OPSTime opened this issue Aug 14, 2017 · 3 comments
Closed

"error":"etcdserver: user name is empty","code":3 #8399

OPSTime opened this issue Aug 14, 2017 · 3 comments

Comments

@OPSTime
Copy link

OPSTime commented Aug 14, 2017

env:
[root@node2 etcd]# uname -a
Linux node2.kafka.soho.pdtv.it 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@node2 etcd]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@node2 etcd]# curl -L http://192.168.1.81:2379/version
{"etcdserver":"3.2.5","etcdcluster":"3.2.0"}

[root@node2 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/user/add" -XPOST -d '{"name":"root","password":"password"}'
[root@node2 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/role/add" -XPOST -d '{"name":"root"}'
[root@node2 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/user/grant" -XPOST -d '{"user":"root","role":"root"}'
[root@node2 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/enable" -XPOST -d '{}'
[root@node2 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/authenticate" -XPOST -d '{"name":"root","password":"password"}'
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"1","raft_term":"294"},"token":"uAyDFSPVmiLHbxPw.27"}
[root@node2 etcd]# curl -s -H 'Authorization : uAyDFSPVmiLHbxPw.27' -L http://192.168.1.81:2379/v3alpha/kv/put -X POST -d '{"key": "Zm9v", "value": "YmFy"}'
{"error":"etcdserver: user name is empty","code":3}

debug log:
2017-08-14 19:40:18.766883 [pkg_logger.go:147] D | auth: authorized root, token is uAyDFSPVmiLHbxPw.27

why??

@mitake
Copy link
Contributor

mitake commented Aug 14, 2017

@lyddragon could you try the latest master branch? The problem is already solved in the master.

@zhongjin616
Copy link

Yep! the latest master branch(commit fa32a85) has fixed this issue.

$ uname -a

Linux ThinkPad-P50 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

@OPSTime
Copy link
Author

OPSTime commented Sep 4, 2017

Success:

[root@node1 etcd]# rm -rf data.etcd/*

[root@node1 etcd]# curl -s -L "http://192.168.1.81:2379/version"
{"etcdserver":"3.2.0+git","etcdcluster":"3.2.0"}

[root@node1 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/user/add" -XPOST -d '{"name":"root","password":"password"}'
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"1","raft_term":"4"}}
[root@node1 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/role/add" -XPOST -d '{"name":"root"}'        
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"1","raft_term":"4"}}
[root@node1 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/user/grant" -XPOST -d '{"user":"root","role":"root"}'
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"1","raft_term":"4"}}
[root@node1 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/enable" -XPOST -d '{}'
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"1","raft_term":"4"}}
[root@node1 etcd]# curl -s -L "http://192.168.1.81:2379/v3alpha/auth/authenticate" -XPOST -d '{"name":"root","password":"password"}'
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"1","raft_term":"4"},"token":"owHkwgcIIfrXymbk.14"}
[root@node1 etcd]# curl -s -H 'Authorization : owHkwgcIIfrXymbk.14'  -L "http://192.168.1.81:2379/v3alpha/kv/put" -X POST -d '{"key": "Zm9v", "value": "YmFy"}'
{"header":{"cluster_id":"17195555412678344936","member_id":"8326998383030939542","revision":"2","raft_term":"4"}}
[root@node1 etcd]# curl -s -H 'Authorization : owHkwgcIIfrXymbk.14'  -L "http://192.168.1.81:2379/v3alpha/kv/range" -X POST -d '{"key": "Zm9v"}'|jq
{
  "header": {
    "cluster_id": "17195555412678344936",
    "member_id": "8326998383030939542",
    "revision": "2",
    "raft_term": "4"
  },
  "kvs": [
    {
      "key": "Zm9v",
      "create_revision": "2",
      "mod_revision": "2",
      "version": "1",
      "value": "YmFy"
    }
  ],
  "count": "1"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants