2222 ZeroRttStatus ,
2323 WebTestTls ,
2424)
25- from checks .tasks import SetupUnboundContext
2625from checks .tasks .dispatcher import check_registry , post_callback_hook
2726from checks .tasks .shared import (
2827 aggregate_subreports ,
3231 mail_get_servers ,
3332 resolve_a_aaaa ,
3433 results_per_domain ,
34+ TranslatableTechTableItem ,
3535)
3636from checks .tasks .tls .http import http_checks
3737from interface import batch , batch_shared_task , redis_id
@@ -158,7 +158,6 @@ def callback_null_mx(results, domain, test_type):
158158 bind = True ,
159159 soft_time_limit = settings .SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
160160 time_limit = settings .SHARED_TASK_TIME_LIMIT_HIGH ,
161- base = SetupUnboundContext ,
162161)
163162def web_cert (self , af_ip_pairs , url , * args , ** kwargs ):
164163 return do_web_cert (af_ip_pairs , url , self , * args , ** kwargs )
@@ -169,7 +168,6 @@ def web_cert(self, af_ip_pairs, url, *args, **kwargs):
169168 bind = True ,
170169 soft_time_limit = settings .BATCH_SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
171170 time_limit = settings .BATCH_SHARED_TASK_TIME_LIMIT_HIGH ,
172- base = SetupUnboundContext ,
173171)
174172def batch_web_cert (self , af_ip_pairs , url , * args , ** kwargs ):
175173 return do_web_cert (af_ip_pairs , url , self , * args , ** kwargs )
@@ -180,7 +178,6 @@ def batch_web_cert(self, af_ip_pairs, url, *args, **kwargs):
180178 bind = True ,
181179 soft_time_limit = settings .SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
182180 time_limit = settings .SHARED_TASK_TIME_LIMIT_HIGH ,
183- base = SetupUnboundContext ,
184181)
185182def web_conn (self , af_ip_pairs , url , * args , ** kwargs ):
186183 return do_web_conn (af_ip_pairs , url , * args , ** kwargs )
@@ -191,7 +188,6 @@ def web_conn(self, af_ip_pairs, url, *args, **kwargs):
191188 bind = True ,
192189 soft_time_limit = settings .BATCH_SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
193190 time_limit = settings .BATCH_SHARED_TASK_TIME_LIMIT_HIGH ,
194- base = SetupUnboundContext ,
195191)
196192def batch_web_conn (self , af_ip_pairs , url , * args , ** kwargs ):
197193 return do_web_conn (af_ip_pairs , url , * args , ** kwargs )
@@ -202,7 +198,6 @@ def batch_web_conn(self, af_ip_pairs, url, *args, **kwargs):
202198 bind = True ,
203199 soft_time_limit = settings .SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
204200 time_limit = settings .SHARED_TASK_TIME_LIMIT_HIGH ,
205- base = SetupUnboundContext ,
206201)
207202def mail_smtp_starttls (self , mailservers , url , * args , ** kwargs ):
208203 return do_mail_smtp_starttls (mailservers , url , self , * args , ** kwargs )
@@ -213,7 +208,6 @@ def mail_smtp_starttls(self, mailservers, url, *args, **kwargs):
213208 bind = True ,
214209 soft_time_limit = settings .BATCH_SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
215210 time_limit = settings .BATCH_SHARED_TASK_TIME_LIMIT_HIGH ,
216- base = SetupUnboundContext ,
217211)
218212def batch_mail_smtp_starttls (self , mailservers , url , * args , ** kwargs ):
219213 return do_mail_smtp_starttls (mailservers , url , self , * args , ** kwargs )
@@ -224,7 +218,6 @@ def batch_mail_smtp_starttls(self, mailservers, url, *args, **kwargs):
224218 bind = True ,
225219 soft_time_limit = settings .SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
226220 time_limit = settings .SHARED_TASK_TIME_LIMIT_HIGH ,
227- base = SetupUnboundContext ,
228221)
229222def web_http (self , af_ip_pairs , url , * args , ** kwargs ):
230223 return do_web_http (af_ip_pairs , url , self , * args , ** kwargs )
@@ -235,7 +228,6 @@ def web_http(self, af_ip_pairs, url, *args, **kwargs):
235228 bind = True ,
236229 soft_time_limit = settings .BATCH_SHARED_TASK_SOFT_TIME_LIMIT_HIGH ,
237230 time_limit = settings .BATCH_SHARED_TASK_TIME_LIMIT_HIGH ,
238- base = SetupUnboundContext ,
239231)
240232def batch_web_http (self , af_ip_pairs , url , * args , ** kwargs ):
241233 return do_web_http (af_ip_pairs , url , self , args , ** kwargs )
@@ -293,6 +285,11 @@ def save_results(model, results, addr, domain, category):
293285 model .cert_signature_score = result .get ("sigalg_score" )
294286 model .cert_hostmatch_score = result .get ("hostmatch_score" )
295287 model .cert_hostmatch_bad = result .get ("hostmatch_bad" )
288+ model .caa_enabled = result .get ("caa_result" ).caa_found
289+ model .caa_error = [ttti .to_dict () for ttti in result .get ("caa_result" ).errors ]
290+ model .caa_recommendations = [ttti .to_dict () for ttti in result .get ("caa_result" ).recommendations ]
291+ model .caa_score = result .get ("caa_result" ).score
292+ model .caa_found_on_domain = result .get ("caa_result" ).canonical_name
296293 model .dane_log = result .get ("dane_log" )
297294 model .dane_score = result .get ("dane_score" )
298295 model .dane_status = result .get ("dane_status" )
@@ -361,6 +358,11 @@ def save_results(model, results, addr, domain, category):
361358 model .cert_signature_score = result .get ("sigalg_score" )
362359 model .cert_hostmatch_score = result .get ("hostmatch_score" )
363360 model .cert_hostmatch_bad = result .get ("hostmatch_bad" )
361+ model .caa_enabled = result .get ("caa_result" ).caa_found
362+ model .caa_error = [ttti .to_dict () for ttti in result .get ("caa_result" ).errors ]
363+ model .caa_recommendations = [ttti .to_dict () for ttti in result .get ("caa_result" ).recommendations ]
364+ model .caa_score = result .get ("caa_result" ).score
365+ model .caa_found_on_domain = result .get ("caa_result" ).canonical_name
364366 model .dane_log = result .get ("dane_log" )
365367 model .dane_score = result .get ("dane_score" )
366368 model .dane_status = result .get ("dane_status" )
@@ -500,6 +502,22 @@ def annotate_and_combine_all(good_items, sufficient_items, bad_items, phaseout_i
500502 else :
501503 category .subtests ["cert_hostmatch" ].result_good ()
502504
505+ if dttls .caa_enabled :
506+ caa_host_message = [
507+ TranslatableTechTableItem (
508+ msgid = "found_host" , context = {"host" : dttls .caa_found_on_domain }
509+ ).to_dict ()
510+ ]
511+ else :
512+ caa_host_message = [TranslatableTechTableItem (msgid = "not_found" ).to_dict ()]
513+ caa_tech_table = caa_host_message + dttls .caa_errors + dttls .caa_recommendations
514+ if not dttls .caa_enabled or dttls .caa_errors :
515+ category .subtests ["web_caa" ].result_bad (caa_tech_table )
516+ elif dttls .caa_recommendations :
517+ category .subtests ["web_caa" ].result_recommendations (caa_tech_table )
518+ else :
519+ category .subtests ["web_caa" ].result_good (caa_tech_table )
520+
503521 if dttls .dane_status == DaneStatus .none :
504522 category .subtests ["dane_exists" ].result_bad ()
505523 elif dttls .dane_status == DaneStatus .none_bogus :
@@ -637,6 +655,20 @@ def annotate_and_combine_all(good_items, sufficient_items, bad_items, phaseout_i
637655 else :
638656 category .subtests ["cert_hostmatch" ].result_good ()
639657
658+ if dttls .caa_enabled :
659+ caa_host_message = [
660+ TranslatableTechTableItem (msgid = "found_host" , context = {"host" : dttls .caa_found_on_domain }).to_dict ()
661+ ]
662+ else :
663+ caa_host_message = [TranslatableTechTableItem (msgid = "not_found" ).to_dict ()]
664+ caa_tech_table = caa_host_message + dttls .caa_errors + dttls .caa_recommendations
665+ if not dttls .caa_enabled or dttls .caa_errors :
666+ category .subtests ["mail_caa" ].result_bad (caa_tech_table )
667+ elif dttls .caa_recommendations :
668+ category .subtests ["mail_caa" ].result_recommendations (caa_tech_table )
669+ else :
670+ category .subtests ["mail_caa" ].result_good (caa_tech_table )
671+
640672 if dttls .dane_status == DaneStatus .none :
641673 category .subtests ["dane_exists" ].result_bad ()
642674 elif dttls .dane_status == DaneStatus .none_bogus :
@@ -711,15 +743,15 @@ def build_summary_report(testtls, category):
711743 testtls .report = report
712744
713745
714- def do_web_cert (af_ip_pairs , url , task , * args , ** kwargs ):
746+ def do_web_cert (af_ip_pairs , url , * args , ** kwargs ):
715747 """
716748 Check the web server's certificate.
717749
718750 """
719751 try :
720752 results = {}
721753 for af_ip_pair in af_ip_pairs :
722- results [af_ip_pair [1 ]] = cert_checks (url , ChecksMode .WEB , task , af_ip_pair , * args , ** kwargs )
754+ results [af_ip_pair [1 ]] = cert_checks (url , ChecksMode .WEB , af_ip_pair , * args , ** kwargs )
723755 except SoftTimeLimitExceeded :
724756 log .debug ("Soft time limit exceeded. Url: %s" , url )
725757 for af_ip_pair in af_ip_pairs :
@@ -747,7 +779,7 @@ def do_web_conn(af_ip_pairs, url, *args, **kwargs):
747779 return ("tls_conn" , results )
748780
749781
750- def do_mail_smtp_starttls (mailservers , url , task , * args , ** kwargs ):
782+ def do_mail_smtp_starttls (mailservers , url , * args , ** kwargs ):
751783 """
752784 Start all the TLS related checks for the mail test.
753785
@@ -782,7 +814,7 @@ def do_mail_smtp_starttls(mailservers, url, task, *args, **kwargs):
782814 (server , dane_cb_data ) for server , dane_cb_data , _ in mailservers if not results [server ]
783815 ]
784816 log .debug (f"=========== checking remaining { servers_to_check = } " )
785- results .update (check_mail_tls_multiple (servers_to_check , task ))
817+ results .update (check_mail_tls_multiple (servers_to_check ))
786818 time .sleep (1 )
787819 for server , server_result in results .items ():
788820 cache_id = redis_id .mail_starttls .id .format (server )
@@ -798,15 +830,15 @@ def do_mail_smtp_starttls(mailservers, url, task, *args, **kwargs):
798830 return "smtp_starttls" , results
799831
800832
801- def do_web_http (af_ip_pairs , url , task , * args , ** kwargs ):
833+ def do_web_http (af_ip_pairs , url , * args , ** kwargs ):
802834 """
803835 Start all the HTTP related checks for the web test.
804836
805837 """
806838 try :
807839 results = {}
808840 for af_ip_pair in af_ip_pairs :
809- results [af_ip_pair [1 ]] = http_checks (af_ip_pair , url , task )
841+ results [af_ip_pair [1 ]] = http_checks (af_ip_pair , url )
810842
811843 except SoftTimeLimitExceeded :
812844 log .debug ("Soft time limit exceeded." )
0 commit comments