Use authentication for websockets
This commit is contained in:
parent
ec3c2c9d5c
commit
0170c43916
|
@ -12,7 +12,7 @@ mkdir -p /etc/systemd/system/armagetronad-dedicated.service.d
|
||||||
cat > /etc/systemd/system/armagetronad-dedicated.service.d/override.conf <<EOF
|
cat > /etc/systemd/system/armagetronad-dedicated.service.d/override.conf <<EOF
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=/usr/bin/console2web -p 62551 /usr/games/armagetronad-dedicated.real --datadir /usr/share/games/armagetronad --configdir /etc/armagetronad --userdatadir /var/games/armagetronad
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62551 /usr/games/armagetronad-dedicated.real --datadir /usr/share/games/armagetronad --configdir /etc/armagetronad --userdatadir /var/games/armagetronad
|
||||||
EOF
|
EOF
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ After=bzflag.service
|
||||||
Requires=bzflag.service
|
Requires=bzflag.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/console2web -p 62553 /usr/games/bzadmin admin@localhost -ui stdboth "/password ${systempassword}"
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62553 /usr/games/bzadmin admin@localhost -ui stdboth "/password ${systempassword}"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=${systemuser}
|
User=${systemuser}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
WorkingDirectory=/var/lib/mindustry
|
WorkingDirectory=/var/lib/mindustry
|
||||||
ExecStart=/usr/bin/console2web -p 62548 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /opt/mindustry-${mindustry_version}/mindustry.jar "config autosave true","config autosaveSpacing 120","host"
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62548 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /opt/mindustry-${mindustry_version}/mindustry.jar "config autosave true","config autosaveSpacing 120","host"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=${systemuser}
|
User=${systemuser}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ Requires=teeworlds.service
|
||||||
Conflicts=teeworlds-ddrace-rcon.service
|
Conflicts=teeworlds-ddrace-rcon.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/console2web -p 62552 -b "${systempassword}" telnet localhost 8123
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62552 -b "${systempassword}" telnet localhost 8123
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=${systemuser}
|
User=${systemuser}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ Description=Unvanquished server
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/console2web -p 62549 ${unvanquished_directory}/bin/daemonded -pakpath ${unvanquished_directory}/share/pkg/ -libpath ${unvanquished_directory}/bin/ -homepath \${HOME}/unvanquished_home/ +exec unvanquished.cfg
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62549 ${unvanquished_directory}/bin/daemonded -pakpath ${unvanquished_directory}/share/pkg/ -libpath ${unvanquished_directory}/bin/ -homepath \${HOME}/unvanquished_home/ +exec unvanquished.cfg
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=${systemuser}
|
User=${systemuser}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ if [ x"$NOSSL" != "x" ] && [ $NOSSL -eq 1 ]; then
|
||||||
sed -i $file -e s/"https:"/"http:"/g
|
sed -i $file -e s/"https:"/"http:"/g
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
sed -i /var/www/html/js/consoles.js -e s/"MD5GAMEPASSWORD"/"$(echo -n "${systempassword}" | md5sum | cut -d' ' -f1)"/g
|
||||||
|
|
||||||
# Patch the NGINX configuration for the web sockets
|
# Patch the NGINX configuration for the web sockets
|
||||||
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
|
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
|
||||||
|
|
|
@ -48,7 +48,7 @@ Conflicts=xonotic.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
WorkingDirectory=${xonotic_directory}
|
WorkingDirectory=${xonotic_directory}
|
||||||
ExecStart=/usr/bin/console2web -p 62550 ${xonotic_directory}/all run dedicated +serverconfig server.cfg -userdir ${systemuserhome}/xonotic-br
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62550 ${xonotic_directory}/all run dedicated +serverconfig server.cfg -userdir ${systemuserhome}/xonotic-br
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=${systemuser}
|
User=${systemuser}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ Conflicts=xonotic-br.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
WorkingDirectory=${xonotic_directory}/Xonotic
|
WorkingDirectory=${xonotic_directory}/Xonotic
|
||||||
ExecStart=/usr/bin/console2web -p 62550 ${xonotic_directory}/Xonotic/xonotic-linux64-dedicated +serverconfig server.cfg -userdir ${systemuserhome}/xonotic
|
ExecStart=/usr/bin/console2web -a "${systempassword}" -p 62550 ${xonotic_directory}/Xonotic/xonotic-linux64-dedicated +serverconfig server.cfg -userdir ${systemuserhome}/xonotic
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=${systemuser}
|
User=${systemuser}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ function createConsole(root, game_name, text_colour_function, initial_command, h
|
||||||
}
|
}
|
||||||
|
|
||||||
function consoles_init() {
|
function consoles_init() {
|
||||||
|
document.cookie = 'token=MD5GAMEPASSWORD; SameSite=Strict';
|
||||||
const root = document.getElementById('console-div');
|
const root = document.getElementById('console-div');
|
||||||
createConsole(
|
createConsole(
|
||||||
root,
|
root,
|
||||||
|
|
Reference in New Issue