Skip to content

Commit e3636c0

Browse files
authored
Merge pull request #2 from DaanSelen/master
Working in wrong branch
2 parents 470f22b + 9e6b98a commit e3636c0

4 files changed

Lines changed: 58 additions & 25 deletions

File tree

.github/workflows/docker.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- master
66
release:
7-
types: [published]
7+
types: [ published ]
88

99
env:
1010
REGISTRY: ghcr.io
@@ -36,6 +36,8 @@ jobs:
3636

3737
- name: Set up QEMU
3838
uses: docker/setup-qemu-action@v3
39+
with:
40+
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
3941

4042
- name: Set up Docker Buildx
4143
uses: docker/setup-buildx-action@v3
@@ -58,10 +60,21 @@ jobs:
5860
with:
5961
context: .
6062
file: docker/Dockerfile
61-
platforms: linux/amd64,linux/arm64
63+
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
6264
push: true
6365
tags: ${{ steps.meta.outputs.tags }}
6466
labels: ${{ steps.meta.outputs.labels }}
6567
build-args: |
6668
INCLUDE_MONGODBTOOLS=true
69+
INCLUDE_POSTGRESQL_TOOLS=true
70+
INCLUDE_MARIADB_TOOLS=true
6771
PREINSTALL_LIBS=true
72+
73+
- name: Docker Scout
74+
id: docker-scout
75+
uses: docker/scout-action@v1
76+
with:
77+
command: quickview,cves
78+
image: image://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
79+
summary: true
80+
only-severities: critical,high,medium,low,unspecified

docker/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ ENV CONFIG_FILE="/opt/meshcentral/meshcentral-data/config.json"
4646
ENV DYNAMIC_CONFIG="true"
4747

4848
# environment variables for the above defined MeshCentral Config.json
49-
ENV ALLOWPLUGINS="false"
49+
ENV ALLOW_PLUGINS="false"
5050
ENV ALLOW_NEW_ACCOUNTS="false"
5151
ENV ALLOWED_ORIGIN="false"
5252
ENV ARGS=""
5353
ENV HOSTNAME="localhost"
5454
ENV IFRAME="false"
55-
ENV LOCALSESSIONRECORDING="true"
55+
ENV LOCAL_SESSION_RECORDING="true"
5656
ENV MINIFY="true"
57-
ENV REGENSESSIONKEY="false"
57+
ENV REGEN_SESSIONKEY="false"
5858
ENV REVERSE_PROXY=""
5959
ENV REVERSE_PROXY_TLS_PORT="443"
6060
ENV WEBRTC="false"
61-
61+
ENV TRUSTED_PROXY=""
6262

6363
# MongoDB Variables
6464
ARG INCLUDE_MONGODB_TOOLS="false"

docker/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Below is a breakdown of environment variables used in this setup.
1212
| NODE_ENV | production | Specifies the Node.js environment. |
1313
| CONFIG_FILE | /opt/meshcentral/meshcentral-data/config.json | Path to the configuration file. |
1414
| DYNAMIC_CONFIG | true | Enables/disables dynamic configuration. This means config is being rechecked every container restart. |
15-
| ALLOWPLUGINS | false | Enables/disables plugins. |
15+
| ALLOW_PLUGINS | false | Enables/disables plugins. |
1616
| ALLOW_NEW_ACCOUNTS | false | Enables/disables new account creation. |
1717
| ALLOWED_ORIGIN | false | Enables/disables allowed origin policy. |
1818
| ARGS | "" | Additional arguments for MeshCentral. |
1919
| HOSTNAME | localhost | Specifies the hostname. |
2020
| IFRAME | false | Enables/disables embedding in an iframe. |
21-
| LOCALSESSIONRECORDING | true | Enables session recording. |
21+
| LOCAL_SESSION_RECORDING | true | Enables session recording. |
2222
| MINIFY | true | Minifies the JavaScript and HTML output. |
23-
| REGENSESSIONKEY | false | Regenerates the session key on each restart of the container. |
23+
| REGEN_SESSIONKEY | false | Regenerates the session key on each restart of the container. |
2424
| REVERSE_PROXY | "" | Configures reverse proxy support through `certUrl`. |
2525
| REVERSE_PROXY_TLS_PORT | "443" | Configures reverse proxy TLS port, will be combined with: `REVERSE_PROXY`. |
2626
| WEBRTC | false | Enables/disables WebRTC support. |
@@ -104,15 +104,15 @@ CONFIG_FILE=/opt/meshcentral/meshcentral-data/config.json
104104
DYNAMIC_CONFIG=true
105105
106106
# MeshCentral Configuration
107-
ALLOWPLUGINS=false
107+
ALLOW_PLUGINS=false
108108
ALLOW_NEW_ACCOUNTS=false
109109
ALLOWED_ORIGIN=false
110110
ARGS=
111111
HOSTNAME=localhost
112112
IFRAME=false
113-
LOCALSESSIONRECORDING=true
113+
LOCAL_SESSION_RECORDING=true
114114
MINIFY=true
115-
REGENSESSIONKEY=false
115+
REGEN_SESSIONKEY=false
116116
REVERSE_PROXY=
117117
REVERSE_PROXY_TLS_PORT=
118118
WEBRTC=false

