Exemplo n.º 1
0
 def _lookupKeys(self):
     """
     Do the key lookup using the actual lookup method.
     """
     log.debug("DKIM: TXT lookup: %s" % (self._getSelectorKey(),))
     data = (yield lookupDataViaTXT(self._getSelectorKey()))
     log.debug("DKIM: TXT lookup results: %s\n%s" % (self._getSelectorKey(), "\n".join(data),))
     returnValue(tuple([DKIMUtils.extractTags(line) for line in data]))
Exemplo n.º 2
0
 def _lookupKeys(self):
     """
     Do the key lookup using the actual lookup method.
     """
     log.debug("DKIM: TXT lookup: %s" % (self._getSelectorKey(), ))
     data = (yield lookupDataViaTXT(self._getSelectorKey()))
     log.debug("DKIM: TXT lookup results: %s\n%s" % (
         self._getSelectorKey(),
         "\n".join(data),
     ))
     returnValue(tuple([DKIMUtils.extractTags(line) for line in data]))
Exemplo n.º 3
0
    def test_lookupDataViaTXT(self):
        """
        Test L{lookupDataViaTXT} with a local Bind find
        """

        # Patch config
        for zonefile, checks in (
            ("db.example.com", (("example.com", "_ischedule._domainkey", "v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjUfDqd8ICAL0dyq2KdjKN6LS8O/Y4yMxOxgATqtSIMi7baKXEs1w5Wj9efOC2nU+aqyhP2/J6AzfFJfSB+GV5gcIT+LAC4btJKPGjPUyXcQFJV4a73y0jIgCTBzWxdaP6qD9P9rzYlvMPcdrrKiKoAOtI3JZqAAdZudOmGlc4QQIDAQAB"),),),
            ("db.two.zones", (
                ("example.com", "_ischedule._domainkey", "v=DKIM1; p="),
                ("example.org", "_ischedule2._domainkey", "v=DKIM1; s=ischedule; p="),
            )),
        ):
            module = getModule(__name__)
            dataPath = module.filePath.sibling("data")
            bindPath = dataPath.child(zonefile)
            self.patch(config.Scheduling.iSchedule, "DNSDebug", bindPath.path)
            utils.DebugResolver = None

            for domain, prefix, result in checks:
                texts = (yield utils.lookupDataViaTXT(domain, prefix))
                self.assertEqual(texts, [result])