{
 "HTTPS、TLS 與 Let's Encrypt 的原理#1": {
  "type": "cards",
  "reveal": [
   0,
   0,
   3,
   3
  ],
  "cards": [
   {
    "title": "加密",
    "points": [
     "別人看不到內容"
    ]
   },
   {
    "title": "完整性",
    "points": [
     "內容沒有被改過"
    ]
   },
   {
    "title": "身分驗證",
    "points": [
     "連到確實是那個網站"
    ]
   }
  ]
 },
 "HTTPS、TLS 與 Let's Encrypt 的原理#2": {
  "type": "flow",
  "reveal": [
   0,
   0,
   3
  ],
  "nodes": [
   {
    "label": "根 CA",
    "color": 0
   },
   {
    "label": "中繼 CA",
    "color": 1
   },
   {
    "label": "你的憑證",
    "color": 2,
    "sub": "含公鑰"
   }
  ]
 },
 "HTTPS、TLS 與 Let's Encrypt 的原理#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   2
  ],
  "head": [
   "驗證方式",
   "做法"
  ],
  "rows": [
   [
    "HTTP-01",
    "CA 從 80 埠讀 .well-known 下的檔案"
   ],
   [
    "DNS-01",
    "加一筆 TXT 記錄,不需 80 埠,可申請萬用字元"
   ]
  ],
  "widths": [
   2,
   6
  ]
 },
 "HTTPS、TLS 與 Let's Encrypt 的原理#4": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "A 記錄",
    "color": 0,
    "sub": "dig 檢查"
   },
   {
    "label": "放行 80/443",
    "color": 1,
    "sub": "防火牆與安全群組"
   },
   {
    "label": "server_name",
    "color": 2,
    "sub": "nginx -t 通過"
   },
   {
    "label": "先測試",
    "color": 3,
    "sub": "--dry-run"
   }
  ]
 },
 "HTTPS、TLS 與 Let's Encrypt 的原理#5": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "head": [
   "要點",
   "做法"
  ],
  "rows": [
   [
    "監聽 443",
    "啟用 SSL"
   ],
   [
    "憑證與私鑰",
    "指定路徑"
   ],
   [
    "80 轉 HTTPS",
    "301 永久轉址"
   ],
   [
    "TLS 版本",
    "只允許 1.2 與 1.3"
   ],
   [
    "HSTS 標頭",
    "設定後期限內無法退回"
   ]
  ],
  "widths": [
   2,
   4
  ]
 },
 "用 Certbot 申請並自動更新憑證#2": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "nodes": [
   {
    "label": "apt snapd",
    "color": 0,
    "sub": "先安裝 snap"
   },
   {
    "label": "snap install",
    "color": 1,
    "sub": "--classic certbot"
   },
   {
    "label": "ln -s",
    "color": 2,
    "sub": "連到 /usr/bin"
   }
  ]
 },
 "用 Certbot 申請並自動更新憑證#4": {
  "type": "flow",
  "reveal": [
   0,
   4,
   4,
   4,
   4
  ],
  "nodes": [
   {
    "label": "申請憑證",
    "color": 0,
    "sub": "向 Let's Encrypt"
   },
   {
    "label": "80 埠驗證",
    "color": 1
   },
   {
    "label": "改 server block",
    "color": 2,
    "sub": "加 443 與路徑"
   },
   {
    "label": "是否轉址",
    "color": 3,
    "sub": "建議選轉址"
   }
  ]
 },
 "用 Certbot 申請並自動更新憑證#7": {
  "type": "cards",
  "reveal": [
   0,
   1,
   1,
   2,
   2
  ],
  "cards": [
   {
    "title": "443 區塊",
    "points": [
     "listen 443 ssl",
     "憑證與私鑰路徑",
     "引入 options-ssl-nginx.conf"
    ]
   },
   {
    "title": "80 區塊",
    "points": [
     "只做轉址",
     "return 301 到 HTTPS"
    ]
   }
  ]
 },
 "Nginx 反向代理與後端應用#1": {
  "type": "cards",
  "reveal": [
   0,
   0,
   1,
   2,
   3
  ],
  "cards": [
   {
    "title": "後端不直接暴露",
    "points": [
     "攻擊面變少"
    ]
   },
   {
    "title": "HTTPS 設定一次",
    "points": [
     "後端不必處理憑證"
    ]
   },
   {
    "title": "依網域分流",
    "points": [
     "同一個 443 埠",
     "對應多個應用"
    ]
   }
  ]
 },
 "Nginx 反向代理與後端應用#2": {
  "type": "table",
  "reveal": [
   0,
   0,
   0,
   5,
   5,
   5
  ],
  "head": [
   "設定",
   "值"
  ],
  "rows": [
   [
    "proxy_pass",
    "http://127.0.0.1:3000"
   ],
   [
    "Host",
    "$host"
   ],
   [
    "X-Real-IP",
    "$remote_addr"
   ],
   [
    "X-Forwarded-For",
    "$proxy_add_x_forwarded_for"
   ],
   [
    "X-Forwarded-Proto",
    "$scheme"
   ]
  ],
  "widths": [
   2,
   4
  ]
 },
 "Nginx 反向代理與後端應用#4": {
  "type": "bar",
  "reveal": [
   0,
   2,
   2,
   2
  ],
  "labels": [
   "預設",
   "範例"
  ],
  "values": [
   60,
   120
  ],
  "unit": "秒"
 },
 "Nginx 反向代理與後端應用#5": {
  "type": "flow",
  "reveal": [
   0,
   0,
   3
  ],
  "nodes": [
   {
    "label": "瀏覽器",
    "color": 0
   },
   {
    "label": "Nginx",
    "color": 1,
    "sub": "TLS 終止"
   },
   {
    "label": "後端應用",
    "color": 2,
    "sub": "本機 HTTP"
   }
  ]
 },
 "Nginx 反向代理與後端應用#6": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   2,
   2
  ],
  "head": [
   "ss 看到",
   "意義"
  ],
  "rows": [
   [
    "127.0.0.1:3000",
    "只聽本機,正常"
   ],
   [
    "0.0.0.0:3000 或 *:3000",
    "別人可繞過 Nginx 直打後端"
   ]
  ],
  "widths": [
   2,
   3
  ]
 },
 "Nginx 反向代理與後端應用#7": {
  "type": "table",
  "reveal": [
   0,
   0,
   1,
   2,
   3,
   4
  ],
  "head": [
   "設定",
   "說明"
  ],
  "rows": [
   [
    "a2enmod",
    "proxy proxy_http headers"
   ],
   [
    "ProxyPreserveHost On",
    "保留原本主機名稱"
   ],
   [
    "ProxyPass / http://127.0.0.1:3000/",
    "轉給本機 3000 埠"
   ],
   [
    "ProxyPassReverse / http://127.0.0.1:3000/",
    "與 ProxyPass 成對"
   ]
  ],
  "widths": [
   4,
   3
  ]
 }
}