Skip to content

Commit 7ad1a96

Browse files
author
botium-build
committed
BOT-2003 Applied Security Best Practices (not run as root user)
1 parent 60e250d commit 7ad1a96

13 files changed

+66
-32
lines changed

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ This project is standing on the shoulders of giants.
180180

181181
## Changelog
182182

183+
### 2022-02-28
184+
185+
* Applied Security Best Practices (not run as root user)
186+
183187
### 2022-01-12
184188

185189
* Added support for Azure Speech Services

Diff for: frontend/resources/.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ BOTIUM_SPEECH_MARYTTS_URL=http://tts:59125
2929
BOTIUM_SPEECH_PICO_CMDPREFIX=pico2wave
3030

3131
# STT Provider Kaldi URLs
32-
BOTIUM_SPEECH_KALDI_URL_EN=http://stt-en:80/client/dynamic/recognize
33-
BOTIUM_SPEECH_KALDI_URL_DE=http://stt-de:80/client/dynamic/recognize
32+
BOTIUM_SPEECH_KALDI_URL_EN=http://stt-en:56180/client/dynamic/recognize
33+
BOTIUM_SPEECH_KALDI_URL_DE=http://stt-de:56180/client/dynamic/recognize
3434

3535
# STT Provider Google
3636
#BOTIUM_SPEECH_GOOGLE_KEYFILE=./resources/google.json

Diff for: nginx.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ http {
2929
proxy_set_header Connection "Upgrade";
3030
proxy_set_header Host $host;
3131
proxy_set_header X-Forwarded-Host $http_host;
32-
proxy_pass http://$upstream_stt_en;
32+
proxy_pass http://$upstream_stt_en:56180;
3333
proxy_read_timeout 300;
3434
}
3535
rewrite ^/stt-de$ /stt-de/ redirect;
@@ -43,7 +43,7 @@ http {
4343
proxy_set_header Connection "Upgrade";
4444
proxy_set_header Host $host;
4545
proxy_set_header X-Forwarded-Host $http_host;
46-
proxy_pass http://$upstream_stt_de;
46+
proxy_pass http://$upstream_stt_de:56180;
4747
proxy_read_timeout 300;
4848
}
4949
rewrite ^/dictate$ /dictate/ redirect;

Diff for: scripts/k8s/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ To use it:
99
* deploy it `kubectl apply -R -f default`
1010
* undeploy it `kubectl delete -R -f default`
1111

12-
Do not modify and commit directly. Workload files are generated from helm chat!
12+
Do not modify and commit directly. Workload files are generated from helm chart!

Diff for: stt/Dockerfile.kaldi.de

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ RUN apt-get update && \
1414
COPY models/zamia_20190328_tdnn_f_de.yaml /opt/models/zamia_20190328_tdnn_f_de.yaml
1515
COPY supervisord.kaldi.de.conf /etc/supervisor/conf.d/supervisord.conf
1616

17-
EXPOSE 80
17+
EXPOSE 56180
1818

19-
CMD ["/usr/bin/supervisord"]
19+
RUN groupadd --gid 1000 kaldi && useradd --uid 1000 --gid kaldi --shell /bin/bash --create-home kaldi
20+
RUN mkdir /opt/logs && chown -R 1000:1000 /opt/models /opt/logs
21+
USER kaldi
22+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

Diff for: stt/Dockerfile.kaldi.en

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ RUN apt-get update && \
1414
COPY models/zamia_20190609_tdnn_fl_en.yaml /opt/models/zamia_20190609_tdnn_fl_en.yaml
1515
COPY supervisord.kaldi.en.conf /etc/supervisor/conf.d/supervisord.conf
1616

17-
EXPOSE 80
17+
EXPOSE 56180
1818

19-
CMD ["/usr/bin/supervisord"]
19+
RUN groupadd --gid 1000 kaldi && useradd --uid 1000 --gid kaldi --shell /bin/bash --create-home kaldi
20+
RUN mkdir /opt/logs && chown -R 1000:1000 /opt/models /opt/logs
21+
USER kaldi
22+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

Diff for: stt/models/zamia_20190328_tdnn_f_de.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ decoder:
1818
chunk-length-in-secs: 0.25
1919
num-nbest: 10
2020
phone-syms: /opt/models/kaldi-generic-de-tdnn_f-r20190328/model/graph/phones.txt
21-
out-dir: tmp
21+
out-dir: /opt/models/tmp
2222

2323
use-vad: False
2424
silence-timeout: 15

Diff for: stt/models/zamia_20190609_tdnn_fl_en.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ decoder:
1818
chunk-length-in-secs: 0.25
1919
num-nbest: 10
2020
phone-syms: /opt/models/kaldi-generic-en-tdnn_fl-r20190609/model/graph/phones.txt
21-
out-dir: tmp
21+
out-dir: /opt/models/tmp
2222

2323
use-vad: False
2424
silence-timeout: 15

Diff for: stt/supervisord.kaldi.de.conf

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
[supervisord]
22
nodaemon=true
3+
logfile=/opt/logs/kaldi-de-supervisord.log
4+
pidfile=/opt/logs/kaldi-de-supervisord.pid
35

46
[program:master]
5-
command=python /opt/kaldi-gstreamer-server/kaldigstserver/master_server.py --port=80
7+
environment=HOME="/home/kaldi",USER="kaldi"
8+
command=python /opt/kaldi-gstreamer-server/kaldigstserver/master_server.py --port=56180
69
numprocs=1
710
autostart=true
811
autorestart=true
9-
stderr_logfile=/opt/logs/master.log
12+
user=kaldi
13+
stderr_logfile=/opt/logs/kaldi-de-master.log
1014

