{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/42307158","id":42307158,"diff_hunk":"@@ -0,0 +1,48 @@\n+package kafka.admin\n+\n+import javax.security.auth.login.LoginException\n+import joptsimple.OptionParser\n+import org.I0Itec.zkclient.ZkClient\n+import kafka.utils.{ToolsUtils, Logging, ZKGroupTopicDirs, ZkUtils, CommandLineUtils}\n+import org.apache.kafka.common.security.JaasUtils\n+\n+object ZkSecurityMigrator extends Logging {\n+\n+  def main(args: Array[String]) {\n+    val parser = new OptionParser()\n+\n+    val jaasFileOpt = parser.accepts(\"jaas.file\", \"JAAS Config file.\").\n+      withRequiredArg().ofType(classOf[String])\n+    val zkUrlOpt = parser.accepts(\"connect\", \"Sets the ZooKeeper connect string (ensemble). This parameter \" +\n+                                  \"takes a comma-separated list of host:port pairs.\").\n+      withRequiredArg().defaultsTo(\"localhost:2181\").ofType(classOf[String])\n+    val zkSessionTimeoutOpt = parser.accepts(\"session.timeout\", \"Sets the ZooKeeper session timeout.\").\n+      withRequiredArg().defaultsTo(\"30000\").ofType(classOf[Integer])\n+    val zkConnectionTimeoutOpt = parser.accepts(\"connection.timeout\", \"Sets the ZooKeeper connection timeout.\").\n+      withRequiredArg().defaultsTo(\"30000\").ofType(classOf[Integer])\n+    val helpOpt = parser.accepts(\"help\", \"Print usage information.\")\n+\n+    val options = parser.parse(args : _*)\n+    if(options.has(helpOpt))\n+      CommandLineUtils.printUsageAndDie(parser, \"ZooKeeper Migration Tool Help\")\n+\n+    if(!options.has(jaasFileOpt) ||\n+      !JaasUtils.isSecure(System.getProperty(options.valueOf(jaasFileOpt)))) {\n+      error(\"No JAAS configuration file has been found. Please make sure that \"","path":"core/src/main/scala/kafka/admin/ZkSecurityMigrator.scala","position":31,"original_position":31,"commit_id":"943f30d428b2c6ddb1c731c91ae4e8b2e6b177c7","original_commit_id":"943f30d428b2c6ddb1c731c91ae4e8b2e6b177c7","user":{"login":"fpj","id":572920,"avatar_url":"https://avatars.githubusercontent.com/u/572920?v=3","gravatar_id":"","url":"https://api.github.com/users/fpj","html_url":"https://github.com/fpj","followers_url":"https://api.github.com/users/fpj/followers","following_url":"https://api.github.com/users/fpj/following{/other_user}","gists_url":"https://api.github.com/users/fpj/gists{/gist_id}","starred_url":"https://api.github.com/users/fpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpj/subscriptions","organizations_url":"https://api.github.com/users/fpj/orgs","repos_url":"https://api.github.com/users/fpj/repos","events_url":"https://api.github.com/users/fpj/events{/privacy}","received_events_url":"https://api.github.com/users/fpj/received_events","type":"User","site_admin":false},"body":"> || should be && since we only need one of the options\r\n\r\nIf we have the file and `isSecur`e returns false, then we end up proceeding, which is incorrect. We want it to fail if the file option isn't present and if the file option is present but `isSecure` evaluates to false (config is broken, for example). In fact, I changed the name of that predicate, it should be `isZkSecurityEnabled`.\r\n\r\n> Actually, it seems that we will always need the jass file from system property since zookeeper client requires that?\r\n\r\nYes, we're setting the system property a bit further down in the code (line 55 in my current copy).","created_at":"2015-10-17T08:13:25Z","updated_at":"2015-10-17T08:13:25Z","html_url":"https://github.com/apache/kafka/pull/313#discussion_r42307158","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/313","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/42307158"},"html":{"href":"https://github.com/apache/kafka/pull/313#discussion_r42307158"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/313"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/313","id":47760187,"html_url":"https://github.com/apache/kafka/pull/313","diff_url":"https://github.com/apache/kafka/pull/313.diff","patch_url":"https://github.com/apache/kafka/pull/313.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/313","number":313,"state":"open","locked":false,"title":"KAFKA-2641: Upgrade path for ZK authentication","user":{"login":"fpj","id":572920,"avatar_url":"https://avatars.githubusercontent.com/u/572920?v=3","gravatar_id":"","url":"https://api.github.com/users/fpj","html_url":"https://github.com/fpj","followers_url":"https://api.github.com/users/fpj/followers","following_url":"https://api.github.com/users/fpj/following{/other_user}","gists_url":"https://api.github.com/users/fpj/gists{/gist_id}","starred_url":"https://api.github.com/users/fpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpj/subscriptions","organizations_url":"https://api.github.com/users/fpj/orgs","repos_url":"https://api.github.com/users/fpj/repos","events_url":"https://api.github.com/users/fpj/events{/privacy}","received_events_url":"https://api.github.com/users/fpj/received_events","type":"User","site_admin":false},"body":"This pull request adds a configuration parameter and a migration tool. It is also based on pull request #303, which should go in first.","created_at":"2015-10-15T09:01:07Z","updated_at":"2015-10-17T08:13:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d99cfb5545c9bfc8043c10f04b4d19a475ca7a3b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/313/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/313/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/313/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/943f30d428b2c6ddb1c731c91ae4e8b2e6b177c7","head":{"label":"fpj:KAFKA-2641","ref":"KAFKA-2641","sha":"943f30d428b2c6ddb1c731c91ae4e8b2e6b177c7","user":{"login":"fpj","id":572920,"avatar_url":"https://avatars.githubusercontent.com/u/572920?v=3","gravatar_id":"","url":"https://api.github.com/users/fpj","html_url":"https://github.com/fpj","followers_url":"https://api.github.com/users/fpj/followers","following_url":"https://api.github.com/users/fpj/following{/other_user}","gists_url":"https://api.github.com/users/fpj/gists{/gist_id}","starred_url":"https://api.github.com/users/fpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpj/subscriptions","organizations_url":"https://api.github.com/users/fpj/orgs","repos_url":"https://api.github.com/users/fpj/repos","events_url":"https://api.github.com/users/fpj/events{/privacy}","received_events_url":"https://api.github.com/users/fpj/received_events","type":"User","site_admin":false},"repo":{"id":39900213,"name":"kafka","full_name":"fpj/kafka","owner":{"login":"fpj","id":572920,"avatar_url":"https://avatars.githubusercontent.com/u/572920?v=3","gravatar_id":"","url":"https://api.github.com/users/fpj","html_url":"https://github.com/fpj","followers_url":"https://api.github.com/users/fpj/followers","following_url":"https://api.github.com/users/fpj/following{/other_user}","gists_url":"https://api.github.com/users/fpj/gists{/gist_id}","starred_url":"https://api.github.com/users/fpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpj/subscriptions","organizations_url":"https://api.github.com/users/fpj/orgs","repos_url":"https://api.github.com/users/fpj/repos","events_url":"https://api.github.com/users/fpj/events{/privacy}","received_events_url":"https://api.github.com/users/fpj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fpj/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/fpj/kafka","forks_url":"https://api.github.com/repos/fpj/kafka/forks","keys_url":"https://api.github.com/repos/fpj/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fpj/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fpj/kafka/teams","hooks_url":"https://api.github.com/repos/fpj/kafka/hooks","issue_events_url":"https://api.github.com/repos/fpj/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/fpj/kafka/events","assignees_url":"https://api.github.com/repos/fpj/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/fpj/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/fpj/kafka/tags","blobs_url":"https://api.github.com/repos/fpj/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fpj/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fpj/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/fpj/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fpj/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/fpj/kafka/languages","stargazers_url":"https://api.github.com/repos/fpj/kafka/stargazers","contributors_url":"https://api.github.com/repos/fpj/kafka/contributors","subscribers_url":"https://api.github.com/repos/fpj/kafka/subscribers","subscription_url":"https://api.github.com/repos/fpj/kafka/subscription","commits_url":"https://api.github.com/repos/fpj/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/fpj/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/fpj/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/fpj/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/fpj/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/fpj/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fpj/kafka/merges","archive_url":"https://api.github.com/repos/fpj/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fpj/kafka/downloads","issues_url":"https://api.github.com/repos/fpj/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/fpj/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/fpj/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/fpj/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fpj/kafka/labels{/name}","releases_url":"https://api.github.com/repos/fpj/kafka/releases{/id}","created_at":"2015-07-29T15:11:21Z","updated_at":"2015-07-29T15:11:24Z","pushed_at":"2015-10-16T22:14:47Z","git_url":"git://github.com/fpj/kafka.git","ssh_url":"git@github.com:fpj/kafka.git","clone_url":"https://github.com/fpj/kafka.git","svn_url":"https://github.com/fpj/kafka","homepage":null,"size":23036,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"28e59a1df7da9bbfc133180ee332a68e4540ee3e","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","created_at":"2011-08-15T18:06:16Z","updated_at":"2015-10-17T06:09:38Z","pushed_at":"2015-10-17T06:46:22Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":34819,"stargazers_count":2061,"watchers_count":2061,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1226,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":95,"forks":1226,"open_issues":95,"watchers":2061,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/313"},"html":{"href":"https://github.com/apache/kafka/pull/313"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/313"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/313/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/313/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/313/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/943f30d428b2c6ddb1c731c91ae4e8b2e6b177c7"}}}}