129 Commits

Author SHA1 Message Date
Hitoshi Mitake
2c8ffa6bcb etcdserver: correct error log for strict reconfig checking
This commit fixes an error log caused by the strict reconfig checking
option.

Before:
14:21:38 etcd2 | 2015-11-05 14:21:38.870356 E | etcdhttp: got unexpected response error (etcdserver: re-configuration failed due to not enough started members)

After:
log
13:27:33 etcd2 | 2015-11-05 13:27:33.089364 E | etcdhttp: etcdserver: re-configuration failed due to not enough started members

The error is not an unexpected thing therefore the old message is
incorrect.
2015-11-06 11:03:42 +09:00
Gyu-Ho Lee
85f4475f62 httptypes/errors: HTTPError.WriteTo returns error
Squashing all commits into this one
(from https://github.com/coreos/etcd/pull/357).

Thanks,
2015-09-25 08:06:26 -07:00
Yicheng Qin
8f6bf029f8 etcdserver: specify request timeout error due to connection lost
It specifies request timeout error possibly caused by connection lost,
and print out better log for user to understand.

It handles two cases:
1. the leader cannot connect to majority of cluster.
2. the connection between follower and leader is down for a while,
and it losts proposals.

log format:
```
20:04:19 etcd3 | 2015-08-25 20:04:19.368126 E | etcdhttp: etcdserver:
request timed out, possibly due to connection lost
20:04:19 etcd3 | 2015-08-25 20:04:19.368227 E | etcdhttp: etcdserver:
request timed out, possibly due to connection lost
```
2015-08-26 12:38:37 -07:00
Yicheng Qin
c229e6e655 etcdserver: improve error message when timeout due to leader fail 2015-08-13 15:46:21 -07:00
Yicheng Qin
27170e67b9 etcdserver: specify timeout caused by leader election
Before this PR, the timeout caused by leader election returns:

```
14:45:37 etcd2 | 2015-08-12 14:45:37.786349 E | etcdhttp: got unexpected
response error (etcdserver: request timed out)
```

After this PR:

```
15:52:54 etcd1 | 2015-08-12 15:52:54.389523 E | etcdhttp: etcdserver:
request timed out, possibly due to leader down
```
2015-08-12 16:53:18 -07:00
Yicheng Qin
c3d4d11402 etcdhttp: adjust request timeout based on config
It uses heartbeat interval and election timeout to estimate the
expected request timeout.

This PR helps etcd survive under high roundtrip-time environment,
e.g., globally-deployed cluster.
2015-08-12 09:22:59 -07:00
Xiang Li
c39aad0e92 etcdserver: use correct http status code for auth error 2015-06-22 09:28:47 -07:00
Barak Michener
64ec8af91b *: Rename security to auth 2015-06-15 18:18:50 -04:00
Brian Akins
d8a836e618 Simple debug HTTP request logging 2015-06-09 13:40:37 -04:00
Xiang Li
0adeee2965 etcdhttp: use leveled logging 2015-06-09 09:26:57 -07:00
Barak Michener
fa74e702d8 security: Improve the security api as per the suggestions list in #2384
Subcommits:

decouple root and security enable/disable

create root role

prefix matching

godep: bump go-etcd to include credentials

add godep for speakeasy and auth entry parsing

appropriate errors for security enable/disable

WIP adding to etcd/client all the security client methods

add guest access

minor ui return tweaks

revert client changes

respond to comments, log more security operations

fix major ensure() bug, add better UX

block recursive access

fix some boneheaded mistakes

fix integration test

last comments

fix up security_api.md

philips nits

fix docs
2015-04-23 16:11:38 -04:00
Barak Michener
001efa0639 security: Implement RBAC security for etcd
stub out security

further wip

Last stub before CRUD for roles

Complete role merging

start tests

add Godep for golang.org/x/crypto/bcrypt

first round of comments

add tests, remove root addition (will be added back as part of creation)

Add security checks for /v2/machines and /v2/keys

Allow non-root to determine if security is enabled, get machine list.

Responding to comments, remove multiple verbs (like /v2/security/user/foo/password)

add some prefixes to the logging
2015-03-16 16:23:11 -04:00
Jonathan Boulle
f1ed69e883 *: switch to line comments for copyright
Build tags are not compatible with block comments.
Also adds copyright header to a few places it was missing.
2015-01-26 09:53:30 -08:00
Yicheng Qin
4dd00be365 etcdhttp: reset serve and watch timeout 2015-01-02 16:39:13 -08:00
Yicheng Qin
2235b47030 Merge pull request #1545 from unihorn/197
etcdhttp: always respond json-format error to client
2014-11-03 23:25:14 -08:00
Yicheng Qin
9aefb91531 etcdhttp: always respond json-format error to client 2014-11-03 22:19:17 -08:00
Jonathan Boulle
9726d3909c etcdhttp: bump default Server timeout to 5 mins 2014-10-31 10:52:46 -07:00
Brian Waldon
8fbf887e52 etcdhttp: only log when error deserves it 2014-10-28 10:30:05 -07:00
Xiang Li
6cb45236ac etcdhttp: make admin HTTP endpoint return json format error 2014-10-27 17:03:58 -07:00
Xiang Li
d0604c7d5c error: write->writeTo 2014-10-27 15:32:36 -07:00
Brian Waldon
b06499d0c2 etcdserver/etcdhttp: break apart HTTP handlers 2014-10-26 13:20:53 -07:00
Brian Waldon
435611cf0d etcdserver/etcdhttp: break apart http.go 2014-10-25 11:28:52 -07:00
Yicheng Qin
338f59db74 Merge pull request #1401 from unihorn/186
etcdhttp: parse quorum field from http request
2014-10-24 15:54:40 -07:00
Yicheng Qin
0e1d1646fd etcdhttp: parse quorum field from http request 2014-10-24 15:44:39 -07:00
Yicheng Qin
cb59a46576 Merge pull request #1396 from unihorn/185
etcdhttp: trim StoreKeysPrefix from error in serveKeys
2014-10-24 14:48:31 -07:00
Jonathan Boulle
46528ee17b Merge pull request #1391 from jonboulle/version
/version is 404 now
2014-10-24 14:48:02 -07:00
Jonathan Boulle
9a465b9cf5 etcdhttp: add /version endpoint 2014-10-24 14:47:37 -07:00
Jonathan Boulle
bac13b5cb2 etcdserver/etcdhttp: remove log message for every received raft 2014-10-24 14:25:20 -07:00
Yicheng Qin
34dcbb4679 etcdhttp: trim StoreKeysPrefix from error in serveKeys
It returns error messaage like this now:
'{"errorCode":100,"message":"Key not found","cause":"/1/pants","index":10}'

The commit trims '/1' prefix from cause field if exists.

This is a hack to make it display well. It is correct because all error causes
that contain Path puts Path at the head of the string.
2014-10-24 14:12:53 -07:00
Jonathan Boulle
14852662ef etcdhttp: rename Members -> members in JSON, update doc 2014-10-24 12:03:17 -07:00
Jonathan Boulle
7ef468b315 etcdhttp: remove /v2/admin/members/x serving 2014-10-24 12:03:17 -07:00
Jonathan Boulle
9b679de9dd etcdserver/etcdhttp: use container for admin/members endpoint 2014-10-24 12:03:17 -07:00
Xiang Li
ed29259801 etcdserver: fix member endpoint on peerurl 2014-10-23 17:18:01 -07:00
Xiang Li
d8258c38be Merge pull request #1374 from xiangli-cmu/cluster_on_peerurl
etcdserver: add member endpoint to peerurl
2014-10-23 16:08:45 -07:00
Jonathan Boulle
af42f4a56b etcdserver: sort Members() in Cluster 2014-10-23 15:57:27 -07:00
Xiang Li
02551c277d etcdserver: add member endpoint to peerurl 2014-10-23 15:55:00 -07:00
Yicheng Qin
8eee8c260e etcdserver: rebase on master and code clean 2014-10-23 13:58:55 -07:00
Yicheng Qin
89572b5fd7 etcdserver: refactor cluster and clusterStore
Integrate clusterStore into cluster, and let cluster become the source of
cluster info.
2014-10-23 13:27:54 -07:00
Xiang Li
86facb3f91 etcdhttp: sort member 2014-10-23 11:21:20 -07:00
Xiang Li
8d6bb4a471 etcdserver: support GET on admin endpoint 2014-10-23 10:53:55 -07:00
Xiang Li
051ad7585f Merge pull request #1363 from coreos/return_json
etcdserver: admin PUT returns the json representation of the newly creat...
2014-10-22 20:11:08 -07:00
Brandon Philips
2cb8efb9b5 Merge pull request #1362 from philips/consistent-hex-use
etcdserver: use hex for cluster and machine id
2014-10-22 18:43:21 -07:00
Xiang Li
63fa2a626a etcdserver: admin PUT returns the json representation of the newly created member 2014-10-22 17:19:28 -07:00
Xiang Li
712a05be83 Merge pull request #1357 from coreos/accept_json
etcdserver: admin endpoint accepts json body
2014-10-22 16:30:22 -07:00
Brandon Philips
ab90369f9e etcdserver: use hex for cluster and machine id
Continue using hex everywhere. Including here.

TODO: cleanup the printing of the structs which currently have decimal
to/from:

`{Type:MsgAppResp To:9973738105406047488 From:17050684879817348455 T...`
2014-10-22 16:24:50 -07:00
Xiang Li
7be0f4b618 etcdserver: admin endpoint accepts json body 2014-10-22 16:19:48 -07:00
Brandon Philips
0d0bc3a57e etcdserver: fixup mismatch error line
Both wcid and gcid are strings, don't try to print it out in hex.
2014-10-22 15:48:22 -07:00
Brandon Philips
400dd2d7bc etcdserver: cleanup the cluster ID error message
1) Don't panic since we know exactly where this is coming from and don't
need the user to see a full back trace

2) Add docs explaining this situation a bit further

3) Cleanup the error to look like other similiar errors
2014-10-22 15:26:35 -07:00
Xiang Li
d00152765a etcdserver: etcdserver generates the ID when adding new member.
When adding new member, the etcdserver generates the ID based on the current time
and the given peerurls. We include time to add the uniqueness, since the node with
same peerurls should be able to (add, then remove) several times.
2014-10-22 13:15:56 -07:00
Yicheng Qin
5014558b00 etcdserver: clean code 2014-10-22 11:09:36 -07:00