{"action":"created","comment":{"url":"https://api.github.com/repos/unixcharles/acme-client/pulls/comments/47448550","id":47448550,"diff_hunk":"@@ -9,6 +9,39 @@ def initialize(certificate, chain, request)\n     @x509 = certificate\n     @x509_chain = chain\n     @request = request\n+\n+    #create_self_signed_cert if x509.nil?\n+  end\n+\n+  def create_self_signed_cert subjectAltDomains\n+    keypair = OpenSSL::PKey::RSA.new(2048) \n+\n+    cert = OpenSSL::X509::Certificate.new\n+    cert.subject = cert.issuer = OpenSSL::X509::Name.parse \"/CN=#{subjectAltDomains.first}\"\n+    cert.not_before = Time.now\n+    cert.not_after = Time.now + 48*3600\n+    cert.public_key = keypair.public_key\n+    cert.version = 2 # X509v3\n+    cert.serial = 0x0\n+\n+    ext = []\n+\n+    ef = OpenSSL::X509::ExtensionFactory.new\n+    ef.subject_certificate = cert\n+    ef.issuer_certificate = cert\n+\n+    cert.extensions = [\n+        ef.create_extension(\"basicConstraints\",\"CA:TRUE\", true),\n+        ef.create_extension(\"subjectKeyIdentifier\", \"hash\"),\n+    ]\n+\n+    cert.add_extension ef.create_extension(\"authorityKeyIdentifier\", \"keyid:always,issuer:always\")\n+    cert.add_extension ef.create_extension(\"subjectAltName\", subjectAltDomains.map { |d| \"DNS: #{d}\" }.join(','))","path":"lib/acme/certificate.rb","position":40,"original_position":40,"commit_id":"fc38615208d14ddc0d7c819a58e1c3024f521e8d","original_commit_id":"fc38615208d14ddc0d7c819a58e1c3024f521e8d","user":{"login":"jhass","id":141294,"avatar_url":"https://avatars.githubusercontent.com/u/141294?v=3","gravatar_id":"","url":"https://api.github.com/users/jhass","html_url":"https://github.com/jhass","followers_url":"https://api.github.com/users/jhass/followers","following_url":"https://api.github.com/users/jhass/following{/other_user}","gists_url":"https://api.github.com/users/jhass/gists{/gist_id}","starred_url":"https://api.github.com/users/jhass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhass/subscriptions","organizations_url":"https://api.github.com/users/jhass/orgs","repos_url":"https://api.github.com/users/jhass/repos","events_url":"https://api.github.com/users/jhass/events{/privacy}","received_events_url":"https://api.github.com/users/jhass/received_events","type":"User","site_admin":false},"body":"This seems a bit inconsistent, either populate `extensions=` with the full array or use `add_extension` for all four.","created_at":"2015-12-13T19:10:35Z","updated_at":"2015-12-13T19:10:35Z","html_url":"https://github.com/unixcharles/acme-client/pull/36#discussion_r47448550","pull_request_url":"https://api.github.com/repos/unixcharles/acme-client/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/unixcharles/acme-client/pulls/comments/47448550"},"html":{"href":"https://github.com/unixcharles/acme-client/pull/36#discussion_r47448550"},"pull_request":{"href":"https://api.github.com/repos/unixcharles/acme-client/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/unixcharles/acme-client/pulls/36","id":53502178,"html_url":"https://github.com/unixcharles/acme-client/pull/36","diff_url":"https://github.com/unixcharles/acme-client/pull/36.diff","patch_url":"https://github.com/unixcharles/acme-client/pull/36.patch","issue_url":"https://api.github.com/repos/unixcharles/acme-client/issues/36","number":36,"state":"open","locked":false,"title":"Support for tls-dvsni-01","user":{"login":"saltsa","id":2312453,"avatar_url":"https://avatars.githubusercontent.com/u/2312453?v=3","gravatar_id":"","url":"https://api.github.com/users/saltsa","html_url":"https://github.com/saltsa","followers_url":"https://api.github.com/users/saltsa/followers","following_url":"https://api.github.com/users/saltsa/following{/other_user}","gists_url":"https://api.github.com/users/saltsa/gists{/gist_id}","starred_url":"https://api.github.com/users/saltsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltsa/subscriptions","organizations_url":"https://api.github.com/users/saltsa/orgs","repos_url":"https://api.github.com/users/saltsa/repos","events_url":"https://api.github.com/users/saltsa/events{/privacy}","received_events_url":"https://api.github.com/users/saltsa/received_events","type":"User","site_admin":false},"body":"sni_name method returns the server name to be used in webserver config and to create self-signed certificate","created_at":"2015-12-13T15:28:10Z","updated_at":"2015-12-13T19:10:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80fa20e0f155d36591ec9c1e603394e08ab76c29","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/unixcharles/acme-client/pulls/36/commits","review_comments_url":"https://api.github.com/repos/unixcharles/acme-client/pulls/36/comments","review_comment_url":"https://api.github.com/repos/unixcharles/acme-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unixcharles/acme-client/issues/36/comments","statuses_url":"https://api.github.com/repos/unixcharles/acme-client/statuses/fc38615208d14ddc0d7c819a58e1c3024f521e8d","head":{"label":"saltsa:master","ref":"master","sha":"fc38615208d14ddc0d7c819a58e1c3024f521e8d","user":{"login":"saltsa","id":2312453,"avatar_url":"https://avatars.githubusercontent.com/u/2312453?v=3","gravatar_id":"","url":"https://api.github.com/users/saltsa","html_url":"https://github.com/saltsa","followers_url":"https://api.github.com/users/saltsa/followers","following_url":"https://api.github.com/users/saltsa/following{/other_user}","gists_url":"https://api.github.com/users/saltsa/gists{/gist_id}","starred_url":"https://api.github.com/users/saltsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltsa/subscriptions","organizations_url":"https://api.github.com/users/saltsa/orgs","repos_url":"https://api.github.com/users/saltsa/repos","events_url":"https://api.github.com/users/saltsa/events{/privacy}","received_events_url":"https://api.github.com/users/saltsa/received_events","type":"User","site_admin":false},"repo":{"id":47916851,"name":"acme-client","full_name":"saltsa/acme-client","owner":{"login":"saltsa","id":2312453,"avatar_url":"https://avatars.githubusercontent.com/u/2312453?v=3","gravatar_id":"","url":"https://api.github.com/users/saltsa","html_url":"https://github.com/saltsa","followers_url":"https://api.github.com/users/saltsa/followers","following_url":"https://api.github.com/users/saltsa/following{/other_user}","gists_url":"https://api.github.com/users/saltsa/gists{/gist_id}","starred_url":"https://api.github.com/users/saltsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltsa/subscriptions","organizations_url":"https://api.github.com/users/saltsa/orgs","repos_url":"https://api.github.com/users/saltsa/repos","events_url":"https://api.github.com/users/saltsa/events{/privacy}","received_events_url":"https://api.github.com/users/saltsa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/saltsa/acme-client","description":"A Ruby client for the letsencrypt's ACME protocol.","fork":true,"url":"https://api.github.com/repos/saltsa/acme-client","forks_url":"https://api.github.com/repos/saltsa/acme-client/forks","keys_url":"https://api.github.com/repos/saltsa/acme-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saltsa/acme-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saltsa/acme-client/teams","hooks_url":"https://api.github.com/repos/saltsa/acme-client/hooks","issue_events_url":"https://api.github.com/repos/saltsa/acme-client/issues/events{/number}","events_url":"https://api.github.com/repos/saltsa/acme-client/events","assignees_url":"https://api.github.com/repos/saltsa/acme-client/assignees{/user}","branches_url":"https://api.github.com/repos/saltsa/acme-client/branches{/branch}","tags_url":"https://api.github.com/repos/saltsa/acme-client/tags","blobs_url":"https://api.github.com/repos/saltsa/acme-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saltsa/acme-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saltsa/acme-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/saltsa/acme-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saltsa/acme-client/statuses/{sha}","languages_url":"https://api.github.com/repos/saltsa/acme-client/languages","stargazers_url":"https://api.github.com/repos/saltsa/acme-client/stargazers","contributors_url":"https://api.github.com/repos/saltsa/acme-client/contributors","subscribers_url":"https://api.github.com/repos/saltsa/acme-client/subscribers","subscription_url":"https://api.github.com/repos/saltsa/acme-client/subscription","commits_url":"https://api.github.com/repos/saltsa/acme-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/saltsa/acme-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/saltsa/acme-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/saltsa/acme-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/saltsa/acme-client/contents/{+path}","compare_url":"https://api.github.com/repos/saltsa/acme-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saltsa/acme-client/merges","archive_url":"https://api.github.com/repos/saltsa/acme-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saltsa/acme-client/downloads","issues_url":"https://api.github.com/repos/saltsa/acme-client/issues{/number}","pulls_url":"https://api.github.com/repos/saltsa/acme-client/pulls{/number}","milestones_url":"https://api.github.com/repos/saltsa/acme-client/milestones{/number}","notifications_url":"https://api.github.com/repos/saltsa/acme-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saltsa/acme-client/labels{/name}","releases_url":"https://api.github.com/repos/saltsa/acme-client/releases{/id}","created_at":"2015-12-13T11:42:46Z","updated_at":"2015-12-13T11:42:47Z","pushed_at":"2015-12-13T18:54:44Z","git_url":"git://github.com/saltsa/acme-client.git","ssh_url":"git@github.com:saltsa/acme-client.git","clone_url":"https://github.com/saltsa/acme-client.git","svn_url":"https://github.com/saltsa/acme-client","homepage":null,"size":237,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"unixcharles:master","ref":"master","sha":"3b7771b2c85233208e7ed70b1b5dbd586cd2d6a8","user":{"login":"unixcharles","id":78458,"avatar_url":"https://avatars.githubusercontent.com/u/78458?v=3","gravatar_id":"","url":"https://api.github.com/users/unixcharles","html_url":"https://github.com/unixcharles","followers_url":"https://api.github.com/users/unixcharles/followers","following_url":"https://api.github.com/users/unixcharles/following{/other_user}","gists_url":"https://api.github.com/users/unixcharles/gists{/gist_id}","starred_url":"https://api.github.com/users/unixcharles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unixcharles/subscriptions","organizations_url":"https://api.github.com/users/unixcharles/orgs","repos_url":"https://api.github.com/users/unixcharles/repos","events_url":"https://api.github.com/users/unixcharles/events{/privacy}","received_events_url":"https://api.github.com/users/unixcharles/received_events","type":"User","site_admin":false},"repo":{"id":40743504,"name":"acme-client","full_name":"unixcharles/acme-client","owner":{"login":"unixcharles","id":78458,"avatar_url":"https://avatars.githubusercontent.com/u/78458?v=3","gravatar_id":"","url":"https://api.github.com/users/unixcharles","html_url":"https://github.com/unixcharles","followers_url":"https://api.github.com/users/unixcharles/followers","following_url":"https://api.github.com/users/unixcharles/following{/other_user}","gists_url":"https://api.github.com/users/unixcharles/gists{/gist_id}","starred_url":"https://api.github.com/users/unixcharles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unixcharles/subscriptions","organizations_url":"https://api.github.com/users/unixcharles/orgs","repos_url":"https://api.github.com/users/unixcharles/repos","events_url":"https://api.github.com/users/unixcharles/events{/privacy}","received_events_url":"https://api.github.com/users/unixcharles/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/unixcharles/acme-client","description":"A Ruby client for the letsencrypt's ACME protocol.","fork":false,"url":"https://api.github.com/repos/unixcharles/acme-client","forks_url":"https://api.github.com/repos/unixcharles/acme-client/forks","keys_url":"https://api.github.com/repos/unixcharles/acme-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unixcharles/acme-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unixcharles/acme-client/teams","hooks_url":"https://api.github.com/repos/unixcharles/acme-client/hooks","issue_events_url":"https://api.github.com/repos/unixcharles/acme-client/issues/events{/number}","events_url":"https://api.github.com/repos/unixcharles/acme-client/events","assignees_url":"https://api.github.com/repos/unixcharles/acme-client/assignees{/user}","branches_url":"https://api.github.com/repos/unixcharles/acme-client/branches{/branch}","tags_url":"https://api.github.com/repos/unixcharles/acme-client/tags","blobs_url":"https://api.github.com/repos/unixcharles/acme-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unixcharles/acme-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unixcharles/acme-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/unixcharles/acme-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unixcharles/acme-client/statuses/{sha}","languages_url":"https://api.github.com/repos/unixcharles/acme-client/languages","stargazers_url":"https://api.github.com/repos/unixcharles/acme-client/stargazers","contributors_url":"https://api.github.com/repos/unixcharles/acme-client/contributors","subscribers_url":"https://api.github.com/repos/unixcharles/acme-client/subscribers","subscription_url":"https://api.github.com/repos/unixcharles/acme-client/subscription","commits_url":"https://api.github.com/repos/unixcharles/acme-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/unixcharles/acme-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/unixcharles/acme-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/unixcharles/acme-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/unixcharles/acme-client/contents/{+path}","compare_url":"https://api.github.com/repos/unixcharles/acme-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unixcharles/acme-client/merges","archive_url":"https://api.github.com/repos/unixcharles/acme-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unixcharles/acme-client/downloads","issues_url":"https://api.github.com/repos/unixcharles/acme-client/issues{/number}","pulls_url":"https://api.github.com/repos/unixcharles/acme-client/pulls{/number}","milestones_url":"https://api.github.com/repos/unixcharles/acme-client/milestones{/number}","notifications_url":"https://api.github.com/repos/unixcharles/acme-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unixcharles/acme-client/labels{/name}","releases_url":"https://api.github.com/repos/unixcharles/acme-client/releases{/id}","created_at":"2015-08-15T02:11:50Z","updated_at":"2015-12-13T06:48:34Z","pushed_at":"2015-12-13T18:54:44Z","git_url":"git://github.com/unixcharles/acme-client.git","ssh_url":"git@github.com:unixcharles/acme-client.git","clone_url":"https://github.com/unixcharles/acme-client.git","svn_url":"https://github.com/unixcharles/acme-client","homepage":null,"size":230,"stargazers_count":75,"watchers_count":75,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":2,"forks":16,"open_issues":2,"watchers":75,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unixcharles/acme-client/pulls/36"},"html":{"href":"https://github.com/unixcharles/acme-client/pull/36"},"issue":{"href":"https://api.github.com/repos/unixcharles/acme-client/issues/36"},"comments":{"href":"https://api.github.com/repos/unixcharles/acme-client/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/unixcharles/acme-client/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/unixcharles/acme-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unixcharles/acme-client/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/unixcharles/acme-client/statuses/fc38615208d14ddc0d7c819a58e1c3024f521e8d"}}}}