Exemplo n.º 1
0
  def validate_factory_proxy(self):
    #--- using factory and vofrontend ---
    if len(self.x509_proxy())  == 0 or \
       len(self.x509_gsi_dn()) == 0:
      common.logerr("""You have said you want to use a Frontend and Factory proxies.
The x509_proxy and x509_gsi_dn option must be populated.""")
    proxy_file = self.x509_proxy()
    common.logit("... validating x509_proxy: %s" % proxy_file)
    if not os.path.exists(proxy_file):
      common.logerr("""File specified does not exist.""")
    common.logit("... validating x509_gsi_dn: %s" % self.x509_gsi_dn())
    type = "proxy"
    dn_to_validate = self.x509_gsi_dn()
    dn_in_file = common.get_gsi_dn(type,proxy_file)
    if dn_in_file <> dn_to_validate:
      common.logerr("""The DN of the %(type)s in %(file)s 
does not match the x509_gsi_dn attribute in your ini file:
%(type)8s dn: %(file_dn)s
%(ini)11s: %(ini_dn)s
This may cause a problem in other services.
Are you sure this is a proxy and not a certificate?""" % \
              { "type"    : type,
                "ini"     : "x509_gsi_dn",
                "file"    : proxy_file,
                "file_dn" : dn_in_file,
                "ini_dn"  : dn_to_validate},)
Exemplo n.º 2
0
  def validate_glidein_proxies(self):
    common.logit("... validating glidein_proxy_files and glidein_proxy_dns")
    reinstall_msg = """You will need to reinstall the UserCollector so these pilot dns are used for
authentification/authorizaton of the glidein pilots""" 
    reinstall_msg = """You will need to reinstall the UserCollector so these pilot dns are used for
authentification/authorizaton of the glidein pilots.""" 

    if self.factory.use_vofrontend_proxy() == "y" and \
       len(self.glidein_proxy_files()) == 0:
      common.logerr("""The Factory use_vofrontend_proxy option (%(use_vofrontend)s) requires that you 
provide proxies using the VOFrontend glidein_proxy_files and
glidein_proxy_dns option.  These are not populated.
%(reinstall)s.""" % \
          { "use_vofrontend" : self.factory.use_vofrontend_proxy(), 
            "reinstall"      : reinstall_msg, })
    proxies = self.glidein_proxy_files().split(" ")
    if len(self.glidein_proxy_dns()) <> len(proxies):
      common.logerr("""The number of glidein_proxy_files (%(proxy)s) must match the number of glidein_proxy_dns (%(dns)s).
%(reinstall)s.""" % \
          { "proxy" : len(proxies),
            "dns"   : len(self.glidein_proxy_dns()),
            "reinstall"      : reinstall_msg, })
    proxy_dns = self.glidein_proxy_dns()
    cnt = 0
    for proxy in proxies:
      if len(proxy) == 0:
        break
      common.logit("""    glidein_proxy_files[%(position)s]: %(proxy)s
    glidein_proxy_dns[%(position)i]: %(option_dn)s.""" % \
            { "position"   : cnt,
              "option_dn"  : proxy_dns[cnt],
              "proxy"      : proxy, })
      dn_in_file = common.get_gsi_dn("proxy",proxy,self.username())
      if dn_in_file <> proxy_dns[cnt]:
        common.logerr("""The DN in glidein_proxy_dns is incorrect.
option: %(option_dn)s
  file: %(dn_in_file)s
%(reinstall)s.""" % \
             { "dn_in_file" : dn_in_file, 
               "option_dn"  : proxy_dns[cnt],
               "reinstall"  : reinstall_msg, 
             })
      cnt = cnt + 1 
    common.logit("")