{"action":"created","comment":{"url":"https://api.github.com/repos/mbruzek/layer-tls/pulls/comments/48911993","id":48911993,"diff_hunk":"@@ -89,6 +89,27 @@ def create_csr(tls):\n     else:\n         hookenv.log('The leader does not need to create a CSR.')\n \n+@when_not('client certificate signed')\n+@when('certificate authority available')\n+def create_client_csr():\n+    '''Create a certificate signing request (CSR) for the client connections.\n+    this method is run implicitly on the certificate authority and placed in\n+    the units key/value store for retreival by upper charm layers'''\n+    if is_leader():\n+        cn = 'client'\n+        hookenv.log('Creating the CSR for {}'.format(cn))\n+        with chdir('easy-rsa/easyrsa3'):\n+            sans = get_sans()\n+            path_name = \"client\"\n+            gen_req = './easyrsa --batch --req-cn={0} --subject-alt-name={1} ' \\\n+            'build-client-full {2} nopass 2>&1'.format(cn, sans, path_name)\n+            check_call(split(gen_req))\n+    db = unitdata.kv()\n+    with open('easy-rsa/easyrsa3/pki/issued/client.crt') as f:\n+        client_certificate = f.read()\n+    db.set('tls.client.certificate', client_certificate)\n+    set_state('client certificate signed')","path":"reactive/tls.py","position":23,"original_position":23,"commit_id":"c5ef3de8abe59772411fa0ae6054b31118fd1900","original_commit_id":"c5ef3de8abe59772411fa0ae6054b31118fd1900","user":{"login":"chuckbutler","id":246944,"avatar_url":"https://avatars.githubusercontent.com/u/246944?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckbutler","html_url":"https://github.com/chuckbutler","followers_url":"https://api.github.com/users/chuckbutler/followers","following_url":"https://api.github.com/users/chuckbutler/following{/other_user}","gists_url":"https://api.github.com/users/chuckbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckbutler/subscriptions","organizations_url":"https://api.github.com/users/chuckbutler/orgs","repos_url":"https://api.github.com/users/chuckbutler/repos","events_url":"https://api.github.com/users/chuckbutler/events{/privacy}","received_events_url":"https://api.github.com/users/chuckbutler/received_events","type":"User","site_admin":false},"body":"this follows the nomenclature of 'server certificate signed'","created_at":"2016-01-05T23:39:24Z","updated_at":"2016-01-05T23:39:24Z","html_url":"https://github.com/mbruzek/layer-tls/pull/11#discussion_r48911993","pull_request_url":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/mbruzek/layer-tls/pulls/comments/48911993"},"html":{"href":"https://github.com/mbruzek/layer-tls/pull/11#discussion_r48911993"},"pull_request":{"href":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11","id":55144218,"html_url":"https://github.com/mbruzek/layer-tls/pull/11","diff_url":"https://github.com/mbruzek/layer-tls/pull/11.diff","patch_url":"https://github.com/mbruzek/layer-tls/pull/11.patch","issue_url":"https://api.github.com/repos/mbruzek/layer-tls/issues/11","number":11,"state":"open","locked":false,"title":"Adds concept tls generation for client certs","user":{"login":"chuckbutler","id":246944,"avatar_url":"https://avatars.githubusercontent.com/u/246944?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckbutler","html_url":"https://github.com/chuckbutler","followers_url":"https://api.github.com/users/chuckbutler/followers","following_url":"https://api.github.com/users/chuckbutler/following{/other_user}","gists_url":"https://api.github.com/users/chuckbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckbutler/subscriptions","organizations_url":"https://api.github.com/users/chuckbutler/orgs","repos_url":"https://api.github.com/users/chuckbutler/repos","events_url":"https://api.github.com/users/chuckbutler/events{/privacy}","received_events_url":"https://api.github.com/users/chuckbutler/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-01-05T21:17:18Z","updated_at":"2016-01-05T23:39:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2463ee7bc959a1c798aa314ee95a76c1040a0c4a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11/commits","review_comments_url":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11/comments","review_comment_url":"https://api.github.com/repos/mbruzek/layer-tls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mbruzek/layer-tls/issues/11/comments","statuses_url":"https://api.github.com/repos/mbruzek/layer-tls/statuses/c5ef3de8abe59772411fa0ae6054b31118fd1900","head":{"label":"chuckbutler:client-certs","ref":"client-certs","sha":"c5ef3de8abe59772411fa0ae6054b31118fd1900","user":{"login":"chuckbutler","id":246944,"avatar_url":"https://avatars.githubusercontent.com/u/246944?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckbutler","html_url":"https://github.com/chuckbutler","followers_url":"https://api.github.com/users/chuckbutler/followers","following_url":"https://api.github.com/users/chuckbutler/following{/other_user}","gists_url":"https://api.github.com/users/chuckbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckbutler/subscriptions","organizations_url":"https://api.github.com/users/chuckbutler/orgs","repos_url":"https://api.github.com/users/chuckbutler/repos","events_url":"https://api.github.com/users/chuckbutler/events{/privacy}","received_events_url":"https://api.github.com/users/chuckbutler/received_events","type":"User","site_admin":false},"repo":{"id":47987584,"name":"layer-tls","full_name":"chuckbutler/layer-tls","owner":{"login":"chuckbutler","id":246944,"avatar_url":"https://avatars.githubusercontent.com/u/246944?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckbutler","html_url":"https://github.com/chuckbutler","followers_url":"https://api.github.com/users/chuckbutler/followers","following_url":"https://api.github.com/users/chuckbutler/following{/other_user}","gists_url":"https://api.github.com/users/chuckbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckbutler/subscriptions","organizations_url":"https://api.github.com/users/chuckbutler/orgs","repos_url":"https://api.github.com/users/chuckbutler/repos","events_url":"https://api.github.com/users/chuckbutler/events{/privacy}","received_events_url":"https://api.github.com/users/chuckbutler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chuckbutler/layer-tls","description":"The TLS charm layer using the reactive framework.","fork":true,"url":"https://api.github.com/repos/chuckbutler/layer-tls","forks_url":"https://api.github.com/repos/chuckbutler/layer-tls/forks","keys_url":"https://api.github.com/repos/chuckbutler/layer-tls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chuckbutler/layer-tls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chuckbutler/layer-tls/teams","hooks_url":"https://api.github.com/repos/chuckbutler/layer-tls/hooks","issue_events_url":"https://api.github.com/repos/chuckbutler/layer-tls/issues/events{/number}","events_url":"https://api.github.com/repos/chuckbutler/layer-tls/events","assignees_url":"https://api.github.com/repos/chuckbutler/layer-tls/assignees{/user}","branches_url":"https://api.github.com/repos/chuckbutler/layer-tls/branches{/branch}","tags_url":"https://api.github.com/repos/chuckbutler/layer-tls/tags","blobs_url":"https://api.github.com/repos/chuckbutler/layer-tls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chuckbutler/layer-tls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chuckbutler/layer-tls/git/refs{/sha}","trees_url":"https://api.github.com/repos/chuckbutler/layer-tls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chuckbutler/layer-tls/statuses/{sha}","languages_url":"https://api.github.com/repos/chuckbutler/layer-tls/languages","stargazers_url":"https://api.github.com/repos/chuckbutler/layer-tls/stargazers","contributors_url":"https://api.github.com/repos/chuckbutler/layer-tls/contributors","subscribers_url":"https://api.github.com/repos/chuckbutler/layer-tls/subscribers","subscription_url":"https://api.github.com/repos/chuckbutler/layer-tls/subscription","commits_url":"https://api.github.com/repos/chuckbutler/layer-tls/commits{/sha}","git_commits_url":"https://api.github.com/repos/chuckbutler/layer-tls/git/commits{/sha}","comments_url":"https://api.github.com/repos/chuckbutler/layer-tls/comments{/number}","issue_comment_url":"https://api.github.com/repos/chuckbutler/layer-tls/issues/comments{/number}","contents_url":"https://api.github.com/repos/chuckbutler/layer-tls/contents/{+path}","compare_url":"https://api.github.com/repos/chuckbutler/layer-tls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chuckbutler/layer-tls/merges","archive_url":"https://api.github.com/repos/chuckbutler/layer-tls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chuckbutler/layer-tls/downloads","issues_url":"https://api.github.com/repos/chuckbutler/layer-tls/issues{/number}","pulls_url":"https://api.github.com/repos/chuckbutler/layer-tls/pulls{/number}","milestones_url":"https://api.github.com/repos/chuckbutler/layer-tls/milestones{/number}","notifications_url":"https://api.github.com/repos/chuckbutler/layer-tls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chuckbutler/layer-tls/labels{/name}","releases_url":"https://api.github.com/repos/chuckbutler/layer-tls/releases{/id}","created_at":"2015-12-14T16:38:27Z","updated_at":"2015-12-14T16:38:28Z","pushed_at":"2016-01-05T23:28:30Z","git_url":"git://github.com/chuckbutler/layer-tls.git","ssh_url":"git@github.com:chuckbutler/layer-tls.git","clone_url":"https://github.com/chuckbutler/layer-tls.git","svn_url":"https://github.com/chuckbutler/layer-tls","homepage":null,"size":24,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"mbruzek:master","ref":"master","sha":"ff1287dd712f3c1a42655b3a24853a1ec12f25d4","user":{"login":"mbruzek","id":6385185,"avatar_url":"https://avatars.githubusercontent.com/u/6385185?v=3","gravatar_id":"","url":"https://api.github.com/users/mbruzek","html_url":"https://github.com/mbruzek","followers_url":"https://api.github.com/users/mbruzek/followers","following_url":"https://api.github.com/users/mbruzek/following{/other_user}","gists_url":"https://api.github.com/users/mbruzek/gists{/gist_id}","starred_url":"https://api.github.com/users/mbruzek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbruzek/subscriptions","organizations_url":"https://api.github.com/users/mbruzek/orgs","repos_url":"https://api.github.com/users/mbruzek/repos","events_url":"https://api.github.com/users/mbruzek/events{/privacy}","received_events_url":"https://api.github.com/users/mbruzek/received_events","type":"User","site_admin":false},"repo":{"id":47726665,"name":"layer-tls","full_name":"mbruzek/layer-tls","owner":{"login":"mbruzek","id":6385185,"avatar_url":"https://avatars.githubusercontent.com/u/6385185?v=3","gravatar_id":"","url":"https://api.github.com/users/mbruzek","html_url":"https://github.com/mbruzek","followers_url":"https://api.github.com/users/mbruzek/followers","following_url":"https://api.github.com/users/mbruzek/following{/other_user}","gists_url":"https://api.github.com/users/mbruzek/gists{/gist_id}","starred_url":"https://api.github.com/users/mbruzek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbruzek/subscriptions","organizations_url":"https://api.github.com/users/mbruzek/orgs","repos_url":"https://api.github.com/users/mbruzek/repos","events_url":"https://api.github.com/users/mbruzek/events{/privacy}","received_events_url":"https://api.github.com/users/mbruzek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mbruzek/layer-tls","description":"The TLS charm layer using the reactive framework.","fork":false,"url":"https://api.github.com/repos/mbruzek/layer-tls","forks_url":"https://api.github.com/repos/mbruzek/layer-tls/forks","keys_url":"https://api.github.com/repos/mbruzek/layer-tls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbruzek/layer-tls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbruzek/layer-tls/teams","hooks_url":"https://api.github.com/repos/mbruzek/layer-tls/hooks","issue_events_url":"https://api.github.com/repos/mbruzek/layer-tls/issues/events{/number}","events_url":"https://api.github.com/repos/mbruzek/layer-tls/events","assignees_url":"https://api.github.com/repos/mbruzek/layer-tls/assignees{/user}","branches_url":"https://api.github.com/repos/mbruzek/layer-tls/branches{/branch}","tags_url":"https://api.github.com/repos/mbruzek/layer-tls/tags","blobs_url":"https://api.github.com/repos/mbruzek/layer-tls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbruzek/layer-tls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbruzek/layer-tls/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbruzek/layer-tls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbruzek/layer-tls/statuses/{sha}","languages_url":"https://api.github.com/repos/mbruzek/layer-tls/languages","stargazers_url":"https://api.github.com/repos/mbruzek/layer-tls/stargazers","contributors_url":"https://api.github.com/repos/mbruzek/layer-tls/contributors","subscribers_url":"https://api.github.com/repos/mbruzek/layer-tls/subscribers","subscription_url":"https://api.github.com/repos/mbruzek/layer-tls/subscription","commits_url":"https://api.github.com/repos/mbruzek/layer-tls/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbruzek/layer-tls/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbruzek/layer-tls/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbruzek/layer-tls/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbruzek/layer-tls/contents/{+path}","compare_url":"https://api.github.com/repos/mbruzek/layer-tls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbruzek/layer-tls/merges","archive_url":"https://api.github.com/repos/mbruzek/layer-tls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbruzek/layer-tls/downloads","issues_url":"https://api.github.com/repos/mbruzek/layer-tls/issues{/number}","pulls_url":"https://api.github.com/repos/mbruzek/layer-tls/pulls{/number}","milestones_url":"https://api.github.com/repos/mbruzek/layer-tls/milestones{/number}","notifications_url":"https://api.github.com/repos/mbruzek/layer-tls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbruzek/layer-tls/labels{/name}","releases_url":"https://api.github.com/repos/mbruzek/layer-tls/releases{/id}","created_at":"2015-12-09T23:54:29Z","updated_at":"2015-12-09T23:54:39Z","pushed_at":"2016-01-05T23:28:31Z","git_url":"git://github.com/mbruzek/layer-tls.git","ssh_url":"git@github.com:mbruzek/layer-tls.git","clone_url":"https://github.com/mbruzek/layer-tls.git","svn_url":"https://github.com/mbruzek/layer-tls","homepage":null,"size":24,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11"},"html":{"href":"https://github.com/mbruzek/layer-tls/pull/11"},"issue":{"href":"https://api.github.com/repos/mbruzek/layer-tls/issues/11"},"comments":{"href":"https://api.github.com/repos/mbruzek/layer-tls/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/mbruzek/layer-tls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mbruzek/layer-tls/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/mbruzek/layer-tls/statuses/c5ef3de8abe59772411fa0ae6054b31118fd1900"}}}}