Correct the wrong content

master
Dct Mei 2020-08-15 02:52:21 +00:00
parent 822af7c99b
commit a1f976aeb9
1 changed files with 17 additions and 6 deletions

@ -1,11 +1,13 @@
## 使用證書時權限不足 ## 使用證書時權限不足
假設,證書文檔分別為: ### 方案一(不推薦)
假定證書文檔分別為:
1. `/srv/http/example.com.pem` 1. `/srv/http/example.com.pem`
2. `/srv/http/example.com.key` 2. `/srv/http/example.com.key`
### 方案一(不推薦) 據此:
1. `/srv/http/` 的默認權限一般為 755 1. `/srv/http/` 的默認權限一般為 755
2. `/srv/http/example.com.pem` 的默認權限一般為 644。 2. `/srv/http/example.com.pem` 的默認權限一般為 644。
@ -19,6 +21,11 @@
### 方案二 ### 方案二
假定證書文檔分別為:
1. `/srv/http/example.com.pem`
2. `/srv/http/example.com.key`
``` ```
# id nobody # id nobody
``` ```
@ -54,10 +61,12 @@ uid=65534(nobody) gid=65534(nobody) groups=65534(nobody)
1. `/etc/letsencrypt/live/example.com/fullchain.pem` 1. `/etc/letsencrypt/live/example.com/fullchain.pem`
2. `/etc/letsencrypt/live/example.com/privkey.pem` 2. `/etc/letsencrypt/live/example.com/privkey.pem`
如果你使用 Debian 發行版,在安裝 Cerbot 後,`renew` 是會定期執行的。
建立 V2Ray 專用的證書文檔目錄: 建立 V2Ray 專用的證書文檔目錄:
``` ```
# mkdir /etc/ssl/v2ray/ # install -d -o nobody -g nogroup /etc/ssl/v2ray/
``` ```
將證書文檔以指定權限部署到指定路徑: 將證書文檔以指定權限部署到指定路徑:
@ -67,7 +76,7 @@ uid=65534(nobody) gid=65534(nobody) groups=65534(nobody)
# install -m 600 -o nobody -g nogroup /etc/letsencrypt/live/example.com/privkey.pem -t /etc/ssl/v2ray/ # install -m 600 -o nobody -g nogroup /etc/letsencrypt/live/example.com/privkey.pem -t /etc/ssl/v2ray/
``` ```
為在後續 `renew` 中自動重新部署(如果你使用 Debian 發行版,在安裝 Cerbot 後,`renew` 是會定期執行的),需要一個腳本,以下是參照內容: 為在後續 `renew` 中自動重新部署,需要一個腳本,以下是參照內容:
```bash ```bash
# vim /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh # vim /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh
@ -85,8 +94,10 @@ if [[ "$RENEWED_LINEAGE" == "/etc/letsencrypt/live/$TROJAN_DOMAIN" ]]; then
fi fi
``` ```
### 給予腳本可執行權限 #### 給予腳本可執行權限
``` ```
# chmod +x /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh # chmod +x /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh
``` ```
`renew` 重新部署證書後,會自動執行 `deploy/` 下具有可執行權限的腳本。