純粹用 Shell(Unix shell)語言編寫的 ACME 協定客戶端。
完整的 ACME 協定實施。
支援ECDSA證書
支援SAN和通配符證書
簡單、強大且非常易於使用。您只需要 3 分鐘即可學會。
Bash、dash 和 sh 相容。
純粹用 Shell 寫,不依賴 python。
只需一個腳本即可自動頒發、續訂和安裝您的憑證。
不需要root/sudoer
存取權限。
Docker 準備就緒
IPv6 就緒
有關更新或錯誤等的 Cron 作業通知。
它可能是自動頒發和續訂免費證書的easiest & smartest
shell 腳本。
維基:https://github.com/acmesh-official/acme.sh/wiki
對於 Docker 粉絲:acme.sh ?碼頭工人
推特:@neilpangxa
FreeBSD.org
紅寶石中國網
普羅克斯莫克斯
普夫感
負載平衡器.org
discourse.org
中央管理軟體
史普林克斯
opnsense.org
CentOS 網頁面板
lnmp.org
更多的...
不 | 地位 | 平台 |
---|---|---|
1 | 蘋果電腦 | |
2 | Windows(包含curl、openssl和crontab的cygwin) | |
3 | 自由BSD | |
4 | 索拉里斯 | |
5 | 烏班圖 | |
6 | 不適用 | 普夫感 |
7 | 開放BSD | |
8 | 網路BSD | |
9 | 蜻蜓BSD | |
10 | 奧姆尼奧斯 | |
11 | 德班 | |
12 | 中央作業系統 | |
13 | 開放SUSE | |
14 | Alpine Linux(附curl) | |
15 | ArchLinux | |
16 | 軟呢帽 | |
17 號 | 卡利Linux | |
18 | 甲骨文Linux | |
19 | 馬吉亞 | |
10 | Gentoo Linux | |
11 | 清除Linux | |
22 | ----- | 雲端 Linux #111 |
23 | ----- | OpenWRT:已測試且運作正常。請參閱維基頁面 |
24 | Proxmox:請參閱 Proxmox VE Wiki。版本 4.x、5.0、5.1、版本 5.2 及更高版本 |
查看我們的測試項目:
https://github.com/acmesh-official/acmetest
ZeroSSL.com CA(預設)
Letscrypt.org CA
BuyPass.com CA
SSL.com CA
Google.com 公共 CA
Pebble 嚴格模式
任何其他符合 RFC8555 的 CA
網路根模式
獨立模式
獨立 tls-alpn 模式
阿帕契模式
Nginx模式
DNS模式
DNS別名模式
無狀態模式
檢查這個項目:https://github.com/acmesh-official/get.acme.sh
捲曲 https://get.acme.sh | sh -s 電子郵件[email protected]
或者:
wget -O - https://get.acme.sh | sh -s 電子郵件[email protected]
克隆該專案並啟動安裝:
git 克隆 https://github.com/acmesh-official/acme.sh.gitcd ./acme.sh ./acme.sh --install -m [email protected]
儘管it is recommended
您成為 root,但您don't have to be root
。
進階安裝:https://github.com/acmesh-official/acme.sh/wiki/How-to-install
安裝程式將執行 3 個操作:
建立acme.sh
並將其複製到您的主目錄 ( $HOME
): ~/.acme.sh/
。所有證書也將放置在此資料夾中。
建立別名: acme.sh=~/.acme.sh/acme.sh
。
建立每日 cron 作業來檢查並更新憑證(如果需要)。
cron 條目範例:
0 0 * * * "/home/user/.acme.sh"/acme.sh --cron --home "/home/user/.acme.sh" > /dev/null
安裝完成後,必須關閉目前終端並重新開啟才能使別名生效。
好的,您現在可以頒發證書了。
顯示幫助訊息:
root@v1:~# acme.sh -h
範例 1:單一域。
acme.sh --issue -d example.com -w /home/wwwroot/example.com
或者:
acme.sh --issue -d example.com -w /home/使用者名稱/public_html
或者:
acme.sh --issue -d example.com -w /var/www/html
範例 2:同一憑證中的多個網域。
acme.sh --issue -d example.com -d www.example.com -d cp.example.com -w /home/wwwroot/example.com
參數/home/wwwroot/example.com
或/home/username/public_html
或/var/www/html
是託管網站檔案的 Web 根資料夾。您必須具有對此資料夾的write access
。
第二個參數「example.com」是您要為其頒發憑證的主網域。您必須至少擁有一個網域。
您必須將所有網域指向並綁定到同一個 webroot 目錄: /home/wwwroot/example.com
。
證書將放置在~/.acme.sh/example.com/
中
證書將每60天自動更新一次。
更多範例:https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert
產生憑證後,您可能想要將憑證安裝/複製到您的 Apache/Nginx 或其他伺服器。您必須使用此命令將證書複製到目標文件,請勿使用~/.acme.sh/資料夾中的證書文件,它們僅供內部使用,資料夾結構將來可能會更改。
阿帕契範例:
acme.sh --install-cert -d example.com --cert-file /path/to/certfile/in/apache/cert.pem --金鑰檔案/path/to/keyfile/in/apache/key.pem --fullchain-檔案 /path/to/fullchain/certfile/apache/fullchain.pem --reloadcmd“服務apache2強制重新載入”
Nginx範例:
acme.sh --install-cert -d example.com --密鑰檔案/path/to/keyfile/in/nginx/key.pem --fullchain-檔案/path/to/fullchain/nginx/cert.pem --reloadcmd“服務 nginx 強制重新載入”
僅域是必需的,所有其他參數都是可選的。
現有文件的所有權和權限資訊將被保留。您可以預先建立文件來定義所有權和權限。
將憑證/金鑰安裝/複製到生產 Apache 或 Nginx 路徑。
預設情況下,憑證每60天更新一次(可設定)。更新憑證後,Apache/Nginx 服務將透過以下指令自動重新載入: service apache2 force-reload
或service nginx force-reload
。
請注意:reloadcmd 非常重要。憑證可以自動續訂,但是,如果沒有正確的“reloadcmd”,憑證可能無法刷新到您的伺服器(如 nginx 或 apache),那麼您的網站將無法在 60 天內顯示續訂的憑證。
(要求您是 root/sudoer 或具有偵聽連接埠 80 (TCP) 的權限)
埠80
(TCP)必須可以自由監聽,否則系統會提示您釋放它並重試。
acme.sh --issue --standalone -d example.com -d www.example.com -d cp.example.com
更多範例:https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert
(要求您是 root/sudoer 或有權偵聽連接埠 443 (TCP))
連接埠443
(TCP)必須可以自由監聽,否則系統會提示您釋放它並重試。
acme.sh --issue --alpn -d example.com -d www.example.com -d cp.example.com
更多範例:https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert
(需要您是 root/sudoer,因為需要與 Apache 伺服器互動)
如果您使用的是Web伺服器,建議使用Webroot mode
。
特別是,如果您正在執行 Apache 伺服器,則可以使用 Apache 模式。此模式不會將任何檔案寫入您的 Web 根資料夾。
只需將字串「apache」設定為第二個參數,它就會自動強制使用 apache 插件。
acme.sh --issue --apache -d example.com -d www.example.com -d cp.example.com
此 apache 模式僅頒發證書,它不會更改您的 apache 設定檔。您需要設定網站設定檔才能自行使用憑證。我們不想弄亂您的 apache 伺服器,別擔心。
更多範例:https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert
(需要你是 root/sudoer,因為它需要與 Nginx 伺服器互動)
如果您使用的是Web伺服器,建議使用Webroot mode
。
特別是,如果您正在執行 nginx 伺服器,則可以使用 nginx 模式。此模式不會將任何檔案寫入您的 Web 根資料夾。
只需將字串“nginx”設定為第二個參數即可。
它會自動設定 nginx 伺服器來驗證網域,然後將 nginx 設定還原到原始版本。
所以,配置沒有改變。
acme.sh --issue --nginx -d example.com -d www.example.com -d cp.example.com
這個nginx模式只是頒發證書,它不會改變你的nginx設定檔。您需要設定網站設定檔才能自行使用憑證。我們不想弄亂您的 nginx 伺服器,不用擔心。
更多範例:https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert
如果您的 DNS 提供者支援 API 訪問,我們可以使用該 API 自動頒發憑證。
您無需手動執行任何操作!
https://github.com/acmesh-official/acme.sh/wiki/dnsapi
首先請參閱:https://github.com/acmesh-official/acme.sh/wiki/dns-manual-mode。
如果您的dns提供者不支援任何api訪問,您可以手動新增txt記錄。
acme.sh --issue --dns -d example.com -d www.example.com -d cp.example.com
您應該得到如下輸出:
新增以下txt記錄: 網域:_acme-challenge.example.com 文字值:9ihDbjYfTExAYeDs4DBUeuTo18KBzwvTEjUnSwd32-c 新增以下txt記錄: 網域:_acme-challenge.www.example.com 文字值:9ihDbjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 請將這些 txt 記錄新增至網域。等待dns生效。
然後只需使用renew
參數重新運行:
acme.sh --renew -d example.com
好的,完成了。
注意,這是dns手動模式,不能自動更新。當您續訂憑證時,您必須手動為您的網域新增新的 txt 記錄。
請改用dns api模式。
只需設定帶有前綴ec-
keylength
參數即可。
例如:
acme.sh --issue -w /home/wwwroot/example.com -d example.com --keylength ec-256
acme.sh --issue -w /home/wwwroot/example.com -d example.com -d www.example.com --keylength ec-256
請查看上面的keylength
參數。
有效值為:
ec-256(prime256v1,“ECDSA P-256”,這是預設金鑰類型)
ec-384(secp384r1,「ECDSA P-384」)
ec-521(secp521r1,“ECDSA P-521”,Let's Encrypt 尚未支援。)
2048(RSA2048)
3072(RSA3072)
4096(RSA4096)
很簡單,只需給出一個通配符域作為-d
參數即可。
acme.sh --issue -d example.com -d '*.example.com' --dns dns_cf
不,您不需要手動續訂證書。所有證書將每60天自動更新一次。
但是,您也可以強制續約證書:
acme.sh --renew -d example.com --force
或者,對於 ECC 證書:
acme.sh --renew -d example.com --force --ecc
若要停止更新證書,您可以執行下列命令從更新清單中刪除證書:
acme.sh --remove -d example.com [--ecc]
憑證/金鑰檔案不會從磁碟中刪除。
您可以自行刪除對應的目錄(例如~/.acme.sh/example.com
)。
acme.sh
acme.sh 正在不斷開發中,因此強烈建議使用最新的程式碼。
您可以將 acme.sh 更新為最新程式碼:
acme.sh --升級
您也可以啟用自動升級:
acme.sh --upgrade --自動升級
然後acme.sh將自動保持最新。
停用自動升級:
acme.sh --upgrade --自動升級 0
https://github.com/acmesh-official/acme.sh/wiki/Issue-a-cert-from-existing-CSR
https://github.com/acmesh-official/acme.sh/wiki/notify
使用 shell 講 ACME 語言,直接進行「Let's Encrypt」。
待辦事項:
Acme-tiny:https://github.com/diafygi/acme-tiny
ACME協議:https://github.com/ietf-wg-acme/acme
這個項目的存在要感謝所有做出貢獻的人。
成為財務貢獻者並幫助我們維持我們的社區。 [貢獻]
與您的組織一起支持該專案。您的徽標將顯示在此處,並帶有指向您網站的連結。 [貢獻]
授權是 GPLv3
請給我加星標和叉子。
歡迎提出問題和拉取請求。
您的捐贈使acme.sh變得更好:
PayPal/Alipay(支付寶)/Wechat(微信): https://donate.acme.sh/
捐贈名單