sshd の MaxStartups

スポンサーリンク

事の発端

ssh 接続時に下記のエラーが頻発するようになったことで調査をしました。

ssh_exchange_identification: Connection closed by remote host

結論として、MaxStartups の設定を引き上げることで問題が解決しました。

MaxStartups とは

sshd_config の日本語訳では下記の様に記載されています。

MaxStartups (最大起動数)
認証されていない段階の接続をSSH デーモンが最大でどれだけ受けつけるかを指定します。
この値を超えた (認証されていない段階の) 接続は捨てられます。
この状態は (すでに接続したクライアントの) 認証が成功するか、そのLoginGraceTime(ログイン猶予時間) が切れるまで続きます。

つまり ssh 接続した瞬間から認証OKとなるまでの間の最大接続数ということなのですが、Web でいろいろ見ていると、単なる同時接続数のように記載しているサイトが非常に多い印象です。
認証OK後の接続数は MaxStartups には無関係ですので注意が必要です。

設定の意味

CentOS7 などのデフォルトでは 10:30:100 になっています。
これは、非認証な接続が 10 を超えるとそれ以降の接続を 30% の確率で拒否し、さらに 100 に達した時点でそれ以降の接続を全て拒否するという設定になります。
通常、非認証な接続が一気に 10 も来ることはほとんど無いと思いますので、いわゆる不正アクセス対策のための設定と考えて良いと思います。
しかし、自分の場合は正当な接続でこの制限に引っかかってしまったわけですが(/_\*)

検証方法

非認証の ssh 接続を一気に 10 以上発生させることは普通にやっていてはできません(^_^;) 効率よく検証するには、一気に同一サーバへ ssh 接続する様なスクリプトを作成することも可能ですが、Mac の Iterm2 の Broardcast Input などのようなマルチカーソル的なものを使って一気に ssh 接続を発生させるのがお手軽で簡単です。
すると、MaxStartups に従って、いくつかのターミナルでは冒頭のエラーが発生することが確認できると思います。

コメント

  1. Quality articles or reviews is the crucial to be a focus for the users to go to see the web page,
    that’s what this web site is providing.

    Visit my web page – Grown N Flow Review

  2. This article will assist the internet users for building up new website
    or even a blog from start to end.

    Feel free to surf to my website http://pureketoextra.net/

  3. Hello, i think that i saw you visited my site so i came to ?return the favor?.I am attempting
    to find things to improve my web site!I suppose its ok to use
    a few of your ideas!!

    my blog; Natural Green CBD Reviews

  4. I rattling thankful to find this website on bing, just what I was searching for
    😀 besides saved to my bookmarks.

    my web blog :: http://theanimalrightsagenda.qhub.com/member/2101121

  5. Hey there! Do you know if they make any plugins to protect against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any
    recommendations?

    My blog post – 바카라 사이트

  6. First off I would like to say superb blog! I had a quick
    question that I’d like to ask if you don’t mind.
    I was interested to know how you center yourself and clear your mind prior to writing.

    I have had trouble clearing my thoughts in getting my thoughts out there.
    I do take pleasure in writing however it just seems like the first 10 to
    15 minutes are generally wasted simply just trying to figure out how
    to begin. Any suggestions or hints? Appreciate it!

  7. Hi there, just became aware of your blog through Google,
    and found that it’s truly informative. I am gonna watch out
    for brussels. I’ll appreciate if you continue this in future.
    Lots of people will be benefited from your writing.
    Cheers!

  8. Hello there, just became alert to your blog through Google,
    and found that it’s really informative. I’m going to watch out for brussels.
    I’ll be grateful if you continue this in future. A lot of people will be benefited from your
    writing. Cheers!

    Visit my web page: Designer Keto Reviews

  9. Very nice article, totally what I wanted to find.

    Feel free to surf to my blog post Green Leaf CBD

  10. WOW just what I was searching for. Came here by searching
    for website

  11. Hey there would you mind stating which blog platform you’re using?
    I’m looking to start my own blog in the near
    future but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and
    Drupal. The reason I ask is because your design and style seems
    different then most blogs and I’m looking for something
    completely unique. P.S Apologies for getting off-topic but I had to ask!

    Also visit my page – DivaTrim Reviews

  12. Hi there all, here every one is sharing such experience, thus it’s
    fastidious to read this website, and I used to
    visit this weblog every day.

    Feel free to visit my blog post … Max Releaf CBD Oil

  13. I had been honored to get a call from a friend when he identified the important guidelines shared on your own site.
    Examining your blog posting is a real amazing
    experience. Many thanks for taking into consideration readers just
    like me, and I want for you the best of success like a professional in this domain.

    Also visit my blog: https://www.mostawrd.com/groups/7-keto-dhea-diet-pills-the-best-choice-252113557/

  14. I seriously love your blog.. Great colors & theme.

    Did you create this amazing site yourself? Please reply back as I?m looking to
    create my own blog and would like to know
    where you got this from or just what the theme is named.

    Cheers!

    Look at my web page: http://skymdcbd.net/

  15. I got what you intend,saved to bookmarks, very nice site.

    My webpage :: http://gloria.bk-ninja.com/forums/users/manualbruche/

  16. What’s up, this weekend is pleasant in favor of me, for the reason that
    this time i am reading this impressive educational piece of
    writing here at my house.

    My homepage … http://whitetulipantiagingcream.com/

  17. Nice weblog here! Additionally your website loads up very
    fast! What host are you the usage of? Can I am getting your affiliate hyperlink in your host?
    I wish my website loaded up as fast as yours lol

    Also visit my web site … http://studyforum.com.au/forums/users/timstiner0002527/

  18. Great beat ! I wish to apprentice whilst you amend your web site, how could i
    subscribe for a weblog website? The account helped me
    a acceptable deal. I had been a little bit acquainted of this your broadcast offered vivid clear concept

    Review my website; Vigor Testo Review

タイトルとURLをコピーしました