{"action":"created","comment":{"url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/comments/35350408","id":35350408,"diff_hunk":"@@ -0,0 +1,93 @@\n+--[[\n+Copyright 2015 Rackspace\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS-IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+--]]\n+local HostInfo = require('./base').HostInfo\n+\n+local table = require('table')\n+local los = require('los')\n+local readCast = require('./misc').readCast\n+local async = require('async')\n+local fs = require('fs')\n+\n+--[[ Pluggable auth modules ]]--\n+local Info = HostInfo:extend()\n+function Info:initialize()\n+  HostInfo.initialize(self)\n+end\n+\n+function Info:run(callback)\n+\n+  if los.type() ~= 'linux' then\n+    self._error = 'Unsupported OS for pluggable auth module definitions'\n+    return callback()\n+  end\n+\n+  local function casterFunc(iter, obj, line)\n+    local keywords = {\n+      password = true,\n+      auth = true,\n+      account = true,\n+      session = true\n+    }\n+    local module_interface, control_flags, module_name, module_arguments, soStart, soEnd\n+    if line:find('%\\t') then\n+      iter = line:gmatch('%\\t')\n+    end\n+\n+    module_interface = iter()\n+    if keywords[module_interface] then\n+      soStart, soEnd = line:find('%.so')\n+      -- sometimes the pam files have many control flags\n+      if (line:find('%]')) then\n+        control_flags = line:sub(line:find('%[')+1, line:find('%]')-1)\n+        module_name = line:sub(line:find('%]')+2, soEnd)\n+      else\n+        control_flags = iter()\n+        module_name = iter()\n+      end\n+      -- They also like to have variable numbers of module args\n+      if (line:len() ~= soEnd and soEnd ~= nil) then\n+        module_arguments = line:sub(soEnd+2, line:len())\n+      else\n+        module_arguments = ''\n+      end\n+      table.insert(obj, {\n+        module_interface = module_interface,\n+        control_flags = control_flags,\n+        module_name = module_name,\n+        module_arguments = module_arguments\n+      })\n+    end\n+  end\n+\n+  local pamPath = '/etc/pam.d/'\n+  local filesList = fs.readdirSync(pamPath)\n+  local outTable = {}\n+  local errTable = {}\n+\n+  async.forEachLimit(filesList, 5, function(file, cb)\n+    readCast(pamPath..file, errTable, outTable, casterFunc, cb)","path":"hostinfo/pam.lua","position":81,"original_position":81,"commit_id":"af1c4bc81832f6fc78ed3093b7d95c6d346f1feb","original_commit_id":"af1c4bc81832f6fc78ed3093b7d95c6d346f1feb","user":{"login":"rphillips","id":1963,"avatar_url":"https://avatars.githubusercontent.com/u/1963?v=3","gravatar_id":"","url":"https://api.github.com/users/rphillips","html_url":"https://github.com/rphillips","followers_url":"https://api.github.com/users/rphillips/followers","following_url":"https://api.github.com/users/rphillips/following{/other_user}","gists_url":"https://api.github.com/users/rphillips/gists{/gist_id}","starred_url":"https://api.github.com/users/rphillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rphillips/subscriptions","organizations_url":"https://api.github.com/users/rphillips/orgs","repos_url":"https://api.github.com/users/rphillips/repos","events_url":"https://api.github.com/users/rphillips/events{/privacy}","received_events_url":"https://api.github.com/users/rphillips/received_events","type":"User","site_admin":false},"body":"better to tweak line 75 to be '/etc/pam.d' and use path.join(pamPath, file)","created_at":"2015-07-23T17:51:12Z","updated_at":"2015-07-23T17:51:12Z","html_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/pull/798#discussion_r35350408","pull_request_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798","_links":{"self":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/comments/35350408"},"html":{"href":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/pull/798#discussion_r35350408"},"pull_request":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798"}}},"pull_request":{"url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798","id":40698772,"html_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/pull/798","diff_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/pull/798.diff","patch_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/pull/798.patch","issue_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues/798","number":798,"state":"open","locked":false,"title":"feat(hostinfo/pam)","user":{"login":"kaustavha","id":3248143,"avatar_url":"https://avatars.githubusercontent.com/u/3248143?v=3","gravatar_id":"","url":"https://api.github.com/users/kaustavha","html_url":"https://github.com/kaustavha","followers_url":"https://api.github.com/users/kaustavha/followers","following_url":"https://api.github.com/users/kaustavha/following{/other_user}","gists_url":"https://api.github.com/users/kaustavha/gists{/gist_id}","starred_url":"https://api.github.com/users/kaustavha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaustavha/subscriptions","organizations_url":"https://api.github.com/users/kaustavha/orgs","repos_url":"https://api.github.com/users/kaustavha/repos","events_url":"https://api.github.com/users/kaustavha/events{/privacy}","received_events_url":"https://api.github.com/users/kaustavha/received_events","type":"User","site_admin":false},"body":"Hostinfo plugin to retrieve data from pluggable auth module definitions, slightly more reliable than the ohai variant\r\n","created_at":"2015-07-23T17:49:48Z","updated_at":"2015-07-23T17:51:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f97ec0e69cb485509d239de163bd41ce589315a2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798/commits","review_comments_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798/comments","review_comment_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues/798/comments","statuses_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/statuses/af1c4bc81832f6fc78ed3093b7d95c6d346f1feb","head":{"label":"kaustavha:kaustavha/feat/pam","ref":"kaustavha/feat/pam","sha":"af1c4bc81832f6fc78ed3093b7d95c6d346f1feb","user":{"login":"kaustavha","id":3248143,"avatar_url":"https://avatars.githubusercontent.com/u/3248143?v=3","gravatar_id":"","url":"https://api.github.com/users/kaustavha","html_url":"https://github.com/kaustavha","followers_url":"https://api.github.com/users/kaustavha/followers","following_url":"https://api.github.com/users/kaustavha/following{/other_user}","gists_url":"https://api.github.com/users/kaustavha/gists{/gist_id}","starred_url":"https://api.github.com/users/kaustavha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaustavha/subscriptions","organizations_url":"https://api.github.com/users/kaustavha/orgs","repos_url":"https://api.github.com/users/kaustavha/repos","events_url":"https://api.github.com/users/kaustavha/events{/privacy}","received_events_url":"https://api.github.com/users/kaustavha/received_events","type":"User","site_admin":false},"repo":{"id":39226093,"name":"rackspace-monitoring-agent","full_name":"kaustavha/rackspace-monitoring-agent","owner":{"login":"kaustavha","id":3248143,"avatar_url":"https://avatars.githubusercontent.com/u/3248143?v=3","gravatar_id":"","url":"https://api.github.com/users/kaustavha","html_url":"https://github.com/kaustavha","followers_url":"https://api.github.com/users/kaustavha/followers","following_url":"https://api.github.com/users/kaustavha/following{/other_user}","gists_url":"https://api.github.com/users/kaustavha/gists{/gist_id}","starred_url":"https://api.github.com/users/kaustavha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaustavha/subscriptions","organizations_url":"https://api.github.com/users/kaustavha/orgs","repos_url":"https://api.github.com/users/kaustavha/repos","events_url":"https://api.github.com/users/kaustavha/events{/privacy}","received_events_url":"https://api.github.com/users/kaustavha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaustavha/rackspace-monitoring-agent","description":"Rackspace Cloud Monitoring Agent","fork":true,"url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent","forks_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/forks","keys_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/teams","hooks_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/hooks","issue_events_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/issues/events{/number}","events_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/events","assignees_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/assignees{/user}","branches_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/branches{/branch}","tags_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/tags","blobs_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/languages","stargazers_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/stargazers","contributors_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/contributors","subscribers_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/subscribers","subscription_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/subscription","commits_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/contents/{+path}","compare_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/merges","archive_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/downloads","issues_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/issues{/number}","pulls_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/labels{/name}","releases_url":"https://api.github.com/repos/kaustavha/rackspace-monitoring-agent/releases{/id}","created_at":"2015-07-16T23:57:27Z","updated_at":"2015-07-16T23:57:28Z","pushed_at":"2015-07-23T17:47:59Z","git_url":"git://github.com/kaustavha/rackspace-monitoring-agent.git","ssh_url":"git@github.com:kaustavha/rackspace-monitoring-agent.git","clone_url":"https://github.com/kaustavha/rackspace-monitoring-agent.git","svn_url":"https://github.com/kaustavha/rackspace-monitoring-agent","homepage":"http://virgoagent.com/rackspace-monitoring-agent/","size":18708,"stargazers_count":0,"watchers_count":0,"language":"Lua","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"virgo-agent-toolkit:master","ref":"master","sha":"08a6a3eae9473d2993b63810d086a9fc16675c8b","user":{"login":"virgo-agent-toolkit","id":6343547,"avatar_url":"https://avatars.githubusercontent.com/u/6343547?v=3","gravatar_id":"","url":"https://api.github.com/users/virgo-agent-toolkit","html_url":"https://github.com/virgo-agent-toolkit","followers_url":"https://api.github.com/users/virgo-agent-toolkit/followers","following_url":"https://api.github.com/users/virgo-agent-toolkit/following{/other_user}","gists_url":"https://api.github.com/users/virgo-agent-toolkit/gists{/gist_id}","starred_url":"https://api.github.com/users/virgo-agent-toolkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virgo-agent-toolkit/subscriptions","organizations_url":"https://api.github.com/users/virgo-agent-toolkit/orgs","repos_url":"https://api.github.com/users/virgo-agent-toolkit/repos","events_url":"https://api.github.com/users/virgo-agent-toolkit/events{/privacy}","received_events_url":"https://api.github.com/users/virgo-agent-toolkit/received_events","type":"Organization","site_admin":false},"repo":{"id":2034526,"name":"rackspace-monitoring-agent","full_name":"virgo-agent-toolkit/rackspace-monitoring-agent","owner":{"login":"virgo-agent-toolkit","id":6343547,"avatar_url":"https://avatars.githubusercontent.com/u/6343547?v=3","gravatar_id":"","url":"https://api.github.com/users/virgo-agent-toolkit","html_url":"https://github.com/virgo-agent-toolkit","followers_url":"https://api.github.com/users/virgo-agent-toolkit/followers","following_url":"https://api.github.com/users/virgo-agent-toolkit/following{/other_user}","gists_url":"https://api.github.com/users/virgo-agent-toolkit/gists{/gist_id}","starred_url":"https://api.github.com/users/virgo-agent-toolkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virgo-agent-toolkit/subscriptions","organizations_url":"https://api.github.com/users/virgo-agent-toolkit/orgs","repos_url":"https://api.github.com/users/virgo-agent-toolkit/repos","events_url":"https://api.github.com/users/virgo-agent-toolkit/events{/privacy}","received_events_url":"https://api.github.com/users/virgo-agent-toolkit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent","description":"Rackspace Cloud Monitoring Agent","fork":false,"url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent","forks_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/forks","keys_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/teams","hooks_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/hooks","issue_events_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues/events{/number}","events_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/events","assignees_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/assignees{/user}","branches_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/branches{/branch}","tags_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/tags","blobs_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/languages","stargazers_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/stargazers","contributors_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/contributors","subscribers_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/subscribers","subscription_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/subscription","commits_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/contents/{+path}","compare_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/merges","archive_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/downloads","issues_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues{/number}","pulls_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/labels{/name}","releases_url":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/releases{/id}","created_at":"2011-07-12T06:25:25Z","updated_at":"2015-06-17T21:30:24Z","pushed_at":"2015-07-23T17:49:48Z","git_url":"git://github.com/virgo-agent-toolkit/rackspace-monitoring-agent.git","ssh_url":"git@github.com:virgo-agent-toolkit/rackspace-monitoring-agent.git","clone_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent.git","svn_url":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent","homepage":"http://virgoagent.com/rackspace-monitoring-agent/","size":102546,"stargazers_count":112,"watchers_count":112,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":34,"mirror_url":null,"open_issues_count":61,"forks":34,"open_issues":61,"watchers":112,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798"},"html":{"href":"https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/pull/798"},"issue":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues/798"},"comments":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/issues/798/comments"},"review_comments":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798/comments"},"review_comment":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/pulls/798/commits"},"statuses":{"href":"https://api.github.com/repos/virgo-agent-toolkit/rackspace-monitoring-agent/statuses/af1c4bc81832f6fc78ed3093b7d95c6d346f1feb"}}}}