gpt4 book ai didi

python - SSH:我怎么知道并发限制?

转载 作者:太空宇宙 更新时间:2023-11-03 15:19:58 30 4
gpt4 key购买 nike

为了测试 SSH 服务器,我在客户端创建了一个测试程序(在 python 中)。测试程序会生成100个进程,每个进程都会与服务器建立SSH连接。任何失败的尝试都将等待 10 秒,然后重试。

这是我的观察:

  1. 在前 10 秒内,只有 30 个客户端可以创建成功的连接。 70 个客户被拒绝。
  2. 在接下来的 10 秒内,另外 30 个客户端可以成功创建连接。 40 人被拒绝。
  3. 在接下来的 10 秒内,另外 30 个客户端可以成功创建连接。 10 人被拒绝。
  4. 在接下来的 10 秒内,最后 10 个客户端可以创建成功的连接。

这是我的问题:

  1. 是否有可能一次建立 100 个成功的安全连接?我需要修改哪个 SSH 参数(服务器端)才能实现此目的?
  2. Python 有一个内置的 SSL 库。如果我使用 SSL 代替 SSH,是否可以一次性建立 100 个成功的安全连接?

提前致谢

最佳答案

I would like to log in 100 concurrent connection in one go. Which SSH paramerters I need to modify?

好吧,我要求您指定您使用的是哪个 ssh 服务器,但由于您没有回应,我不得不假设您使用的是 openssh .

唯一sshd_config(5)我可以看到这可能会影响您可以“同时”建立的连接数的配置参数是 MaxStartups,文档说...

Specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. Additional connections will be dropped until authentication succeeds or the LoginGraceTime expires for a connection. The default is 10.

Alternatively, random early drop can be enabled by specifying the three colon separated values “start:rate:full” (e.g. "10:30:60"). sshd(8) will refuse connection attempts with a probability of “rate/100” (30%) if there are currently “start” (10) unauthenticated connections. The probability increases linearly and all connection attempts are refused if the number of unauthenticated connections reaches “full” (60).

...因此您可能必须将该值设置为至少 100。

关于python - SSH:我怎么知道并发限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16712670/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com