Casper-API-Tools icon indicating copy to clipboard operation
Casper-API-Tools copied to clipboard

CasperAPI.py is not working

Open hpanwar2 opened this issue 6 years ago • 4 comments

Hi I am trying to run CasperAPI.py to unmanage macs and perform other tasks. However when i run this i get below error message I am running this as admin, i have also remove and re-setup this on my Mac however stil giving me issues.

LAxxxxxxxxx:CasperAPI username$ python CasperAPI_CLI.py unmanagecomputer xxxx Unmanaging computer xxxx... Traceback (most recent call last): File "CasperAPI_CLI.py", line 2006, in main() File "CasperAPI_CLI.py", line 1939, in main unmanageComputer(computerID, user, password) File "CasperAPI_CLI.py", line 1335, in unmanageComputer response = sendAPIRequest(putStr, username, password, 'PUT', putXML) File "CasperAPI_CLI.py", line 121, in sendAPIRequest response = urllib2.urlopen(request, XML) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open context=self._context) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open raise URLError(err) urllib2.URLError: <urlopen error [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)>

hpanwar2 avatar Mar 11 '19 14:03 hpanwar2

Hi @hpanwar2 - what version of macOS are you using? That could be an error related to an old TLS version on your version of macOS.

You'll probably need TLS version 1.2 to be able to connect to your JSS.

jkuo-eb avatar Mar 11 '19 17:03 jkuo-eb

Thanks for your quick reply. I am running Mac OS High Sierra 10.13.6 Regarding the TLS version i believe its TLS V1.2 as when i run "curl https://google.com/ --tlsv1.2 --verbose" command in terminal i get below result.

curl https://google.com/ --tlsv1.2 --verbose

  • Trying 216.58.210.46...
  • TCP_NODELAY set
  • Connected to google.com (216.58.210.46) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/cert.pem CApath: none
  • TLSv1.2 (OUT), TLS handshake, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS change cipher, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / AES256-GCM-SHA384
  • ALPN, server did not agree to a protocol
  • Server certificate:
  • subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=*.google.com
  • start date: Mar 1 09:43:57 2019 GMT
  • expire date: May 24 09:25:00 2019 GMT
  • subjectAltName: host "google.com" matched cert's "google.com"
  • issuer: C=US; ST=MN; L=Plymouth; O=OptumIT Web Proxy HTTPS Proxy; CN=UHGIntwebproxy2018.uhc.com; [email protected]
  • SSL certificate verify ok.

GET / HTTP/1.1 Host: google.com User-Agent: curl/7.54.0 Accept: /

< HTTP/1.1 301 Moved Permanently < Location: https://www.google.com/ < Date: Mon, 11 Mar 2019 17:28:47 GMT < Expires: Wed, 10 Apr 2019 17:28:47 GMT < Cache-Control: public, max-age=2592000 < Server: gws < X-XSS-Protection: 1; mode=block < X-Frame-Options: SAMEORIGIN < Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39" < Content-Length: 220 < Content-Type: text/html; charset=UTF-8 < Via: 1.1 proxy-ii500-ip2.uhc.com:80 (Cisco-WSA/9.0.1-162) < Connection: keep-alive <

301 Moved

301 Moved

The document has moved here. * Connection #0 to host google.com left intact

hpanwar2 avatar Mar 11 '19 17:03 hpanwar2

It looks like Ben had a similar issue, and had to explicitly enter the port number in the url during the setup for this to work. (I have it working on Jamf Cloud).

https://github.com/eventbrite/Casper-API-Tools/issues/1

Maybe try that?

Thanks.

jkuo-eb avatar Mar 11 '19 22:03 jkuo-eb

Thanks for the update, i did follow the steps suggested to ben, nothing really work i can run python CasperAPI_CLI.py -h however nothing apart from this. i have reset up the whole process and used :8443 after the JSS url also put sudo in bash_profile. I am getting the same error

hpanwar2 avatar Mar 13 '19 15:03 hpanwar2