Changeset 272 for etherws/trunk
- Timestamp:
- 12/29/14 16:35:37 (10 years ago)
- Location:
- etherws/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
etherws/trunk/README.rst
r260 r272 162 162 163 163 Password can be input from stdin as well as WebSocket tunnel creation. 164 165 Note: *etherws ctl* currently cannot verify SSL certificate on controller.166 164 167 165 Virtual Machines Connection -
etherws/trunk/etherws.py
r267 r272 944 944 return setattr(ns, htpasswd, Htpasswd(val)) 945 945 946 # if args.debug:947 # websocket.enableTrace(True)946 # if args.debug: 947 # websocket.enableTrace(True) 948 948 949 949 if args.ageout <= 0: … … 1018 1018 1019 1019 def _start_ctl(args): 1020 def have_ssl_cert_verification(): 1021 return 'context' in urllib2.urlopen.__code__.co_varnames 1022 1020 1023 def request(args, method, params=None, id_=0): 1021 1024 req = urllib2.Request(args.ctlurl) … … 1030 1033 if params is not None: 1031 1034 data['params'] = params 1032 return json.loads(urllib2.urlopen(req, json.dumps(data)).read()) 1035 if have_ssl_cert_verification(): 1036 ctx = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, 1037 cafile=args.ctlsslcert) 1038 if args.ctlinsecure: 1039 ctx.check_hostname = False 1040 ctx.verify_mode = ssl.CERT_NONE 1041 fp = urllib2.urlopen(req, json.dumps(data), context=ctx) 1042 elif args.ctlsslcert: 1043 raise EnvironmentError('do not support certificate verification') 1044 else: 1045 fp = urllib2.urlopen(req, json.dumps(data)) 1046 return json.loads(fp.read()) 1033 1047 1034 1048 def print_table(rows): … … 1204 1218 parser_ctl.add_argument('--ctlpasswd', 1205 1219 help='password to auth control API') 1220 parser_ctl.add_argument('--ctlsslcert', 1221 help='path to SSL certificate for control API') 1222 parser_ctl.add_argument( 1223 '--ctlinsecure', action='store_true', default=False, 1224 help='do not verify control API certificate') 1206 1225 1207 1226 control_method = parser_ctl.add_subparsers(dest='control_method')
Note: See TracChangeset
for help on using the changeset viewer.