docker/entrypoint.sh

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ else
2222
fi
2323

2424
if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
25-
cat $CONFIG_FILE
25+
cat "$CONFIG_FILE"
2626
echo "Using Dynamic Configuration values..."
2727

2828
# BEGIN DATABASE CONFIGURATION FIELDS
@@ -93,7 +93,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
9393
echo "If defaults are going to get applied, refer to: https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json"
9494

9595
# SESSIONKEY
96-
if [[ $REGENSESSIONKEY =~ ^(true|yes)$ ]]; then
96+
if [[ $REGEN_SESSIONKEY =~ ^(true|yes)$ ]]; then
9797
echo "Regenerating Session-Key because REGENSESSIONKEY is 'true' or 'yes'"
9898
SESSION_KEY=$(tr -dc 'A-Z0-9' < /dev/urandom | fold -w 96 | head -n 1)
9999

@@ -106,7 +106,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
106106
fi
107107

108108
# HOSTNAME
109-
if [[ -n $HOSTNAME ]] && [[ $HOSTNAME =~ ^[a-zA-Z0-9-]+$ ]]; then
109+
if [[ -n $HOSTNAME ]]; then
110110
echo "Setting hostname (cert)... $HOSTNAME"
111111

112112
jq --arg hostname "$HOSTNAME" \
@@ -120,15 +120,15 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
120120
fi
121121

122122
# ALLOWPLUGINS
123-
if [[ -n $ALLOWPLUGINS ]] && [[ $ALLOWPLUGINS =~ ^(true|false)$ ]]; then
124-
echo "Setting plugins... $ALLOWPLUGINS"
123+
if [[ -n $ALLOW_PLUGINS ]] && [[ $ALLOW_PLUGINS =~ ^(true|false)$ ]]; then
124+
echo "Setting plugins... $ALLOW_PLUGINS"
125125

126126
sed -i 's/"_plugins"/"plugins"/' "$CONFIG_FILE"
127-
jq --argjson allow_plugins "$ALLOWPLUGINS" \
127+
jq --argjson allow_plugins "$ALLOW_PLUGINS" \
128128
'.settings.plugins.enabled = $allow_plugins' \
129129
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
130130
else
131-
echo "Invalid or no ALLOWPLUGINS value given, commenting out so default applies... Value given: $ALLOWPLUGINS"
131+
echo "Invalid or no ALLOWPLUGINS value given, commenting out so default applies... Value given: $ALLOW_PLUGINS"
132132
sed -i 's/"plugins":/"_plugins":/g' "$CONFIG_FILE"
133133
fi
134134

@@ -159,6 +159,26 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
159159
sed -i 's/"AllowFraming":/"_AllowFraming":/g' "$CONFIG_FILE"
160160
fi
161161

