AnsweredAssumed Answered

Get SSL details thorugh portalpy

Question asked by Adityakumar529 on Dec 14, 2016
Latest reply on Dec 29, 2016 by rastrauch

Hi team,

  I am working on portal.py. I am trying to get the details of SSL certficates which the portal is using. 

 I have tried with some code but nothing is working. Any suggestion on this will be helpful.

 

import sys
sys.path.append('..')  
import portalpy    
import csv  
import ssl, socket 
portalUrl           = "https://xxx-xxx.xx.xx.com:7443/arcgis"
portalAdminUser     = "xxxx"
portalAdminPassword = "xxxx"       
portal = portalpy.Portal(portalUrl, portalAdminUser,portalAdminPassword)    
users = portal.search_users('(role:account_admin OR role:account_publisher  OR role:account_user)')  
activeUser = portal.logged_in_user()     
print activeUser['email']    
ctx = ssl.create_default_context()     
s = ctx.wrap_socket(socket.socket(),server_hostname='http://xxx-xxx.xxxx.com/arcgis/home/')    
s.connect((portal, 443))    
cert = s.getpeercert()     
print cert

 


Thanks

Aditya Kumar

Outcomes