docs: SOP 新增步驟 9 — 更新 NPM 資料庫到期日顯示
Custom Certificate 無法透過 UI 編輯,需用 Python 直接改 SQLite Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -108,22 +108,30 @@ ssh hospital_web "echo | openssl s_client -connect localhost:443 \
|
||||
| grep 'Verify return code'"
|
||||
```
|
||||
|
||||
預期:`Verify return code: 0 (ok)`
|
||||
|
||||
> 注意:GCA 憑證的根 CA(GRCA G3)不在 Linux 預設信任庫,
|
||||
> 伺服器端會顯示 `Verify return code: 20`,這是正常的。
|
||||
> 瀏覽器端通常可正常驗證。
|
||||
|
||||
---
|
||||
### 步驟 9:更新 NPM 資料庫顯示
|
||||
|
||||
## 替代方案:透過 NPM 管理後台
|
||||
直接替換檔案部署時,NPM 後台顯示的到期日不會自動更新(Custom Certificate 無法透過 UI 編輯)。
|
||||
需手動更新資料庫:
|
||||
|
||||
1. `ssh hospital_web`(自動建立 port forwarding)
|
||||
2. 瀏覽器開啟 `http://localhost:8181`
|
||||
3. SSL Certificates → Add SSL Certificate → Custom
|
||||
4. 貼上 `fullchain.pem` 內容(Certificate)
|
||||
5. 貼上 `privkey.pem` 內容(Certificate Key)
|
||||
6. 儲存後套用至對應的 Proxy Host
|
||||
```bash
|
||||
ssh hospital_web 'sudo docker exec nginxproxymanager /opt/certbot/bin/python3 -c "
|
||||
import sqlite3, datetime
|
||||
conn = sqlite3.connect(\"/data/database.sqlite\")
|
||||
c = conn.cursor()
|
||||
now = datetime.datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\")
|
||||
# 將到期日改為新憑證的到期日
|
||||
c.execute(\"UPDATE certificate SET expires_on=?, modified_on=? WHERE id=1\", (\"2028-04-01 00:54:36\", now))
|
||||
conn.commit()
|
||||
print(\"Updated. Rows:\", c.rowcount)
|
||||
conn.close()
|
||||
"'
|
||||
```
|
||||
|
||||
更新後重新整理 NPM 後台頁面即可看到正確的到期日。
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user