Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udp: symmetric encrypted cookie #1091

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

da2ce7
Copy link
Contributor

@da2ce7 da2ce7 commented Nov 17, 2024

Implement a simple symmetrically encrypted connection id to be used as a cookie for authenticating announce requests.

I have taken some time to optimize the implementation, hopefully it will preform the same as the previous approach.

@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from 97e96c7 to 91d1dc0 Compare November 18, 2024 03:38
@da2ce7 da2ce7 changed the title WIP encrypted cookie implmetation udp: symmetric encrypted cookie Nov 18, 2024
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from 91d1dc0 to be5fb95 Compare November 18, 2024 03:51
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from be5fb95 to b5983d4 Compare November 18, 2024 04:10
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from b5983d4 to 25d354f Compare November 18, 2024 04:18
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from 25d354f to eddf231 Compare November 18, 2024 04:19
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from eddf231 to 356f652 Compare November 18, 2024 04:28
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from 356f652 to e5ba2cd Compare November 18, 2024 04:30
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from e5ba2cd to a60571c Compare November 18, 2024 07:53
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from a60571c to 41582ac Compare November 18, 2024 08:07
@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from 41582ac to 39ccba7 Compare November 18, 2024 08:14
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 92.60700% with 19 lines in your changes missing coverage. Please review.

Project coverage is 76.44%. Comparing base (0e340bf) to head (c53e289).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
src/servers/udp/connection_cookie.rs 92.13% 6 Missing and 1 partial ⚠️
src/bootstrap/app.rs 0.00% 6 Missing ⚠️
src/shared/crypto/keys.rs 84.84% 5 Missing ⚠️
packages/configuration/src/v2_0_0/udp_tracker.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1091      +/-   ##
===========================================
- Coverage    77.14%   76.44%   -0.70%     
===========================================
  Files          174      174              
  Lines        11750    11488     -262     
  Branches     11750    11488     -262     
===========================================
- Hits          9064     8782     -282     
- Misses        2488     2507      +19     
- Partials       198      199       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@da2ce7 da2ce7 force-pushed the 20241117_udp_enc_cookie branch from b683b8c to e3562f0 Compare November 18, 2024 08:28
@da2ce7 da2ce7 marked this pull request as ready for review November 18, 2024 08:51
josecelano
josecelano previously approved these changes Nov 18, 2024
Copy link
Member

@josecelano josecelano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @da2ce7 It looks good to me. I have only added some minor suggestions.

Regarding performance, it seems it hasn't changed.

This PR

Worst case:

Requests out: 425928.00/second
Responses in: 403889.28/second
  - Connect responses:  199933.64
  - Announce responses: 199936.23
  - Scrape responses:   4019.41
  - Error responses:    0.00
Peers per announce response: 0.00
Announce responses per info hash:
  - p10: 1
  - p25: 1
  - p50: 1
  - p75: 1
  - p90: 2
  - p95: 3
  - p99: 105
  - p99.9: 323
  - p100: 407

Best case:

Requests out: 492705.64/second
Responses in: 415447.68/second
  - Connect responses:  205609.94
  - Announce responses: 205718.08
  - Scrape responses:   4119.67
  - Error responses:    0.00
Peers per announce response: 0.00
Announce responses per info hash:
  - p10: 1
  - p25: 1
  - p50: 1
  - p75: 1
  - p90: 2
  - p95: 3
  - p99: 105
  - p99.9: 331
  - p100: 429

Base branch

Worst case:

Requests out: 416133.96/second
Responses in: 379643.54/second
  - Connect responses:  188013.86
  - Announce responses: 187883.50
  - Scrape responses:   3745.38
  - Error responses:    0.80
Peers per announce response: 0.00
Announce responses per info hash:
  - p10: 1
  - p25: 1
  - p50: 1
  - p75: 1
  - p90: 2
  - p95: 3
  - p99: 104
  - p99.9: 305
  - p100: 389

Best case:

Requests out: 539571.74/second
Responses in: 448536.20/second
  - Connect responses:  222046.78
  - Announce responses: 222037.22
  - Scrape responses:   4452.20
  - Error responses:    0.00
Peers per announce response: 0.00
Announce responses per info hash:
  - p10: 1
  - p25: 1
  - p50: 1
  - p75: 1
  - p90: 2
  - p95: 3
  - p99: 104
  - p99.9: 353
  - p100: 455

NOTE: this best case is not common.

src/bootstrap/app.rs Outdated Show resolved Hide resolved
src/servers/udp/connection_cookie.rs Outdated Show resolved Hide resolved
src/servers/udp/connection_cookie.rs Outdated Show resolved Hide resolved
src/servers/udp/error.rs Outdated Show resolved Hide resolved
src/servers/udp/server/processor.rs Outdated Show resolved Hide resolved
src/servers/udp/handlers.rs Outdated Show resolved Hide resolved
@josecelano josecelano self-requested a review November 19, 2024 08:23
Copy link
Member

@josecelano josecelano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @da2ce7 some tests are not passing after these latest changes.

src/servers/udp/connection_cookie.rs Outdated Show resolved Hide resolved
@josecelano
Copy link
Member

ACK c53e289

@josecelano josecelano merged commit b827c31 into torrust:develop Nov 19, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants