@drumee/setup-infra 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-local-certs +38 -0
- package/bin/env +8 -5
- package/bin/init-acme +23 -4
- package/bin/init-named +1 -1
- package/bin/install +28 -4
- package/bin/prosody +21 -12
- package/index.js +314 -218
- package/package.json +2 -2
- package/templates/etc/bind/named.conf.local +39 -0
- package/templates/etc/bind/named.conf.options +13 -4
- package/templates/etc/dhcp/dhclient.conf +55 -0
- package/templates/etc/drumee/certs/jitsi.private.cnf +13 -0
- package/templates/etc/drumee/certs/private.cnf +13 -0
- package/templates/etc/drumee/conf.d/conference.private.json +9 -0
- package/templates/etc/drumee/conf.d/conference.public.json +9 -0
- package/templates/etc/drumee/conf.d/myDrumee.json.tpl +2 -1
- package/templates/etc/drumee/drumee.sh.tpl +32 -17
- package/templates/etc/drumee/infrastructure/internals/accel.private.conf.tpl +47 -0
- package/templates/etc/drumee/infrastructure/internals/{accel.conf.tpl → accel.public.conf.tpl} +1 -1
- package/templates/etc/drumee/infrastructure/{platform.json.tpl → mfs.private.conf.tpl} +5 -5
- package/templates/etc/drumee/infrastructure/{mfs.conf.tpl → mfs.public.conf.tpl} +1 -1
- package/templates/etc/drumee/infrastructure/routes/private.conf.tpl +143 -0
- package/templates/etc/drumee/infrastructure/routes/{main.conf.tpl → public.conf.tpl} +18 -28
- package/templates/etc/drumee/infrastructure/servers/tt.conf +9 -9
- package/templates/etc/drumee/ssl/private.conf.tpl +2 -1
- package/templates/etc/drumee/ssl/public.conf.tpl +1 -1
- package/templates/etc/jitsi/jicofo/jicofo.private.conf.tpl +46 -0
- package/templates/etc/jitsi/jicofo/{jicofo.conf.tpl → jicofo.public.conf.tpl} +7 -7
- package/templates/etc/jitsi/jicofo/sip-cmmunicator.private.properties +3 -0
- package/templates/etc/jitsi/jicofo/sip-cmmunicator.public.properties +3 -0
- package/templates/etc/jitsi/meet.private.conf.tpl +132 -0
- package/templates/etc/jitsi/{meet.conf.tpl → meet.public.conf.tpl} +5 -5
- package/templates/etc/jitsi/ssl.private.conf.tpl +25 -0
- package/templates/etc/jitsi/{ssl.conf.tpl → ssl.public.conf.tpl} +3 -3
- package/templates/etc/jitsi/videobridge/defaults/jvb.conf +1 -1
- package/templates/etc/jitsi/videobridge/jvb.private.conf +67 -0
- package/templates/etc/jitsi/videobridge/{jvb.conf → jvb.public.conf} +6 -6
- package/templates/etc/jitsi/web/config.private.js.tpl +208 -0
- package/templates/etc/jitsi/web/{config.js.tpl → config.public.js.tpl} +4 -4
- package/templates/etc/jitsi/web/defaults/default +2 -2
- package/templates/etc/jitsi/web/defaults/meet.conf +3 -3
- package/templates/etc/mysql/mariadb.conf.d/50-server.cnf +3 -3
- package/templates/etc/nginx/modules-enabled/{90-turn-relay.conf → 90-turn-relay.private.conf.tpl} +6 -6
- package/templates/etc/nginx/modules-enabled/{90-turn-relay.conf.tpl → 90-turn-relay.public.conf.tpl} +4 -4
- package/templates/etc/nginx/nginx.conf +3 -1
- package/templates/etc/nginx/sites-enabled/{public.conf.tpl → 01-public.conf.tpl} +7 -7
- package/templates/etc/nginx/sites-enabled/{private.conf.tpl → 02-private.conf.tpl} +6 -6
- package/templates/etc/nginx/sites-enabled/{jitsi.conf.tpl → 20-jitsi.private.conf.tpl} +9 -9
- package/templates/etc/nginx/sites-enabled/{pivate.jitsi.conf.tpl → 20-jitsi.public.conf.tpl} +9 -9
- package/templates/etc/nginx/sites-enabled/{localhost.conf → loopback.tpl} +10 -9
- package/templates/etc/nginx/sites-enabled/turnrelay.conf.tpl +4 -4
- package/templates/etc/prosody/conf.d/private.cfg.lua.tpl +51 -51
- package/templates/etc/prosody/conf.d/public.cfg.lua.tpl +47 -47
- package/templates/etc/prosody/defaults/conf.d/jitsi-meet.cfg.lua +3 -3
- package/templates/etc/turnserver.private.conf.tpl +46 -0
- package/templates/etc/{turnserver.conf.tpl → turnserver.public.conf.tpl} +3 -3
- package/templates/index.js +3 -2
- package/templates/utils.js +22 -147
- package/templates/var/lib/bind/domain.tpl +70 -0
- package/templates/var/lib/bind/private-reverse.tpl +1 -1
- package/templates/var/lib/bind/{prvate.tpl → private.tpl} +1 -10
- package/templates/var/lib/bind/public-reverse.tpl +7 -7
- package/templates/var/lib/bind/public.tpl +7 -7
- package/bin/init-private +0 -40
- package/bin/set-jitsi-conf +0 -14
- package/template.js +0 -453
- package/templates/etc/bind/named.conf.private +0 -21
- package/templates/etc/bind/named.conf.public +0 -21
- package/templates/etc/drumee/conf.d/conference.json.tpl +0 -9
- package/templates/etc/drumee/dnsapi.sh.tpl +0 -28
- package/templates/etc/drumee/env.json +0 -29
- package/templates/etc/jitsi/jicofo/sip-cmmunicator.properties +0 -3
- package/templates/etc/nginx/sites-enabled/public.jitsi.conf.tpl +0 -28
- package/templates/etc/prosody/conf.d/vhost.cfg.lua.tpl +0 -162
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
function self_sign(){
|
|
4
|
+
domain=$1
|
|
5
|
+
echo "Configuring certificates for $1..."
|
|
6
|
+
cnf_dir="/etc/drumee/certs/${domain}_ecc"
|
|
7
|
+
cnf=$cnf_dir/${domain}.cnf
|
|
8
|
+
if [ ! -f $cnf ]; then
|
|
9
|
+
echo "Local certificates could not be created. $cnf is missing "
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
cd $cnf_dir
|
|
14
|
+
|
|
15
|
+
openssl req -x509 -newkey rsa:4096 -keyout ${domain}.key -out ${domain}.cer -sha256 -days 3650 -nodes -config $cnf
|
|
16
|
+
|
|
17
|
+
target=/usr/local/share/ca-certificates
|
|
18
|
+
cp ${domain}.cer $target/
|
|
19
|
+
cp ${domain}.key $target/
|
|
20
|
+
chmod g+r $target/${domain}.key
|
|
21
|
+
openssl x509 -outform der -in ${domain}.cer -out $DRUMEE_STATIC_DIR/certs/${domain}.der
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#-------------------
|
|
25
|
+
mkdir -p $DRUMEE_STATIC_DIR/certs
|
|
26
|
+
|
|
27
|
+
if [ "$PRIVATE_DOMAIN" != "" ]; then
|
|
28
|
+
self_sign $PRIVATE_DOMAIN
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [ "$JITSI_DOMAIN" != "" ]; then
|
|
32
|
+
self_sign $JITSI_DOMAIN
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
update-ca-certificates
|
|
38
|
+
|
package/bin/env
CHANGED
|
@@ -39,11 +39,14 @@ protect_dir() {
|
|
|
39
39
|
echo "No directory to protect. Skipped"
|
|
40
40
|
fi
|
|
41
41
|
else
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
ro=$(grep $dir /proc/mounts | sed -E "s/^.+(ro).+$/readl-only/")
|
|
43
|
+
if [ "$ro" != "read-only" ]; then
|
|
44
|
+
mkdir -p $dir
|
|
45
|
+
chown -R $DRUMEE_SYSTEM_USER:$DRUMEE_SYSTEM_GROUP $dir
|
|
46
|
+
if [ "$confidential" = "yes" ]; then
|
|
47
|
+
chmod -R go-rwx $dir
|
|
48
|
+
fi
|
|
49
|
+
chmod -R u+rwx $dir
|
|
46
50
|
fi
|
|
47
|
-
chmod -R u+rwx $dir
|
|
48
51
|
fi
|
|
49
52
|
}
|
package/bin/init-acme
CHANGED
|
@@ -13,8 +13,13 @@ echo "Configuring certificates..."
|
|
|
13
13
|
function make_certs(){
|
|
14
14
|
sum=0
|
|
15
15
|
dom=$1
|
|
16
|
+
method=dns_nsupdate
|
|
17
|
+
if [ "$2" != "" -a -f "$2" ]; then
|
|
18
|
+
source $2 # source env filen
|
|
19
|
+
method=dns_$ACME_PROVIDER # https://github.com/acmesh-official/acme.sh/wiki/dnsapi
|
|
20
|
+
fi
|
|
16
21
|
echo Generating "${dom}" cetificates...
|
|
17
|
-
OPTIONS="--issue -d $dom -d "*.${dom}" --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $CERTS_DIR --dns
|
|
22
|
+
OPTIONS="--issue -d $dom -d "*.${dom}" --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $CERTS_DIR --dns ${method}"
|
|
18
23
|
./acme.sh $OPTIONS
|
|
19
24
|
while [ ! -f ${CERTS_DIR}/${dom}_ecc/fullchain.cer ]; do
|
|
20
25
|
./acme.sh $OPTIONS
|
|
@@ -31,6 +36,20 @@ function make_certs(){
|
|
|
31
36
|
fi
|
|
32
37
|
sum=$(expr 1 + $sum)
|
|
33
38
|
done
|
|
39
|
+
|
|
40
|
+
ca_dir=/usr/local/share/ca-certificates
|
|
41
|
+
mkdir -p $ca_dir
|
|
42
|
+
|
|
43
|
+
cert_file="${CERTS_DIR}/${dom}_ecc/${dom}"
|
|
44
|
+
if [ -f "${cert_file}.cer" ]; then
|
|
45
|
+
cp -f "${cert_file}.cer" "${target}.cer"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if [ -f "${cert_file}.key" ]; then
|
|
49
|
+
cp -f "${cert_file}.key" "${target}.key"
|
|
50
|
+
chmod g+r "${cert_file}.key"
|
|
51
|
+
fi
|
|
52
|
+
|
|
34
53
|
}
|
|
35
54
|
|
|
36
55
|
set +e
|
|
@@ -49,7 +68,7 @@ if [ "$OWN_SSL" != "" ]; then
|
|
|
49
68
|
fi
|
|
50
69
|
|
|
51
70
|
if [ "$ACME_DIR" = "" ]; then
|
|
52
|
-
export ACME_DIR=/
|
|
71
|
+
export ACME_DIR=/etc/drumee/certs/acme
|
|
53
72
|
fi
|
|
54
73
|
|
|
55
74
|
if [ ! -d $ACME_DIR ]; then
|
|
@@ -63,8 +82,8 @@ failed=0
|
|
|
63
82
|
./acme.sh --register-account -m $ACME_EMAIL_ACCOUNT --home $ACME_DIR --config-home $ACME_DIR/configs --cert-home $CERTS_DIR
|
|
64
83
|
|
|
65
84
|
|
|
66
|
-
make_certs $DRUMEE_DOMAIN_NAME
|
|
67
|
-
make_certs $JITSI_DOMAIN
|
|
85
|
+
make_certs $DRUMEE_DOMAIN_NAME $ACME_ENV_FILE
|
|
86
|
+
make_certs $JITSI_DOMAIN $ACME_ENV_FILE
|
|
68
87
|
|
|
69
88
|
usermod -a -G $DRUMEE_SYSTEM_GROUP prosody
|
|
70
89
|
usermod -a -G $DRUMEE_SYSTEM_GROUP jvb
|
package/bin/init-named
CHANGED
package/bin/install
CHANGED
|
@@ -6,10 +6,21 @@ script_dir=$(dirname $(readlink -f $0))
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export base=$(dirname $script_dir)
|
|
9
|
-
$base/bin/init-mail $DRUMEE_DOMAIN_NAME
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export PUBLIC_DOMAIN=$DRUMEE_DOMAIN_NAME
|
|
11
|
+
|
|
12
|
+
if [ "$PUBLIC_DOMAIN" != "" ]; then
|
|
13
|
+
$base/bin/init-mail $DRUMEE_DOMAIN_NAME$PUBLIC_DOMAIN
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Generate all the required settings
|
|
12
17
|
node $base/index.js
|
|
18
|
+
|
|
19
|
+
if [ ! -e /etc/drumee/drumee.sh ]; then
|
|
20
|
+
echo "Setup has failed"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
13
24
|
source /etc/drumee/drumee.sh
|
|
14
25
|
|
|
15
26
|
if [ -d /etc/cron.d/drumee ]; then
|
|
@@ -30,6 +41,8 @@ for d in mfs tmp; do
|
|
|
30
41
|
done
|
|
31
42
|
|
|
32
43
|
|
|
44
|
+
set +e
|
|
45
|
+
|
|
33
46
|
LOG_DIR=$DRUMEE_SERVER_HOME/.pm2/logs
|
|
34
47
|
|
|
35
48
|
touch $DRUMEE_DATA_DIR/mfs/dont-remove-this-dir
|
|
@@ -44,10 +57,21 @@ protect_dir $DRUMEE_SERVER_HOME
|
|
|
44
57
|
protect_dir $DRUMEE_EXPORT_DIR
|
|
45
58
|
protect_dir $DRUMEE_IMPORT_DIR
|
|
46
59
|
|
|
47
|
-
$
|
|
48
|
-
$base/bin/init-
|
|
60
|
+
if [ "$ACME_ENV_FILE" = "" -o ! -f "$ACME_ENV_FILE" ]; then
|
|
61
|
+
$base/bin/init-named
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
if [ "$PRIVATE_DOMAIN" != "" ]; then
|
|
65
|
+
$base/bin/create-local-certs
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
if [ "$PUBLIC_DOMAIN" != "" ]; then
|
|
69
|
+
$base/bin/init-acme
|
|
70
|
+
fi
|
|
71
|
+
|
|
49
72
|
|
|
50
73
|
setup_dirs
|
|
74
|
+
|
|
51
75
|
setup_prosody
|
|
52
76
|
|
|
53
77
|
crontab < /etc/cron.d/drumee
|
package/bin/prosody
CHANGED
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
source /etc/drumee/drumee.sh
|
|
4
4
|
source /etc/prosody/defaults/credentials.sh
|
|
5
5
|
|
|
6
|
-
set +e
|
|
7
6
|
#-------------------
|
|
8
7
|
function setup_dirs() {
|
|
9
8
|
echo Configuring directories permissions
|
|
10
9
|
|
|
11
|
-
ca_dir=/usr/local/share/ca-certificates
|
|
12
|
-
mkdir -p $ca_dir
|
|
10
|
+
# ca_dir=/usr/local/share/ca-certificates
|
|
11
|
+
# mkdir -p $ca_dir
|
|
13
12
|
|
|
14
|
-
cert_file="${CERTS_DIR}/${JITSI_DOMAIN}_ecc/${JITSI_DOMAIN}"
|
|
15
|
-
target="${ca_dir}/auth.${JITSI_DOMAIN}"
|
|
13
|
+
# cert_file="${CERTS_DIR}/${JITSI_DOMAIN}_ecc/${JITSI_DOMAIN}"
|
|
14
|
+
# target="${ca_dir}/auth.${JITSI_DOMAIN}"
|
|
16
15
|
|
|
17
|
-
if [ -f "${cert_file}.cer" ]; then
|
|
18
|
-
|
|
19
|
-
fi
|
|
16
|
+
# if [ -f "${cert_file}.cer" ]; then
|
|
17
|
+
# cp -f "${cert_file}.cer" "${target}.cer"
|
|
18
|
+
# fi
|
|
20
19
|
|
|
21
|
-
if [ -f "${cert_file}.key" ]; then
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
fi
|
|
20
|
+
# if [ -f "${cert_file}.key" ]; then
|
|
21
|
+
# chmod g+r "${cert_file}.key"
|
|
22
|
+
# cp -f "${cert_file}.key" "${target}.key"
|
|
23
|
+
# fi
|
|
24
|
+
|
|
25
|
+
# update-ca-certificates
|
|
25
26
|
|
|
26
27
|
mkdir -p $DRUMEE_RUNTIME_DIR/prosody
|
|
27
28
|
chown -R prosody:prosody $DRUMEE_RUNTIME_DIR/prosody
|
|
@@ -73,6 +74,14 @@ function setup_prosody() {
|
|
|
73
74
|
addUser jvb $JVB_PASSWORD $auth_host
|
|
74
75
|
addUser $APP_ID $APP_PASSWORD $JITSI_DOMAIN
|
|
75
76
|
|
|
77
|
+
if [ -f /etc/jitsi/videobridge/jvb.public.conf ]; then
|
|
78
|
+
ln -sf /etc/jitsi/videobridge/jvb.public.conf /etc/jitsi/videobridge/jvb.conf
|
|
79
|
+
else
|
|
80
|
+
if [ -f /etc/jitsi/videobridge/jvb.private.conf ]; then
|
|
81
|
+
ln -sf /etc/jitsi/videobridge/jvb.private.conf /etc/jitsi/videobridge/jvb.conf
|
|
82
|
+
fi
|
|
83
|
+
fi
|
|
84
|
+
|
|
76
85
|
pub_ip=$(grep public-address /etc/jitsi/videobridge/jvb.conf | awk '{print $3}' | sed -e s/\"//g)
|
|
77
86
|
if [ "$pub_ip" != "" ]; then
|
|
78
87
|
o=$(grep ${pub_ip} /etc/hosts)
|