<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Ambari LDAP sync-ldap issue with proxy getting 502 Bad Gateway in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-LDAP-sync-ldap-issue-with-proxy-getting-502-Bad/m-p/211247#M66018</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/17944/nshelke.html" nodeid="17944"&gt;@nshelke&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When we perform "ambari-server sync-ldap" then ambari actually invokes the following ambari API on "127.0.0.1" address (not on the ambari FQDN)&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://127.0.0.1:8080/api/v1/ldap_sync_events" target="_blank"&gt;http://127.0.0.1:8080/api/v1/ldap_sync_events&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;- Python code snippet from "setupSecurity.py" that is used for ldap sync&lt;/P&gt;&lt;PRE&gt;  url = get_ambari_server_api_base(properties) + SERVER_API_LDAP_URL
  admin_auth = base64.encodestring('%s:%s' % (admin_login, admin_password)).replace('\n', '')
  request = urllib2.Request(url)
  request.add_header('Authorization', 'Basic %s' % admin_auth)
  request.add_header('X-Requested-By', 'ambari')&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Because ambari uses the following &lt;STRONG&gt;python script &lt;/STRONG&gt;(not java) to perform the following python script [1], Hence the "-Dhttp.nonProxyHosts" proxy setting will not be used here because that property is Java specific, Python modules will not respect that property.&lt;/P&gt;So you should try setting the proxy settings at the OS level inside the "~/.profile", "~/.bash_profile", ENV level. Like:&lt;BR /&gt;&lt;PRE&gt;http_proxy="http://proxy.com:8080"
no_proxy="127.0.0.1, localhost"&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;[1] &lt;A href="https://github.com/apache/ambari/blob/release-2.5.1/ambari-server/src/main/python/ambari_server/setupSecurity.py#L315-L319" target="_blank"&gt;https://github.com/apache/ambari/blob/release-2.5.1/ambari-server/src/main/python/ambari_server/setupSecurity.py#L315-L319&lt;/A&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Aug 2017 13:03:07 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2017-08-04T13:03:07Z</dc:date>
    <item>
      <title>Ambari LDAP sync-ldap issue with proxy getting 502 Bad Gateway</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-LDAP-sync-ldap-issue-with-proxy-getting-502-Bad/m-p/211246#M66017</link>
      <description>&lt;P&gt;I am getting below error while doing the initial sync for ambari LDAP&lt;/P&gt;&lt;PRE&gt;ambari-server sync-ldap --users /home/centos/users.txt
Using python /usr/bin/python Syncing with LDAP...
Enter Ambari Admin login: admin
Enter Ambari Admin password:
Syncing specified users and groups.ERROR:
Exiting with exit code 1.
REASON: Sync event creation failed.
Error details: HTTP Error 502: Bad Gateway &lt;/PRE&gt;&lt;P&gt;I am using internal proxy server, So I setup some configuration in ambari-env.sh for this,&lt;/P&gt;&lt;PRE&gt;export AMBARI_JVM_ARGS=$AMBARI_JVM_ARGS' -Xms512m -Xmx2048m -XX:MaxPermSize=128m -Djava.security.auth.login.config=$ROOT/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -Dhttp.proxyHost=FQDN -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts="FQDN|localhost|127.0.0.1"'&lt;/PRE&gt;&lt;P&gt;LDAPsearch command works fine. Same configs I have added it in ambari.properties.&lt;/P&gt;&lt;P&gt;After setting this, still getting 502: Bad Gateway error&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 06:35:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-LDAP-sync-ldap-issue-with-proxy-getting-502-Bad/m-p/211246#M66017</guid>
      <dc:creator>nshelke</dc:creator>
      <dc:date>2017-08-04T06:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari LDAP sync-ldap issue with proxy getting 502 Bad Gateway</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-LDAP-sync-ldap-issue-with-proxy-getting-502-Bad/m-p/211247#M66018</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/17944/nshelke.html" nodeid="17944"&gt;@nshelke&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When we perform "ambari-server sync-ldap" then ambari actually invokes the following ambari API on "127.0.0.1" address (not on the ambari FQDN)&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://127.0.0.1:8080/api/v1/ldap_sync_events" target="_blank"&gt;http://127.0.0.1:8080/api/v1/ldap_sync_events&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;- Python code snippet from "setupSecurity.py" that is used for ldap sync&lt;/P&gt;&lt;PRE&gt;  url = get_ambari_server_api_base(properties) + SERVER_API_LDAP_URL
  admin_auth = base64.encodestring('%s:%s' % (admin_login, admin_password)).replace('\n', '')
  request = urllib2.Request(url)
  request.add_header('Authorization', 'Basic %s' % admin_auth)
  request.add_header('X-Requested-By', 'ambari')&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Because ambari uses the following &lt;STRONG&gt;python script &lt;/STRONG&gt;(not java) to perform the following python script [1], Hence the "-Dhttp.nonProxyHosts" proxy setting will not be used here because that property is Java specific, Python modules will not respect that property.&lt;/P&gt;So you should try setting the proxy settings at the OS level inside the "~/.profile", "~/.bash_profile", ENV level. Like:&lt;BR /&gt;&lt;PRE&gt;http_proxy="http://proxy.com:8080"
no_proxy="127.0.0.1, localhost"&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;[1] &lt;A href="https://github.com/apache/ambari/blob/release-2.5.1/ambari-server/src/main/python/ambari_server/setupSecurity.py#L315-L319" target="_blank"&gt;https://github.com/apache/ambari/blob/release-2.5.1/ambari-server/src/main/python/ambari_server/setupSecurity.py#L315-L319&lt;/A&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 13:03:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-LDAP-sync-ldap-issue-with-proxy-getting-502-Bad/m-p/211247#M66018</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-08-04T13:03:07Z</dc:date>
    </item>
  </channel>
</rss>

