blob: 2940e553b8ea2de5b40b3aad0963ef765cf76bbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/bin/bash
# This file is in the public domain.
set -eu
# Inputs: DOMAIN_NAME & ENABLE_TLS
source functions.sh
source config/user.conf
source config/internal.conf
if test -z ${DOMAIN_NAME:-}
then
say "Error: config/user.conf does not specify DOMAIN_NAME"
exit 1
fi
if test -z ${ENABLE_TLS:-}
then
say "Error: config/user.conf does not specify ENABLE_TLS"
exit 1
fi
say "Configuring Nginx"
SITES_AVAILABLE_DIR=/etc/nginx/sites-available
SITES_ENABLED_DIR=/etc/nginx/sites-enabled
cat ${SITES_AVAILABLE_DIR}/taler-exchange \
| sed -e "s/localhost/exchange.${DOMAIN_NAME}/g" \
| sed -e "s/location \/taler-exchange\//location \//g" \
| sed -e "s/# proxy_set_header/proxy_set_header/g" \
> ${SITES_AVAILABLE_DIR}/taler-exchange.${DOMAIN_NAME}
rm -f ${SITES_ENABLED_DIR}/exchange.${DOMAIN_NAME}
ln -s ${SITES_AVAILABLE_DIR}/taler-exchange.${DOMAIN_NAME} ${SITES_ENABLED_DIR}/exchange.${DOMAIN_NAME}
cat ${SITES_AVAILABLE_DIR}/taler-merchant \
| sed -e "s/localhost/backend.${DOMAIN_NAME}/g" \
| sed -e "s/location \/taler-merchant\//location \//g" \
| sed -e "s/# proxy_set_header/proxy_set_header/g" \
> ${SITES_AVAILABLE_DIR}/taler-merchant.${DOMAIN_NAME}
rm -f ${SITES_ENABLED_DIR}/backend.${DOMAIN_NAME}
ln -s ${SITES_AVAILABLE_DIR}/taler-merchant.${DOMAIN_NAME} ${SITES_ENABLED_DIR}/backend.${DOMAIN_NAME}
cat ${SITES_AVAILABLE_DIR}/libeufin-sandbox \
| sed -e "s/localhost/bank.${DOMAIN_NAME}/g" \
| sed -e "s/\$scheme/https/g" \
> ${SITES_AVAILABLE_DIR}/libeufin-sandbox.${DOMAIN_NAME}
rm -f ${SITES_ENABLED_DIR}/bank.${DOMAIN_NAME}
ln -s ${SITES_AVAILABLE_DIR}/libeufin-sandbox.${DOMAIN_NAME} ${SITES_ENABLED_DIR}/bank.${DOMAIN_NAME}
say "Restarting Nginx with new configuration"
systemctl restart nginx
if test ${ENABLE_TLS} == "y"
then
say "Obtaining TLS certificates"
certbot --nginx \
-d backend.${DOMAIN_NAME} \
-d bank.${DOMAIN_NAME} \
-d exchange.${DOMAIN_NAME}
fi
|