home
·
contact
·
privacy
projects
/
config
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8f9ce11
)
Reduce scope of letsencrypt.sh script.
author
Christian Heller
<c.heller@plomlompom.de>
Thu, 29 Nov 2018 23:39:55 +0000
(
00:39
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Thu, 29 Nov 2018 23:39:55 +0000
(
00:39
+0100)
all_new_2018/letsencrypt.sh
patch
|
blob
|
history
diff --git
a/all_new_2018/letsencrypt.sh
b/all_new_2018/letsencrypt.sh
index 2e6a03b2194c06b1e71761dcd7975f063e1283a0..18f9aa4f0d50d9aa494d97aef328d045ff78387b 100755
(executable)
--- a/
all_new_2018/letsencrypt.sh
+++ b/
all_new_2018/letsencrypt.sh
@@
-2,13
+2,7
@@
# Install or copy LetsEncrypt certificates on/from server.
#
# First argument: server
# Install or copy LetsEncrypt certificates on/from server.
#
# First argument: server
-# Second argument: either "set" or "get" or "put"
-#
-# "set" install certbot on remote server and requests a new certificate
-# for it. This needs two more arguments: an e-mail address for future
-# communication with LetsEncrypt, and the domain for which to request
-# the certificate (might plausibly be equivalent to the first argument
-# though). This needs port 80 open on the server.
+# Second argument: "get" or "put"
#
# "get" copies the server's /etc/letsencrypt to a local letsencrypt.tar.
#
#
# "get" copies the server's /etc/letsencrypt to a local letsencrypt.tar.
#
@@
-27,16
+21,7
@@
action="$2"
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
-if [ "${action}" = "set" ]; then
- # Install certificate. This needs port 80 open (443 does not work here).
- if [ $# -lt 4 ]; then
- echo "Need mail address and domain as arguments."
- false
- fi
- mail="$3"
- domain="$4"
- ssh -t plom@${server} "su -c 'apt update && apt -y install certbot && certbot certonly --standalone --agree-tos -m ${mail} -d ${server}'"
-elif [ "${action}" = "get" ]; then
+if [ "${action}" = "get" ]; then
# Get /etc/letsencrypt/ as tar file.
ssh -t plom@${server} 'su -c "cd /etc/ && tar cf letsencrypt.tar letsencrypt && chown plom:plom letsencrypt.tar && mv letsencrypt.tar /home/plom/"'
scp plom@${server}:~/letsencrypt.tar .
# Get /etc/letsencrypt/ as tar file.
ssh -t plom@${server} 'su -c "cd /etc/ && tar cf letsencrypt.tar letsencrypt && chown plom:plom letsencrypt.tar && mv letsencrypt.tar /home/plom/"'
scp plom@${server}:~/letsencrypt.tar .
@@
-45,6
+30,6
@@
elif [ "${action}" = "put" ]; then
scp letsencrypt.tar plom@${server}:~/
ssh -t plom@${server} 'su -c "rmdir /etc/letsencrypt && mv letsencrypt.tar /etc/ && cd /etc/ && tar xf letsencrypt.tar && rm letsencrypt.tar"'
else
scp letsencrypt.tar plom@${server}:~/
ssh -t plom@${server} 'su -c "rmdir /etc/letsencrypt && mv letsencrypt.tar /etc/ && cd /etc/ && tar xf letsencrypt.tar && rm letsencrypt.tar"'
else
- echo "Action must be '
set', '
get', or 'put'."
+ echo "Action must be 'get', or 'put'."
false
fi
false
fi