AnsweredAssumed Answered

how to use portalpy with win-authenticated SSL

Question asked by ss9839 on Mar 30, 2015
Latest reply on Nov 20, 2015 by juliebrown

We have an enterprise Portal that uses SSL-only and does windows-authentication from your PC domain login.

I recently downloaded the 'portalpy' extension from ESRI and tried to run an example script, a simplified version shown below.

 

import sys

 

# bring in the portal python library

portalpyPath    = r'C:|Python27\portalpy-master'

sys.path.append(portalpyPath)

import portalpy

 

# Login to portal, collect all users

portalUrl           = "https://ourserver.enterprize.com:7443/arcgis/home"

portalAdminUser     = "PortalAdmin"

portalAdminPassword = "AdminMasterPW"

portal = portalpy.Portal(portalUrl, portalAdminUser, portalAdminPassword)

 

# Loop through the portal, printing stats

for user in portal.get_org_users():

    print user['username']

 

This in turn gets an SSL error shown below.

portal = portalpy.Portal(portalUrl, portalAdminUser, portalAdminPassword)

  File "c:\Python27\portalpy-master\portalpy.py", line 115, in __init__

referer, proxy_host, proxy_port)

  File "c:\Python27\portalpy-master\portalpy.py", line 1247, in __init__

self.login(username, password, expiration)

  File "c:\Python27\portalpy-master\portalpy.py", line 1262, in login

newtoken = self.generate_token(username, password, expiration)

  File "c:\Python27\portalpy-master\portalpy.py", line 1256, in generate_token

resp = self.post('generateToken', postdata, ssl=True)

  File "c:\Python27\portalpy-master\portalpy.py", line 1463, in post

resp = opener.open(url, data=encoded_postdata)

  File "C:\Python27\ArcGISx6410.2\lib\urllib2.py", line 404, in open

response = self._open(req, data)

  File "C:\Python27\ArcGISx6410.2\lib\urllib2.py", line 422, in _open

'_open', req)

  File "C:\Python27\ArcGISx6410.2\lib\urllib2.py", line 382, in _call_chain

result = func(*args)

  File "C:\Python27\ArcGISx6410.2\lib\urllib2.py", line 1222, in https_open

return self.do_open(httplib.HTTPSConnection, req)

  File "C:\Python27\ArcGISx6410.2\lib\urllib2.py", line 1184, in do_open

raise URLError(err)

URLError: <urlopen error [Errno 1] _ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

 

I've seen various posts on the net that talk about OpenSSL problems and hacks, but I'm betting somebody on this group has worked with portalpy in a secure domain before now.

 

What's the work-around here?  Do I need to import a different module and change an SSL default setting?

Outcomes