add acme-helper script
This commit is contained in:
parent
62fae1bcde
commit
efe8218836
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run this script with "(sudo) bash <filename> <args>".
|
||||
|
||||
# Exit on error.
|
||||
#set -e
|
||||
# Debug
|
||||
set -eux
|
||||
|
||||
# The Acme.sh user.
|
||||
ACME_USER='acme'
|
||||
|
||||
# The Acme.sh group.
|
||||
ACME_GROUP='acme'
|
||||
|
||||
# The acme.sh home.
|
||||
ACME_HOME='/etc/acme'
|
||||
|
||||
# Where to download the acme.sh script.
|
||||
ACME_SCRIPT_URL='https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh'
|
||||
|
||||
# Temporary script location.
|
||||
ACME_SCRIPT_TMP='~/acme.sh'
|
||||
|
||||
install() {
|
||||
# Add user.
|
||||
adduser --system --disabled-login --gecos GECOS \
|
||||
--no-create-home --home "${ACME_HOME}" "${ACME_USER}"
|
||||
|
||||
# Lock the user.
|
||||
passwd -l "${ACME_USER}"
|
||||
|
||||
# Add user to group if it exists otherwise add it & then add the user
|
||||
# to the group.
|
||||
usermod -aG ${ACME_GROUP} ${ACME_USER} || \
|
||||
addgroup --system ${ACME_GROUP}
|
||||
usermod -aG ${ACME_GROUP} ${ACME_USER}
|
||||
|
||||
# Make the home dir.
|
||||
mkdir -v ${ACME_HOME}
|
||||
chown ${ACME_USER}:${ACME_GROUP} ${ACME_HOME}
|
||||
chmod -cR 750 ${ACME_HOME}
|
||||
chmod -cR u+s,g+s,o+s ${ACME_HOME}
|
||||
|
||||
# Add needed binaries.
|
||||
apt install sudo socat curl tee
|
||||
|
||||
# Download & install.
|
||||
sudo -s -u "${ACME_HOME}" curl -o "${ACME_SCRIPT_TMP}" "${ACME_SCRIPT_URL}" && ${ACME_SCRIPT_TMP} --install
|
||||
|
||||
}
|
||||
|
||||
${1} "$@"
|
Loading…
Reference in New Issue