Changeset 2855


Ignore:
Timestamp:
29/08/07 17:12:19 (12 years ago)
Author:
pjkersha
Message:

Fixes to tickets #828 #829

ndg.security.server/ndg/security/server/AttAuthority/server-config.tac,
ndg.security.server/ndg/security/server/ca/server-config.tac,
ndg.security.server/ndg/security/server/SessionMgr/server-config.tac:

  • Split import for wsSecurity into common component (no Zope or Twisted) and

server component (Zope and Twisted imports)

ndg.security.server/ndg/security/server/twisted.py:

  • new module to contain Twisted handler code for NDG-Security server egg.

This code is removed from common.wsSecurity so that the client egg no longer
has any Twisted or Zope dependencies

ndg.security.common/ndg/security/common/wsSecurity.py: removed Twisted handler
code and moved to new server.twisted module

ndg-security-install.py: add new --config-dir option to copy server egg conf/
dir contents to /etc/ndg/security on target host. Incomplete as a way to
programmatically get the egg site-packages/ location is needed.

Location:
TI12-security/trunk/python
Files:
1 added
5 edited

Legend:

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

    r2827 r2855  
    3333     
    3434    @cvar defaultTwistedURI: default location for Twisted download 
    35     @type param: string''' 
     35    @type param: string  
     36     
     37    @cvar configDir: default location for configuration directory "conf" 
     38    @type configDir: string''' 
     39     
    3640    dependencyLink = "http://ndg.nerc.ac.uk/dist/"   
    3741    defaultTwistedURI = \ 
    3842'http://tmrc.mit.edu/mirror/twisted/Twisted/2.2/TwistedSumo-2006-02-12.tar.bz2' 
     43    configDir = os.path.join("etc", "ndg", "security") 
    3944     
    4045    def __call__(self): 
     
    113118          'force upgrade (search PyPI/dependency links for latest version)') 
    114119     
    115      
    116         (self.opt, args) = parser.parse_args() 
     120        parser.add_option("-C", 
     121                          "--config-dir", 
     122                          dest="configDir", 
     123                          default=self.__class__.configDir, 
     124                          help=\ 
     125"""Specify a location for configuration files.  The default is \"%s\"""" % \ 
     126                                                    self.__class__.configDir) 
     127     
     128        self.opt, args = parser.parse_args() 
    117129     
    118130        # Sanity check 
     
    145157        elif self.opt.installServer: 
    146158            args += ["ndg_security_server"] 
     159            import pdb;pdb.set_trace() 
    147160            main(args) 
    148161            self.installTwisted() 
     
    244257        os.chdir(twistedDir) 
    245258        try:  
    246             retCode = call([sys.prefix+'/bin/python', 'setup.py', 'install']) 
     259            retCode = call([os.path.join(sys.prefix, 'bin', 'python'),  
     260                            'setup.py',  
     261                            'install']) 
    247262        except OSError, e: 
    248263            raise SecurityInstallError, \ 
     
    256271 
    257272 
     273    def createConfigDir(self): 
     274        """Copy configuration files for services from the server egg into 
     275        a config area.  The default is /etc/ndg/security/conf""" 
     276         
     277        # Skip if not set 
     278        if not self.opt.configDir:  
     279            return 
     280         
     281        # Otherwise create - fix to rwx for owner and group only 
     282        os.makedirs(self.opt.configDir, mode=0770) 
     283         
     284        # Copy over conf directory from egg 
     285         
     286 
    258287if __name__ == "__main__": 
    259288    SecurityInstall()() 
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/wsSecurity.py

    r2679 r2855  
    11#!/bin/env python 
    2  
    32"""WS-Security test class includes digital signature handler 
    43 
     
    14211420            #print decryptedData 
    14221421            #import pdb;pdb.set_trace() 
    1423  
    1424  
    1425 #_____________________________________________________________________________ 
    1426 from zope.interface import classProvides, implements, Interface 
    1427 import twisted.web.http 
    1428 from twisted.python import log, failure 
    1429  
    1430 from ZSI.twisted.WSresource import DefaultHandlerChain, \ 
    1431     DefaultCallbackHandler, CallbackChainInterface, HandlerChainInterface, \ 
    1432     DataHandler 
    1433      
    1434 from ZSI import _get_element_nsuri_name, EvaluateException, ParseException 
    1435      
    1436      
    1437 class WSSecurityHandlerChainFactory: 
    1438     protocol = DefaultHandlerChain 
    1439      
    1440     @classmethod 
    1441     def newInstance(cls): 
    1442         return cls.protocol(DefaultCallbackHandler,  
    1443                             DataHandler, 
    1444                             WSSecurityHandler) 
    1445      
    1446  
    1447 class WSSecurityHandler: 
    1448     classProvides(HandlerChainInterface) 
    1449  
    1450     signatureHandler = None 
    1451      
    1452     @classmethod 
    1453     def processRequest(cls, ps, **kw): 
    1454         """invokes callback that should return a (request,response) tuple. 
    1455         representing the SOAP request and response respectively. 
    1456         ps -- ParsedSoap instance representing HTTP Body. 
    1457         request -- twisted.web.server.Request 
    1458         """ 
    1459         if cls.signatureHandler: 
    1460             cls.signatureHandler.verify(ps) 
    1461              
    1462         return ps 
    1463      
    1464     @classmethod 
    1465     def processResponse(cls, sw, **kw): 
    1466          
    1467         if cls.signatureHandler: 
    1468             cls.signatureHandler.sign(sw) 
    1469              
    1470         return sw 
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/AttAuthority/server-config.tac

    r2530 r2855  
    2727        AttAuthorityAccessDenied 
    2828         
    29 from ndg.security.common.wsSecurity import WSSecurityHandlerChainFactory, \ 
    30         WSSecurityHandler, SignatureHandler 
     29from ndg.security.common.wsSecurity import SignatureHandler 
     30from ndg.security.server.twisted import WSSecurityHandlerChainFactory, \ 
     31        WSSecurityHandler 
    3132 
    3233from ndg.security.common.X509 import X509Cert, X509CertRead 
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/server-config.tac

    r2730 r2855  
    2424        SessionMgrService 
    2525from ndg.security.server.SessionMgr import SessionMgr 
    26 from ndg.security.common.wsSecurity import WSSecurityHandlerChainFactory, \ 
    27         WSSecurityHandler, SignatureHandler 
     26from ndg.security.common.wsSecurity import SignatureHandler 
     27from ndg.security.server.twisted import WSSecurityHandler, \ 
     28        WSSecurityHandlerChainFactory 
     29         
     30 
    2831from ndg.security.common.X509 import X509CertRead 
    2932 
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/ca/server-config.tac

    r2730 r2855  
    2424        CertificateAuthorityService 
    2525from ndg.security.server.ca import SimpleCA, SimpleCAPassPhraseError 
    26 from ndg.security.common.wsSecurity import WSSecurityHandlerChainFactory, \ 
    27         WSSecurityHandler, SignatureHandler 
     26from ndg.security.common.wsSecurity import SignatureHandler 
     27from ndg.security.server.twisted import WSSecurityHandlerChainFactory, \ 
     28        WSSecurityHandler 
    2829 
    2930 
Note: See TracChangeset for help on using the changeset viewer.