Esempio n. 1
0
def handleProxy(server, baseurl, voRole, voGroup, days):
    """
    """
    proxy = CredentialInteractions('', '', voRole, voGroup, logging)
    #proxy.myproxyDesiredValidity = days
    proxy.setMyProxyValidity(int(days) * 24 * 60)

    logging.info("Checking credentials")

    proxy.proxyInfo = proxy.createNewVomsProxy(timeLeftThreshold=720)
    proxyfilename = proxy.proxyInfo['filename']

    #get the dn of the agents from the server
    alldns = server_info('delegatedn', server, proxyfilename, baseurl)
    for serverdn in alldns['services']:
        proxy.defaultDelegation['serverDN'] = serverdn
        proxy.defaultDelegation['myProxySvr'] = 'myproxy.cern.ch'

        logging.info("Registering user credentials for server %s" % serverdn)
        proxy.createNewMyProxy(timeleftthreshold=60 * 60 * 24 *
                               RENEW_MYPROXY_THRESHOLD,
                               nokey=True)
        proxy.createNewMyProxy2(timeleftthreshold=60 * 60 * 24 *
                                RENEW_MYPROXY_THRESHOLD,
                                nokey=True)
Esempio n. 2
0
    def __call__(self):

        proxy = CredentialInteractions('', '', '', '', self.logger)
        days = self.options.days
        proxy.setMyProxyValidity(int(days) * 24 * 60)  # minutes
        timeLeftThreshold = int(days) * 24 * 60 * 60 # seconds

        self.logger.info("Checking credentials")

        # need an X509 proxy in order to talk with CRABServer to get list of myproxy authorized retrievers
        proxy.proxyInfo = proxy.createNewVomsProxy(timeLeftThreshold=720)
        proxyfilename = proxy.proxyInfo['filename']
        serverurl = 'cmsweb.cern.ch'
        baseurl = '/crabserver/prod/info'
        alldns = server_info(subresource='delegatedn', serverurl=serverurl, proxyfilename=proxyfilename, baseurl=baseurl)
        for serverdn in alldns['services']:
            proxy.defaultDelegation['serverDN'] = serverdn
            proxy.defaultDelegation['myProxySvr'] = 'myproxy.cern.ch'

            self.logger.info("Registering user credentials for server %s" % serverdn)
            (credentialName, myproxyTimeleft) = proxy.createNewMyProxy(timeleftthreshold=timeLeftThreshold, nokey=True)
            self.logger.info("Credential exists on myproxy: username: %s  - validity: %s", credentialName,
                             str(timedelta(seconds=myproxyTimeleft)))
            (credentialName, myproxyTimeleft) = proxy.createNewMyProxy2(timeleftthreshold=timeLeftThreshold, nokey=True)
            self.logger.info("Credential exists on myproxy: username: %s  - validity: %s", credentialName,
                             str(timedelta(seconds=myproxyTimeleft)))

        return
Esempio n. 3
0
    def __call__(self):

        credentialHandler = CredentialInteractions(self.logger)
        days = self.options.days

        credentialHandler.setMyProxyValidity(int(days) * 24 * 60)  # minutes
        # give a bit of slack to the threshold, avoid that repeating the c
        timeLeftThreshold = int(days - 1) * 24 * 60 * 60  # seconds

        self.logger.info("Checking credentials")

        # need an X509 proxy in order to talk with CRABServer to get list of myproxy authorized retrievers
        credentialHandler.createNewVomsProxy(timeLeftThreshold=720)
        alldns = server_info(crabserver=self.crabserver,
                             subresource='delegatedn')
        for authorizedDNs in alldns['services']:
            credentialHandler.setRetrievers(authorizedDNs)
            self.logger.info("Registering user credentials in myproxy")
            (credentialName,
             myproxyTimeleft) = credentialHandler.createNewMyProxy(
                 timeleftthreshold=timeLeftThreshold)
            self.logger.info(
                "Credential exists on myproxy: username: %s  - validity: %s",
                credentialName, str(timedelta(seconds=myproxyTimeleft)))
        return