iT邦幫忙

2026 iThome 鐵人賽

DAY 29
0
ChatGPT & Codex

窮鬼冰箱升級計劃系列 第 29 篇

【Day 29】beggarFridge Security Hardening

  • 分享至 

  • xImage
  •  

簡述

今天,預計透過檢視整個系統可能存在的被攻擊層面,進行資訊安全的加強。

Attack Interface

Internet
   │
   ▼
Router / No-IP
   │
   ▼
Raspberry Pi
   ├── SSH
   ├── FastAPI
   ├── Dashboard
   ├── SQLite
   ├── Photos
   ├── Telegram/API secrets
   └── Meshtastic

可能暴露的弱點

Raspberry Pi 被入侵
SSH 密碼太弱
API 沒驗證
Port Forwarding 開太多
.env 權限錯
照片目錄可公開讀
Log 洩漏 Token
Backup 沒加密
systemd service 用 root 跑

Security Hardening 可以分成

Network
OS
Application
Secrets
Data
Service Permission

逐步檢查項

關閉非必要 port

ss -lntup

FastAPI port

FastAPI 不要直接裸露 8000,以下常見範例,都開 8000 port

Internet
   ↓
Router
   ↓
:8000
   ↓
Uvicorn

修改成

Internet
   ↓
HTTPS :443
   ↓
Reverse Proxy
   ↓
127.0.0.1:8000
   ↓
FastAPI

其中,IP 就不綁給 0.0.0.0,理由是 FastAPI 只需要被本機 Reverse Proxy 存取。

uvicorn app.main:app \
  --host 127.0.0.1 \
  --port 8000

上一篇
【Day 28】beggarFridge 的 Backup & Recovery
下一篇
【Day 30】beggarFridge:從一台舊 Raspberry Pi 到完整智慧冰箱架構回顧
系列文
窮鬼冰箱升級計劃 共 30 篇
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言