diff options
| author | Bitflash <admin@bitflash.network> | 2026-08-13 14:39:40 -0300 |
|---|---|---|
| committer | Bitflash <admin@bitflash.network> | 2026-08-13 14:39:40 -0300 |
| commit | 8e21e8ca0b8d50c29376bc2f0a89575baa477213 (patch) | |
| tree | 4590b138ec6fb4848004ffa224273b7b6bb45e38 | |
| parent | 5dec9b16a5b98ed0e24ec7113b867f22be2d0026 (diff) | |
| parent | 03e583395c42124521d09287bef29bf1d1bbe59b (diff) | |
Merge pull request 'release: package Windows builds with managed Tor' (#34) from windows-managed-tor-package into main
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | README.md | 15 | ||||
| -rw-r--r-- | docs/release-verification.md | 8 | ||||
| -rw-r--r-- | docs/tor.md | 19 | ||||
| -rwxr-xr-x | scripts/make-release-checksums.sh | 2 | ||||
| -rwxr-xr-x | scripts/package-windows-tor.sh | 187 |
6 files changed, 236 insertions, 1 deletions
| @@ -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 | ||
| 184 | windows-tor: windows | ||
| 185 | ./scripts/package-windows-tor.sh | ||
| 186 | |||
| 183 | # ---- Clean ---------------------------------------------------------------- | 187 | # ---- Clean ---------------------------------------------------------------- |
| 184 | 188 | ||
| 185 | clean: | 189 | clean: |
| @@ -206,6 +210,6 @@ sign-checksums: | |||
| 206 | verify-release: | 210 | verify-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 |
| @@ -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`. |
| 55 | If you want managed Tor without a separate Tor install, use the | ||
| 56 | `-windows-with-tor.zip` package and start Bitflash with `-managedtor`. | ||
| 55 | 57 | ||
| 56 | Every release ships a `SHA256SUMS` covering the assets. Verifying takes a second | 58 | Every release ships a `SHA256SUMS` covering the assets. Verifying takes a second |
| 57 | and is worth doing: | 59 | and is worth doing: |
| @@ -452,6 +454,19 @@ make windows | |||
| 452 | ``` | 454 | ``` |
| 453 | Installs deps via pacman, produces `Bitflash-*-windows.zip`. | 455 | Installs deps via pacman, produces `Bitflash-*-windows.zip`. |
| 454 | 456 | ||
| 457 | To build the Windows package that also carries the Tor Expert Bundle: | ||
| 458 | |||
| 459 | ```bash | ||
| 460 | make windows-tor | ||
| 461 | ``` | ||
| 462 | |||
| 463 | That produces `Bitflash-*-windows-with-tor.zip`. The release script downloads | ||
| 464 | the Tor Expert Bundle from the official Tor archive, verifies its pinned SHA256, | ||
| 465 | optionally verifies the Tor Project GPG signature when `gpg` is available, and | ||
| 466 | places `tor/tor.exe` beside `Bitflash.exe` so `-managedtor` works without a | ||
| 467 | separate Tor install. For release builds, use `TOR_VERIFY_GPG=required make | ||
| 468 | windows-tor` to require the extra signature check. | ||
| 469 | |||
| 455 | --- | 470 | --- |
| 456 | 471 | ||
| 457 | ## At a glance | 472 | ## At a glance |
diff --git a/docs/release-verification.md b/docs/release-verification.md index 408bab9..b8eaf5e 100644 --- a/docs/release-verification.md +++ b/docs/release-verification.md | |||
| @@ -81,6 +81,14 @@ Publish, alongside the assets, `SHA256SUMS` and `SHA256SUMS.asc`, and update | |||
| 81 | is ever rotated, announce the new fingerprint clearly and update the embedded | 81 | is ever rotated, announce the new fingerprint clearly and update the embedded |
| 82 | key in `verify-release.sh`. | 82 | key in `verify-release.sh`. |
| 83 | 83 | ||
| 84 | For Windows releases with managed Tor built in, run `make windows-tor`. It | ||
| 85 | creates `Bitflash-*-windows-with-tor.zip` by downloading the Tor Expert Bundle, | ||
| 86 | checking the pinned SHA256 in `scripts/package-windows-tor.sh`, optionally | ||
| 87 | verifying the Tor Project `.asc` signature, and placing `tor/tor.exe` next to | ||
| 88 | `Bitflash.exe`. For release builds, run `TOR_VERIFY_GPG=required make | ||
| 89 | windows-tor` so the signature check is mandatory. Include that zip in | ||
| 90 | `SHA256SUMS` like any other release asset. | ||
| 91 | |||
| 84 | ## Why this matters | 92 | ## Why this matters |
| 85 | 93 | ||
| 86 | `SHA256SUMS` alone protects against a broken download, but not against someone | 94 | `SHA256SUMS` alone protects against a broken download, but not against someone |
diff --git a/docs/tor.md b/docs/tor.md index 1c0f589..a408704 100644 --- a/docs/tor.md +++ b/docs/tor.md | |||
| @@ -53,6 +53,25 @@ Without a value, Bitflash looks for Tor in this order: | |||
| 53 | 2. `tor.exe` or `tor` beside the Bitflash binary; | 53 | 2. `tor.exe` or `tor` beside the Bitflash binary; |
| 54 | 3. `tor.exe` or `tor` on `PATH`. | 54 | 3. `tor.exe` or `tor` on `PATH`. |
| 55 | 55 | ||
| 56 | Windows releases can also be built as `Bitflash-*-windows-with-tor.zip`. That | ||
| 57 | package includes the official Tor Expert Bundle under `tor/`, so the first path | ||
| 58 | above exists immediately after extraction and `bitflash -managedtor` needs no | ||
| 59 | separate Tor install. | ||
| 60 | |||
| 61 | The bundled-Tor package is created by: | ||
| 62 | |||
| 63 | ```bash | ||
| 64 | make windows-tor | ||
| 65 | ``` | ||
| 66 | |||
| 67 | The packaging script verifies a pinned SHA256 for the downloaded Tor Expert | ||
| 68 | Bundle before copying it into the release directory. When `gpg` is available it | ||
| 69 | also verifies the matching `.asc` signature against the pinned Tor Browser | ||
| 70 | Developers signing-key fingerprint. Release builds should use | ||
| 71 | `TOR_VERIFY_GPG=required make windows-tor` to make that second check mandatory. | ||
| 72 | The Tor binary is bundled; the runtime data directory, hidden-service key, and | ||
| 73 | control cookie are still created under the user's Bitflash data directory. | ||
| 74 | |||
| 56 | To point at a specific Tor executable: | 75 | To point at a specific Tor executable: |
| 57 | 76 | ||
| 58 | ```bash | 77 | ```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 | ||
| 11 | Creates SHA256SUMS for release assets in the current directory: | 11 | Creates 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 | |||
| 44 | assets=() | 45 | assets=() |
| 45 | for pattern in \ | 46 | for 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" |
| 49 | do | 51 | do |
diff --git a/scripts/package-windows-tor.sh b/scripts/package-windows-tor.sh new file mode 100755 index 0000000..c8cca3b --- /dev/null +++ b/scripts/package-windows-tor.sh | |||
| @@ -0,0 +1,187 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | set -euo pipefail | ||
| 3 | |||
| 4 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| 5 | VERSION="${VERSION:-$(sed -n 's/^VERSION[[:space:]]*:= *//p' "$ROOT/Makefile" | head -1)}" | ||
| 6 | |||
| 7 | TOR_VERSION="${TOR_VERSION:-15.0.19}" | ||
| 8 | TOR_ARCHIVE_NAME="tor-expert-bundle-windows-x86_64-${TOR_VERSION}.tar.gz" | ||
| 9 | TOR_URL="${TOR_URL:-https://archive.torproject.org/tor-package-archive/torbrowser/${TOR_VERSION}/${TOR_ARCHIVE_NAME}}" | ||
| 10 | TOR_SHA256="${TOR_SHA256:-6AC067402C7B4A3DC37887ED3754B3914B67FDC220C966190683E9CCF91ABF0F}" | ||
| 11 | TOR_ASC_URL="${TOR_ASC_URL:-${TOR_URL}.asc}" | ||
| 12 | TOR_SIGNING_KEY_FINGERPRINT="${TOR_SIGNING_KEY_FINGERPRINT:-EF6E286DDA85EA2A4BA7DE684E2C6E8793298290}" | ||
| 13 | TOR_VERIFY_GPG="${TOR_VERIFY_GPG:-auto}" | ||
| 14 | |||
| 15 | BUNDLE_DIR="${BUNDLE_DIR:-$ROOT/Bitflash-${VERSION}-windows}" | ||
| 16 | OUT_ZIP="${OUT_ZIP:-$ROOT/Bitflash-${VERSION}-windows-with-tor.zip}" | ||
| 17 | CACHE_DIR="${CACHE_DIR:-$ROOT/.cache}" | ||
| 18 | ARCHIVE="${TOR_ARCHIVE:-$CACHE_DIR/$TOR_ARCHIVE_NAME}" | ||
| 19 | ASC_FILE="${TOR_ASC:-$ARCHIVE.asc}" | ||
| 20 | |||
| 21 | usage() { | ||
| 22 | cat <<EOF | ||
| 23 | Usage: scripts/package-windows-tor.sh | ||
| 24 | |||
| 25 | Creates Bitflash-${VERSION}-windows-with-tor.zip from an existing | ||
| 26 | Bitflash-${VERSION}-windows/ release directory. | ||
| 27 | |||
| 28 | Environment overrides: | ||
| 29 | VERSION Bitflash release version, default read from Makefile | ||
| 30 | TOR_VERSION Tor Expert Bundle version, default ${TOR_VERSION} | ||
| 31 | TOR_URL Download URL, default official Tor archive URL | ||
| 32 | TOR_ASC_URL Signature URL, default TOR_URL.asc | ||
| 33 | TOR_SHA256 Expected archive SHA256 | ||
| 34 | TOR_ARCHIVE Use an existing archive instead of downloading | ||
| 35 | TOR_ASC Use an existing detached signature | ||
| 36 | TOR_VERIFY_GPG auto, required, or off; default auto | ||
| 37 | BUNDLE_DIR Existing unpacked Windows release directory | ||
| 38 | OUT_ZIP Output zip path | ||
| 39 | EOF | ||
| 40 | } | ||
| 41 | |||
| 42 | if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then | ||
| 43 | usage | ||
| 44 | exit 0 | ||
| 45 | fi | ||
| 46 | |||
| 47 | need() { | ||
| 48 | command -v "$1" >/dev/null 2>&1 || { | ||
| 49 | echo "missing required command: $1" >&2 | ||
| 50 | exit 1 | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | need sha256sum | ||
| 55 | need tar | ||
| 56 | need zip | ||
| 57 | |||
| 58 | download() { | ||
| 59 | local url="$1" | ||
| 60 | local out="$2" | ||
| 61 | if command -v curl >/dev/null 2>&1; then | ||
| 62 | curl -L --fail --output "$out" "$url" | ||
| 63 | elif command -v wget >/dev/null 2>&1; then | ||
| 64 | wget -O "$out" "$url" | ||
| 65 | else | ||
| 66 | echo "missing required command: curl or wget" >&2 | ||
| 67 | exit 1 | ||
| 68 | fi | ||
| 69 | } | ||
| 70 | |||
| 71 | if [ ! -d "$BUNDLE_DIR" ]; then | ||
| 72 | echo "missing Windows release directory: $BUNDLE_DIR" >&2 | ||
| 73 | echo "run 'make windows' first, or set BUNDLE_DIR" >&2 | ||
| 74 | exit 1 | ||
| 75 | fi | ||
| 76 | if [ ! -f "$BUNDLE_DIR/Bitflash.exe" ]; then | ||
| 77 | echo "missing Bitflash.exe in $BUNDLE_DIR" >&2 | ||
| 78 | exit 1 | ||
| 79 | fi | ||
| 80 | BUNDLE_PARENT="$(cd "$(dirname "$BUNDLE_DIR")" && pwd)" | ||
| 81 | BUNDLE_NAME="$(basename "$BUNDLE_DIR")" | ||
| 82 | OUT_PARENT="$(mkdir -p "$(dirname "$OUT_ZIP")" && cd "$(dirname "$OUT_ZIP")" && pwd)" | ||
| 83 | OUT_NAME="$(basename "$OUT_ZIP")" | ||
| 84 | OUT_ZIP_ABS="$OUT_PARENT/$OUT_NAME" | ||
| 85 | |||
| 86 | mkdir -p "$CACHE_DIR" | ||
| 87 | if [ ! -f "$ARCHIVE" ]; then | ||
| 88 | download "$TOR_URL" "$ARCHIVE" | ||
| 89 | fi | ||
| 90 | |||
| 91 | got="$(sha256sum "$ARCHIVE" | awk '{print tolower($1)}')" | ||
| 92 | want="$(printf '%s' "$TOR_SHA256" | tr 'A-F' 'a-f')" | ||
| 93 | if [ "$got" != "$want" ]; then | ||
| 94 | echo "Tor archive SHA256 mismatch" >&2 | ||
| 95 | echo " expected: $want" >&2 | ||
| 96 | echo " got: $got" >&2 | ||
| 97 | exit 1 | ||
| 98 | fi | ||
| 99 | |||
| 100 | tmp="$(mktemp -d "${TMPDIR:-/tmp}/bitflash-tor-package.XXXXXX")" | ||
| 101 | trap 'rm -rf "$tmp"' EXIT | ||
| 102 | |||
| 103 | case "$TOR_VERIFY_GPG" in | ||
| 104 | auto|required|off) ;; | ||
| 105 | *) echo "TOR_VERIFY_GPG must be auto, required, or off" >&2; exit 2 ;; | ||
| 106 | esac | ||
| 107 | |||
| 108 | if [ "$TOR_VERIFY_GPG" != "off" ]; then | ||
| 109 | if command -v gpg >/dev/null 2>&1; then | ||
| 110 | if [ ! -f "$ASC_FILE" ]; then | ||
| 111 | download "$TOR_ASC_URL" "$ASC_FILE" | ||
| 112 | fi | ||
| 113 | gnupg_home="$tmp/gnupg" | ||
| 114 | mkdir -p "$gnupg_home" | ||
| 115 | chmod 0700 "$gnupg_home" | ||
| 116 | gpg --homedir "$gnupg_home" --batch --auto-key-locate nodefault,wkd,keyserver \ | ||
| 117 | --locate-keys torbrowser@torproject.org >/dev/null 2>&1 || { | ||
| 118 | if [ "$TOR_VERIFY_GPG" = "required" ]; then | ||
| 119 | echo "could not import Tor Browser Developers signing key" >&2 | ||
| 120 | exit 1 | ||
| 121 | fi | ||
| 122 | echo "WARNING: skipped Tor GPG signature verification; signing key import failed" >&2 | ||
| 123 | } | ||
| 124 | if gpg --homedir "$gnupg_home" --batch --with-colons --fingerprint "$TOR_SIGNING_KEY_FINGERPRINT" \ | ||
| 125 | 2>/dev/null | grep -q "^fpr:::::::::${TOR_SIGNING_KEY_FINGERPRINT}:"; then | ||
| 126 | gpg --homedir "$gnupg_home" --batch --verify "$ASC_FILE" "$ARCHIVE" >/dev/null 2>&1 || { | ||
| 127 | echo "Tor archive GPG signature verification failed" >&2 | ||
| 128 | exit 1 | ||
| 129 | } | ||
| 130 | echo "Tor archive GPG signature verified against ${TOR_SIGNING_KEY_FINGERPRINT}" | ||
| 131 | elif [ "$TOR_VERIFY_GPG" = "required" ]; then | ||
| 132 | echo "Tor signing key fingerprint mismatch" >&2 | ||
| 133 | exit 1 | ||
| 134 | else | ||
| 135 | echo "WARNING: skipped Tor GPG signature verification; signing key fingerprint was not available" >&2 | ||
| 136 | fi | ||
| 137 | elif [ "$TOR_VERIFY_GPG" = "required" ]; then | ||
| 138 | echo "missing required command for TOR_VERIFY_GPG=required: gpg" >&2 | ||
| 139 | exit 1 | ||
| 140 | else | ||
| 141 | echo "WARNING: gpg not found; relying on pinned SHA256 only" >&2 | ||
| 142 | fi | ||
| 143 | fi | ||
| 144 | |||
| 145 | mkdir -p "$tmp/extract" | ||
| 146 | tar -xzf "$ARCHIVE" -C "$tmp/extract" | ||
| 147 | |||
| 148 | if [ ! -f "$tmp/extract/tor/tor.exe" ]; then | ||
| 149 | echo "Tor archive did not contain tor/tor.exe" >&2 | ||
| 150 | exit 1 | ||
| 151 | fi | ||
| 152 | |||
| 153 | rm -rf "$BUNDLE_DIR/tor" | ||
| 154 | mkdir -p "$BUNDLE_DIR/tor" | ||
| 155 | cp -R "$tmp/extract/tor/." "$BUNDLE_DIR/tor/" | ||
| 156 | if [ -d "$tmp/extract/docs" ]; then | ||
| 157 | mkdir -p "$BUNDLE_DIR/tor/docs" | ||
| 158 | cp -R "$tmp/extract/docs/." "$BUNDLE_DIR/tor/docs/" | ||
| 159 | fi | ||
| 160 | if [ -d "$tmp/extract/data" ]; then | ||
| 161 | mkdir -p "$BUNDLE_DIR/tor/data-defaults" | ||
| 162 | cp -R "$tmp/extract/data/." "$BUNDLE_DIR/tor/data-defaults/" | ||
| 163 | fi | ||
| 164 | |||
| 165 | cat > "$BUNDLE_DIR/TOR-EXPERT-BUNDLE.txt" <<EOF | ||
| 166 | Bitflash managed Tor bundle | ||
| 167 | |||
| 168 | This Windows package includes the Tor Expert Bundle so -managedtor can start | ||
| 169 | Tor without requiring a separate Tor install. | ||
| 170 | |||
| 171 | Tor Expert Bundle: ${TOR_VERSION} | ||
| 172 | Archive URL: ${TOR_URL} | ||
| 173 | Archive SHA256: ${TOR_SHA256} | ||
| 174 | |||
| 175 | Bitflash uses tor/tor.exe from this package. Runtime state, hidden-service keys, | ||
| 176 | and control authentication cookies are written under the user's Bitflash data | ||
| 177 | directory, not inside this release directory. | ||
| 178 | EOF | ||
| 179 | |||
| 180 | rm -f "$OUT_ZIP_ABS" | ||
| 181 | ( | ||
| 182 | cd "$BUNDLE_PARENT" | ||
| 183 | zip -qr "$OUT_ZIP_ABS" "$BUNDLE_NAME" | ||
| 184 | ) | ||
| 185 | |||
| 186 | echo "Bundled Tor Expert Bundle ${TOR_VERSION}" | ||
| 187 | echo "Built: $OUT_ZIP_ABS" | ||