{"action":"created","comment":{"url":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/23295288","id":23295288,"diff_hunk":"@@ -0,0 +1,87 @@\n+package scan\n+\n+import (\n+\t\"crypto/tls\"\n+\t\"fmt\"\n+\t\"net\"\n+)\n+\n+// TLSSession contains tests of host TLS Session Resumption via\n+// Session Tickets and Session IDs\n+var TLSSession = &Family{\n+\tName:        \"TLSSessionScanners\",\n+\tDescription: \"Scans host's implementation of TLS session resumption using session tickets/session IDs\",\n+\tScanners: []*Scanner{\n+\t\t{\n+\t\t\t\"SessionResumeScanner\",\n+\t\t\t\"Host is able to resume sessions accross all addresses.\",\n+\t\t\tsessionResumeScan,\n+\t\t},\n+\t},\n+}\n+\n+// sessionCache is a mock ClientSessionCache used to record all stores (i.e. new session tickets)\n+type sessionCache struct {\n+\tcache map[string][]*tls.ClientSessionState\n+}\n+\n+func newSessionCache() *sessionCache {\n+\treturn &sessionCache{make(map[string][]*tls.ClientSessionState)}\n+}\n+func (s *sessionCache) Get(sessionKey string) (mostRecent *tls.ClientSessionState, ok bool) {\n+\tstates, ok := s.cache[sessionKey]\n+\tif len(states) < 1 {\n+\t\treturn\n+\t}\n+\tmostRecent = states[len(states)-1]\n+\treturn\n+}\n+func (s *sessionCache) Put(sessionKey string, cs *tls.ClientSessionState) {\n+\ts.cache[sessionKey] = append(s.cache[sessionKey], cs)\n+}\n+\n+// SessionResumeScan tests that host is able to resume sessions accross all addresses.\n+func sessionResumeScan(host string) (grade Grade, output Output, err error) {\n+\tvar port string\n+\thost, port, err = net.SplitHostPort(host)\n+\tif err != nil {\n+\t\treturn\n+\t}\n+\tips, err := net.LookupIP(host)\n+\tif err != nil {\n+\t\treturn\n+\t}\n+\tsessions := newSessionCache()\n+\toutput = sessions\n+\tconfig := &tls.Config{ClientSessionCache: sessions, InsecureSkipVerify: true}\n+\tfor _, ip := range ips {\n+\t\tvar addr string\n+\t\tif ip.To4() != nil {\n+\t\t\taddr = ip.String()\n+\t\t} else {\n+\t\t\taddr = \"[\" + ip.String() + \"]\"\n+\t\t}\n+\t\tif len(port) == 0 {","path":"scan/tls_session.go","position":64,"original_position":64,"commit_id":"687ebb7c3a6a4b08b556db04828b08142895d821","original_commit_id":"687ebb7c3a6a4b08b556db04828b08142895d821","user":{"login":"jgrahamc","id":53644,"avatar_url":"https://avatars.githubusercontent.com/u/53644?v=3","gravatar_id":"","url":"https://api.github.com/users/jgrahamc","html_url":"https://github.com/jgrahamc","followers_url":"https://api.github.com/users/jgrahamc/followers","following_url":"https://api.github.com/users/jgrahamc/following{/other_user}","gists_url":"https://api.github.com/users/jgrahamc/gists{/gist_id}","starred_url":"https://api.github.com/users/jgrahamc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgrahamc/subscriptions","organizations_url":"https://api.github.com/users/jgrahamc/orgs","repos_url":"https://api.github.com/users/jgrahamc/repos","events_url":"https://api.github.com/users/jgrahamc/events{/privacy}","received_events_url":"https://api.github.com/users/jgrahamc/received_events","type":"User","site_admin":false},"body":"Why not use\r\n```\r\nport == \"\"\r\n```\r\ninstead of\r\n```\r\nlen(port) == 0\r\n```","created_at":"2015-01-21T12:27:07Z","updated_at":"2015-01-21T12:27:07Z","html_url":"https://github.com/cloudflare/cfssl/pull/73#discussion_r23295288","pull_request_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/23295288"},"html":{"href":"https://github.com/cloudflare/cfssl/pull/73#discussion_r23295288"},"pull_request":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/cloudflare/cfssl/pulls/73","id":27622315,"html_url":"https://github.com/cloudflare/cfssl/pull/73","diff_url":"https://github.com/cloudflare/cfssl/pull/73.diff","patch_url":"https://github.com/cloudflare/cfssl/pull/73.patch","issue_url":"https://api.github.com/repos/cloudflare/cfssl/issues/73","number":73,"state":"open","locked":false,"title":"Initial CLI Version of `cfssl scan`","user":{"login":"jacobhaven","id":95305,"avatar_url":"https://avatars.githubusercontent.com/u/95305?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobhaven","html_url":"https://github.com/jacobhaven","followers_url":"https://api.github.com/users/jacobhaven/followers","following_url":"https://api.github.com/users/jacobhaven/following{/other_user}","gists_url":"https://api.github.com/users/jacobhaven/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobhaven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobhaven/subscriptions","organizations_url":"https://api.github.com/users/jacobhaven/orgs","repos_url":"https://api.github.com/users/jacobhaven/repos","events_url":"https://api.github.com/users/jacobhaven/events{/privacy}","received_events_url":"https://api.github.com/users/jacobhaven/received_events","type":"User","site_admin":false},"body":"Adds new `scan` command, that performs a variety of connectivity and TLS protocol tests.\r\n\r\nUnfortunately, some of these require importing the go standard library's `crypto/tls` package's source in order to access private members. These are used in `scan/tls/cfsslscan_*.go` files to export additional functionality not supplied by the `crypto/tls` API.\r\n\r\nSupport for the standard CFSSL HTTP API is forthcoming, but comments on this initial structure might be useful first.","created_at":"2015-01-19T17:20:10Z","updated_at":"2015-01-21T12:27:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"209f3fa56d3a1efd4ce389536e0b75c895e37859","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/73/commits","review_comments_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/73/comments","review_comment_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cloudflare/cfssl/issues/73/comments","statuses_url":"https://api.github.com/repos/cloudflare/cfssl/statuses/687ebb7c3a6a4b08b556db04828b08142895d821","head":{"label":"cloudflare:jacob/scan","ref":"jacob/scan","sha":"687ebb7c3a6a4b08b556db04828b08142895d821","user":{"login":"cloudflare","id":314135,"avatar_url":"https://avatars.githubusercontent.com/u/314135?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudflare","html_url":"https://github.com/cloudflare","followers_url":"https://api.github.com/users/cloudflare/followers","following_url":"https://api.github.com/users/cloudflare/following{/other_user}","gists_url":"https://api.github.com/users/cloudflare/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudflare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudflare/subscriptions","organizations_url":"https://api.github.com/users/cloudflare/orgs","repos_url":"https://api.github.com/users/cloudflare/repos","events_url":"https://api.github.com/users/cloudflare/events{/privacy}","received_events_url":"https://api.github.com/users/cloudflare/received_events","type":"Organization","site_admin":false},"repo":{"id":21591001,"name":"cfssl","full_name":"cloudflare/cfssl","owner":{"login":"cloudflare","id":314135,"avatar_url":"https://avatars.githubusercontent.com/u/314135?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudflare","html_url":"https://github.com/cloudflare","followers_url":"https://api.github.com/users/cloudflare/followers","following_url":"https://api.github.com/users/cloudflare/following{/other_user}","gists_url":"https://api.github.com/users/cloudflare/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudflare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudflare/subscriptions","organizations_url":"https://api.github.com/users/cloudflare/orgs","repos_url":"https://api.github.com/users/cloudflare/repos","events_url":"https://api.github.com/users/cloudflare/events{/privacy}","received_events_url":"https://api.github.com/users/cloudflare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudflare/cfssl","description":"CFSSL: CloudFlare's PKI toolkit","fork":false,"url":"https://api.github.com/repos/cloudflare/cfssl","forks_url":"https://api.github.com/repos/cloudflare/cfssl/forks","keys_url":"https://api.github.com/repos/cloudflare/cfssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudflare/cfssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudflare/cfssl/teams","hooks_url":"https://api.github.com/repos/cloudflare/cfssl/hooks","issue_events_url":"https://api.github.com/repos/cloudflare/cfssl/issues/events{/number}","events_url":"https://api.github.com/repos/cloudflare/cfssl/events","assignees_url":"https://api.github.com/repos/cloudflare/cfssl/assignees{/user}","branches_url":"https://api.github.com/repos/cloudflare/cfssl/branches{/branch}","tags_url":"https://api.github.com/repos/cloudflare/cfssl/tags","blobs_url":"https://api.github.com/repos/cloudflare/cfssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudflare/cfssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudflare/cfssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudflare/cfssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudflare/cfssl/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudflare/cfssl/languages","stargazers_url":"https://api.github.com/repos/cloudflare/cfssl/stargazers","contributors_url":"https://api.github.com/repos/cloudflare/cfssl/contributors","subscribers_url":"https://api.github.com/repos/cloudflare/cfssl/subscribers","subscription_url":"https://api.github.com/repos/cloudflare/cfssl/subscription","commits_url":"https://api.github.com/repos/cloudflare/cfssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudflare/cfssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudflare/cfssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudflare/cfssl/issues/comments/{number}","contents_url":"https://api.github.com/repos/cloudflare/cfssl/contents/{+path}","compare_url":"https://api.github.com/repos/cloudflare/cfssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudflare/cfssl/merges","archive_url":"https://api.github.com/repos/cloudflare/cfssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudflare/cfssl/downloads","issues_url":"https://api.github.com/repos/cloudflare/cfssl/issues{/number}","pulls_url":"https://api.github.com/repos/cloudflare/cfssl/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudflare/cfssl/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudflare/cfssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudflare/cfssl/labels{/name}","releases_url":"https://api.github.com/repos/cloudflare/cfssl/releases{/id}","created_at":"2014-07-07T23:49:12Z","updated_at":"2015-01-20T21:43:00Z","pushed_at":"2015-01-20T00:27:40Z","git_url":"git://github.com/cloudflare/cfssl.git","ssh_url":"git@github.com:cloudflare/cfssl.git","clone_url":"https://github.com/cloudflare/cfssl.git","svn_url":"https://github.com/cloudflare/cfssl","homepage":"https://blog.cloudflare.com/introducing-cfssl","size":3673,"stargazers_count":431,"watchers_count":431,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":6,"forks":24,"open_issues":6,"watchers":431,"default_branch":"master"}},"base":{"label":"cloudflare:master","ref":"master","sha":"26d86173ef75c5849f519e46f8fda32121ef5922","user":{"login":"cloudflare","id":314135,"avatar_url":"https://avatars.githubusercontent.com/u/314135?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudflare","html_url":"https://github.com/cloudflare","followers_url":"https://api.github.com/users/cloudflare/followers","following_url":"https://api.github.com/users/cloudflare/following{/other_user}","gists_url":"https://api.github.com/users/cloudflare/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudflare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudflare/subscriptions","organizations_url":"https://api.github.com/users/cloudflare/orgs","repos_url":"https://api.github.com/users/cloudflare/repos","events_url":"https://api.github.com/users/cloudflare/events{/privacy}","received_events_url":"https://api.github.com/users/cloudflare/received_events","type":"Organization","site_admin":false},"repo":{"id":21591001,"name":"cfssl","full_name":"cloudflare/cfssl","owner":{"login":"cloudflare","id":314135,"avatar_url":"https://avatars.githubusercontent.com/u/314135?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudflare","html_url":"https://github.com/cloudflare","followers_url":"https://api.github.com/users/cloudflare/followers","following_url":"https://api.github.com/users/cloudflare/following{/other_user}","gists_url":"https://api.github.com/users/cloudflare/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudflare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudflare/subscriptions","organizations_url":"https://api.github.com/users/cloudflare/orgs","repos_url":"https://api.github.com/users/cloudflare/repos","events_url":"https://api.github.com/users/cloudflare/events{/privacy}","received_events_url":"https://api.github.com/users/cloudflare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudflare/cfssl","description":"CFSSL: CloudFlare's PKI toolkit","fork":false,"url":"https://api.github.com/repos/cloudflare/cfssl","forks_url":"https://api.github.com/repos/cloudflare/cfssl/forks","keys_url":"https://api.github.com/repos/cloudflare/cfssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudflare/cfssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudflare/cfssl/teams","hooks_url":"https://api.github.com/repos/cloudflare/cfssl/hooks","issue_events_url":"https://api.github.com/repos/cloudflare/cfssl/issues/events{/number}","events_url":"https://api.github.com/repos/cloudflare/cfssl/events","assignees_url":"https://api.github.com/repos/cloudflare/cfssl/assignees{/user}","branches_url":"https://api.github.com/repos/cloudflare/cfssl/branches{/branch}","tags_url":"https://api.github.com/repos/cloudflare/cfssl/tags","blobs_url":"https://api.github.com/repos/cloudflare/cfssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudflare/cfssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudflare/cfssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudflare/cfssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudflare/cfssl/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudflare/cfssl/languages","stargazers_url":"https://api.github.com/repos/cloudflare/cfssl/stargazers","contributors_url":"https://api.github.com/repos/cloudflare/cfssl/contributors","subscribers_url":"https://api.github.com/repos/cloudflare/cfssl/subscribers","subscription_url":"https://api.github.com/repos/cloudflare/cfssl/subscription","commits_url":"https://api.github.com/repos/cloudflare/cfssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudflare/cfssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudflare/cfssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudflare/cfssl/issues/comments/{number}","contents_url":"https://api.github.com/repos/cloudflare/cfssl/contents/{+path}","compare_url":"https://api.github.com/repos/cloudflare/cfssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudflare/cfssl/merges","archive_url":"https://api.github.com/repos/cloudflare/cfssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudflare/cfssl/downloads","issues_url":"https://api.github.com/repos/cloudflare/cfssl/issues{/number}","pulls_url":"https://api.github.com/repos/cloudflare/cfssl/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudflare/cfssl/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudflare/cfssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudflare/cfssl/labels{/name}","releases_url":"https://api.github.com/repos/cloudflare/cfssl/releases{/id}","created_at":"2014-07-07T23:49:12Z","updated_at":"2015-01-20T21:43:00Z","pushed_at":"2015-01-20T00:27:40Z","git_url":"git://github.com/cloudflare/cfssl.git","ssh_url":"git@github.com:cloudflare/cfssl.git","clone_url":"https://github.com/cloudflare/cfssl.git","svn_url":"https://github.com/cloudflare/cfssl","homepage":"https://blog.cloudflare.com/introducing-cfssl","size":3673,"stargazers_count":431,"watchers_count":431,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":6,"forks":24,"open_issues":6,"watchers":431,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/73"},"html":{"href":"https://github.com/cloudflare/cfssl/pull/73"},"issue":{"href":"https://api.github.com/repos/cloudflare/cfssl/issues/73"},"comments":{"href":"https://api.github.com/repos/cloudflare/cfssl/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/cloudflare/cfssl/statuses/687ebb7c3a6a4b08b556db04828b08142895d821"}}}}