Compare commits

...
11 Commits
Author SHA1 Message Date
Arvids Godjuks a9cc743106 Merge pull request #240 from Hornwitser/release-1.2.1
Release 1.2.1
2019-09-20 14:18:52 +02:00
Hornwitser 2a7758f60d Release version 1.2.1
This release incorporates some minor bugfixes and a security fix for
an unauthenticated api in the master server.  See CHANGELOG.md for
details.
2019-09-18 18:20:00 +02:00
Hornwitser 7e2ca58a59 Fix license in package.json
Correct license entry being ISC instead of MIT in package.json.
2019-09-18 18:17:38 +02:00
Arvids Godjuks 718d4ed659 Merge pull request #239 from Hornwitser/fix-sigterm
Spawn factorio server deteached in client.js
2019-09-18 18:14:13 +02:00
Hornwitser 6b090cddbe Spawn factorio server deteached in client.js
Sending ^C via the terminal on Linux may cause SIGINT to be sent twice
to the factorio process, causing it to exit without completing the
saving.  This happens because the shell sends the interupt to all
members of the process group for the job and this includes both the
node client process and the factorio server process.

Avoid this situation by passing detached to spawn when the platform is
Linux, which causes the process to be created with its own process group
and therefore not targeted by a SIGINT from the shell.

This unfortunately does not work on Windows as we can't send SIGINT or
^C to a process there.  Doing subprocces.kill on Windows terminates the
process similarly to how SIGKILL works on Linux.
2019-09-18 18:11:49 +02:00
Arvids Godjuks 56c023f643 Merge pull request #232 from Hornwitser/update-node-factroio-api
Update node-factorio-api
2019-09-12 17:19:07 +02:00
Hornwitser 78de7236c5 Update node-factorio-api to 0.3.8
Fixes #229

