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

Awa_mirage: Fix rekey #58

Merged
merged 1 commit into from
May 17, 2023
Merged

Awa_mirage: Fix rekey #58

merged 1 commit into from
May 17, 2023

Conversation

reynir
Copy link
Member

@reynir reynir commented May 12, 2023

The application can experience a denial of service if a user sends for example a bunch of backspaces to the shell. It seems this creates a bunch of pending timeouts that eventually slows down the server to a grind. The Lwt.catch call was at best useless.

@hannesm
Copy link
Member

hannesm commented May 17, 2023

I approve this PR - just for common understanding, what happens in nexus:

  • this is the main loop of the server for each client, which keeps three promises:
  • it reads from the network (net_read),
  • the Lwt_switch (to terminate the connection switched_off),
  • and waits for a key tmeout (since keys may need to be rekeyed -- earlier timeout, now rekey_promise)

In the code, the Lwt.nchoose_split is used since multiple promises may be fulfilled at any given time. (loop handles each fulfilled promise). When a Timeout is received (Rekey event), the rekey is done, and a fresh promise is inserted.

The handling of network reads is a bit special: a separate buffer, input_buffer, is passed to nexus (initially empty) -- and this is being decoded / decrypted, and may accumulate more fragmented data (before a full ssh message is received).

@hannesm hannesm merged commit c761015 into mirage:main May 17, 2023
@reynir reynir mentioned this pull request May 17, 2023
hannesm added a commit to hannesm/opam-repository that referenced this pull request Jun 19, 2023
CHANGES:

* FEATURE server: propagate window-change message (mirage/awa-ssh#55 @reynir)
* FEATURE server: implement ext-info and server-sig-algs extension (mirage/awa-ssh#56 @reynir)
* FEATURE server: support RFC 4419 (group key exchanges) and NIST ECDH key
  exchanges, and X25519 (mirage/awa-ssh#63 mirage/awa-ssh#67 @hannesm)
* FEATURE server: handle unknown public keys (instead of closing the connection,
  send a message back, allowing other public keys to be probeb) (mirage/awa-ssh#68 @reynir)
* BUGFIX server: fix rekey (avoid allocating lots of timeout tasks (mirage/awa-ssh#58 @reynir)
* BUGFIX server: filter advertised host key algorithms with used host key
  (mirage/awa-ssh#62 @hannesm)
* server: use logs instead of printf (mirage/awa-ssh#69 @hannesm)
* awa-lwt: drop package (unused, mirage/awa-ssh#61 @hannesm)
* drop Driver module, embed into awa_test_server.ml (mirage/awa-ssh#64 @hannesm)
@reynir reynir deleted the mirage-rekey branch September 25, 2024 11:52
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