From 368660196d93c0dc218b8e74995228fd8bcad514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 2 May 2024 23:34:48 +0200 Subject: [PATCH 1/9] transfer-ci: upgrade to debian bookworm --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4582ac..d929eb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: name: "Test BitTorrent file transfers (UDP, HTTP, WebTorrent)" timeout-minutes: 20 container: - image: rust:1-bullseye + image: rust:1-bookworm options: --ulimit memlock=524288:524288 steps: - name: Checkout From 279f4601998ef93243ee353a38311347eddf2e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 2 May 2024 23:42:20 +0200 Subject: [PATCH 2/9] transfer ci: use subjectAltName in cert --- .github/actions/test-file-transfers/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test-file-transfers/entrypoint.sh b/.github/actions/test-file-transfers/entrypoint.sh index 9cd5081..e0dff41 100755 --- a/.github/actions/test-file-transfers/entrypoint.sh +++ b/.github/actions/test-file-transfers/entrypoint.sh @@ -40,7 +40,7 @@ fi $SUDO echo "127.0.0.1 example.com" >> /etc/hosts openssl ecparam -genkey -name prime256v1 -out key.pem -openssl req -new -sha256 -key key.pem -out csr.csr -subj "/C=GB/ST=Test/L=Test/O=Test/OU=Test/CN=example.com" +openssl req -new -sha256 -key key.pem -out csr.csr -subj "/C=GB/ST=Test/L=Test/O=Test/OU=Test/CN=example.com" -addext "subjectAltName = DNS:example.com" openssl req -x509 -sha256 -nodes -days 365 -key key.pem -in csr.csr -out cert.crt openssl pkcs8 -in key.pem -topk8 -nocrypt -out key.pk8 From 4120e227c9bf589ad954054436e1c59ed1954434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 2 May 2024 23:48:13 +0200 Subject: [PATCH 3/9] Clean up transfer-ci script --- .../actions/test-file-transfers/entrypoint.sh | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/actions/test-file-transfers/entrypoint.sh b/.github/actions/test-file-transfers/entrypoint.sh index e0dff41..64d775b 100755 --- a/.github/actions/test-file-transfers/entrypoint.sh +++ b/.github/actions/test-file-transfers/entrypoint.sh @@ -22,6 +22,7 @@ $SUDO apt-get install -y cmake libssl-dev screen rtorrent mktorrent ssl-cert ca- git clone https://github.com/anacrolix/torrent.git gotorrent cd gotorrent +# Use commit known to work git checkout 16176b762e4a840fc5dfe3b1dfd2d6fa853b68d7 go build -o $HOME/gotorrent ./cmd/torrent cd .. @@ -51,12 +52,22 @@ $SUDO update-ca-certificates cargo build --bin aquatic +# UDP +echo " +log_level = 'debug' + +[network] +address = '127.0.0.1:3000'" > udp.toml +./target/debug/aquatic udp -c udp.toml > "$HOME/udp.log" 2>&1 & + +# HTTP echo "log_level = 'debug' [network] address = '127.0.0.1:3004'" > http.toml ./target/debug/aquatic http -c http.toml > "$HOME/http.log" 2>&1 & +# HTTP with TLS echo "log_level = 'debug' [network] @@ -67,13 +78,16 @@ tls_private_key_path = './key.pk8' " > tls.toml ./target/debug/aquatic http -c tls.toml > "$HOME/tls.log" 2>&1 & -echo " -log_level = 'debug' +# WebTorrent +echo "log_level = 'debug' [network] -address = '127.0.0.1:3000'" > udp.toml -./target/debug/aquatic udp -c udp.toml > "$HOME/udp.log" 2>&1 & +address = '127.0.0.1:3003' +enable_http_health_checks = true +" > ws.toml +./target/debug/aquatic ws -c ws.toml > "$HOME/ws.log" 2>&1 & +# WebTorrent with TLS echo "log_level = 'debug' [network] @@ -84,14 +98,6 @@ tls_private_key_path = './key.pk8' " > ws-tls.toml ./target/debug/aquatic ws -c ws-tls.toml > "$HOME/ws-tls.log" 2>&1 & -echo "log_level = 'debug' - -[network] -address = '127.0.0.1:3003' -enable_http_health_checks = true -" > ws.toml -./target/debug/aquatic ws -c ws.toml > "$HOME/ws.log" 2>&1 & - # Setup directories cd "$HOME" From f7ac21770b9fb33732133a092f10ab507dd41aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 2 May 2024 23:48:46 +0200 Subject: [PATCH 4/9] transfer-ci: remove GODEBUG=x509ignoreCN=0 statement for gotorrent --- .github/actions/test-file-transfers/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/test-file-transfers/entrypoint.sh b/.github/actions/test-file-transfers/entrypoint.sh index 64d775b..7c0abc5 100755 --- a/.github/actions/test-file-transfers/entrypoint.sh +++ b/.github/actions/test-file-transfers/entrypoint.sh @@ -160,12 +160,12 @@ screen -dmS rtorrent-leech rtorrent echo "Starting leeching ws-tls (wss) client" cd leech -GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43000" ../torrents/ws-tls-ipv4.torrent > "$HOME/ws-tls-leech.log" 2>&1 & +GOPPROF=http $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43000" ../torrents/ws-tls-ipv4.torrent > "$HOME/ws-tls-leech.log" 2>&1 & cd .. echo "Starting leeching ws client" cd leech -GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43001" ../torrents/ws-ipv4.torrent > "$HOME/ws-leech.log" 2>&1 & +GOPPROF=http $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --addr ":43001" ../torrents/ws-ipv4.torrent > "$HOME/ws-leech.log" 2>&1 & cd .. # Check for completion From 2e5b8c633493ffd871536584340e149aea721dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 2 May 2024 23:58:18 +0200 Subject: [PATCH 5/9] transfer ci: use other ssl cert gen method --- .../actions/test-file-transfers/entrypoint.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/actions/test-file-transfers/entrypoint.sh b/.github/actions/test-file-transfers/entrypoint.sh index 7c0abc5..eb89691 100755 --- a/.github/actions/test-file-transfers/entrypoint.sh +++ b/.github/actions/test-file-transfers/entrypoint.sh @@ -40,12 +40,14 @@ fi $SUDO echo "127.0.0.1 example.com" >> /etc/hosts -openssl ecparam -genkey -name prime256v1 -out key.pem -openssl req -new -sha256 -key key.pem -out csr.csr -subj "/C=GB/ST=Test/L=Test/O=Test/OU=Test/CN=example.com" -addext "subjectAltName = DNS:example.com" -openssl req -x509 -sha256 -nodes -days 365 -key key.pem -in csr.csr -out cert.crt -openssl pkcs8 -in key.pem -topk8 -nocrypt -out key.pk8 +openssl ecparam -genkey -name prime256v1 -out ca.key +openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=Acme Root CA" -out ca.crt +openssl req -newkey prime256v1 -nodes -keyout server.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=*.example.com" -out server.csr +openssl x509 -req -extfile <(printf "subjectAltName=DNS:example.com,DNS:www.example.com") -days 365 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt +openssl pkcs8 -in ca.key -topk8 -nocrypt -out key.pk8 -$SUDO cp cert.crt /usr/local/share/ca-certificates/snakeoil.crt +$SUDO cp ca.crt /usr/local/share/ca-certificates/snakeoil-ca.crt +$SUDO cp server.crt /usr/local/share/ca-certificates/snakeoil-server.crt $SUDO update-ca-certificates # Build and start tracker @@ -73,7 +75,7 @@ echo "log_level = 'debug' [network] address = '127.0.0.1:3001' enable_tls = true -tls_certificate_path = './cert.crt' +tls_certificate_path = './server.crt' tls_private_key_path = './key.pk8' " > tls.toml ./target/debug/aquatic http -c tls.toml > "$HOME/tls.log" 2>&1 & @@ -93,7 +95,7 @@ echo "log_level = 'debug' [network] address = '127.0.0.1:3002' enable_tls = true -tls_certificate_path = './cert.crt' +tls_certificate_path = './server.crt' tls_private_key_path = './key.pk8' " > ws-tls.toml ./target/debug/aquatic ws -c ws-tls.toml > "$HOME/ws-tls.log" 2>&1 & From 206b0d81b2de9223c20dd9020f13ea55ff202c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Fri, 3 May 2024 00:07:25 +0200 Subject: [PATCH 6/9] transfer ci ssl fix --- .github/actions/test-file-transfers/entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/test-file-transfers/entrypoint.sh b/.github/actions/test-file-transfers/entrypoint.sh index eb89691..8fa92e5 100755 --- a/.github/actions/test-file-transfers/entrypoint.sh +++ b/.github/actions/test-file-transfers/entrypoint.sh @@ -40,11 +40,11 @@ fi $SUDO echo "127.0.0.1 example.com" >> /etc/hosts -openssl ecparam -genkey -name prime256v1 -out ca.key +openssl genrsa -out ca.key 2048 openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=Acme Root CA" -out ca.crt -openssl req -newkey prime256v1 -nodes -keyout server.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=*.example.com" -out server.csr +openssl req -newkey rsa:2048 -nodes -keyout server.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=*.example.com" -out server.csr openssl x509 -req -extfile <(printf "subjectAltName=DNS:example.com,DNS:www.example.com") -days 365 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -openssl pkcs8 -in ca.key -topk8 -nocrypt -out key.pk8 +openssl pkcs8 -in server.key -topk8 -nocrypt -out key.pk8 $SUDO cp ca.crt /usr/local/share/ca-certificates/snakeoil-ca.crt $SUDO cp server.crt /usr/local/share/ca-certificates/snakeoil-server.crt From 5252910b8ace7af54b728c41acaf5940574e2d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Fri, 3 May 2024 00:14:54 +0200 Subject: [PATCH 7/9] transfer-ci: clean up script --- .github/actions/test-file-transfers/entrypoint.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/test-file-transfers/entrypoint.sh b/.github/actions/test-file-transfers/entrypoint.sh index 8fa92e5..f585ddc 100755 --- a/.github/actions/test-file-transfers/entrypoint.sh +++ b/.github/actions/test-file-transfers/entrypoint.sh @@ -110,17 +110,17 @@ mkdir torrents # Create torrents +echo "udp-test-ipv4" > seed/udp-test-ipv4 echo "http-test-ipv4" > seed/http-test-ipv4 echo "tls-test-ipv4" > seed/tls-test-ipv4 -echo "udp-test-ipv4" > seed/udp-test-ipv4 -echo "ws-tls-test-ipv4" > seed/ws-tls-test-ipv4 echo "ws-test-ipv4" > seed/ws-test-ipv4 +echo "ws-tls-test-ipv4" > seed/ws-tls-test-ipv4 +mktorrent -p -o "torrents/udp-ipv4.torrent" -a "udp://127.0.0.1:3000" "seed/udp-test-ipv4" mktorrent -p -o "torrents/http-ipv4.torrent" -a "http://127.0.0.1:3004/announce" "seed/http-test-ipv4" mktorrent -p -o "torrents/tls-ipv4.torrent" -a "https://example.com:3001/announce" "seed/tls-test-ipv4" -mktorrent -p -o "torrents/udp-ipv4.torrent" -a "udp://127.0.0.1:3000" "seed/udp-test-ipv4" -mktorrent -p -o "torrents/ws-tls-ipv4.torrent" -a "wss://example.com:3002" "seed/ws-tls-test-ipv4" mktorrent -p -o "torrents/ws-ipv4.torrent" -a "ws://example.com:3003" "seed/ws-test-ipv4" +mktorrent -p -o "torrents/ws-tls-ipv4.torrent" -a "wss://example.com:3002" "seed/ws-tls-test-ipv4" cp -r torrents torrents-seed cp -r torrents torrents-leech @@ -129,14 +129,14 @@ cp -r torrents torrents-leech echo "Starting seeding ws-tls (wss) client" cd seed -GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/ws-tls-ipv4.torrent > "$HOME/ws-tls-seed.log" 2>&1 & +GOPPROF=http $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/ws-tls-ipv4.torrent > "$HOME/ws-tls-seed.log" 2>&1 & cd .. # Setup ws seeding client echo "Starting seeding ws client" cd seed -GOPPROF=http GODEBUG=x509ignoreCN=0 $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/ws-ipv4.torrent > "$HOME/ws-seed.log" 2>&1 & +GOPPROF=http $HOME/gotorrent download --dht=false --tcppeers=false --utppeers=false --pex=false --stats --seed ../torrents/ws-ipv4.torrent > "$HOME/ws-seed.log" 2>&1 & cd .. # Start seeding rtorrent client From 470c8b6985bf00d73587216137faa2baea53a17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Fri, 3 May 2024 00:17:27 +0200 Subject: [PATCH 8/9] ci: use dtolnay/rust-toolchain --- .github/workflows/ci.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d929eb2..e45e1f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,11 +16,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install latest stable Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + uses: dtolnay/rust-toolchain@stable - name: Install dependencies run: sudo apt-get update -y && sudo apt-get install libhwloc-dev -y - name: Setup Rust dependency caching @@ -37,11 +33,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install latest stable Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + uses: dtolnay/rust-toolchain@stable - name: Setup Rust dependency caching uses: Swatinem/rust-cache@v2 - name: Build @@ -53,11 +45,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install latest stable Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + uses: dtolnay/rust-toolchain@stable - name: Install dependencies run: sudo apt-get update -y && sudo apt-get install libhwloc-dev -y - name: Setup Rust dependency caching From 3c07d222e9b4c3b72540ac5d819e7dca55fe10f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Fri, 3 May 2024 00:18:59 +0200 Subject: [PATCH 9/9] Update TODO --- TODO.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/TODO.md b/TODO.md index 1840efd..c5a2f60 100644 --- a/TODO.md +++ b/TODO.md @@ -2,9 +2,6 @@ ## High priority -* use more recent debian/ubuntu for transfer test - * need to update way to set fake tls certificates so torrent clients accept them - * udp (uring) * run tests under valgrind * hangs for integration tests, possibly related to https://bugs.kde.org/show_bug.cgi?id=463859