Changeset 2070


Ignore:
Timestamp:
29/01/07 09:17:43 (13 years ago)
Author:
pjkersha
Message:

python/ndg.security.server/ndg/security/server/SessionMgr/server-config.tac:
update return from SessionMgr?.connect call

python/ndg.security.server/ndg/security/server/SessionMgr/init.py:
fix to SessionMgr?.createCookie + updated header

python/ndg.security.server/ndg/security/server/MyProxy.py:
!! Changed type of all commands sent to server so that they explicitly set to
string type. Sending uencoded strings causes errors.

python/ndg.security.test/ndg/security/test/MyProxy/myProxyClientTest.cfg:
change user settings for tests.

python/ndg.security.test/ndg/security/test/SessionMgr/SessionMgrClientTest.py:

  • fix to setUp so that not tested for password if left blank in config file -

useful for private keys without password protection.

  • updates to test2CookieConnect and test3ProxyCertConnect for testing

connect WS operation.

python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrProperties.xml:
Add in MyProxy? config details.

python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrClientTest.cfg:
updates to settings for tests.

Location:
TI12-security/trunk/python
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/MyProxy.py

    r2063 r2070  
    544544        conn.write('0') 
    545545     
    546         # send info command 
     546        # send info command - ensure conversion from unicode before writing 
    547547        cmd = MyProxyClient.__infoCmd % username 
    548         conn.write(cmd) 
     548        conn.write(str(cmd)) 
    549549     
    550550        # process server response 
     
    607607        conn.write('0') 
    608608     
    609         # send command 
     609        # send command - ensure conversion from unicode before writing 
    610610        cmd = MyProxyClient.__changePassphraseCmd % (username,  
    611611                                                     passphrase, 
    612612                                                     newPassphrase) 
    613         conn.write(cmd) 
     613        conn.write(str(cmd)) 
    614614     
    615615        # process server response 
     
    664664        conn.write('0') 
    665665     
    666         # send destroy command 
     666        # send destroy command - ensure conversion from unicode before writing 
    667667        cmd = MyProxyClient.__destroyCmd % username 
    668         conn.write(cmd) 
     668        conn.write(str(cmd)) 
    669669     
    670670        # process server response 
     
    715715         
    716716        lifetime = lifetime or self.__prop['proxyCertMaxLifetime'] 
     717 
     718        # Inputs must be string type otherwise server will reject the request 
     719        if isinstance(username, unicode): 
     720            username = str(username) 
     721             
     722        if isinstance(passphrase, unicode): 
     723            passphrase = str(passphrase) 
    717724         
    718725        globusLoc = os.environ.get('GLOBUS_LOCATION') 
     
    749756        conn.write('0') 
    750757     
    751         # send store command 
     758        # send store command - ensure conversion from unicode before writing 
    752759        cmd = MyProxyClient.__storeCmd % (username, lifetime) 
    753         conn.write(cmd) 
     760        conn.write(str(cmd)) 
    754761     
    755762        # process server response 
     
    803810        conn.write('0') 
    804811     
    805         # send get command 
     812        # send get command - ensure conversion from unicode before writing 
    806813        cmd = MyProxyClient.__getCmd % (username, passphrase, lifetime) 
    807         conn.write(cmd) 
     814        conn.write(str(cmd)) 
    808815     
    809816        # process server response 
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/__init__.py

    r2063 r2070  
    192192        """Create cookies for session ID Session Manager WSDL address 
    193193 
    194         sessMgrURI:     WSDL address for Session Mananger  
    195         sessMgrPubKeyURI:   URI for public key of Session Manager 
    196         encrKey:               encryption key used to encrypted above URIs 
    197         sessID:                if no session ID is provided, use the latest  
    198                                one to be allocated. 
    199         cookieDomain:          domain set for cookie, if non set, web server 
    200                                domain name is used.  Nb. Generalised domains 
    201                                which don't set a specific host can be a  
    202                                security risk. 
    203         asString:              Set to True to return the cookie as string  
    204                                text.  If False, it is returned as a  
    205                                SessionCookie instance.""" 
     194        @type sessMgrURI: string 
     195        @param sessMgrURI: address for Session Mananger  
     196         
     197        @type encrKey: string 
     198        @param encrKey: encryption key used to encrypted above URIs 
     199         
     200        @type sessID: string 
     201        @keyword sessID: if no session ID is provided, use the latest one to  
     202        be allocated. 
     203         
     204        @type cookieDomain: string 
     205        @keyword cookieDomain: domain set for cookie, if non set, web server 
     206        domain name is used.  Nb. Generalised domains which don't set a  
     207        specific host can be a security risk. 
     208         
     209        @type asString: bool 
     210        @keyword asString: Set to True to return the cookie as string text.   
     211        If False, it is returned as a SessionCookie instance. 
     212         
     213        @rtype: SessionCookie / string depending on asString keyword 
     214        @return: session cookie""" 
    206215           
    207216        if sessID is None: 
     
    220229         
    221230        # Call class method  
    222         cookieTagsKw = SessionCookie.tags 
     231        cookieTags = SessionCookie.tags 
    223232        cookieTagsKw = {}.fromkeys(cookieTags) 
    224233        cookieTagsKw[cookieTags[0]] = sessID 
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/server-config.tac

    r2063 r2070  
    4545 
    4646    def soap_connect(self, ps, **kw): 
    47         #import pdb;pdb.set_trace() 
     47        import pdb;pdb.set_trace() 
    4848        request, response = SessionMgrService.soap_connect(self, ps) 
    4949 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/MyProxy/myProxyClientTest.cfg

    r2039 r2070  
    1111 
    1212[test1Store] 
    13 #username: sstljakTestUser 
    14 username: gabriel 
     13username: sstljakTestUser 
     14#username: gabriel 
    1515passphrase: 
    1616certFile: ./userCert.pem 
     
    2121 
    2222[test2GetDelegation] 
    23 #username: sstljakTestUser 
    24 username: gabriel 
     23username: sstljakTestUser 
     24#username: gabriel 
    2525passphrase: 
    2626 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/SessionMgr/SessionMgrClientTest.py

    r2063 r2070  
    4040        tracefile = sys.stderr 
    4141 
    42         clntPriKeyPwd = self.cfg['setUp'].get('clntprikeypwd') or \ 
    43             getpass.getpass(prompt="\nsetUp - client private key password: ") 
    44          
     42        try: 
     43            if self.cfg['setUp'].get('clntprikeypwd') is None: 
     44                clntPriKeyPwd = getpass.getpass(\ 
     45                            prompt="\nsetUp - client private key password: ") 
     46            else: 
     47                clntPriKeyPwd = self.cfg['setUp'].get('clntprikeypwd') 
     48        except KeyboardInterrupt: 
     49            sys.exit(0) 
     50             
    4551        # Initialise the Session Manager client connection 
    4652        # Omit traceFile keyword to leave out SOAP debug info 
     
    7783        getpass.getpass(prompt="\ntest2CookieConnect pass-phrase for user: ") 
    7884 
    79         import pdb;pdb.set_trace() 
    80         userID = self.clnt.connect(self.cfg['test2CookieConnect']['username'],  
    81                                    passphrase=passphrase, 
    82                                    getCookie=True) 
    83  
    84         self.sessCookie = SessionCookie(userID[-1]) 
     85        self.proxyCert, self.proxyPriKey, self.userCert, cookie = \ 
     86            self.clnt.connect(self.cfg['test2CookieConnect']['username'],  
     87                              passphrase=passphrase, 
     88                              getCookie=True) 
     89 
     90        self.sessCookie = SessionCookie(cookie) 
    8591        print "User '%s' connected to Session Manager:\n%s" % \ 
    86             (self.cfg['test2CookieConnect']['username'], sSessCookie) 
     92            (self.cfg['test2CookieConnect']['username'], self.sessCookie) 
    8793             
    8894 
     
    95101                    prompt="\ntest3ProxyCertConnect pass-phrase for user: ") 
    96102 
    97         self.proxyCert, self.proxyPriKey, self.userCert = self.clnt.connect(\ 
    98                                self.cfg['test3ProxyCertConnect']['username'],  
    99                                passphrase=passphrase, 
    100                                createServerSess=True, 
    101                                getCookie=False) 
     103        self.proxyCert, self.proxyPriKey, self.userCert, null = \ 
     104            self.clnt.connect(self.cfg['test3ProxyCertConnect']['username'],  
     105                              passphrase=passphrase, 
     106                              createServerSess=True, 
     107                              getCookie=False) 
    102108        print "User '%s' connected to Session Manager:\n%s" % \ 
    103109            (self.cfg['test3ProxyCertConnect']['username'], self.proxyCert) 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrClientTest.cfg

    r2063 r2070  
    2323# Password protecting client private key - if omitted it will be prompted for 
    2424# from tty 
    25 #clntprikeypwd =  
     25clntprikeypwd =  
    2626 
    2727clntcertfilepath = ./clnt-cert.pem 
     
    3434  
    3535[test2CookieConnect]          
    36 username = gabriel 
     36username = sstljakTestUser 
     37#username = gabriel 
    3738#passphrase =  
    3839 
    3940[test3ProxyCertConnect]          
    40 username = gabriel 
     41username = sstljakTestUser 
     42#username = gabriel 
    4143#passphrase =  
    4244 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrProperties.xml

    r2063 r2070  
    4747                        specified when a certificate is first created by store() method 
    4848                --> 
    49                 <proxyCertMaxLifetime></proxyCertMaxLifetime> <!-- in hours --> 
     49                <proxyCertMaxLifetime>24</proxyCertMaxLifetime> <!-- in hours --> 
    5050                <!--  
    5151                        Life time of a proxy certificate when issued from the Proxy Server  
    5252                        with getDelegation() method 
    5353                        --> 
    54                 <proxyCertLifetime></proxyCertLifetime> <!-- in hours --> 
    55                 <caCertFile></caCertFile> 
     54                <proxyCertLifetime>8</proxyCertLifetime> <!-- in hours --> 
     55                <caCertFile>$NDGSEC_SM_UNITTEST_DIR/cacert.pem</caCertFile> 
    5656        </myProxyProp> 
    5757        <simpleCACltProp> 
Note: See TracChangeset for help on using the changeset viewer.