{"action":"created","comment":{"url":"https://api.github.com/repos/getlantern/lantern_aws/pulls/comments/60771658","id":60771658,"diff_hunk":"@@ -15,16 +16,47 @@\n \n whitelisted = redis_shell is not None and redis_shell.exists('sshalert-whitelist:%s' % ip)\n \n+original_cmd = os.getenv('SSH_ORIGINAL_COMMAND')\n+\n if not whitelisted:\n-    alert.send_to_slack(\"SSH login\", \"User %s *logging in* from IP %s\" % (user, ip))\n+    # WARNING: if you make any changes to this check or its response you better\n+    # test them in a more disposable machine (e.g., a test proxy, rather than a\n+    # test cloudmaster).  You can easily lock yourself out of the test machine.\n+    # Keeping a backup of this file and a separate SSH session open while you\n+    # test this should help prevent such lockout.\n+    if not original_cmd:","path":"salt/sshalert/sshalert.py","position":21,"original_position":21,"commit_id":"637dea96a6d507488c470069cb94dd68cf19b415","original_commit_id":"637dea96a6d507488c470069cb94dd68cf19b415","user":{"login":"aranhoide","id":2204867,"avatar_url":"https://avatars.githubusercontent.com/u/2204867?v=3","gravatar_id":"","url":"https://api.github.com/users/aranhoide","html_url":"https://github.com/aranhoide","followers_url":"https://api.github.com/users/aranhoide/followers","following_url":"https://api.github.com/users/aranhoide/following{/other_user}","gists_url":"https://api.github.com/users/aranhoide/gists{/gist_id}","starred_url":"https://api.github.com/users/aranhoide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aranhoide/subscriptions","organizations_url":"https://api.github.com/users/aranhoide/orgs","repos_url":"https://api.github.com/users/aranhoide/repos","events_url":"https://api.github.com/users/aranhoide/events{/privacy}","received_events_url":"https://api.github.com/users/aranhoide/received_events","type":"User","site_admin":false},"body":"We are testing in redis whether the user's IP is whitelisted.  Env vars are used to get the user's IP (and, less to the point, to get the command they are trying to run).  These are not provided by us but by SSH etc.  I'm on my phone but you can google their names.","created_at":"2016-04-22T17:10:12Z","updated_at":"2016-04-22T17:10:12Z","html_url":"https://github.com/getlantern/lantern_aws/pull/146#discussion_r60771658","pull_request_url":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146","_links":{"self":{"href":"https://api.github.com/repos/getlantern/lantern_aws/pulls/comments/60771658"},"html":{"href":"https://github.com/getlantern/lantern_aws/pull/146#discussion_r60771658"},"pull_request":{"href":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146"}}},"pull_request":{"url":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146","id":67510828,"html_url":"https://github.com/getlantern/lantern_aws/pull/146","diff_url":"https://github.com/getlantern/lantern_aws/pull/146.diff","patch_url":"https://github.com/getlantern/lantern_aws/pull/146.patch","issue_url":"https://api.github.com/repos/getlantern/lantern_aws/issues/146","number":146,"state":"open","locked":false,"title":"ssh-alert doublecheck","user":{"login":"aranhoide","id":2204867,"avatar_url":"https://avatars.githubusercontent.com/u/2204867?v=3","gravatar_id":"","url":"https://api.github.com/users/aranhoide","html_url":"https://github.com/aranhoide","followers_url":"https://api.github.com/users/aranhoide/followers","following_url":"https://api.github.com/users/aranhoide/following{/other_user}","gists_url":"https://api.github.com/users/aranhoide/gists{/gist_id}","starred_url":"https://api.github.com/users/aranhoide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aranhoide/subscriptions","organizations_url":"https://api.github.com/users/aranhoide/orgs","repos_url":"https://api.github.com/users/aranhoide/repos","events_url":"https://api.github.com/users/aranhoide/events{/privacy}","received_events_url":"https://api.github.com/users/aranhoide/received_events","type":"User","site_admin":false},"body":"If you accidentally ssh into a proxy, you'll be prompted to use hussh instead.  You can still override this if you're in a rush to fix something or you can't set up hussh at this moment.\r\n\r\nFor interactive logins, you just get asked to confirm that you really want to log in.  For noninteractive logins, you can prepend `_force_` to bypass this check.  In either case, the script will try and shame you on that. :)\r\n\r\nAs a side feature, ssh alerts now go to a new #ssh-alert slack channel.\r\n\r\nI've tested this in a test proxy.","created_at":"2016-04-22T13:26:47Z","updated_at":"2016-04-22T17:10:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"313f45b771ba48816fbd9fba48546f28a8c2741b","assignee":{"login":"uaalto","id":12701448,"avatar_url":"https://avatars.githubusercontent.com/u/12701448?v=3","gravatar_id":"","url":"https://api.github.com/users/uaalto","html_url":"https://github.com/uaalto","followers_url":"https://api.github.com/users/uaalto/followers","following_url":"https://api.github.com/users/uaalto/following{/other_user}","gists_url":"https://api.github.com/users/uaalto/gists{/gist_id}","starred_url":"https://api.github.com/users/uaalto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uaalto/subscriptions","organizations_url":"https://api.github.com/users/uaalto/orgs","repos_url":"https://api.github.com/users/uaalto/repos","events_url":"https://api.github.com/users/uaalto/events{/privacy}","received_events_url":"https://api.github.com/users/uaalto/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146/commits","review_comments_url":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146/comments","review_comment_url":"https://api.github.com/repos/getlantern/lantern_aws/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getlantern/lantern_aws/issues/146/comments","statuses_url":"https://api.github.com/repos/getlantern/lantern_aws/statuses/637dea96a6d507488c470069cb94dd68cf19b415","head":{"label":"getlantern:sshalert-doublecheck","ref":"sshalert-doublecheck","sha":"637dea96a6d507488c470069cb94dd68cf19b415","user":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"repo":{"id":5247106,"name":"lantern_aws","full_name":"getlantern/lantern_aws","owner":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getlantern/lantern_aws","description":"AWS utilities and Salt configuration","fork":false,"url":"https://api.github.com/repos/getlantern/lantern_aws","forks_url":"https://api.github.com/repos/getlantern/lantern_aws/forks","keys_url":"https://api.github.com/repos/getlantern/lantern_aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/lantern_aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/lantern_aws/teams","hooks_url":"https://api.github.com/repos/getlantern/lantern_aws/hooks","issue_events_url":"https://api.github.com/repos/getlantern/lantern_aws/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/lantern_aws/events","assignees_url":"https://api.github.com/repos/getlantern/lantern_aws/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/lantern_aws/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/lantern_aws/tags","blobs_url":"https://api.github.com/repos/getlantern/lantern_aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/lantern_aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/lantern_aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/lantern_aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/lantern_aws/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/lantern_aws/languages","stargazers_url":"https://api.github.com/repos/getlantern/lantern_aws/stargazers","contributors_url":"https://api.github.com/repos/getlantern/lantern_aws/contributors","subscribers_url":"https://api.github.com/repos/getlantern/lantern_aws/subscribers","subscription_url":"https://api.github.com/repos/getlantern/lantern_aws/subscription","commits_url":"https://api.github.com/repos/getlantern/lantern_aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/lantern_aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/lantern_aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/lantern_aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/lantern_aws/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/lantern_aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/lantern_aws/merges","archive_url":"https://api.github.com/repos/getlantern/lantern_aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/lantern_aws/downloads","issues_url":"https://api.github.com/repos/getlantern/lantern_aws/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/lantern_aws/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/lantern_aws/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/lantern_aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/lantern_aws/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/lantern_aws/releases{/id}","deployments_url":"https://api.github.com/repos/getlantern/lantern_aws/deployments","created_at":"2012-07-31T14:43:10Z","updated_at":"2016-03-26T11:56:52Z","pushed_at":"2016-04-22T14:21:40Z","git_url":"git://github.com/getlantern/lantern_aws.git","ssh_url":"git@github.com:getlantern/lantern_aws.git","clone_url":"https://github.com/getlantern/lantern_aws.git","svn_url":"https://github.com/getlantern/lantern_aws","homepage":"","size":9532,"stargazers_count":21,"watchers_count":21,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":29,"forks":7,"open_issues":29,"watchers":21,"default_branch":"master"}},"base":{"label":"getlantern:master","ref":"master","sha":"6b0cec1d7ed070f7ce18cc2ccc17fc88165a6979","user":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"repo":{"id":5247106,"name":"lantern_aws","full_name":"getlantern/lantern_aws","owner":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getlantern/lantern_aws","description":"AWS utilities and Salt configuration","fork":false,"url":"https://api.github.com/repos/getlantern/lantern_aws","forks_url":"https://api.github.com/repos/getlantern/lantern_aws/forks","keys_url":"https://api.github.com/repos/getlantern/lantern_aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/lantern_aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/lantern_aws/teams","hooks_url":"https://api.github.com/repos/getlantern/lantern_aws/hooks","issue_events_url":"https://api.github.com/repos/getlantern/lantern_aws/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/lantern_aws/events","assignees_url":"https://api.github.com/repos/getlantern/lantern_aws/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/lantern_aws/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/lantern_aws/tags","blobs_url":"https://api.github.com/repos/getlantern/lantern_aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/lantern_aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/lantern_aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/lantern_aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/lantern_aws/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/lantern_aws/languages","stargazers_url":"https://api.github.com/repos/getlantern/lantern_aws/stargazers","contributors_url":"https://api.github.com/repos/getlantern/lantern_aws/contributors","subscribers_url":"https://api.github.com/repos/getlantern/lantern_aws/subscribers","subscription_url":"https://api.github.com/repos/getlantern/lantern_aws/subscription","commits_url":"https://api.github.com/repos/getlantern/lantern_aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/lantern_aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/lantern_aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/lantern_aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/lantern_aws/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/lantern_aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/lantern_aws/merges","archive_url":"https://api.github.com/repos/getlantern/lantern_aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/lantern_aws/downloads","issues_url":"https://api.github.com/repos/getlantern/lantern_aws/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/lantern_aws/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/lantern_aws/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/lantern_aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/lantern_aws/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/lantern_aws/releases{/id}","deployments_url":"https://api.github.com/repos/getlantern/lantern_aws/deployments","created_at":"2012-07-31T14:43:10Z","updated_at":"2016-03-26T11:56:52Z","pushed_at":"2016-04-22T14:21:40Z","git_url":"git://github.com/getlantern/lantern_aws.git","ssh_url":"git@github.com:getlantern/lantern_aws.git","clone_url":"https://github.com/getlantern/lantern_aws.git","svn_url":"https://github.com/getlantern/lantern_aws","homepage":"","size":9532,"stargazers_count":21,"watchers_count":21,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":29,"forks":7,"open_issues":29,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146"},"html":{"href":"https://github.com/getlantern/lantern_aws/pull/146"},"issue":{"href":"https://api.github.com/repos/getlantern/lantern_aws/issues/146"},"comments":{"href":"https://api.github.com/repos/getlantern/lantern_aws/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/getlantern/lantern_aws/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getlantern/lantern_aws/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/getlantern/lantern_aws/statuses/637dea96a6d507488c470069cb94dd68cf19b415"}}}}