In CI, download Tor from for windows Tor Expert Bundle, and build meek, obfs4proxy, and snowflake ourselves

This commit is contained in:
Micah Lee 2022-04-10 19:07:35 -04:00
parent de4dbb54a0
commit e184ca5d03
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 96 additions and 28 deletions

View File

@ -90,15 +90,38 @@ jobs:
cd ~\project\desktop cd ~\project\desktop
poetry install poetry install
- run: - run:
name: Get tor name: Download tor (Windows Expert Bundle)
command: | command: |
cd ~\project\desktop mkdir ~\Downloads\tor
poetry run python .\scripts\get-tor.py cd ~\Downloads\tor
$URL = "https://www.torproject.org/dist/torbrowser/11.0.10/tor-win32-0.4.6.10.zip"
$Filename = "tor-win32-0.4.6.10.zip"
$ExpectedHash = "d3f62317507dbe1a1aa74b9e0e03996dbded2143f94409270828f6a8bcdda16a"
Invoke-WebRequest -Uri $URL -OutFile $Filename
$FileHash = Get-FileHash $Filename
if($FileHash.Hash -ne $ExpectedHash) {
throw "Invalid hash"
}
Expand-Archive -LiteralPath tor-win32-0.4.6.10.zip -DestinationPath ~\project\desktop\onionshare\resources\tor
- run: - run:
name: Build meek name: Build obfs4proxy
command: | command: |
cd ~\project\desktop mkdir ~\Downloads\obfs4proxy
python .\scripts\build-meek-client.py cd Downloads\obfs4proxy
git clone https://gitlab.com/yawning/obfs4
cd obfs4
go build .\obfs4proxy
Move-Item -Path .\obfs4proxy.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe
- run:
name: Build snowflake-client
command: |
go install git.torproject.org/pluggable-transports/snowflake.git/client@latest
Move-Item -Path ~\go\bin\client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe
- run:
name: Build meek-client
command: |
go install git.torproject.org/pluggable-transports/meek.git/meek-client@v0.37.0
Move-Item -Path ~\go\bin\meek-client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\meek-client.exe
- run: - run:
name: Build OnionShare name: Build OnionShare
command: | command: |
@ -138,10 +161,38 @@ jobs:
cd ~\project\desktop cd ~\project\desktop
C:\Python-32bit\Scripts\poetry install C:\Python-32bit\Scripts\poetry install
- run: - run:
name: Get tor name: Download tor (Windows Expert Bundle)
command: |
mkdir ~\Downloads\tor
cd ~\Downloads\tor
$URL = "https://www.torproject.org/dist/torbrowser/11.0.10/tor-win32-0.4.6.10.zip"
$Filename = "tor-win32-0.4.6.10.zip"
$ExpectedHash = "d3f62317507dbe1a1aa74b9e0e03996dbded2143f94409270828f6a8bcdda16a"
Invoke-WebRequest -Uri $URL -OutFile $Filename
$FileHash = Get-FileHash $Filename
if($FileHash.Hash -ne $ExpectedHash) {
throw "Invalid hash"
}
Expand-Archive -LiteralPath tor-win32-0.4.6.10.zip -DestinationPath ~\project\desktop\onionshare\resources\tor
- run:
name: Build obfs4proxy
command: | command: |
cd ~\project\desktop mkdir ~\Downloads\obfs4proxy
C:\Python-32bit\Scripts\poetry run python .\scripts\get-tor.py cd Downloads\obfs4proxy
git clone https://gitlab.com/yawning/obfs4
cd obfs4
"C:\\Program Files (x86)\\Go\\bin\\go" build .\obfs4proxy
Move-Item -Path .\obfs4proxy.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe
- run:
name: Build snowflake-client
command: |
"C:\\Program Files (x86)\\Go\\bin\\go" install git.torproject.org/pluggable-transports/snowflake.git/client@latest
Move-Item -Path ~\go\bin\client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe
- run:
name: Build meek-client
command: |
"C:\\Program Files (x86)\\Go\\bin\\go" install git.torproject.org/pluggable-transports/meek.git/meek-client@v0.37.0
Move-Item -Path ~\go\bin\meek-client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\meek-client.exe
- run: - run:
name: Build meek name: Build meek
command: | command: |

View File

@ -44,6 +44,7 @@ def run(cmd, cwd=None, error_ok=False):
def sign(filename): def sign(filename):
click.echo(f"> Signing {filename}")
run( run(
[ [
shutil.which("signtool"), shutil.which("signtool"),
@ -580,25 +581,41 @@ def codesign(win32_path, win64_path):
return return
for path in paths: for path in paths:
bin_path = os.path.join(path, "onionshare.exe") sign(os.path.join(path, "onionshare.exe"))
click.echo(f"> Signing {bin_path}") sign(os.path.join(path, "onionshare-cli.exe"))
sign(bin_path) sign(
os.path.join(
bin_path = os.path.join(path, "onionshare-cli.exe") path,
click.echo(f"> Signing {bin_path}") "lib",
sign(bin_path) "onionshare",
"resources",
bin_path = os.path.join( "tor",
path, "Tor",
"lib", "meek-client.exe",
"onionshare", )
"resources", )
"tor", sign(
"Tor", os.path.join(
"meek-client.exe", path,
"lib",
"onionshare",
"resources",
"tor",
"Tor",
"obfs4proxy.exe",
)
)
sign(
os.path.join(
path,
"lib",
"onionshare",
"resources",
"tor",
"Tor",
"snowflake-client.exe",
)
) )
click.echo(f"> Signing {bin_path}")
sign(bin_path)
@main.command() @main.command()