Ignore:
Timestamp:
05/19/12 03:00:33 (12 years ago)
Author:
atzm
Message:
  • server cert verification support
File:
1 edited

Legend:

Unmodified
Added
Removed
  • etherws/trunk/etherws.py

    r155 r156  
    4343import os 
    4444import sys 
     45import ssl 
    4546import base64 
    4647import hashlib 
     
    222223                        if passwd.startswith('{SHA}'): 
    223224                            users[name] = passwd[5:] 
     225            if not users: 
     226                raise RuntimeError('no valid users found') 
    224227        except TypeError: 
    225228            pass 
     
    266269    if args.debug: 
    267270        websocket.enableTrace(True) 
     271 
     272    if not args.insecure: 
     273        websocket._SSLSocketWrapper = \ 
     274            lambda s: ssl.wrap_socket(s, cert_reqs=ssl.CERT_REQUIRED, 
     275                                      ca_certs=args.cacerts) 
    268276 
    269277    passwd = None 
     
    308316    parser_client = subparsers.add_parser('client') 
    309317    parser_client.add_argument('--uri', action='store', required=True) 
     318    parser_client.add_argument('--insecure', action='store_true', default=False) 
     319    parser_client.add_argument('--cacerts', action='store') 
    310320    parser_client.add_argument('--user', action='store') 
    311321 
Note: See TracChangeset for help on using the changeset viewer.