Server Problem - Man in the middle

edited September 2018 in Mods and Customization
First, let me say that I'm very happy to see someone host a server using Classic Bots. Because when you wanna play a quick match or two against competent bots without hosting the server yourself, you can just quickly join for some fun. I am talking about the server named Classic Bots Server.

The problem is that I have no way of contacting the owner. It seems that for about a week or more, I get the 'Man in the middle attack...' error when I join the server, and it doesn't let me join. I suspect this happens to anyone connecting. If the owner reads this, please reset the server. And do message me if you want updated scripts that show player records for each map, every time you join or press a key :)

And out of curiosity, I also wanna ask, what causes this error in the first place? How can it be prevented?


  • KrashKrash Neptune Sleeps
    This can occur if the server's public address changes from what it was when the server started, such as if the host's router was reset and received a new dynamic IP.
    Restarting the server should resolve it. If it happens regularly, having the server automatically restart at intervals would avoid this (as well as a few other peculiarities which can occur when the game runs for more than a few weeks), and would probably be the simplest fix without digging into detecting the change and resetting the appropriate variables.
  • Thanks for the info. Good to know it's something easily solvable.
  • Thanks for the heads up and your work on Classic Bots Roberto!
    (And everyone involved in keeping this game alive all the time!)

    As you said, the mod is perfect for a quick game that feels as close to playing on a server with random people as I can remember from back in the days.
    Even as the only human in the game, it's fun to play against the bots.
    So I thought I'll leave the server running in case someone is still around and wants to have a bit of fun.

    The server is running on a small box where the connection gets a new IP assigned by the ISP every day.
    Since I get the error as well, I tried setting $Host::ClassicAutoRestartServer = 1 and $Host::ClassicRestartTime = 24 in ClassicBots/prefs/ServerPrefs.cs, but as far as I can tell that doesn't really restart the server.
    Unfortunately due to work, I didn't have time to look much further into it yet.

    Since the server gets a new IP every day, it would be nice to be able to just set the appropriate variables that you mentioned Krash, in case someone is currently playing and having an automatic hard reset every few days when no one is using the server.

    I never got into the scripting part of Tribes back in the days and with the game being that old I seem to have a hard time getting much info on the topic now.
    As I'm a sofware dev by trade, If someone could give me some pointers on how to set those variables when the IP changes (can those be set from outside, or does it all have to be a game script?), I'm confident I can cobble something together to get the server accessible
  • Thanks, rom, glad to see you like it. I want to mention, I did encounter the server auto-restart one time when I was playing there right before a map was switched. But I think that's also the problem. I think the server auto-restarts only when someone joins and before switching the map. If no one can join because of that man in the middle error, the server can't restart, IF the auto-restart works in this way.

    So I don't know how to make it auto-restart after you get a new IP for the server, unless it would be done by outside programs. Maybe someone more knowledgeable could help you here.
  • KrashKrash Neptune Sleeps
    edited October 2018
    I expect they figured servers using it would be cycling through missions regularly; if not it wouldn't appear to be working from the outside. For the Classic auto-restart to actively shut down, you could open up GameData/classic/scripts/server.cs, find function AutoRestart(), and add the following block before its other actions:
    if ((ClientGroup.getCount() - $HostGameBotCount) == 0)
    	logEcho("Auto-restarting the server.");

    This should quit the server if empty, and otherwise fall through to the default behaviour (notice the players of a restart on mission change) if not.

    Alternatively, you could try dropping the attached script in scripts/autoexec/ and setting $Host::TN::resetIPv4 = true; in your serverprefs. This will cause the server to use the public address as seen by the master server every time a heartbeat is confirmed -- though even if this works for you, I would still recommend keeping the server auto-restarting once in a while.
  • Thanks for the pointers, will have a look at how this works.

    Had a bit of time today and threw together a quick external restart script in node that gets notified by the router via a dyndns call (the router can use an internal LAN IP for its dyndns calls - who knew). Node then checks the status of the game server over UDP and schedules to check again in a few minutes if there are players.
    Otherwise just reboots the game server right away.

    Been trying to figure out the UDP status protocol by looking at GameQ (, but some parts are missing there.
    Hacking it together to identify bots and human players was ok, but if anyone has a (more) complete description of the UDP status protocol, please let me know.
    Would love to put together a nice and small node lib for this.

    Still need to add binding the game server threads to specific cores, but so far it seems to be working ok enough so that I don't have to do the reboot by hand anymore.
    Seen a few people connect and play, so it seems to be working from outside now as well.
    If someone encounters other problems, please feel free to give me a shout here on PM or email.
    Will test a bit more during the week when I get time
Sign In or Register to comment.