Ejemplo n.º 1
0
 def filter(self, order):
     if sift.fnmatches(order['certificate'].get('dns_names', []), self.args.domain_name_pns):
         app.logger.info(fmt('order_status={0} args_status={1}', order['status'], self.args.status))
         if sift.fnmatches([order['status']], self.args.status):
             if isinstance(self.args.within, int):
                 within = timedelta(self.args.within)
                 delta = datetime.strptime(order['certificate']['valid_till'], '%Y-%m-%d') - datetime.utcnow()
                 return TIMEDELTA_ZERO < delta and delta < within
             return True
     return False
Ejemplo n.º 2
0
def check(bundles, overrides):
    print('blacklist.check: overrides =', overrides)
    blacklist_names = []
    for bundle in bundles:
        domains = [bundle.common_name] + (bundle.sans if bundle.sans else [])
        print('domains =', domains)
        blacklist_names += sift.fnmatches(domains, BLACKLIST, overrides)
    if blacklist_names:
        raise BlacklistError(blacklist_names)
Ejemplo n.º 3
0
def check(certs, overrides):
    print('blacklist.check: overrides =', overrides)
    blacklist_names = []
    for cert in certs:
        domains = [cert.common_name] + (cert.sans if cert.sans else [])
        print('domains =', domains)
        blacklist_names += sift.fnmatches(domains, BLACKLIST, overrides)
    if blacklist_names:
        raise BlacklistError(blacklist_names)
Ejemplo n.º 4
0
 def filter(self, order):
     try:
         status = order['status']
         certificate = order['certificate']
         common_name = certificate.get('common_name', 'UNDEF')
         dns_names = certificate.get('dns_names', [])
         valid_till = certificate['valid_till']
         if sift.fnmatches(dns_names, self.args.domain_name_pns):
             if sift.fnmatches([status], self.args.status):
                 if isinstance(self.args.within, int):
                     within = timedelta(self.args.within)
                     delta = datetime.strptime(
                         valid_till, '%Y-%m-%d') - datetime.utcnow()
                     return TIMEDELTA_ZERO < delta and delta < within
                 return True
     except Exception as ex:
         app.logger.debug('FILTER_EX: ' + traceback.format_exc())
     return False
Ejemplo n.º 5
0
 def bundles(cls, bundle_name_pns, within=None, expired=False):
     bundles = []
     if isint(within):
         within = timedelta(within)
     for bundle_name in sorted(sift.fnmatches(cls.names, bundle_name_pns)):
         bundle = Bundle.from_disk(bundle_name, bundle_path=cls.bundle_path)
         if bundle.sans:
             bundle.sans = sorted(bundle.sans)
         if within:
             delta = bundle.expiry - cls.timestamp
             if cls.zero < delta and delta < within:
                 bundles += [bundle]
         elif expired:
             if bundle.expiry < cls.timestamp:
                 bundles += [bundle]
         elif bundle.expiry > cls.timestamp:
             bundles += [bundle]
     return bundles
Ejemplo n.º 6
0
 def load_certs(self, *cert_name_pns, within=None, expired=False):
     certs = []
     if isinstance(within, int):
         within = timedelta(within)
     for cert_name in sorted(sift.fnmatches(self.cert_names, cert_name_pns)):
         cert = self.load_cert(cert_name)
         if cert.sans:
             cert.sans = sorted(cert.sans)
         if within:
             delta = cert.expiry - self.timestamp
             if TIMEDELTA_ZERO < delta and delta < within:
                 certs += [cert]
         elif expired:
             if cert.expiry < self.timestamp:
                 certs += [cert]
         else:
             if cert.expiry > self.timestamp:
                 certs += [cert]
     return certs