upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--README.md13
-rw-r--r--docs/release-verification.md6
-rw-r--r--docs/tor.md16
-rwxr-xr-xscripts/make-release-checksums.sh2
-rwxr-xr-xscripts/package-windows-tor.sh132
6 files changed, 174 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b4d0cf7..d1277a4 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
2# 2#
3# make linux build Bitflash-*-x86_64.AppImage 3# make linux build Bitflash-*-x86_64.AppImage
4# make windows build Bitflash-*-windows.zip (from MSYS2 UCRT64) 4# make windows build Bitflash-*-windows.zip (from MSYS2 UCRT64)
5# make windows-tor build Bitflash-*-windows-with-tor.zip
5# make tests build and run standalone unit tests 6# make tests build and run standalone unit tests
6# make checksums create SHA256SUMS for release assets 7# make checksums create SHA256SUMS for release assets
7# make verify-release TAG=v1.2.13 8# make verify-release TAG=v1.2.13
@@ -180,6 +181,9 @@ windows: deps-windows
180 @zip -r Bitflash-$(VERSION)-windows.zip Bitflash-$(VERSION)-windows/ 181 @zip -r Bitflash-$(VERSION)-windows.zip Bitflash-$(VERSION)-windows/
181 @echo "Built: Bitflash-$(VERSION)-windows.zip" 182 @echo "Built: Bitflash-$(VERSION)-windows.zip"
182 183
184windows-tor: windows
185 ./scripts/package-windows-tor.sh
186
183# ---- Clean ---------------------------------------------------------------- 187# ---- Clean ----------------------------------------------------------------
184 188
185clean: 189clean:
@@ -206,6 +210,6 @@ sign-checksums:
206verify-release: 210verify-release:
207 ./scripts/verify-release.sh $(if $(TAG),$(TAG),latest) 211 ./scripts/verify-release.sh $(if $(TAG),$(TAG),latest)
208 212
209.PHONY: linux windows clean appimage \ 213.PHONY: linux windows windows-tor clean appimage \
210 tests fuzz-net-message-smoke fuzz-script-smoke checksums sign-checksums verify-release \ 214 tests fuzz-net-message-smoke fuzz-script-smoke checksums sign-checksums verify-release \
211 deps-linux deps-windows deps-apt deps-secp256k1 deps-randomx 215 deps-linux deps-windows deps-apt deps-secp256k1 deps-randomx
diff --git a/README.md b/README.md
index a7ce2b2..c30f171 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,8 @@ configuration — it connects automatically and starts syncing.
52**Linux:** make the `.AppImage` executable and run it. 52**Linux:** make the `.AppImage` executable and run it.
53 53
54**Windows:** extract the `-windows.zip` and run `Bitflash.exe`. 54**Windows:** extract the `-windows.zip` and run `Bitflash.exe`.
55If you want managed Tor without a separate Tor install, use the
56`-windows-with-tor.zip` package and start Bitflash with `-managedtor`.
55 57
56Every release ships a `SHA256SUMS` covering the assets. Verifying takes a second 58Every release ships a `SHA256SUMS` covering the assets. Verifying takes a second
57and is worth doing: 59and is worth doing:
@@ -452,6 +454,17 @@ make windows
452``` 454```
453Installs deps via pacman, produces `Bitflash-*-windows.zip`. 455Installs deps via pacman, produces `Bitflash-*-windows.zip`.
454 456
457To build the Windows package that also carries the Tor Expert Bundle:
458
459```bash
460make windows-tor
461```
462
463That produces `Bitflash-*-windows-with-tor.zip`. The release script downloads
464the Tor Expert Bundle from the official Tor archive, verifies its pinned SHA256,
465and places `tor/tor.exe` beside `Bitflash.exe` so `-managedtor` works without a
466separate Tor install.
467
455--- 468---
456 469
457## At a glance 470## At a glance
diff --git a/docs/release-verification.md b/docs/release-verification.md
index 408bab9..04d18a3 100644
--- a/docs/release-verification.md
+++ b/docs/release-verification.md
@@ -81,6 +81,12 @@ Publish, alongside the assets, `SHA256SUMS` and `SHA256SUMS.asc`, and update
81is ever rotated, announce the new fingerprint clearly and update the embedded 81is ever rotated, announce the new fingerprint clearly and update the embedded
82key in `verify-release.sh`. 82key in `verify-release.sh`.
83 83
84For Windows releases with managed Tor built in, run `make windows-tor`. It
85creates `Bitflash-*-windows-with-tor.zip` by downloading the Tor Expert Bundle,
86checking the pinned SHA256 in `scripts/package-windows-tor.sh`, and placing
87`tor/tor.exe` next to `Bitflash.exe`. Include that zip in `SHA256SUMS` like any
88other release asset.
89
84## Why this matters 90## Why this matters
85 91
86`SHA256SUMS` alone protects against a broken download, but not against someone 92`SHA256SUMS` alone protects against a broken download, but not against someone
diff --git a/docs/tor.md b/docs/tor.md
index 1c0f589..be6a145 100644
--- a/docs/tor.md
+++ b/docs/tor.md
@@ -53,6 +53,22 @@ Without a value, Bitflash looks for Tor in this order:
532. `tor.exe` or `tor` beside the Bitflash binary; 532. `tor.exe` or `tor` beside the Bitflash binary;
543. `tor.exe` or `tor` on `PATH`. 543. `tor.exe` or `tor` on `PATH`.
55 55
56Windows releases can also be built as `Bitflash-*-windows-with-tor.zip`. That
57package includes the official Tor Expert Bundle under `tor/`, so the first path
58above exists immediately after extraction and `bitflash -managedtor` needs no
59separate Tor install.
60
61The bundled-Tor package is created by:
62
63```bash
64make windows-tor
65```
66
67The packaging script verifies a pinned SHA256 for the downloaded Tor Expert
68Bundle before copying it into the release directory. The Tor binary is bundled;
69the runtime data directory, hidden-service key, and control cookie are still
70created under the user's Bitflash data directory.
71
56To point at a specific Tor executable: 72To point at a specific Tor executable:
57 73
58```bash 74```bash
diff --git a/scripts/make-release-checksums.sh b/scripts/make-release-checksums.sh
index 5b29e2d..9c4f45a 100755
--- a/scripts/make-release-checksums.sh
+++ b/scripts/make-release-checksums.sh
@@ -10,6 +10,7 @@ Usage: scripts/make-release-checksums.sh [--sign] [--local-user KEYID]
10 10
11Creates SHA256SUMS for release assets in the current directory: 11Creates SHA256SUMS for release assets in the current directory:
12 Bitflash-*-windows.zip 12 Bitflash-*-windows.zip
13 Bitflash-*-windows-with-tor.zip
13 Bitflash-*-x86_64.AppImage 14 Bitflash-*-x86_64.AppImage
14 bitflash-node-*-x86_64 15 bitflash-node-*-x86_64
15 16
@@ -44,6 +45,7 @@ fi
44assets=() 45assets=()
45for pattern in \ 46for pattern in \
46 "Bitflash-*-windows.zip" \ 47 "Bitflash-*-windows.zip" \
48 "Bitflash-*-windows-with-tor.zip" \
47 "Bitflash-*-x86_64.AppImage" \ 49 "Bitflash-*-x86_64.AppImage" \
48 "bitflash-node-*-x86_64" 50 "bitflash-node-*-x86_64"
49do 51do
diff --git a/scripts/package-windows-tor.sh b/scripts/package-windows-tor.sh
new file mode 100755
index 0000000..084fd1a
--- /dev/null
+++ b/scripts/package-windows-tor.sh
@@ -0,0 +1,132 @@
1#!/usr/bin/env bash
2set -euo pipefail
3
4ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5VERSION="${VERSION:-$(sed -n 's/^VERSION[[:space:]]*:= *//p' "$ROOT/Makefile" | head -1)}"
6
7TOR_VERSION="${TOR_VERSION:-15.0.19}"
8TOR_ARCHIVE_NAME="tor-expert-bundle-windows-x86_64-${TOR_VERSION}.tar.gz"
9TOR_URL="${TOR_URL:-https://archive.torproject.org/tor-package-archive/torbrowser/${TOR_VERSION}/${TOR_ARCHIVE_NAME}}"
10TOR_SHA256="${TOR_SHA256:-6AC067402C7B4A3DC37887ED3754B3914B67FDC220C966190683E9CCF91ABF0F}"
11
12BUNDLE_DIR="${BUNDLE_DIR:-$ROOT/Bitflash-${VERSION}-windows}"
13OUT_ZIP="${OUT_ZIP:-$ROOT/Bitflash-${VERSION}-windows-with-tor.zip}"
14CACHE_DIR="${CACHE_DIR:-$ROOT/.cache}"
15ARCHIVE="${TOR_ARCHIVE:-$CACHE_DIR/$TOR_ARCHIVE_NAME}"
16
17usage() {
18 cat <<EOF
19Usage: scripts/package-windows-tor.sh
20
21Creates Bitflash-${VERSION}-windows-with-tor.zip from an existing
22Bitflash-${VERSION}-windows/ release directory.
23
24Environment overrides:
25 VERSION Bitflash release version, default read from Makefile
26 TOR_VERSION Tor Expert Bundle version, default ${TOR_VERSION}
27 TOR_URL Download URL, default official Tor archive URL
28 TOR_SHA256 Expected archive SHA256
29 TOR_ARCHIVE Use an existing archive instead of downloading
30 BUNDLE_DIR Existing unpacked Windows release directory
31 OUT_ZIP Output zip path
32EOF
33}
34
35if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
36 usage
37 exit 0
38fi
39
40need() {
41 command -v "$1" >/dev/null 2>&1 || {
42 echo "missing required command: $1" >&2
43 exit 1
44 }
45}
46
47need sha256sum
48need tar
49need zip
50
51if [ ! -d "$BUNDLE_DIR" ]; then
52 echo "missing Windows release directory: $BUNDLE_DIR" >&2
53 echo "run 'make windows' first, or set BUNDLE_DIR" >&2
54 exit 1
55fi
56if [ ! -f "$BUNDLE_DIR/Bitflash.exe" ]; then
57 echo "missing Bitflash.exe in $BUNDLE_DIR" >&2
58 exit 1
59fi
60BUNDLE_PARENT="$(cd "$(dirname "$BUNDLE_DIR")" && pwd)"
61BUNDLE_NAME="$(basename "$BUNDLE_DIR")"
62OUT_PARENT="$(mkdir -p "$(dirname "$OUT_ZIP")" && cd "$(dirname "$OUT_ZIP")" && pwd)"
63OUT_NAME="$(basename "$OUT_ZIP")"
64OUT_ZIP_ABS="$OUT_PARENT/$OUT_NAME"
65
66mkdir -p "$CACHE_DIR"
67if [ ! -f "$ARCHIVE" ]; then
68 if command -v curl >/dev/null 2>&1; then
69 curl -L --fail --output "$ARCHIVE" "$TOR_URL"
70 elif command -v wget >/dev/null 2>&1; then
71 wget -O "$ARCHIVE" "$TOR_URL"
72 else
73 echo "missing required command: curl or wget" >&2
74 exit 1
75 fi
76fi
77
78got="$(sha256sum "$ARCHIVE" | awk '{print tolower($1)}')"
79want="$(printf '%s' "$TOR_SHA256" | tr 'A-F' 'a-f')"
80if [ "$got" != "$want" ]; then
81 echo "Tor archive SHA256 mismatch" >&2
82 echo " expected: $want" >&2
83 echo " got: $got" >&2
84 exit 1
85fi
86
87tmp="$(mktemp -d "${TMPDIR:-/tmp}/bitflash-tor-package.XXXXXX")"
88trap 'rm -rf "$tmp"' EXIT
89
90mkdir -p "$tmp/extract"
91tar -xzf "$ARCHIVE" -C "$tmp/extract"
92
93if [ ! -f "$tmp/extract/tor/tor.exe" ]; then
94 echo "Tor archive did not contain tor/tor.exe" >&2
95 exit 1
96fi
97
98rm -rf "$BUNDLE_DIR/tor"
99mkdir -p "$BUNDLE_DIR/tor"
100cp -R "$tmp/extract/tor/." "$BUNDLE_DIR/tor/"
101if [ -d "$tmp/extract/docs" ]; then
102 mkdir -p "$BUNDLE_DIR/tor/docs"
103 cp -R "$tmp/extract/docs/." "$BUNDLE_DIR/tor/docs/"
104fi
105if [ -d "$tmp/extract/data" ]; then
106 mkdir -p "$BUNDLE_DIR/tor/data-defaults"
107 cp -R "$tmp/extract/data/." "$BUNDLE_DIR/tor/data-defaults/"
108fi
109
110cat > "$BUNDLE_DIR/TOR-EXPERT-BUNDLE.txt" <<EOF
111Bitflash managed Tor bundle
112
113This Windows package includes the Tor Expert Bundle so -managedtor can start
114Tor without requiring a separate Tor install.
115
116Tor Expert Bundle: ${TOR_VERSION}
117Archive URL: ${TOR_URL}
118Archive SHA256: ${TOR_SHA256}
119
120Bitflash uses tor/tor.exe from this package. Runtime state, hidden-service keys,
121and control authentication cookies are written under the user's Bitflash data
122directory, not inside this release directory.
123EOF
124
125rm -f "$OUT_ZIP_ABS"
126(
127 cd "$BUNDLE_PARENT"
128 zip -qr "$OUT_ZIP_ABS" "$BUNDLE_NAME"
129)
130
131echo "Bundled Tor Expert Bundle ${TOR_VERSION}"
132echo "Built: $OUT_ZIP_ABS"