Skip to content

Commit f4eed5f

Browse files
authored
No longer require '._domainkey' for domains.selectors (canada-ca#817)
* Append '._domainkey' to all dkim selector strings within scanning process * Reflect changes within test
1 parent e9acbb3 commit f4eed5f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

services/scanners/dns/dns_scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def scan_dkim(domain, selectors):
108108
record[selector] = {}
109109
try:
110110
# Retrieve public key from DNS
111-
pk_txt = dnsplug.get_txt_dnspython(f"{selector}.{domain}")
111+
pk_txt = dnsplug.get_txt_dnspython(f"{selector}._domainkey.{domain}")
112112
logging.info("Public key (TXT) retrieved from DNS")
113113

114114
pk, keysize, ktag = load_pk(f"{selector}.{domain}", pk_txt)

services/scanners/dns/tests/test_dns_scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_scan():
1414
test_payload = {
1515
"scan_id": 1,
1616
"domain": "cyber.gc.ca",
17-
"selectors": ["selector1._domainkey", "selector2._domainkey"],
17+
"selectors": ["selector1", "selector2"],
1818
}
1919

2020
res = test_client.post("/", json=test_payload)

0 commit comments

Comments
 (0)