Unable to access Portal for ArcGIS to execute portalScan.py

1234
6
07-17-2018 02:29 PM
PawelGanczarski
New Contributor III

Hello everyone,

I have successfully ran a security scan on ArcGIS Server and wanted to do the same on the Portal for ArcGIS, however 

when attempting to execute the portalScan.py tool I'm presented with a line in PowerShell saying it is unable to access Portal for ArcGIS on localhost ( I tried the FQDN, IP address and other variations withou any luck).

Server is federated with Portal (version 10.6)

I will appreciate any insight on this.

Attaching a screenshot of the message.

Kind regards, 

Pawel

6 Replies
JonathanQuinn
Esri Notable Contributor

In the portalScan.py script, update the generateToken function to print the exception information:

def generateToken(username,password,portalHost,portalUrl):
    params = {'username':username,
              'password':password,
              'referer':portalUrl,
              'f':'json'}
    try:
        request = urllib2.Request(portalUrl + '/sharing/rest/generateToken', urllib.urlencode(params))
        response = urllib2.urlopen(request)
        genToken = json.loads(response.read())
        if 'token' in genToken.keys():
            return genToken.get('token')
        else:
            print('\nInvalid administrator username or password')
            sys.exit(1)
    except Exception as e:
        print('Unable to access Portal for ArcGIS on {} - {}'.format(portalHost,e))
        sys.exit(1)

It will print the Python exception information which can help troubleshoot. Save the .py file as a new script if you want to preserve the original.

PawelGanczarski
New Contributor III

Hi Jonathan,

Thanks for the prompt reply. I've edited the script and can see the error description now (screenshot below) 

However, searching for further clues didn't provide me with clear answers (I'm not proficient in python).

Can you shed some more light on the possible cause of this error ?

Kind regards,

Pawel

PawelGanczarski
New Contributor III

Hi Jonathan,

Can you point me toward possible solution to the above screen grab ?

Best regards, 

pawel

0 Kudos
JonathanQuinn
Esri Notable Contributor

Is the error message exactly the same, (ex. <urlopen error [Errno 8] _ssl.c:504: EOF occurred in violation of protocol>), regardless of what hostname you enter?

0 Kudos
PawelGanczarski
New Contributor III

I replaced the localhost with the FQDN which produced same error message. Then I tried the FQDN that is public and goes via reverse proxy. This time the error message is as follows:

Thanks,

Pawel 

0 Kudos
JonathanQuinn
Esri Notable Contributor

According to Stackoverflow, it may be because SSLv2 is disabled on the web server, among other reasons:

openssl - Python Requests requests.exceptions.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violat...