Index: [Article Count Order] [Thread]

Date: Sat, 21 Aug 2004 10:37:09 +0900
From: HARUYAMA Seigo <haruyama@queen-ml.org>
Subject: [ssh:00221] 3.9の新機能: セッションの多重化
To: ssh@koka-in.org
Message-Id: <877jrte0fu.wl%haruyama@queen-ml.org>
X-Mail-Count: 00221


  春山です.

----------
  * Implement session multiplexing: a single ssh(1) connection can now carry
  multiple login/command/file transfer sessions. Refer to the "ControlMaster"
  and "ControlPath" options in ssh_config(5) for more information

  セッションの多重化が実装された. 単一の ssh(1)接続は,
  複数のログイン/コマンド/ファイル転送セッションを扱うことができるようになった.
  ssh_config(5)の "ControlMaster" と "ControlPath"設定項目により詳しい情報がある.
----------
  
  とあるのでちょっと試してみました.

-----ssh_configより-----
     ControlMaster
             Enables the sharing of multiple sessions over a single network
             connection.  When set to ``yes'' ssh will listen for connections
             on a control socket specified using the ControlPath argument.
             Additional sessions can connect to this socket using the same
             ControlPath with ControlMaster set to ``no'' (the default).
             These sessions will reuse the master instance's network connec-
             tion rather than initiating new ones.  Setting this to ``ask''
             will cause ssh to listen for control connections, but require
             confirmation using the SSH_ASKPASS program before they are ac-
             cepted (see ssh-add(1) for details).

     ControlPath
             Specify the path to the control socket used for connection shar-
             ing.  See ControlMaster above.
----------

  まず.
----------
Host remote_master
  Hostname remote
  ControlMaster ask
  ControlPath ~/.ssh/remote
Host remote
  ControlMaster no
  ControlPath ~/.ssh/remote
----------  
  と ssh_configに追記し,

% ssh remote_master 

  としてホストremoteにログインすると,
  ~/.ssh/remote に Unix Domain Socket ができました.

  そして, remote に接続しようとすると

% ssh remote

  (Masterのほうで「ControlMaster ask」としているので)
  SSH_ASKPASSが起動し, 
  「Allow shared connection to remote?」
  と聞かれます.

  「OK」とすると ログインできました.

  この機能を使わない場合 特権分離しているsshdなら
  ユーザ権限のsshdがremote側で2つ動くはずですが,
  この機能を使うと1つだけ動いていることを確認しました.

  すでに 

% ssh remote_master

  している場合に
  さらに 

% ssh remote_master

  すると, Unix Domain Socket がbindできないとして失敗します.

  (ので, ssh_configのエントリを2つに分けてみました)

  なお,
  sshの-M オプションでも ControlMaster になれます.
	(ただし「ask」は指定できない. もともと 「ask」なら「ask」のまま)
  sshの-Sオプションで ControlPath を指定できます.

-- 

春山 征吾 / HARUYAMA Seigo  haruyama@unixuser.org  haruyama@queen-ml.org