how to use portalpy with win-authenticated SSL

4925
2
Jump to solution
03-30-2015 09:49 AM
SteveStearns
New Contributor II

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?

0 Kudos
1 Solution

Accepted Solutions
JulieBrown
New Contributor III
2 Replies
VikramS
Occasional Contributor

Did you get this working ? I am also facing the same issue

0 Kudos
JulieBrown
New Contributor III

We used the information in this article and go it working:

http://support.esri.com/en/downloads/patches-servicepacks/view/productid/207/metaid/2177