{"action":"created","issue":{"url":"https://api.github.com/repos/apache/ambari/issues/765","repository_url":"https://api.github.com/repos/apache/ambari","labels_url":"https://api.github.com/repos/apache/ambari/issues/765/labels{/name}","comments_url":"https://api.github.com/repos/apache/ambari/issues/765/comments","events_url":"https://api.github.com/repos/apache/ambari/issues/765/events","html_url":"https://github.com/apache/ambari/pull/765","id":308007768,"number":765,"title":"[AMBARI-23311] Use Ambari CLI to specify which services should be setup for SSO integration","user":{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-23T12:16:22Z","updated_at":"2018-03-25T23:36:52Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/ambari/pulls/765","html_url":"https://github.com/apache/ambari/pull/765","diff_url":"https://github.com/apache/ambari/pull/765.diff","patch_url":"https://github.com/apache/ambari/pull/765.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nGive the option to the end users to indicate which services they want to enable SSO for. To allow this the end users have two options:\r\n\r\n- either providing this information as a command-line option with`--sso-enabled-services` (for instance: `--sso-enabled-services=*`\r\n- or we ask them the appropriate questions when running the `setup-sso` tool\r\n\r\nAn additional check must be added too: since the tool now uses the REST API to save/fetch data we need `ambari-server` to be up&running; so that the tool will check this as one of the first steps and fail if this was not the case.\r\n\r\n## How was this patch tested?\r\n\r\nUnit tests were extended to cover the new functionality; latest Python test results in `ambari-server`:\r\n```\r\n----------------------------------------------------------------------\r\nTotal run:1184\r\nTotal errors:0\r\nTotal failures:0\r\nOK\r\n[INFO] \r\n[INFO] --- maven-checkstyle-plugin:2.17:check (checkstyle) @ ambari-server ---\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] BUILD SUCCESS\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Total time: 01:37 min\r\n[INFO] Finished at: 2018-03-23T13:09:37+01:00\r\n[INFO] Final Memory: 125M/1618M\r\n[INFO] ------------------------------------------------------------------------\r\n```\r\n\r\nManual E2E tests were running in my local test environment:\r\n```\r\n\r\n[root@c7401 ~]# ambari-server setup-sso --sso-enabled=true --sso-provider-url=https://knox.ambari.apache.org:8443 --sso-public-cert-file=/tmp/sso.pem --sso-jwt-cookie-name=ambari-jtw --sso-jwt-audience-list=ambari\r\nUsing python  /usr/bin/python\r\nSetting up SSO authentication properties...\r\nEnter Ambari Admin login: admin\r\nEnter Ambari Admin password: \r\nUse SSO for all services [y/n] (n): \r\n\r\nFetching cluster name.\r\nFound cluster name: cluster1\r\nFetching SSO enabled services.\r\nFound SSO enabled services: HDFS, ZOOKEEPER\r\nUse SSO for HDFS [y/n] (y): \r\nUse SSO for ZOOKEEPER [y/n] (y): \r\nAmbari Server 'setup-sso' completed successfully.\r\n\r\n[root@c7401 ~]# PGPASSWORD=bigdata psql -U ambari\r\npsql (9.2.23)\r\nType \"help\" for help.\r\n\r\nambari=> select * from ambari_configuration where category_name = 'sso-configuration';\r\n   category_name   |        property_name        | property_value  \r\n-------------------+-----------------------------+-----------------\r\n sso-configuration | ambari.sso.enabled_services | HDFS, ZOOKEEPER\r\n(1 row)\r\n\r\n[root@c7401 ~]# ambari-server setup-sso --sso-enabled=true --sso-provider-url=https://knox.ambari.apache.org:8443 --sso-public-cert-file=/tmp/sso.pem --sso-jwt-cookie-name=ambari-jtw --sso-jwt-audience-list=ambari --sso-enabled-services=SERVICE1\r\nUsing python  /usr/bin/python\r\nSetting up SSO authentication properties...\r\nEnter Ambari Admin login: admin\r\nEnter Ambari Admin password: \r\nAmbari Server 'setup-sso' completed successfully.\r\n\r\n[root@c7401 ~]# PGPASSWORD=bigdata psql -U ambari\r\npsql (9.2.23)\r\nType \"help\" for help.\r\n\r\nambari=> select * from ambari_configuration where category_name = 'sso-configuration';\r\n   category_name   |        property_name        | property_value \r\n-------------------+-----------------------------+----------------\r\n sso-configuration | ambari.sso.enabled_services | SERVICE1\r\n(1 row)\r\n\r\n[root@c7401 ~]# ambari-server setup-sso --sso-enabled=true --sso-provider-url=https://knox.ambari.apache.org:8443 --sso-public-cert-file=/tmp/sso.pem --sso-jwt-cookie-name=ambari-jtw --sso-jwt-audience-list=ambari\r\nUsing python  /usr/bin/python\r\nSetting up SSO authentication properties...\r\nEnter Ambari Admin login: admin\r\nEnter Ambari Admin password: \r\nUse SSO for all services [y/n] (n): y\r\nAmbari Server 'setup-sso' completed successfully.\r\n\r\n[root@c7401 ~]# PGPASSWORD=bigdata psql -U ambari\r\npsql (9.2.23)\r\nType \"help\" for help.\r\n\r\nambari=> select * from ambari_configuration where category_name = 'sso-configuration';\r\n   category_name   |        property_name        | property_value \r\n-------------------+-----------------------------+----------------\r\n sso-configuration | ambari.sso.enabled_services | *\r\n(1 row)\r\n\r\n[root@c7401 ~]# ambari-server setup-sso --sso-enabled=true --sso-provider-url=https://knox.ambari.apache.org:8443 --sso-public-cert-file=/tmp/sso.pem --sso-jwt-cookie-name=ambari-jtw --sso-jwt-audience-list=ambari --sso-enabled-services=SERVICE1,SERVICE2 --ambari-admin-username=admin --ambari-admin-password=admin\r\nUsing python  /usr/bin/python\r\nSetting up SSO authentication properties...\r\nAmbari Server 'setup-sso' completed successfully.\r\n\r\n[root@c7401 ~]# PGPASSWORD=bigdata psql -U ambari\r\npsql (9.2.23)\r\nType \"help\" for help.\r\n\r\nambari=> select * from ambari_configuration where category_name = 'sso-configuration';\r\n   category_name   |        property_name        |  property_value   \r\n-------------------+-----------------------------+-------------------\r\n sso-configuration | ambari.sso.enabled_services | SERVICE1,SERVICE2\r\n```"},"comment":{"url":"https://api.github.com/repos/apache/ambari/issues/comments/376013003","html_url":"https://github.com/apache/ambari/pull/765#issuecomment-376013003","issue_url":"https://api.github.com/repos/apache/ambari/issues/765","id":376013003,"user":{"login":"rlevas","id":7302947,"avatar_url":"https://avatars3.githubusercontent.com/u/7302947?v=4","gravatar_id":"","url":"https://api.github.com/users/rlevas","html_url":"https://github.com/rlevas","followers_url":"https://api.github.com/users/rlevas/followers","following_url":"https://api.github.com/users/rlevas/following{/other_user}","gists_url":"https://api.github.com/users/rlevas/gists{/gist_id}","starred_url":"https://api.github.com/users/rlevas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlevas/subscriptions","organizations_url":"https://api.github.com/users/rlevas/orgs","repos_url":"https://api.github.com/users/rlevas/repos","events_url":"https://api.github.com/users/rlevas/events{/privacy}","received_events_url":"https://api.github.com/users/rlevas/received_events","type":"User","site_admin":false},"created_at":"2018-03-25T23:36:52Z","updated_at":"2018-03-25T23:36:52Z","author_association":"CONTRIBUTOR","body":"As of [AMBARI-23354](https://issues.apache.org/jira/browse/AMBARI-23354), you will need to set `sso-configuration/ambari.sso.manage_services` to true to enable the feature. So the CLI shoudl ask the user if they want to allow Ambari to manage SSO configurations for installed services. If yes, then the user should be presented with the services to enabled this for. \r\n\r\nFor example\r\n```\r\nAAAAB3NzaC1yc2EAAAADAQABAAABAQD....\r\n\r\nManage SSO for installed services [y/n] (n)? y\r\nUse SSO for all services [y/n] (y)? n\r\nUse SSO for Ambari [y/n] (y)? y\r\nUse SSO for HDFS [y/n] (y)? y\r\nUse SSO for YARN [y/n] (y)? y\r\n...\r\nUse SSO for ZOOKEEPER [y/n] (y)? n\r\nDo you want to configure advanced properties [y/n] (n) ?\r\n```\r\n```\r\nAAAAB3NzaC1yc2EAAAADAQABAAABAQD....\r\n\r\nManage SSO for installed services [y/n] (n)? n\r\nDo you want to configure advanced properties [y/n] (n) ?\r\n```\r\n"}}
{"actor":{"display_login":"rlevas"}}