1115
[program:worker1]
12-
environment=GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
13-
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190328_tdnn_f_de.yaml -u ws://localhost:80/worker/ws/speech
16+
environment=HOME="/home/kaldi",USER="kaldi",GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
17+
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190328_tdnn_f_de.yaml -u ws://localhost:56180/worker/ws/speech
1418
numprocs=1
1519
autostart=true
1620
autorestart=true
17-
stderr_logfile=/opt/logs/worker1.log
21+
user=kaldi
22+
stderr_logfile=/opt/logs/kaldi-de-worker1.log
1823

1924
[program:worker2]
20-
environment=GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
21-
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190328_tdnn_f_de.yaml -u ws://localhost:80/worker/ws/speech
25+
environment=HOME="/home/kaldi",USER="kaldi",GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
26+
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190328_tdnn_f_de.yaml -u ws://localhost:56180/worker/ws/speech
2227
numprocs=1
2328
autostart=true
2429
autorestart=true
25-
stderr_logfile=/opt/logs/worker2.log
30+
user=kaldi
31+
stderr_logfile=/opt/logs/kaldi-de-worker2.log

Diff for: stt/supervisord.kaldi.en.conf

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
[supervisord]
22
nodaemon=true
3+
logfile=/opt/logs/kaldi-en-supervisord.log
4+
pidfile=/opt/logs/kaldi-en-supervisord.pid
35

46
[program:master]
5-
command=python /opt/kaldi-gstreamer-server/kaldigstserver/master_server.py --port=80
7+
environment=HOME="/home/kaldi",USER="kaldi"
8+
command=python /opt/kaldi-gstreamer-server/kaldigstserver/master_server.py --port=56180
69
numprocs=1
710
autostart=true
811
autorestart=true
9-
stderr_logfile=/opt/logs/master.log
12+
user=kaldi
13+
stderr_logfile=/opt/logs/kaldi-en-master.log
1014

1115
[program:worker1]
12-
environment=GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
13-
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190609_tdnn_fl_en.yaml -u ws://localhost:80/worker/ws/speech
16+
environment=HOME="/home/kaldi",USER="kaldi",GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
17+
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190609_tdnn_fl_en.yaml -u ws://localhost:56180/worker/ws/speech
1418
numprocs=1
1519
autostart=true
1620
autorestart=true
17-
stderr_logfile=/opt/logs/worker1.log
21+
user=kaldi
22+
stderr_logfile=/opt/logs/kaldi-en-worker1.log
1823

1924
[program:worker2]
20-
environment=GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
21-
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190609_tdnn_fl_en.yaml -u ws://localhost:80/worker/ws/speech
25+
environment=HOME="/home/kaldi",USER="kaldi",GST_PLUGIN_PATH=/opt/gst-kaldi-nnet2-online/src/:/opt/kaldi/src/gst-plugin/:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
26+
command=python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c /opt/models/zamia_20190609_tdnn_fl_en.yaml -u ws://localhost:56180/worker/ws/speech
2227
numprocs=1
2328
autostart=true
2429
autorestart=true
25-
stderr_logfile=/opt/logs/worker2.log
30+
user=kaldi
31+
stderr_logfile=/opt/logs/kaldi-en-worker2.log

Diff for: tts/Dockerfile.marytts

+5
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ WORKDIR /app/marytts-installer
1010
RUN cat components.json | jq .[].artifact | xargs ./marytts install
1111

1212
EXPOSE 59125
13+
14+
RUN addgroup --gid 1000 marytts && adduser --uid 1000 --ingroup marytts --disabled-password --shell /bin/bash marytts
15+
RUN chown -R 1000:1000 /app/marytts-installer
16+
USER marytts
17+
1318
ENV JAVA_OPTS -Xmx2g
1419
CMD ./marytts

Diff for: watcher/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ RUN apt-get update && \
66
apt-get autoremove -y && \
77
rm -rf /var/lib/apt/lists/*
88

9-
VOLUME /app/watch
10-
119
COPY watch_stt.sh /app/watch_stt.sh
1210
COPY watch_tts.sh /app/watch_tts.sh
1311
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
1412

15-
CMD ["/usr/bin/supervisord"]
13+
RUN groupadd --gid 1000 watcher && useradd --uid 1000 --gid watcher --shell /bin/bash --create-home watcher
14+
RUN mkdir /app/logs && chown -R 1000:1000 /app
15+
USER watcher
16+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

Diff for: watcher/supervisord.conf

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
[supervisord]
22
nodaemon=true
3+
logfile=/app/logs/watcher-supervisord.log
4+
pidfile=/app/logs/watcher-supervisord.pid
35

46
[program:watch_stt]
7+
environment=HOME="/home/watcher",USER="watcher"
58
command=/app/watch_stt.sh
69
numprocs=1
710
autostart=true
811
autorestart=true
9-
stderr_logfile=/app/logs/stt.log
12+
user=watcher
13+
stderr_logfile=/app/logs/watcher-stt.log
1014

1115
[program:watch_tts]
16+
environment=HOME="/home/watcher",USER="watcher"
1217
command=/app/watch_tts.sh
1318
numprocs=1
1419
autostart=true
1520
autorestart=true
16-
stderr_logfile=/app/logs/tts.log
21+
user=watcher
22+
stderr_logfile=/app/logs/watcher-tts.log

0 commit comments

Comments
 (0)