windows: Tor
- tor: the Tor Project's Expert Bundle for Windows (15.0.26) as a component, pinned by the hash of the release whose signature was checked against the Tor Browser Developers' key; the installer takes gzipped tars now (plain files only: a link could point anywhere). - The torrc upstream's tor.nix writes: SOCKS for the tor outbound, bridges with the bundle's lyrebird (obfs4, webtunnel, meek, snowflake) and conjure, the local proxy as upstream (upstream = "proxy") with its login, extraConfig. The control port is on loopback with cookie authentication (upstream's is a Unix socket only Tor's user opens). Values are quoted with control characters escaped: a newline in, say, the proxy's login would otherwise start a directive (one that runs a program, as SYSTEM). - Tor's own connections go direct under the TUN unless upstream = "proxy". The onion service (for the inbounds) is still to come and is said to be. - Checked: Windows' tor.exe, under Wine, takes a torrc of this shape, bridges and escaped values included; on Linux the service runs Tor and it bootstraps as far as this network lets it without bridges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82fe4d8e65
commit
40221e7981
12 files changed
+282
-14
No files matched your search
@@ -44,19 +44,15 @@ pub async fn archive(src: &Source, routes: &[fetch::Route], cache: &Path) -> Res
|
||||
Err(last.unwrap_or_else(|| anyhow::anyhow!("no way to fetch it")).context(format!("fetching {}", src.url)))
|
||||
}
|
||||
|
||||
/// Extracts what `src` takes from `data` into `dest`, verifying each file it pins.
|
||||
/// Extracts what `src` takes from `data`, a zip or a gzipped tar, into `dest`, verifying each
|
||||
/// file it pins. Only plain files are taken from a tar: a link could point anywhere.
|
||||
pub fn extract(src: &Source, data: &[u8], dest: &Path) -> Result<usize> {
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(data)).context("not a zip archive")?;
|
||||
let mut seen = std::collections::BTreeSet::new();
|
||||
let mut n = 0;
|
||||
for i in 0..zip.len() {
|
||||
let mut entry = zip.by_index(i)?;
|
||||
let name = entry.name().to_owned();
|
||||
let Some(rel) = src.place(&name) else { continue };
|
||||
let mut body = Vec::with_capacity(entry.size() as usize);
|
||||
entry.read_to_end(&mut body)?;
|
||||
let mut take = |name: &str, body: Vec<u8>| -> Result<()> {
|
||||
let Some(rel) = src.place(name) else { return Ok(()) };
|
||||
if let Some(files) = &src.files {
|
||||
let in_archive = name.strip_prefix(src.strip.as_str()).unwrap_or(&name);
|
||||
let in_archive = name.strip_prefix(src.strip.as_str()).unwrap_or(name);
|
||||
let want = &files[in_archive];
|
||||
let got = hex(&body);
|
||||
if got != *want {
|
||||
@@ -70,6 +66,29 @@ pub fn extract(src: &Source, data: &[u8], dest: &Path) -> Result<usize> {
|
||||
}
|
||||
std::fs::write(&out, &body).with_context(|| format!("writing {}", out.display()))?;
|
||||
n += 1;
|
||||
Ok(())
|
||||
};
|
||||
if data.starts_with(&[0x1f, 0x8b]) {
|
||||
let mut tar = tar::Archive::new(flate2::read::GzDecoder::new(data));
|
||||
for entry in tar.entries().context("not a gzipped tar archive")? {
|
||||
let mut entry = entry?;
|
||||
if !entry.header().entry_type().is_file() {
|
||||
continue;
|
||||
}
|
||||
let name = entry.path()?.to_string_lossy().trim_start_matches("./").to_owned();
|
||||
let mut body = Vec::with_capacity(entry.size() as usize);
|
||||
entry.read_to_end(&mut body)?;
|
||||
take(&name, body)?;
|
||||
}
|
||||
} else {
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(data)).context("not a zip archive")?;
|
||||
for i in 0..zip.len() {
|
||||
let mut entry = zip.by_index(i)?;
|
||||
let name = entry.name().to_owned();
|
||||
let mut body = Vec::with_capacity(entry.size() as usize);
|
||||
entry.read_to_end(&mut body)?;
|
||||
take(&name, body)?;
|
||||
}
|
||||
}
|
||||
if let Some(files) = &src.files {
|
||||
let missing: Vec<&String> = files.keys().filter(|f| !seen.contains(*f)).collect();
|
||||
|
||||
Reference in new issue
Block a user