sshd 設定メモ

[`evernote` not found]
Bookmark this on Hatena Bookmark
Share on Facebook
LINEで送る

設定したものの中で知らなかったものや,設定してないけど man を読んで気になったものをメモ.
ssh v1 は使ったことないので,知らない.

設定項目 意味とか
Port セッションを受け付けるポートの指定.複数行記述することで,複数のポートで待てる.
UsePrivilegeSeparation sshの子プロセスの権限をユーザー `sshd' (yesの時) とするか,`root' (noの時) とするか.
LoginGraceTime ログインプロセスのタイムアウト.これ以上時間が経過してもユーザー名とか入れなかったら落ちる.
StrictModes 鍵の置いてあるところ (/home) の o に w 権限が付与されていたら拒否する.
RSAAuthentication ssh v1 の RSA 公開鍵認証の許可.
PrintMotd /var/run/motd の中身をログイン時に表示するか否か.yes だと表示するが,ログインメッセージが 2回表示されてしまう場合があるらしい.
TCPKeepAlive (ssh の man より)
(ClientAliveCountMax の項より) The TCP keepalive option enabled by TCPKeepAlive is spoofable.
(TCPKeepAlive の項より) Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying.
つまり,暗号化セッションの外で ack を投げる設定であって,途中経路で 1 回途絶えたら落ちて,ack の乗っ取りができるというもの.
ClientAliveCountMax (ssh の man より)
If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. (中略) The client alive messages are sent through the encrypted channel and therefore will not be spoofable.
つまり,この数だけ ack が落ちたら切断するよ.TCPKeepAlive と違って乗っ取りされませんよ.という keepalive のこと.
ClientAliveInterval ClientAliveCountMax で言う ack が落ちる,の定義秒.
MaxStartups 認証セッションの許可数.x:y:z の形式で指定するもので,x セッションまでは 100% 受け付けるが,x+1 セッションからは確率 y で拒絶し,z セッションに達するまで拒絶率が線形に増加し,z セッションに達した後には全てのセッションを拒絶する,というパラメタ.
MaxAuthTries 1回の接続における認証のリトライ数の上限.
MaxSessions ssh は 1 接続で複数セッションを貼って通信ができ,その上限.具体的に,どのように動作に効いてくるかは不明…

あんま設定を載せたくないので,具体的にどうしてるかは秘密だけど,かなり固めに設定したと思う.
毎回,設定後に sshd を restart して,再接続を試験する時は緊張するぜ…勿論,既設のセッションは 1 つは残してテストするけど…接続できなくなった時の事を考えると怖い.