JGRennison / OpenTTD-patches

OpenTTD - http://www.openttd.org/ - with additional patches
Other
585 stars 133 forks source link

[Bug]: Rcon connections no longer working in 0.63.0 #771

Closed pvillaverde closed 3 weeks ago

pvillaverde commented 3 weeks ago

Version of OpenTTD

0.63.0

Expected result

Client should connect and send the test message. It was working with 0.62.0. I've been all day trying things up but can't find the issue. Not sure it is related with base OpenTTD or not. These are the openttd logs when it works:

openttd-1  | dbg: [net:3] [admin] Client connected from 172.18.0.1 on frame 2898
openttd-1  | dbg: [net:3] [admin] 'TestBot' (0) has connected
openttd-1  | dbg: [net:3] [admin] Rcon command from 'TestBot' (0): say "hello world"
openttd-1  | dbg: [net:3] [admin] 'TestBot' (0) has disconnected

Actual result

When the server is running 0.63.3 I get this disconnected error saying "unauthorized"

openttd-1  | dbg: [net:3] [admin] Client connected from 172.18.0.1 on frame 2571
openttd-1  | dbg: [net:1] [admin] The admin '' () made an error and has been disconnected: 'non autorizado'
openttd-1  | dbg: [net:3] [admin] '' () has disconnected

Note that this is previous to any authentication, in fact with 0.62.0 if I use a different password it says "wrong password" and recognise the "TestBot" name. Maybe something has changed related to the connection flow?

Steps to reproduce

I'm using the node-openttd-admin with NodeJS to run it with this test code:

var ottd = require("node-openttd-admin"),
   ottdConnection = new ottd.connection();

ottdConnection.connect("localhost", 3977);

ottdConnection.on('connect', function () {
   ottdConnection.authenticate("TestBot", "ADMIN_PASSWORD_GOES_HERE");
});
ottdConnection.on('welcome', function (data) {
   ottdConnection.send_rcon("say \"hello world\"");
   ottdConnection.close();
});

I've also had the same problem using a php library

pvillaverde commented 3 weeks ago

Never mind, I've just found the issue. You know that moment when you've been with the issue all day, you decide to throw in the towel and open an issue, and then you found the solution? XD

It's seem its a recent change to disable insecure logins by default and it's just a setting allow_insecure_admin_login = true imaxe https://github.com/OpenTTD/OpenTTD/pull/11878 I'll take a look to the new auth method but since I'm only allowing connections to rcon port through localhost I think i'll keep it this way.