{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/comments/86880265","pull_request_review_id":7516030,"id":86880265,"diff_hunk":"@@ -0,0 +1,79 @@\n+package cluster\n+\n+import (\n+\t\"crypto/tls\"\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"net\"\n+\t\"time\"\n+\n+\t\"github.com/docker/swarmkit/api\"\n+\t\"github.com/docker/swarmkit/cmd/swarmctl/common\"\n+\t\"github.com/docker/swarmkit/manager/encryption\"\n+\t\"github.com/spf13/cobra\"\n+\t\"google.golang.org/grpc\"\n+\t\"google.golang.org/grpc/credentials\"\n+)\n+\n+// get the unlock key\n+\n+func displayUnlockKey(cluster *api.Cluster, cmd *cobra.Command) error {\n+\tif !cluster.Spec.EncryptionConfig.AutoLockManagers {\n+\t\tfmt.Println(\"Managers not auto-locked.\")\n+\t\treturn nil\n+\t}\n+\n+\taddr, err := cmd.Flags().GetString(\"socket\")\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\topts := []grpc.DialOption{}\n+\tinsecureCreds := credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})\n+\topts = append(opts, grpc.WithTransportCredentials(insecureCreds))\n+\topts = append(opts, grpc.WithDialer(\n+\t\tfunc(addr string, timeout time.Duration) (net.Conn, error) {\n+\t\t\treturn net.DialTimeout(\"unix\", addr, timeout)\n+\t\t}))\n+\tconn, err := grpc.Dial(addr, opts...)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tdefer conn.Close()\n+\n+\tresp, err := api.NewCAClient(conn).GetUnlockKey(common.Context(cmd), &api.GetUnlockKeyRequest{})\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tfmt.Printf(\"Managers auto-locked.  Unlock key: %s\\n\", encryption.HumanReadableKey(resp.UnlockKey))","path":"cmd/swarmctl/cluster/unlockkey.go","position":49,"original_position":49,"commit_id":"a47263bf770cec53481970b7d3a4cfdbbd608a20","original_commit_id":"a47263bf770cec53481970b7d3a4cfdbbd608a20","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"body":"If `resp.UnlockKey` is zero-length, there is no key and a different message should be printed.","created_at":"2016-11-07T22:04:49Z","updated_at":"2016-11-07T22:04:49Z","html_url":"https://github.com/docker/swarmkit/pull/1598#discussion_r86880265","pull_request_url":"https://api.github.com/repos/docker/swarmkit/pulls/1598","_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments/86880265"},"html":{"href":"https://github.com/docker/swarmkit/pull/1598#discussion_r86880265"},"pull_request":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1598"}}},"pull_request":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/1598","id":87847128,"html_url":"https://github.com/docker/swarmkit/pull/1598","diff_url":"https://github.com/docker/swarmkit/pull/1598.diff","patch_url":"https://github.com/docker/swarmkit/pull/1598.patch","issue_url":"https://api.github.com/repos/docker/swarmkit/issues/1598","number":1598,"state":"open","locked":false,"title":"At rest encryption: TLS keys and wrappers around the etcd wal/snap packages","user":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"body":"An implementation of a wrapper that would implement the on-disk snapshot encryption and on-disk WAL encryption as described here:  https://docs.google.com/document/d/1YxMH2oIv-mtRcs1djRkm0ndLfiteo0UzBUFKYhLKYkQ/edit#.\n\nThis is going to rely on `raft.go` or `storage.go` to tell it whether something is encrypted, and with which algorithm.  For WALs, such information can be included in the metadata of the file, but no such metadata exists for snapshots.  Another option is to base this on the snapshot and WAL directory locations/names, or on a metadata file that lives alongside the raft store.\n\nThis wraps every data object in an `EncryptedRecord` object which specifies the nonce, the algorithm, etc.\n- [x] wrapping code\n- [x] sample encoder/decoder using nacl/secretbox\n- [x] use the wrapping code in all of the current raft storage code\n- [x] migrate existing snapshots and wals to wrapped snapshots and wals\n- ~~encryption key KDF using lock key and node ID~~ <-- we can just take the full key for now, this can be in a separate PR\n- [x] force snapshot whenever the encryption key changes \n","created_at":"2016-10-04T07:53:06Z","updated_at":"2016-11-07T22:04:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bf0d16c672ccd9074748304415d5354f5f05cb9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarmkit/pulls/1598/commits","review_comments_url":"https://api.github.com/repos/docker/swarmkit/pulls/1598/comments","review_comment_url":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarmkit/issues/1598/comments","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/a47263bf770cec53481970b7d3a4cfdbbd608a20","head":{"label":"cyli:wal-snapshot-wrapper","ref":"wal-snapshot-wrapper","sha":"a47263bf770cec53481970b7d3a4cfdbbd608a20","user":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"repo":{"id":66887622,"name":"swarmkit","full_name":"cyli/swarmkit","owner":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cyli/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":true,"url":"https://api.github.com/repos/cyli/swarmkit","forks_url":"https://api.github.com/repos/cyli/swarmkit/forks","keys_url":"https://api.github.com/repos/cyli/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyli/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyli/swarmkit/teams","hooks_url":"https://api.github.com/repos/cyli/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/cyli/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/cyli/swarmkit/events","assignees_url":"https://api.github.com/repos/cyli/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/cyli/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/cyli/swarmkit/tags","blobs_url":"https://api.github.com/repos/cyli/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyli/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyli/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyli/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyli/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/cyli/swarmkit/languages","stargazers_url":"https://api.github.com/repos/cyli/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/cyli/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/cyli/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/cyli/swarmkit/subscription","commits_url":"https://api.github.com/repos/cyli/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyli/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyli/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyli/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/cyli/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/cyli/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyli/swarmkit/merges","archive_url":"https://api.github.com/repos/cyli/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyli/swarmkit/downloads","issues_url":"https://api.github.com/repos/cyli/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/cyli/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/cyli/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/cyli/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyli/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/cyli/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/cyli/swarmkit/deployments","created_at":"2016-08-29T23:13:03Z","updated_at":"2016-08-29T23:13:05Z","pushed_at":"2016-11-07T18:28:25Z","git_url":"git://github.com/cyli/swarmkit.git","ssh_url":"git@github.com:cyli/swarmkit.git","clone_url":"https://github.com/cyli/swarmkit.git","svn_url":"https://github.com/cyli/swarmkit","homepage":"","size":44966,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"2eaae1ab6800f8521236e01bafb2667d2ec5371f","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":51556828,"name":"swarmkit","full_name":"docker/swarmkit","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":false,"url":"https://api.github.com/repos/docker/swarmkit","forks_url":"https://api.github.com/repos/docker/swarmkit/forks","keys_url":"https://api.github.com/repos/docker/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarmkit/teams","hooks_url":"https://api.github.com/repos/docker/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/docker/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarmkit/events","assignees_url":"https://api.github.com/repos/docker/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarmkit/tags","blobs_url":"https://api.github.com/repos/docker/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarmkit/languages","stargazers_url":"https://api.github.com/repos/docker/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/docker/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/docker/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/docker/swarmkit/subscription","commits_url":"https://api.github.com/repos/docker/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarmkit/merges","archive_url":"https://api.github.com/repos/docker/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarmkit/downloads","issues_url":"https://api.github.com/repos/docker/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/docker/swarmkit/deployments","created_at":"2016-02-12T00:02:15Z","updated_at":"2016-11-07T13:51:10Z","pushed_at":"2016-11-07T18:28:28Z","git_url":"git://github.com/docker/swarmkit.git","ssh_url":"git@github.com:docker/swarmkit.git","clone_url":"https://github.com/docker/swarmkit.git","svn_url":"https://github.com/docker/swarmkit","homepage":"","size":22905,"stargazers_count":1025,"watchers_count":1025,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":204,"mirror_url":null,"open_issues_count":178,"forks":204,"open_issues":178,"watchers":1025,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1598"},"html":{"href":"https://github.com/docker/swarmkit/pull/1598"},"issue":{"href":"https://api.github.com/repos/docker/swarmkit/issues/1598"},"comments":{"href":"https://api.github.com/repos/docker/swarmkit/issues/1598/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1598/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1598/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarmkit/statuses/a47263bf770cec53481970b7d3a4cfdbbd608a20"}}}}
{"actor":{"display_login":"aaronlehmann"}}