mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
changed certbot commands
This commit is contained in:
parent
f31663b5f0
commit
b8d48b63cb
@ -31,11 +31,13 @@ fi
|
|||||||
|
|
||||||
user=kvmd-certbot
|
user=kvmd-certbot
|
||||||
web=/run/kvmd-certbot/webroot
|
web=/run/kvmd-certbot/webroot
|
||||||
pstbase=/var/lib/kvmd/pst/data/certbot
|
cur=/var/lib/kvmd/pst/data/certbot/runroot
|
||||||
cur="$pstbase/runroot"
|
new=/var/lib/kvmd/pst/data/certbot/runroot.new
|
||||||
new="$pstbase/runroot.new"
|
|
||||||
tmp=/tmp/kvmd-certbot/runroot
|
tmp=/tmp/kvmd-certbot/runroot
|
||||||
|
|
||||||
|
cur_opts=("--config-dir=$cur/config" "--work-dir=$cur/work" "--logs-dir=$cur/logs")
|
||||||
|
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
rm -rf "$tmp"
|
rm -rf "$tmp"
|
||||||
}
|
}
|
||||||
@ -73,28 +75,23 @@ function restart_if_running_vnc() {
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help|help)
|
-h|--help|help)
|
||||||
sudo -u "$user" certbot "$@" \
|
sudo -u "$user" certbot "$@" "${cur_opts[@]}"
|
||||||
--config-dir="$cur/config" \
|
|
||||||
--work-dir="$cur/work" \
|
|
||||||
--logs-dir="$cur/logs"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
certonly)
|
certonly|certonly_webroot)
|
||||||
|
webroot_opts=()
|
||||||
|
if [ "$1" == certonly_webroot ]; then
|
||||||
|
webroot_opts=(--webroot "--webroot-path=$web")
|
||||||
|
fi
|
||||||
|
shift
|
||||||
create_tmp
|
create_tmp
|
||||||
ensure_runroot
|
ensure_runroot
|
||||||
sudo -u "$user" kvmd-pstrun -- certbot "$@" \
|
sudo -u "$user" kvmd-pstrun -- certbot certonly "$@" "${cur_opts[@]}" \
|
||||||
--config-dir="$cur/config" \
|
"${webroot_opts[@]}" \
|
||||||
--work-dir="$cur/work" \
|
|
||||||
--logs-dir="$cur/logs" \
|
|
||||||
--webroot \
|
|
||||||
--webroot-path="$web" \
|
|
||||||
--deploy-hook="/usr/bin/bash -c '
|
--deploy-hook="/usr/bin/bash -c '
|
||||||
set -ex
|
set -ex
|
||||||
chmod 755 '$cur/config/'{archive,live}
|
chmod 755 '$cur/config/'{archive,live}
|
||||||
cd \"\$RENEWED_LINEAGE\"
|
chmod 640 \"\$RENEWED_LINEAGE/privkey.pem\"
|
||||||
chmod 640 privkey.pem
|
|
||||||
ln -s fullchain.pem server.crt
|
|
||||||
ln -s privkey.pem server.key
|
|
||||||
'"
|
'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -126,33 +123,23 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
install)
|
install_nginx|install_vnc)
|
||||||
case "$2" in
|
target="${1/install_/}"
|
||||||
nginx|vnc)
|
if [ -z "$2" ]; then
|
||||||
if [ -z "$2" ]; then
|
echo "Usage: kvmd-certbot $1 <domain>"
|
||||||
echo "Usage: kvmd-certbot install <nginx|vnc> <domain>"
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
rm -f "/etc/kvmd/$target/ssl/server."{crt,key}
|
||||||
set -x
|
ln -s "$cur/config/live/$2/fullchain.pem" "/etc/kvmd/$target/ssl/server.crt"
|
||||||
rm -f "/etc/kvmd/$2/ssl/server."{crt,key}
|
ln -s "$cur/config/live/$2/privkey.pem" "/etc/kvmd/$target/ssl/server.key"
|
||||||
ln -s "$cur/config/live/$3/server."{crt,key} "/etc/kvmd/$2/ssl/"
|
"restart_if_running_$target"
|
||||||
"restart_if_running_$2"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: kvmd-certbot install <nginx|vnc> <domain>"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
create_tmp
|
create_tmp
|
||||||
ensure_runroot
|
ensure_runroot
|
||||||
sudo -u "$user" kvmd-pstrun -- certbot "$@" \
|
sudo -u "$user" kvmd-pstrun -- certbot "$@" "${cur_opts[@]}"
|
||||||
--config-dir="$cur/config" \
|
|
||||||
--work-dir="$cur/work" \
|
|
||||||
--logs-dir="$cur/logs"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user