2857
コメント:
|
← 2023-07-06 23:20:31時点のリビジョン10 ⇥
3399
|
削除された箇所はこのように表示されます。 | 追加された箇所はこのように表示されます。 |
行 11: | 行 11: |
* digコマンドを使用するためにWindows版BINDを導入 * `%h`を利用して冗長な記述を省略 * ローカルアカウント用の簡潔な設定を追加 |
|
行 12: | 行 15: |
=== config === | |
行 13: | 行 17: |
Match Host ced,mma,mmasamba !exec "ping -n 1 proxy.uec.ac.jp -w 10 > nul" | Match Host ced,mma,mmasamba,sunrise !exec "ping -n 1 proxy.uec.ac.jp -w 10 > nul" |
行 15: | 行 19: |
Match Host nest,saga,atlas,moon,nizigen,hime,lambda,redbull,webserver,flandre !exec "setexec dig +short nest.mma.club.uec.ac.jp & if not '%%RETURN%%'=='192.168.1.1' ( fail )" | 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 )" |
行 37: | 行 41: |
Hostname blue99.ced.cei.uec.ac.jp | Hostname orange27.ced.cei.uec.ac.jp |
行 67: | 行 71: |
#DynamicForward 1081 | |
行 68: | 行 73: |
ServerAliveInterval 60 | |
行 73: | 行 79: |
Host atlas IdentityFile ~/.ssh/atlas_rsa Host flandre IdentityFile ~/.ssh/flandre_rsa Host hime IdentityFile ~/.ssh/hime_rsa Match Host moon,moon-global IdentityFile ~/.ssh/moon_rsa Host nizigen IdentityFile ~/.ssh/nizigen_rsa Host saga IdentityFile ~/.ssh/saga_rsa |
IdentityFile ~/.ssh/%h_rsa Host rosetta User hydrogen IdentityFile ~/.ssh/rosetta_ed25519 ProxyJump mma |
行 88: | 行 87: |
IdentityFile ~/.ssh/webserver_ed25519 | |
行 90: | 行 90: |
IdentityFile ~/.ssh/moon_rsa | |
行 91: | 行 92: |
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 |
|
行 100: | 行 108: |
Hostname ******** User ***** |
Hostname *********** User ****** |
行 104: | 行 112: |
=== 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 }}} |
参考: 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
fail.bat
1 @exit /b 1