1. 添加 ssh 常用命令

2. 添加 开发机隧道方案
This commit is contained in:
Your Name
2024-05-22 15:01:42 +07:00
parent e811099fce
commit 4fd3b27fe0
2 changed files with 110 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
# MISC
## 网络拓扑图
- A: 用户
- B: 中间服务器
- C: 开发服务器
连接: **A->B<-C**
说明: 用户A连接B,开发服务器C连接B,B在内部将A转发到C.
结论: 因为从外部无法观测到A至C的连接, 所以此方案可用于隐藏用户A连接C的记录
## 基于vscode server的隧道方案
其中B为微软提供
### 部署vscode server
```bash
# 开启linger 用户退出以后, 服务也不会停止
sudo loginctl enable-linger $USER
wget https://vscode.download.prss.microsoft.com/dbazure/download/stable/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/vscode_cli_alpine_x64_cli.tar.gz
tar -xzf vscode_cli_alpine_x64_cli.tar.gz
./code tunnel service install
# 执行命令后, 需要选择用什么账号登录, 此次选择用Microsoft Account
## 输出如下
# ? How would you like to log in to Visual Studio Code?
# Microsoft Account
# GitHub Account
## 选择以后, 输出如下
# ✔ How would you like to log in to Visual Studio Code? · Microsoft Account
# To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code I96RAVZDD to authenticate.
## 在浏览中打开上面的链接, 输入code. 然后登录微软账号, 就可以把此隧道, 绑定到微软账号.
## 看到如下输出, 部署就成功了
# *
# * Visual Studio Code Server
# *
# * By using the software, you agree to
# * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
# * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
# *
# [2024-05-21 10:21:24] info Successfully registered service...
# [2024-05-21 10:21:24] info Successfully enabled unit files...
# [2024-05-21 10:21:24] info Tunnel service successfully started
# [2024-05-21 10:21:24] info Tip: run `sudo loginctl enable-linger $USER` to ensure the service stays running after you disconnect.
# Service successfully installed! You can use `code tunnel service log` to monitor it, and `code tunnel service uninstall` to remove it.
```
### 连接 vscode server
1. 先安装vscode, [官方网站](https://code.visualstudio.com/)
2. 安装[remote - tunnel](https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server) 插件
3. 安装完插件后, 左侧栏会出现相应的`远程资源管理器` -> `远程(隧道/SSH)` -> `Tunnels` -> `登陆到向Microsoft注册的隧道 ➡️`(点击箭头) -> 接下来跳转到网页登录账号即可
4. 登录完后, 就可以在Tunnels下,看到对应的隧道
4. 接下来,就与S5H, WSL等非本地开发流程一样了
## 基于amazon session manager的隧道方案
其中B为亚马逊提供