Note that the versions 0.3.6 and 0.3.7 had issues with an old
mod_cache.json being present.
2019-09-12 16:52:44 +02:00
Arvids Godjuks 97c7a69c7a Merge pull request #230 from Hornwitser/auth-1.2.x
Add authentication to socket.io server
2019-09-11 15:19:18 +02:00
Hornwitser 0c45e57732 Add authentication to socket.io server
Authenticate connections made to the socket.io server via a token query
parameter that's validated in a similar manner to the x-access-token for
HTTP requests.
2019-09-10 23:51:48 +02:00
Arvids Godjuks 88eff17dfd Updated README.md 2019-09-04 16:20:50 +02:00
Daniel e1374d501e Use correct version in package.json 2019-08-30 18:06:42 +02:00
5 changed files with 50 additions and 7 deletions

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
Changelog
=========
Version 1.2.1
-------------
- Updated node-factorio-api to v0.3.8 to fix mod downloads randomly breaking
([#229][#229].)
- Fixed SIGINT being sent twice to Factorio server when interrupted by CTRL+C
on Linux ([#217][#217].)
- Fixed package.json incorrectly reporting the license as ISC.
[#217]: https://github.com/clusterio/factorioClusterio/issues/217
[#229]: https://github.com/clusterio/factorioClusterio/issues/229
### Breaking Changes
- Added authentication to the socket.io server running on the master.
+9 -1
View File
@@ -4,6 +4,14 @@
<br/> <br/>
<br/> <br/>
# Warning
Do not use master branch to run your Clusterio - master now is a development version and may not work
Use latest stable release: https://github.com/clusterio/factorioClusterio/releases/latest
Or clone latest stable branch that has name format `x.y.z`
# factorioClusterio # factorioClusterio
Discord for development/support/play: https://discord.gg/5XuDkje Discord for development/support/play: https://discord.gg/5XuDkje
@@ -91,7 +99,7 @@ Master and all slaves:
sudo curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - sudo curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt install -y nodejs python-dev git wget curl tar build-essential sudo apt install -y nodejs python-dev git wget curl tar build-essential
sudo npm install pm2 -g sudo npm install pm2 -g
git clone https://github.com/Danielv123/factorioClusterio.git git clone -b 1.2.x https://github.com/Danielv123/factorioClusterio.git
cd factorioClusterio cd factorioClusterio
curl -o factorio.tar.gz -L https://www.factorio.com/get-download/latest/headless/linux64 curl -o factorio.tar.gz -L https://www.factorio.com/get-download/latest/headless/linux64
tar -xf factorio.tar.gz tar -xf factorio.tar.gz
+8 -3
View File
@@ -359,7 +359,8 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n
'--rcon-port', Number(process.env.RCONPORT) || instconf.clientPort, '--rcon-port', Number(process.env.RCONPORT) || instconf.clientPort,
'--rcon-password', instconf.clientPassword, '--rcon-password', instconf.clientPassword,
], { ], {
'stdio': ['pipe', 'pipe', 'pipe'] 'stdio': ['pipe', 'pipe', 'pipe'],
'detached': process.platform === "linux",
} }
); );
factorio.stdout.on("data", data => { factorio.stdout.on("data", data => {
@@ -471,7 +472,8 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n
'--server-settings', instancedirectory + '/server-settings.json', '--server-settings', instancedirectory + '/server-settings.json',
'--port', args.port || Number(process.env.FACTORIOPORT) || instanceconfig.factorioPort '--port', args.port || Number(process.env.FACTORIOPORT) || instanceconfig.factorioPort
], { ], {
'stdio': ['pipe', 'pipe', 'pipe'] 'stdio': ['pipe', 'pipe', 'pipe'],
'detached': process.platform === "linux",
} }
); );
@@ -570,7 +572,10 @@ async function instanceManagement(instanceconfig) {
console.log("Started instanceManagement();"); console.log("Started instanceManagement();");
/* Open websocket connection to master */ /* Open websocket connection to master */
var socket = ioClient("http://"+config.masterIP+":"+config.masterPort); var socket = ioClient("http://"+config.masterIP+":"+config.masterPort+"?token="+config.masterAuthToken);
socket.on("error", err => {
console.log("SOCKET | Error: ", err);
});
socket.on("hello", data => { socket.on("hello", data => {
console.log("SOCKET | registering slave!"); console.log("SOCKET | registering slave!");
socket.emit("registerSlave", { socket.emit("registerSlave", {
+12
View File
@@ -921,6 +921,18 @@ class wsSlave {
} }
} }
io.use((socket, next) => {
let token = socket.handshake.query.token;
authenticate.check(token).then((result) => {
if (result.ok) {
next();
} else {
console.error(`SOCKET | authentication failed for ${socket.handshake.address}`);
next(new Error(result.msg));
}
});
});
io.on('connection', function (socket) { io.on('connection', function (socket) {
// cleanup dead sockets from disconnected people // cleanup dead sockets from disconnected people
let terminatedConnections = 0; let terminatedConnections = 0;
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "clusterio", "name": "clusterio",
"version": "1.7.0", "version": "1.2.1",
"description": "Interserver communication for factorio", "description": "Interserver communication for factorio",
"repository": "https://github.com/Danielv123/factorioClusterio", "repository": "https://github.com/Danielv123/factorioClusterio",
"main": "master.js", "main": "master.js",
@@ -15,7 +15,7 @@
"factorio" "factorio"
], ],
"author": "Danielv123", "author": "Danielv123",
"license": "ISC", "license": "MIT",
"dependencies": { "dependencies": {
"as-table": "^1.0.31", "as-table": "^1.0.31",
"averaged-timeseries": "^1.4.0", "averaged-timeseries": "^1.4.0",
@@ -46,7 +46,7 @@
"moment": "^2.22.2", "moment": "^2.22.2",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"needle": "^2.2.4", "needle": "^2.2.4",
"node-factorio-api": "^0.3.5", "node-factorio-api": "^0.3.8",
"node-forge": "^0.7.1", "node-forge": "^0.7.1",
"prom-client": "^10.2.3", "prom-client": "^10.2.3",
"rcon-client-fork": "^3.2.0", "rcon-client-fork": "^3.2.0",