参考: https://wiki.mma.club.uec.ac.jp/shosato/ssh_config * WindowsのOpenSSHではControlMasterを使えないので該当部を削除 * バッチファイルを使ってbash特有の処理をうまいこと実装 * コマンドをWindows流に書き換え * プロキシをsolからsshに変更 * 部内へはsunriseではなくnestを利用 * IEDへの接続はremoteを使用 * Samba用SSHトンネルの設定を追加 * 家のWindows PCに繋ぐための設定を追加 * digコマンドを使用するためにWindows版BINDを導入 * `%h`を利用して冗長な記述を省略 * ローカルアカウント用の簡潔な設定を追加 === config === {{{ Match Host ced,mma,mmasamba,sunrise !exec "ping -n 1 proxy.uec.ac.jp -w 10 > nul" ProxyJump uecssh Match Host nest,saga,atlas,moon,nizigen,hime,lambda,redbull,webserver,flandre,rosetta,*-local !exec "setexec dig +short nest.mma.club.uec.ac.jp & if not '%%RETURN%%'=='192.168.1.1' ( fail )" ProxyJump mma # UEC Match Host uec,sol HostName sol.cc.uec.ac.jp User a0000000 IdentityFile ~/.ssh/uec_rsa PreferredAuthentications publickey #ForwardX11 yes ServerAliveInterval 60 Host uecssh HostName ssh.cc.uec.ac.jp User a0000000 IdentityFile ~/.ssh/uecssh_ed25519 ServerAliveInterval 60 DynamicForward 12660 # CED Match Host ced,jre Hostname orange27.ced.cei.uec.ac.jp User a0000000 IdentityFile ~/.ssh/jre_rsa Match Host blue*,red*,yellow*,lemon*,purple*,brown* User a0000000 IdentityFile ~/.ssh/jre_rsa ProxyJump ced Match Host gpu01,gpu02,gpu03,gpu04 User a0000000 IdentityFile ~/.ssh/jre_rsa ProxyJump ced # IED Host ied Hostname remote.ied.inf.uec.ac.jp IdentityFile ~/.ssh/ied_ed25519 User a0000000 Match Host gpu1,gpu2,gpu3,gpu4 User a0000000 IdentityFile ~/.ssh/ied_ed25519 ProxyJump ied # MMA Host sunrise Hostname sunrise.mma.club.uec.ac.jp User hydrogen IdentityFile ~/.ssh/sunrise_ed25519 Match Host nest,mma,mmasamba User hydrogen Hostname nest.mma.club.uec.ac.jp #DynamicForward 1081 IdentityFile ~/.ssh/mma_rsa ServerAliveInterval 60 Host mmasamba LocalForward 10.255.255.1:44445 127.0.0.1:445 LocalForward 10.255.255.1:44139 127.0.0.1:139 Match Host saga,atlas,moon,nizigen,hime,lambda,redbull,flandre User hydrogen IdentityFile ~/.ssh/%h_rsa Host rosetta User hydrogen IdentityFile ~/.ssh/rosetta_ed25519 ProxyJump mma Host webserver HostName webserver.lxd.saga.mma.club.uec.ac.jp User hydrogen IdentityFile ~/.ssh/webserver_ed25519 Host moon-global HostName moon.mma.club.uec.ac.jp IdentityFile ~/.ssh/moon_rsa User hydrogen Host osaka HostName 49.212.150.119 User hydrogen Match Host *-local User local_hydrogen IdentityFile ~/.ssh/%h-local_rsa Host nizigen-local HostName nizigen Host gitlab Hostname gitlab.mma.club.uec.ac.jp IdentityFile ~/.ssh/gitlab_rsa User git Port 2223 Host desktop Hostname *********** User ****** IdentityFile ~/.ssh/head_ed25519 }}} === setexec.bat === {{{#!highlight bat @echo off for /f "usebackq delims=" %%i in (`%*`) do set RETURN=%%i exit /b 0 }}} === fail.bat === {{{#!highlight bat @exit /b 1 }}}