Files
106_105_181_70/ssh_config.md
Timmy 5a4ab39334 docs: 新增本機 SSL 憑證驗證方法說明
添加內容:
- hosts 檔案修改方法(推薦)
- SwitchHosts 工具使用說明
- 指令行和瀏覽器驗證方法
- 完整操作步驟和注意事項

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
2026-04-27 11:37:01 +08:00

90 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SSH Config
```ssh-config
Host jason_hsieh_home_srv
HostName 220.135.27.129
User timmy
Port 2022
ProxyJump timmy_home_server
# Hospital Media Server (影音/通訊服務)
Host hospital_media
HostName 106.105.181.40
User tpech_1duan
ProxyJump jason_hsieh_home_srv
# Hospital Web Server (網頁/NPM 管理)
Host hospital_web
User tpech_1duan
HostName 106.105.181.70
ProxyJump jason_hsieh_home_srv
# 端口轉發設定
LocalForward 8181 127.0.0.1:81 # NPM 管理後台
LocalForward 8888 127.0.0.1:80 # 網頁服務
LocalForward 8443 127.0.0.1:443 # HTTPS 服務
LocalForward 9090 127.0.0.1:8080 # Adminer
LocalForward 8001 127.0.0.1:8001 # PHP 容器 (直連)
```
## 連線架構
- **jason_hsieh_home_srv** (220.135.27.129:2022) — 跳板機
- **hospital_media** (106.105.181.40) — 影音/通訊服務,透過跳板連線,對應 `tel.tpech.gov.tw`
- **hospital_web** (106.105.181.70) — 網頁/NPM 管理,透過跳板連線,對應 `tpesupporter.tpech.gov.tw`
## 端口轉發 (hospital_web)
| 本機端口 | 遠端目標 | 服務 |
|---|---|---|
| localhost:8181 | 127.0.0.1:81 | NPM 管理後台 |
| localhost:8888 | 127.0.0.1:80 | 網頁服務 |
| localhost:8443 | 127.0.0.1:443 | HTTPS 服務 |
| localhost:9090 | 127.0.0.1:8080 | Adminer |
| localhost:8001 | 127.0.0.1:8001 | PHP 容器 (直連) |
## 本機 SSL 憑證驗證
透過 SSH 端口轉發,可以在本機驗證 `tpesupporter.tpech.gov.tw` 的 SSL 憑證。
### 方法 1修改 hosts 檔案(推薦)
建立域名映射,讓瀏覽器可以正確驗證憑證:
```bash
# 編輯 hosts 檔案
sudo echo "127.0.0.1 tpesupporter.tpech.gov.tw" >> /etc/hosts
```
然後在瀏覽器中訪問:
```
https://tpesupporter.tpech.gov.tw:8443
```
**使用 SwitchHosts 工具:**
- 可下載 SwitchHosts 應用程式進行圖形化管理
- 添加規則:`127.0.0.1 tpesupporter.tpech.gov.tw`
- 方便快速切換 hosts 設定
### 方法 2指令行驗證
```bash
# 驗證憑證基本資訊
echo | openssl s_client -connect localhost:8443 \
-servername tpesupporter.tpech.gov.tw 2>/dev/null \
| openssl x509 -noout -dates -subject -issuer
# 檢查憑證鏈
echo | openssl s_client -connect localhost:8443 \
-servername tpesupporter.tpech.gov.tw 2>&1 \
| grep 'Verify return code'
```
### 方法 3瀏覽器忽略警告
直接訪問 `https://127.0.0.1:8443`,然後:
1. 點擊「進階」或「Advanced」
2. 選擇「繼續前往 127.0.0.1」
3. 可查看憑證詳細資訊
> **注意:** 使用方法 1 可獲得最佳的瀏覽器體驗,憑證驗證完全正常。