From 3d989597403ecb2a205ac86fcb5dc4292f3a470a Mon Sep 17 00:00:00 2001 From: Timmy Date: Thu, 9 Apr 2026 13:03:11 +0800 Subject: [PATCH] Initial commit: SSH config and public keys Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 15 ++++ config | 39 +++++++++ config.d/acetech | 41 ++++++++++ config.d/digitalocean | 13 +++ config.d/jason_hsieh | 64 +++++++++++++++ config.d/ma | 161 ++++++++++++++++++++++++++++++++++++++ config.d/timmy | 63 +++++++++++++++ create_ssh_symlinks.sh | 28 +++++++ delete_ssh_files.sh | 15 ++++ google_compute_engine.pub | 1 + id_ecdsa.pub | 1 + id_rsa.pub | 1 + ssh_key_management.sh | 23 ++++++ 13 files changed, 465 insertions(+) create mode 100644 .gitignore create mode 100644 config create mode 100644 config.d/acetech create mode 100644 config.d/digitalocean create mode 100644 config.d/jason_hsieh create mode 100644 config.d/ma create mode 100644 config.d/timmy create mode 100755 create_ssh_symlinks.sh create mode 100755 delete_ssh_files.sh create mode 100644 google_compute_engine.pub create mode 100644 id_ecdsa.pub create mode 100644 id_rsa.pub create mode 100755 ssh_key_management.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4520c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# === 私鑰 — 絕對不可提交 === +id_rsa +id_ecdsa +ecdsa-key-* +google_compute_engine +*.pem + +# === 動態 / 暫存檔案 === +known_hosts +known_hosts.old +google_compute_known_hosts +sockets/ + +# === 公鑰(選擇性排除,取消註解即可追蹤) === +# *.pub diff --git a/config b/config new file mode 100644 index 0000000..2d8b1e5 --- /dev/null +++ b/config @@ -0,0 +1,39 @@ +Include /Users/timmy/.colima/ssh_config +Include config.d/* + +# Fig ssh integration. Keep at the bottom of this file. +Match all + Include ~/.fig/ssh + +Host github.com + IdentityFile ~/.ssh/id_rsa + AddKeysToAgent yes + +# --- Global Settings --- +Host * + +# StrictHostKeyChecking no # 不進行 Strict HostKey 檢查 +# UserKnownHostsFile /dev/null # 不使用 KnownHosts 檔案 + # —— 連線穩定與正常結束 —— + TCPKeepAlive yes # 啟用 TCP KeepAlive 功能 + ServerAliveInterval 60 # 每 60 秒向伺服器端發送一次請求 + ServerAliveCountMax 5 # 若伺服器端 5 次無回應則中斷連接 + ExitOnForwardFailure yes # 若連線轉發失敗立即退出,避免殘留 session + + # —— Multiplexing(加速多連線,減少殘留程序)—— + ControlMaster auto # 自動使用 ControlMaster 功能 + ControlPath ~/.ssh/sockets/%r@%h-%p # 設定 ControlPath + ControlPersist 5m # 主連線關掉後,socket 最多保留 5 分鐘 + + # —— 安全性建議(擇一)—— + # 預設:保留嚴格檢查(建議) + #StrictHostKeyChecking ask + # 或想少互動但仍相對安全: + #StrictHostKeyChecking accept-new + + # —— 代理/金鑰(依你目前環境)—— + IdentityAgent /Users/timmy/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh + + CheckHostIP no # 不檢查 IP 位址是否變更 + VisualHostKey no # 不顯示伺服器端的 HostKey + diff --git a/config.d/acetech b/config.d/acetech new file mode 100644 index 0000000..313da41 --- /dev/null +++ b/config.d/acetech @@ -0,0 +1,41 @@ +# --- AceTech Corp. --- + +# AceTech 9F 防火牆 +Host acetech_9f_fw 192.168.6.1 + HostName 192.168.6.1 + User ubuntu + ProxyJump 60.251.128.52 + +Host 60.251.128.52 + User ubuntu + +# AceTech B2B 服務 (內網) +Host acetech_b2b_local + HostName 192.168.88.36 + User timmy + # 服務:B2B Web(6543), Postgres(5433), Redis(6379) + +# AceTech MantisBT (問題追蹤系統) +Host acetech_mantis + HostName 192.168.88.91 + User root + +# AceTech 內網主機自動跳接 +Host 192.168.6.* + User ubuntu + ProxyJump acetech_9f + +Host 192.168.88.40 + User root + +# AceTech 21F 防火牆 +Host acetech_21f_fw + HostName 220.135.87.91 + User timmy + ProxyJump 211.23.141.208 + +# AceTech 21F 內網主機 (含 nip.io) +Host 192.168.68.1 192.168.68.1.nip.io + User timmy + ProxyJump acetech_21f_fw + diff --git a/config.d/digitalocean b/config.d/digitalocean new file mode 100644 index 0000000..c55cb9e --- /dev/null +++ b/config.d/digitalocean @@ -0,0 +1,13 @@ +# --- DigitalOcean (DO) --- + +# DO Server (YOURLS 短網址) +Host do_yourls + HostName 64.23.128.29 + User root + # 服務:Caddy 反向代理 + YOURLS + +# DO Server (automodules.com) +Host do_automodules + HostName 167.71.96.197 + User root + diff --git a/config.d/jason_hsieh b/config.d/jason_hsieh new file mode 100644 index 0000000..f8271a1 --- /dev/null +++ b/config.d/jason_hsieh @@ -0,0 +1,64 @@ +# Jason Hsieh's Home Server +Host jason_hsieh_home_srv + HostName 220.135.27.129 + User timmy + Port 2022 + Ciphers "^aes128-gcm@openssh.com,aes256-gcm@openssh.com" + # 端口轉發 + LocalForward 13306 127.0.0.1:3306 # MySQL + LocalForward 11433 127.0.0.1:1433 # MSSQL + LocalForward 8080 127.0.0.1:8080 # Nginx + + +# GCP aaPanel 管理 (Root) +Host gcp_aapanel + HostName 35.200.32.232 + User root + +# GCP Server (i3bydo.com) +Host gcp_i3bydo + HostName 34.80.52.73 + User loyangchun + IdentityFile ~/.ssh/google_compute_engine # 指定金鑰路徑 + IdentitiesOnly yes # 只使用指定的金鑰 + CheckHostIP no # 不檢查 IP 變動 + UserKnownHostsFile ~/.ssh/google_compute_known_hosts # 獨立存放已知的連線紀錄 + +# 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 9090 127.0.0.1:8080 # Adminer + LocalForward 8001 127.0.0.1:8001 # PHP 容器 (直連) + +Host 140.136.202.209 + User fdirc + HostName 140.136.202.209 + ProxyJump jason_hsieh_home_srv + +Host 34.80.116.132 + HostName 34.80.116.132 + IdentityFile /Users/timmy/.ssh/google_compute_engine + UserKnownHostsFile=/Users/timmy/.ssh/google_compute_known_hosts + # HostKeyAlias=compute.97799509408430482 + IdentitiesOnly=yes + CheckHostIP=no + +# Fu Jen Dev Server (輔大) +Host fju_dev + User iduan + # 透過 bore 穿透內網 + HostName 125.229.110.50 + Port 9499 + # HostName 140.136.181.229 + # Port 2222 diff --git a/config.d/ma b/config.d/ma new file mode 100644 index 0000000..a8a6a6a --- /dev/null +++ b/config.d/ma @@ -0,0 +1,161 @@ +Host 192.168.77.10 + User root + +# MA 防火牆 +Host ma_fw + HostName 192.168.88.1 + User ubuntu + + +Host 192.168.88.2 + User root + +Host 192.168.88.99 + User ubuntu + +Host 192.168.88.4 192.168.88.4.nip.io + User pi + +Host 192.168.88.10 + User timmy + +Host 192.168.88.11 + User timmy + +Host 192.168.88.12 + User timmy + +Host 192.168.88.13 + User timmy # 預設使用者:連線時自動使用 timmy 帳號登入 + +Host 192.168.88.15 + User ubuntu + +Host 192.168.88.16 + User timmy + +Host 192.168.88.18 + User timmy + LocalForward 50041 127.0.0.1:80 + +Host 192.168.88.19 + User ubuntu + +Host 192.168.88.30 + User ubuntu + +Host 192.168.88.31 + User ubuntu + +Host 192.168.88.173 + User ubuntu + +Host 192.168.88.32 + User ubuntu + Port 22 + +Host 192.168.88.33 + User timmy + +# Mail Server MA (內網連線) +Host mail_ma_local 192.168.88.35 + HostName 192.168.88.35 + User timmy + LocalForward 16361 127.0.0.1:80 # Mail 管理介面 + HostKeyAlgorithms +ssh-rsa # 支援舊版加密 + PubkeyAcceptedKeyTypes +ssh-rsa # 支援舊版金鑰 + +# --- Timmy Personal Dev --- + +# Timmy MA 開發機 +Host timmy_ma_dev + HostName 192.168.88.81 + User timmy + Port 2222 + +# MA 待確認主機 (密碼遺失) +Host ma_unknown_102 + HostName 192.168.88.102 + User timmy + # 備註:可連線,但忘記帳號密碼 + +# MA Confluence (知識管理系統) +Host ma_confluence + HostName 192.168.88.145 + User ubuntu + +# MA Chao 的專案 (1) +Host ma_chao_app1 + HostName 192.168.88.156 + User ubuntu + +# MA Chao 的專案 (2) +Host ma_chao_app2 + HostName 192.168.88.118 + User ubuntu + +# MA MediaWiki (維基系統) +Host ma_mediawiki + HostName 192.168.88.173 + User ubuntu + +Host 192.168.88.181 + User ubuntu + +Host 192.168.88.193 + User ubuntu + HostName 192.168.88.193 + +Host 192.168.88.194 + User ubuntu + HostName 192.168.88.194 + +# This is VMware ESXi 6.0.0 Update 2 with the main firewall for MA on the 11th floor of Oriental Science Park (internal IP 192.168.88.1) and the firewall for implementing IPv6 (internal IP 192.168.88.150). +Host 192.168.88.241 + User root + HostKeyAlgorithms +ssh-rsa + +# This is the MA VMware ESXi 6.7.0 Update 1 server with a mail server, along with the firewall for the 5th floor of Oriental Science Park and a dedicated firewall for the mail server. +Host 192.168.88.248 + User root + +# This is the MA PVE server. +Host 192.168.88.247 + User root + +# This is the MA PVE server. +Host 192.168.88.249 + User root + +# This is the MA PVE server. +Host 192.168.88.73 + User root + + +# This is the firewall for MA on the 5th floor of Oriental Science Park. +Host 192.168.3.88 + User apple + ProxyJump 211.23.141.208 + Ciphers aes256-cbc,aes256-ctr + +# This is the firewall for MA on the 11th floor of Oriental Science Park. +Host 211.23.141.208 + User ubuntu + +# This is the firewall for MA on the 11th floor of Oriental Science Park. +# Host 211.23.141.207 +# User timmy + +# This is the Ubuntu Server for the Serbia office. +Host 89.216.107.241 serbia-office + HostName 89.216.107.241 + User timmy + Port 8022 + Ciphers aes256-cbc,aes256-ctr + ProxyJump 211.23.141.208 + +# 遠振 +Host 103.123.242.152 yz-prod + User root + HostName 103.123.242.152 + HostKeyAlgorithms ssh-rsa diff --git a/config.d/timmy b/config.d/timmy new file mode 100644 index 0000000..ab7cacb --- /dev/null +++ b/config.d/timmy @@ -0,0 +1,63 @@ +Host timmy_home_server + User timmy + HostName 125.229.110.50 + Ciphers aes256-cbc,aes256-ctr # Encryption algorithms for better security + +Host 141.11.93.252 + User root + HostName 141.11.93.252 + Ciphers aes256-cbc,aes256-ctr # Encryption algorithms for better security + + +Host 192.168.42.123 + User root + +Host 192.168.42.10 + User root + +Host 192.168.42.38 + User root + +Host 192.168.42.39 + User root + +Host 192.168.42.40 + User root + + +Host 192.168.42.101 + User root + +Host 192.168.42.102 + User root + +Host 192.168.42.112 + User root + +Host 192.168.42.106 + User root + +Host 192.168.42.120 + User ubuntu + +Host 192.168.42.121 + User ubuntu + +Host 192.168.42.122 + User ubuntu + +Host 192.168.42.211 + User root + +Host 192.168.42.118 + User root + +Host 192.168.42.124 + User root + +Host 192.168.42.126 + User root + +Host 100.64.0.9 + Port 8022 + User u0_a291 diff --git a/create_ssh_symlinks.sh b/create_ssh_symlinks.sh new file mode 100755 index 0000000..ee69f5e --- /dev/null +++ b/create_ssh_symlinks.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Set default configuration +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +TZ='Asia/Taipei' + +# Export environment variables +export PATH +export LANG=en_US.UTF-8 +export LANGUAGE=en_US:en + +# Base directory for SSH files in iCloud Drive +BASE_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs/.ssh" + +# Create .ssh directory if it doesn't exist +mkdir -p ~/.ssh + +# Create symlinks for SSH config, keys, and config.d directory +ln -sf "$BASE_DIR/config" ~/.ssh/config +ln -sf "$BASE_DIR/id_ecdsa" ~/.ssh/id_ecdsa +ln -sf "$BASE_DIR/id_ecdsa.pub" ~/.ssh/id_ecdsa.pub +ln -sf "$BASE_DIR/id_rsa" ~/.ssh/id_rsa +ln -sf "$BASE_DIR/id_rsa.pub" ~/.ssh/id_rsa.pub +ln -sf "$BASE_DIR/config.d" ~/.ssh/config.d + +# Create .ssh/sockets directory +mkdir -p ~/.ssh/sockets diff --git a/delete_ssh_files.sh b/delete_ssh_files.sh new file mode 100755 index 0000000..50ab06d --- /dev/null +++ b/delete_ssh_files.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# 定義預設的配置設定 +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +TZ='Asia/Taipei' + +# 將配置設定寫入環境變數 +export PATH +export LANG=en_US.UTF-8 +export LANGUAGE=en_US:en + +# 刪除 .ssh 目錄中的配置文件、私鑰和公鑰文件 +rm ~/.ssh/config ~/.ssh/id_ecdsa ~/.ssh/id_ecdsa.pub ~/.ssh/id_rsa ~/.ssh/id_rsa.pub + diff --git a/google_compute_engine.pub b/google_compute_engine.pub new file mode 100644 index 0000000..7785d1d --- /dev/null +++ b/google_compute_engine.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC0hqlgX6SOmOacR/FJ9Vi1sRKxrVCE5ooCd6eU1McKz3QCs68hRjGkLM4zjh1I/5yP8k/j8G+hqMBuzW1qxDwflHabKtwiFY2M1MqgT9nS2bWyoouE3v1UddXxqYtH0Cl7JdxcZmTWBw7ZkXjhF61Qg49X6YSQbeQ6AASfBoNLBVUtwbRqEy0MEljnGKi2NlznE8IU92uZkGSf5p79fva0VThA1GXmfuj29Xg/q4kZh+mGP5+PFBcKPmwmEJdRwITPEsrEAhRprjndDiv5qCbik49ds1GBDFbSXFv5Tgc/pKvGLQBXw9BAVlM2RiEK4j7BMAYy5acMatkKDP3s5OFpYQFP1iE1+OVXBXdFqhx5a5yDzmcNcNVavw4zmPOqR23C0LyKQht0DVq583EYeUeKqleFr0Ocn1VaER0SZZcTzF5hfjly/t7+gEp9IzMp+1T1gnEqSREcWhj/2fxxtvMcOq24Sv9u+jwBcXtiaOkTlm88UnJ4PspoqQN0wUKskB0= timmy@TimmydeMBP-15 diff --git a/id_ecdsa.pub b/id_ecdsa.pub new file mode 100644 index 0000000..c279e81 --- /dev/null +++ b/id_ecdsa.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHuWc3e6X0lLFhv7UXipU5ppxTxW1pnx5RVDG0EQVMdJtXRRyztO/jNVkGxW9+X1+kMQY4xMwUCx1vsUiwWCsgE= diff --git a/id_rsa.pub b/id_rsa.pub new file mode 100644 index 0000000..9f354d4 --- /dev/null +++ b/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZaJcoDQnUggR4dGrg4lX5hd9XTsAfgEER0ds7fxEZMoYEX4j9RwsIwE+Zimfn5B1e0Z5FZ2fkAVLQg07kC34ask4laGtP/72Q/8MnN+f34BZBLo5w8uMFpkMkn8R4y0EB/olEWVxobUeV63NKQ9wXxN2DITtLJcwo7V/6qzba0+sQaPAsnE1/VDgS9LyvP0QRY4crArmLdjEHsgaJoLhsXF1E/GbXsx1FLxVFsOSXoZxaDfVamGjJxDIavmnpYHaWHeFsCfyw5NnehvT6sFB3tHMyJ4fnOg627xDNxVvxrQjmdnzdmVRrTNGa9qbKmu+mzRWr9Tbs7RVAEdHLd/5x diff --git a/ssh_key_management.sh b/ssh_key_management.sh new file mode 100755 index 0000000..9d5a8c7 --- /dev/null +++ b/ssh_key_management.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# 定義預設的配置設定 +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +TZ='Asia/Taipei' + +# 將配置設定寫入環境變數 +export PATH +export LANG=en_US.UTF-8 +export LANGUAGE=en_US:en + +# 啟動 SSH-Agent,它會在背景運行並管理 SSH 金鑰 +eval $(ssh-agent) + +# 將指定路徑的 SSH 私鑰加入到 SSH-Agent 中 +# ssh-add ~/Sync/.ssh/ +ssh-add ~/Sync/.ssh/aws_server_13_113_205_237.pem +ssh-add ~/Sync/.ssh/aws_server_18_177_222_167.pem + +# 列出已經加入到 SSH-Agent 中的金鑰清單 +ssh-add -l +