如何刪除已棄用的 certbot-auto,但保留 certbot 和現有配置

如何刪除已棄用的 certbot-auto,但保留 certbot 和現有配置

盲目地遵循安裝教程,我最終得到了 certbot-auto (git clone to /etc/letsencrypt)和實際的 certbot 工具。現在我真的很想清理我的 Ubuntu 安裝,最終只得到最新的 certbot,但也保留現有的憑證和配置。

答案1

這就是我最終所做的。希望有人覺得它有用。

  1. 將整個/etc/letsencrypt目錄備份到 root 的主目錄cp -r /etc/letsencrypt ~

  2. 刪除所有內容rm -rf /etc/letsencrypt

  3. 強制重新安裝 certbotsudo apt-get install certbot --reinstall

  4. 使用 certbot 請求新憑證:

sudo certbot certonly --authenticator standalone -d webmail.hell.org --pre-hook "service nginx stop" --post-hook "service nginx start"

這在下面創建了目錄結構/etc/letsencrypt

accounts      
archive       
csr           
keys          
live          
renewal       
renewal-hooks 
  1. 從上面的備份路徑中,一一覆蓋原來的目錄
cd /etc/letsencrypt/
cp -r ~/letsencrypt/accounts ./
cp -r ~/letsencrypt/accounts/ ./
cp -r ~/letsencrypt/archive ./
cp -r ~/letsencrypt/csr ./
cp -r ~/letsencrypt/keys ./
cp -r ~/letsencrypt/live ./
cp -r ~/letsencrypt/renewal ./
cp -r ~/letsencrypt/renewal-hooks ./
  1. 重新啟動以確保萬無一失。

  2. 測試電子郵件、網頁郵件和網頁伺服器均已啟動並執行。

  3. 進行模擬 certbot 續訂

certbot renew --dry-run

如果您收到類似以下內容的警告訊息:

嘗試使用 Certbot 版本 0.31.0 解析在 /etc/letsencrypt/renewal/mail.hell.org.conf 中找到的版本 1.9.0 續訂設定檔。這可能行不通。

a)忽略它,

b) 編輯有問題的檔案並將版本設定為0.31.0

這是因為續約配置是使用 certbot-auto 進行的,其版本號碼與 certbot 完全無關。

相關內容