-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webconnectivitylte): handle ghost DNS censorship (#1457)
## Checklist - [x] I have read the [contribution guidelines](https://github.com/ooni/probe-cli/blob/master/CONTRIBUTING.md) - [x] reference issue for this pull request: ooni/probe#2652 - [x] if you changed anything related to how experiments work and you need to reflect these changes in the ooni/spec repository, please link to the related ooni/spec pull request: no need - [x] if you changed code inside an experiment, make sure you bump its version number: already bumped for 3.21.x ## Description This commit modifies webconnectivitylte to handle ghost DNS censorship. We define ghost DNS censorship the case where the original domain does not exist anymore but the censor continues to return an IP address for the original domain nonetheless. We used to have null-null handling for this case in the "orig" engine and a reference issue as ooni/probe#2307. With this commit, we modify the "classic" engine to correctly handle this case. To this end, we need to: 1. mark DNS inconsistency when we have successful probe lookups and no IP address has been resolved by the test helper, which is indeed the case of ghost DNS censorship. 2. specific handling on the case in which the website seems down where we also ask ourselves the question of whether the culprit could be the DNS and otherwise set accessible = false and blocking = false. Note that, with those two changes, we depart from strict v0.4-is-always-right orthodoxy. So, while there, let's recognize that always setting HTTPExprimentFailure is probably for the greater good.
- Loading branch information
1 parent
b664281
commit fbe3515
Showing
7 changed files
with
152 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package webconnectivityqa | ||
|
||
import ( | ||
"github.com/apex/log" | ||
"github.com/ooni/netem" | ||
"github.com/ooni/probe-cli/v3/internal/netemx" | ||
) | ||
|
||
// ghostDNSBlockingWithHTTP is the case where the domain does not exist anymore but | ||
// there's still ghost censorship because of the censor DNS censoring configuration, which | ||
// says that we should censor the domain by returning a specific IP address. | ||
// | ||
// See https://github.com/ooni/probe/issues/2308. | ||
func ghostDNSBlockingWithHTTP() *TestCase { | ||
return &TestCase{ | ||
Name: "ghostDNSBlockingWithHTTP", | ||
Flags: TestCaseFlagNoV04, | ||
Input: "http://itsat.info/", | ||
Configure: func(env *netemx.QAEnv) { | ||
// remove the record so that the DNS query returns NXDOMAIN | ||
env.ISPResolverConfig().RemoveRecord("itsat.info") | ||
env.OtherResolversConfig().RemoveRecord("itsat.info") | ||
|
||
// however introduce a rule causing DNS to respond to the query | ||
env.DPIEngine().AddRule(&netem.DPISpoofDNSResponse{ | ||
Addresses: []string{ | ||
netemx.AddressPublicBlockpage, | ||
}, | ||
Logger: log.Log, | ||
Domain: "itsat.info", | ||
}) | ||
}, | ||
ExpectErr: false, | ||
ExpectTestKeys: &testKeys{ | ||
DNSExperimentFailure: nil, | ||
DNSConsistency: "inconsistent", | ||
XBlockingFlags: 16, // AnalysisBlockingFlagHTTPDiff | ||
XNullNullFlags: 16, // AnalysisFlagNullNullUnexpectedDNSLookupSuccess | ||
XStatus: 16, // StatusAnomalyControlFailure | ||
Accessible: false, | ||
Blocking: "dns", | ||
}, | ||
} | ||
} | ||
|
||
// ghostDNSBlockingWithHTTPS is the case where the domain does not exist anymore but | ||
// there's still ghost censorship because of the censor DNS censoring configuration, which | ||
// says that we should censor the domain by returning a specific IP address. | ||
// | ||
// See https://github.com/ooni/probe/issues/2308. | ||
func ghostDNSBlockingWithHTTPS() *TestCase { | ||
return &TestCase{ | ||
Name: "ghostDNSBlockingWithHTTPS", | ||
Flags: 0, | ||
Input: "https://itsat.info/", | ||
Configure: func(env *netemx.QAEnv) { | ||
// remove the record so that the DNS query returns NXDOMAIN | ||
env.ISPResolverConfig().RemoveRecord("itsat.info") | ||
env.OtherResolversConfig().RemoveRecord("itsat.info") | ||
|
||
// however introduce a rule causing DNS to respond to the query | ||
env.DPIEngine().AddRule(&netem.DPISpoofDNSResponse{ | ||
Addresses: []string{ | ||
netemx.AddressPublicBlockpage, | ||
}, | ||
Logger: log.Log, | ||
Domain: "itsat.info", | ||
}) | ||
}, | ||
ExpectErr: false, | ||
ExpectTestKeys: &testKeys{ | ||
DNSExperimentFailure: nil, | ||
DNSConsistency: "inconsistent", | ||
HTTPExperimentFailure: "connection_refused", | ||
XNullNullFlags: 16, // AnalysisFlagNullNullUnexpectedDNSLookupSuccess | ||
XStatus: 4256, // StatusExperimentConnect | StatusAnomalyDNS | StatusAnomalyConnect | ||
Accessible: false, | ||
Blocking: "dns", | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters