2.7 KiB
2.7 KiB
CT105 — ip.lotimmy.com (echoip)
主機 192.168.42.105(hostname CT105),Ubuntu 24.04 LXC,跑在 Proxmox 上。
對外提供一個 echoip 服務:回傳來訪者的 IP 與 GeoIP 資訊。
連線
設定在 ~/.ssh/config.d/timmy,皆內建 ProxyJump timmy_home_server(遠端免打 -J)。
ssh ct105 # User: timmy
ssh ct105-root # User: root
內網直連(在 LAN 上時):ssh 192.168.42.105
- root 與 timmy 皆已裝公鑰(
~/.ssh/id_ecdsa.pub),免密碼。 - sshd
PermitRootLogin without-password:root 僅允許金鑰登入,密碼登入關閉。
服務鏈路
https://ip.lotimmy.com
└─ Nginx Proxy Manager (Let's Encrypt 憑證, Public)
└─ http://192.168.42.105:8080 (echoip 容器)
- NPM 反代位置:另一台主機(NPM 管理介面),proxy host
ip.lotimmy.com→http://192.168.42.105:8080。 - 反代帶
X-Real-IP標頭,echoip 以-H X-Real-IP信任之,故回傳的是真實外網 IP 而非反代內網 IP。
端點
| URL | 回傳 |
|---|---|
https://ip.lotimmy.com |
純文字 IP |
https://ip.lotimmy.com/json |
完整 JSON(IP + GeoIP:city/region/asn 等) |
Docker 容器
兩個容器,compose 檔在主機 /opt 下。
echoip — /opt/echoip/docker-compose.yml
services:
echoip:
image: mpolden/echoip
container_name: echoip
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- /opt/geoip/GeoLite2-City.mmdb:/data/city.mmdb
- /opt/geoip/GeoLite2-ASN.mmdb:/data/asn.mmdb
command: -c /data/city.mmdb -a /data/asn.mmdb -H X-Real-IP
- GeoIP 資料庫掛載自
/opt/geoip/。 /opt/echoip/另有 GeoLite2 原始壓縮檔與download_geolite2_databases.sh(更新 GeoIP 用)。
watchtower — /opt/watchtower/docker-compose.yml
services:
watchtower:
container_name: watchtower
image: containrrr/watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --cleanup --label-enable --interval 300
- 每 5 分鐘檢查、清舊 image,只更新有
com.centurylinklabs.watchtower.enable=true標籤的容器。
已知狀況
- ⚠️ watchtower 開了
--label-enable,但 echoip 沒貼com.centurylinklabs.watchtower.enable=true標籤,所以 echoip 不會被自動更新(watchtower 目前沒管任何容器)。 要啟用自動更新,在 echoip 的 compose 加:然後labels: - com.centurylinklabs.watchtower.enable=truecd /opt/echoip && docker compose up -d。
其他
- 本機服務:sshd:22、Postfix(僅
127.0.0.1:25)、systemd-resolved(本機 DNS)。對外僅 echoip:8080。