Skip to content

Commit

Permalink
feat(sockets): secure socket connection with tokens (#2849)
Browse files Browse the repository at this point in the history
Fixes #2815
  • Loading branch information
sogehige committed Oct 23, 2019
1 parent 5b12d53 commit 4eb3ce8
Show file tree
Hide file tree
Showing 85 changed files with 1,594 additions and 1,662 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Expand Up @@ -2,8 +2,6 @@ FROM node:12.12.0-alpine

ENV LAST_UPDATED 201910151750

ENV DOMAIN localhost
ENV TOKEN __random__
ENV DB mongodb
ENV MONGOURI mongodb://localhost:27017/your-db-name
ENV NODE_ENV production
Expand Down
2 changes: 2 additions & 0 deletions d.ts/index.d.ts
Expand Up @@ -110,8 +110,10 @@ declare namespace NodeJS {
userinfo: import('../src/bot/systems/userinfo').UserInfo;
};
users: import('../src/bot/users').Users;
ui: import('../src/bot/ui').UI;
lib: any;
twitch: import('../src/bot/twitch').Twitch;
socket: import('../src/bot/socket').Socket;
workers: import('../src/bot/workers').Workers;
permissions: import('../src/bot/permissions').Permissions;
customvariables: any;
Expand Down
7 changes: 0 additions & 7 deletions docker.sh
Expand Up @@ -3,13 +3,6 @@ cd /app

export DOCKER_HOST_IP=`route -n | awk '/UG[ \t]/{print $2}'`

if [ "$TOKEN" = '__random__' ]; then
export TOKEN=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
fi

sed -i 's#"domain": "localhost"#"domain": "localhost, '$DOMAIN'"#g' config.json
sed -i 's#"token": "7911776886"#"token": "'$TOKEN'"#g' config.json

if [ "$DB" = 'mongodb' ]; then
sed -i "s#nedb#mongodb#g" config.json
sed -i 's#mongodb:\/\/localhost:27017\/your-db-name#'$MONGOURI'#g' config.json
Expand Down
1 change: 0 additions & 1 deletion docs/_master/_sidebar.md
Expand Up @@ -7,7 +7,6 @@
* [Environment variables](_master/configuration/env.md)
* [Metrics](_master/configuration/metrics.md)
* [Threads](_master/configuration/threads.md)
* [Panel](_master/configuration/panel.md)
* [Timezone](_master/configuration/timezone.md)
* Systems
* [Alias](_master/commands/alias.md)
Expand Down
44 changes: 0 additions & 44 deletions docs/_master/configuration/panel.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/_master/install-and-upgrade.md
Expand Up @@ -22,7 +22,6 @@

``` bash
docker run -it --name <name-of-container> \
--env TOKEN=<token> \
--env MONGOURI=<mongouri> \
-p <port>:20000 \
<image>
Expand All @@ -36,18 +35,13 @@ docker run -it --name <name-of-container> \
- Change `<mongouri>` to your mongodb uri connection
- Change `<version>` to `latest` or release tag (e.g. `9.8.0`)
- Change `<name-of-container>` to set name of your container
- Change `<token>` to set your image specific token, if you want to random token, omit whole `--env TOKEN`

- If you serve bot on different than `localhost`, add `--env DOMAIN=<domain>` to
enable bot UI on specific domain

- Example full command

!> When using non-specific image for latest version, use `docker pull <image>` to update your local image

``` bash
docker run -it --name sogebot \
--env DOMAIN=my.publicdoma.in \
--env MONGOURI=mongodb://localhost:27017/sogebot \
-p 80:20000 docker.pkg.github.com/sogehige/sogebot/release:9.8.0
```
Expand Down
2 changes: 2 additions & 0 deletions locales/cs/ui.menu.json
Expand Up @@ -45,6 +45,7 @@
"wheeloffortune": "Kolo štěstí",
"heist": "Heist",
"oauth": "OAuth",
"socket": "Socket",
"textoverlay": "Text overlay",
"carouseloverlay": "Carousel overlay",
"alerts": "Alerty",
Expand All @@ -55,6 +56,7 @@
"stats": "Statistiky",
"text": "Text",
"currency": "Měna",
"eventlist": "Kanál aktivit",
"clipscarousel": "Promítačka klipů",
"streamlabs": "Streamlabs",
"streamelements": "StreamElements",
Expand Down
7 changes: 7 additions & 0 deletions locales/cs/ui/core/socket.json
@@ -0,0 +1,7 @@
{
"settings": {
"purgeAllConnections": "Zrušit všechna současná připojení (i to tvé)",
"accessTokenExpirationTime": "Čas expirace access tokenu (ve vteřinách)",
"refreshTokenExpirationTime": "Čas expirace refresh tokenu (ve vteřinách)"
}
}
1 change: 1 addition & 0 deletions locales/cs/ui/core/ui.json
@@ -1,6 +1,7 @@
{
"settings": {
"theme": "Theme",
"domain": "Doména",
"percentage": "Rozdíl v procentech",
"shortennumbers": "Zkrácený formát čísel",
"stickystats": "Přilepit statistiky na horní část stránek",
Expand Down
2 changes: 2 additions & 0 deletions locales/en/ui.menu.json
Expand Up @@ -45,6 +45,7 @@
"wheeloffortune": "Wheel of Fortune",
"heist": "Heist",
"oauth": "OAuth",
"socket": "Socket",
"textoverlay": "Text overlay",
"carouseloverlay": "Carousel overlay",
"alerts": "Alerts",
Expand All @@ -55,6 +56,7 @@
"stats": "Stats",
"text": "Text",
"currency": "Currency",
"eventlist": "Eventlist",
"clipscarousel": "Clips carousel",
"streamlabs": "Streamlabs",
"streamelements": "StreamElements",
Expand Down
7 changes: 7 additions & 0 deletions locales/en/ui/core/socket.json
@@ -0,0 +1,7 @@
{
"settings": {
"purgeAllConnections": "Purge All Authenticated Connection (yours as well)",
"accessTokenExpirationTime": "Access Token Expiration Time (seconds)",
"refreshTokenExpirationTime": "Refresh Token Expiration Time (seconds)"
}
}
1 change: 1 addition & 0 deletions locales/en/ui/core/ui.json
@@ -1,6 +1,7 @@
{
"settings": {
"theme": "Theme",
"domain": "Domain",
"percentage": "Percentage difference for stats",
"shortennumbers": "Short format of numbers",
"stickystats": "Stick stats to top",
Expand Down

0 comments on commit 4eb3ce8

Please sign in to comment.