162+
# trustedProxy
163+
if [[ -n $TRUSTED_PROXY ]]; then
164+
echo "Setting trustedProxy... - $REVERSE_PROXY_STRING"
165+
166+
if [[ $TRUSTED_PROXY == "all" ]]; then
167+
sed -i 's/"_trustedProxy"/"trustedProxy"/' "$CONFIG_FILE"
168+
jq --argjson trusted_proxy "true" \
169+
'.settings.trustedProxy = $trusted_proxy' \
170+
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
171+
else
172+
sed -i 's/"_trustedProxy"/"trustedProxy"/' "$CONFIG_FILE"
173+
jq --argjson trusted_proxy "$TRUSTED_PROXY" \
174+
'.settings.trustedProxy = $trusted_proxy' \
175+
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
176+
fi
177+
else
178+
echo "Invalid or no REVERSE_PROXY and/or REVERSE_PROXY_TLS_PORT value given, commenting out so default applies... Value(s) given: $REVERSE_PROXY_STRING"
179+
sed -i 's/"certUrl":/"_certUrl":/g' "$CONFIG_FILE"
180+
fi
181+
162182
# ALLOW_NEW_ACCOUNTS
163183
if [[ -n $ALLOW_NEW_ACCOUNTS ]] && [[ $ALLOW_NEW_ACCOUNTS =~ ^(true|false)$ ]]; then
164184
echo "Setting NewAccounts... $ALLOW_NEW_ACCOUNTS"
@@ -173,15 +193,15 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
173193
fi
174194

175195
# LOCALSESSIONRECORDING
176-
if [[ -n $LOCALSESSIONRECORDING ]] && [[ $LOCALSESSIONRECORDING =~ ^(true|false)$ ]]; then
177-
echo "Setting localSessionRecording... $LOCALSESSIONRECORDING"
196+
if [[ -n $LOCAL_SESSION_RECORDING ]] && [[ $LOCAL_SESSION_RECORDING =~ ^(true|false)$ ]]; then
197+
echo "Setting localSessionRecording... $LOCAL_SESSION_RECORDING"
178198

179199
sed -i 's/"_localSessionRecording"/"localSessionRecording"/' "$CONFIG_FILE"
180-
jq --argjson session_recording "$LOCALSESSIONRECORDING" \
200+
jq --argjson session_recording "$LOCAL_SESSION_RECORDING" \
181201
'.domains[""].localSessionRecording = $session_recording' \
182202
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
183203
else
184-
echo "Invalid or no LOCALSESSIONRECORDING value given, commenting out so default applies... Value given: $LOCALSESSIONRECORDING"
204+
echo "Invalid or no LOCALSESSIONRECORDING value given, commenting out so default applies... Value given: $LOCAL_SESSION_RECORDING"
185205
sed -i 's/"localSessionRecording":/"_localSessionRecording":/g' "$CONFIG_FILE"
186206
fi
187207

@@ -190,7 +210,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
190210
echo "Setting minify... $MINIFY"
191211

192212
sed -i 's/"_minify"/"minify"/' "$CONFIG_FILE"
193-
jq --arg minify "$MINIFY" \
213+
jq --argjson minify "$MINIFY" \
194214
'.domains[""].minify = $minify' \
195215
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
196216
#sed -i "s/\"minify\": *[a-z]*/\"minify\": $MINIFY/" "$CONFIG_FILE"
@@ -204,7 +224,7 @@ if [[ "$DYNAMIC_CONFIG" =~ ^(true|yes)$ ]]; then
204224
echo "Setting allowedOrigin... $ALLOWED_ORIGIN"
205225

206226
sed -i 's/"_allowedOrigin"/"allowedOrigin"/' "$CONFIG_FILE"
207-
jq --arg allowed_origin "$ALLOWED_ORIGIN" \
227+
jq --argjson allowed_origin "$ALLOWED_ORIGIN" \
208228
'.domains[""].allowedOrigin = $allowed_origin' \
209229
"$CONFIG_FILE" > temp_config.json && mv temp_config.json "$CONFIG_FILE"
210230
else

0 commit comments

Comments
 (0)