[HowTo] Run a secured KillerApp server on Linux

Tips & Tricks for DM/DA/LC
Post Reply
schmatzler
Registered users
Registered users
Posts: 14
Joined: Tue Jun 12, 2012 7:54 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Blue
What type of multiplayer do you like to play?: Deathmatch

[HowTo] Run a secured KillerApp server on Linux

Post by schmatzler »

Hi guys,

I wanted to create a new TRON KillerApp server, but I have only a decent Linux box running Debian. But I thought, 2x2,4 GHz and 8 Gig of RAM would make a damn fine machine for all of you out there, so I figured out a way to run it on Linux anyway. Without a monitor, from commandline and with an extra user in its own environment, so it should not be possible to use its security holes for gaining access to your machine. I also added a failsafe script that kicks in and restarts the server if it crashes.

You will have to install Tron, the unofficial patch 1.042 and KillerApp on your Windows machine in order to copy some files from there later on. Lets start:

First, we login to our machine via ssh (as root user) and create a new user called gameserver. This one will be used for running our TRON server:

Code: Select all

useradd --home-dir /home/gameserver --password swordfish --shell /bin/false gameserver
Now we have a new user without a shell. No one can login to your box with this user. Its home directory is /home/gameserver. Fine. Lets move on, the next step is installing the needed software for running the TRON server:

Code: Select all

apt-get install wine xvfb
Wine is needed to emulate a windows environment, xvfb is creating a virtual screen later on, so we can run the server without a screen attached.

Now create a new directory /home/gameserver/tron with

Code: Select all

mkdir /home/gameserver/tron
and place the following files into it:

Code: Select all

Directories and all subfiles in them:

Custom
LightCycleGameData
Profiles
ServerData
tcdg

Files:

Engine.rez
Game.rez
Game2.rez
mfc42.dll
mpger.ls0 (If you have it)
SndDrv.dll
Sound.rez
TRONSrv.exe
autoexec.cfg
bl.dat
gamep5.rez
gamep6.rez
launchcmds.txt
layout.bin
ltmsg.dll
msvcirt.dll
server.dll

Note that there has to be a config inside the ServerData folder. And JUST ONE CONFIG. So you should start up the program at least one time on your windows box and do all the required settings in the multiplayer wizard. After that, you have a preconfigured configfile that you can copy to your linux box.

Second note: Get a msvcirt.dll somewhere on the internet or copy it over from your Windows box into the tron-folder. Wine needs this file to start up the server.

This is it - the tron server files are on your box and your user is created. But in order to start up properly it still needs some registry entries in your fake windows environment. Otherwise the TRONSrv.exe fails with a "Could not load resource file" error.

To create your fake wine folder, type

Code: Select all

sudo -s -u gameserver
xvfb-run -a winecfg
into your terminal. The program will create a /home/gameserver/.wine folder for our settings. In that folder, our registry settings are stored.

Press CTRL+C to quit the program (you can't use it without a display) and type

Code: Select all

exit
to return to your previous user.

Now type the following into your terminal

Code: Select all

mcedit /home/gameserver/.wine/system.reg
An editor should open up. If not, install the program mc with apt-get install mc.

Directly after the line

Code: Select all

[Software\\Microsoft\\Windows NT\\CurrentVersion\\SvcHost] 1338803243
"netsvcs"=str(7):"BITS\0"
add the following code

Code: Select all

[Software\\Monolith Productions\\No One Lives Forever\\1.0] 1339584011

[Software\\Monolith Productions\\TRON 2.0\\1.0] 1339521803
"CDKey"="YOUR-CDKE-YGOE-SHER-E000"
"Commands"="-windowtitle \"TRON 2.0: Killer App Mod\""
"InstallDir"="Z:\\tron"
"KAModFOV"="106"
"KAModResolution"="1360x768"
"KAModTemp"="Z:\\tron\\Custom\\Mods\\Retail\\KAModTemp\\WORLDS\\RETAILSINGLEPLAYER"
"Language"="German"
"Last Random"=dword:00000000
"Num Launcher Runs"=dword:00000004
"OptionsWarning"=dword:00000001
"ProfileName"="Player"
"Save Commands"=dword:00000001
"SelectedMod"="Retail"
"UpdateCommandLine0"="-rez gamep5.rez"
"UpdateCommandLine1"="-rez gamep6.rez"
"UpdateCommandLine4"="-rez \"Z:\\tron\\tcdg\\game\""
"UpdateNum"=dword:00000005
Don't forget to enter a correct cdkey. I will not give you mine :)

Since you chose to start TRONSrv from the Z: drive you will still have to tell wine which folder to use as the Z: drive. In our case, this is /home/gameserver.
To do so, create a symlink with the following commands:

Code: Select all

mkdir /home/gameserver/.wine/dosdevices/z:
ln -s /home/gameserver /home/gameserver/.wine/dosdevices/z:
Now we set up a script that starts your tron server.

Create a new crontab for the gameserver user with the following command:

Code: Select all

EDITOR=mcedit crontab -e -u gameserver
Paste the following content into the editor and press F2+F10 to save and close it:

Code: Select all

MAILTO=""
* * * * * /home/gameserver/tron_check.sh
What this does: It starts the script tron_check.sh every 60 seconds - so we gonna have to create that and fill it with contents:

Code: Select all

mcedit /home/gameserver/tron_check.sh
The editor opens again. This time, paste the following commands into it. Close with F2+F10.

Code: Select all

#!/bin/bash
# check daemon
ps -ef | grep -v grep | grep TRONSrv.exe
# if not found - equals to 1, start it
if [ $? -eq 1 ]
then
cd tron && nohup xvfb-run -a wine TRONSrv.exe >/dev/null 2>/dev/null &
else
echo "tron found - do nothing"
fi

Important: Don't add more than one config in the "ServerData" folder. This does not work and opens the wizard. Since we have no screen, we can't use it to start the server.

Now we will make sure, that the whole directory belongs to the right user and that the script is executable:

Code: Select all

chown -R gameserver:gameserver /home/gameserver

Code: Select all

chmod +x /home/gameserver/tron_check.sh
Done! Now wait some seconds and your server should show up in the master list! If not, unblock the ports 13139, 28888-29901 (TCP) and 27888-29901 (UDP) in your firewall.

You can check my server status here, it is running very stable via wine:

http://hirnschwund.net/" onclick="window.open(this.href);return false;

Running a second server is also possible, but a bit more complicated. I will not cover that here, however I am here if anyone needs assistance.
Last edited by schmatzler on Tue Jun 19, 2012 5:28 am, edited 1 time in total.
User avatar
TronFAQ
[LDSO] Member
[LDSO] Member
Posts: 3021
Joined: Tue Jan 11, 2005 12:50 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Cyan
What type of multiplayer do you like to play?: Deathmatch
Location: Ontario, Canada
Contact:

Re: [HowTo] Run a secured KillerApp server on Linux

Post by TronFAQ »

Wow, that's really a lot of work isn't it. But I guess it's worth it, since Linux servers are easier/cheaper to obtain and are more stable.

Thanks for going to the trouble to write up this guide. T-)
User avatar
SweatyPyro
Registered users
Registered users
Posts: 330
Joined: Tue Feb 01, 2005 5:49 pm
Location: New Jersey, USA
Contact:

Re: [HowTo] Run a secured KillerApp server on Linux

Post by SweatyPyro »

Not a Linux user myself, but brilliant job with the tutorial! Information like this is always helpful.
!!!!
User avatar
deeahchur
Registered users
Registered users
Posts: 458
Joined: Wed Sep 15, 2010 10:43 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: White
What type of multiplayer do you like to play?: Deathmatch
Location: Maryland, USA

Re: [HowTo] Run a secured KillerApp server on Linux

Post by deeahchur »

Maybe we should add it to the wiki?
Ti| / / S C A N N I N G
Tz) / / Incompatable Program detected
Tk| / / Initiate Yggdrassil Conscription Potocol
T=| "Appropriation is the highest form of appreciation."
User avatar
xistence
[LDSO] Site Admin
[LDSO] Site Admin
Posts: 848
Joined: Tue Jan 11, 2005 12:56 am
Location: Germany
Contact:

Re: [HowTo] Run a secured KillerApp server on Linux

Post by xistence »

Nice stuff! As a Linux user, i know that it must have took some time to build up that setup. And good to see that there is an option to play for guys like me (as i'm from Germany), so not needing to 'jump over the great lake'... if i just would find some time to play again... geez.
Good job, keep going!
ldso:// - Living Dead System Operators
[2.0PD] - 2.0 Program Developers
blog
Image
schmatzler
Registered users
Registered users
Posts: 14
Joined: Tue Jun 12, 2012 7:54 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Blue
What type of multiplayer do you like to play?: Deathmatch

Re: [HowTo] Run a secured KillerApp server on Linux

Post by schmatzler »

xistence wrote:Nice stuff! As a Linux user, i know that it must have took some time to build up that setup.
Building up the scripts was very easy as I figured out how to write them a long time ago. The biggest problem was the fact that the server doesn't startup without proper registry entries. Adding them without any interface was a bit hard to manage. Older Lithtech games are a bit more userfriendly (:

The system is far from perfect as it cannot detect if the servers uses 100% CPU and kill it afterwards. This happens very rarely but it can happen and affect all other servers running on the machine.

Once I figured out how to do that I will post it here. Servers are running until I run out of money (which will hopefully never happen). ;)
User avatar
TronFAQ
[LDSO] Member
[LDSO] Member
Posts: 3021
Joined: Tue Jan 11, 2005 12:50 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Cyan
What type of multiplayer do you like to play?: Deathmatch
Location: Ontario, Canada
Contact:

Re: [HowTo] Run a secured KillerApp server on Linux

Post by TronFAQ »

deeahchur wrote:Maybe we should add it to the wiki?
Sounds like a good idea. I can add it later. Or, schmatzler can add it himself.
User avatar
TronFAQ
[LDSO] Member
[LDSO] Member
Posts: 3021
Joined: Tue Jan 11, 2005 12:50 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Cyan
What type of multiplayer do you like to play?: Deathmatch
Location: Ontario, Canada
Contact:

Re: [HowTo] Run a secured KillerApp server on Linux

Post by TronFAQ »

I've been doing a bit of work on the Wiki, updating things a little here and there. I took the opportunity to add schmatzler's tutorial to the Wiki.

I didn't spend too much time on formatting it, which probably could have been done better. I might go in and clean it up a bit more, later. Or perhaps schmatzler can edit it himself, to make it the way he wants. T-)
schmatzler
Registered users
Registered users
Posts: 14
Joined: Tue Jun 12, 2012 7:54 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Blue
What type of multiplayer do you like to play?: Deathmatch

Re: [HowTo] Run a secured KillerApp server on Linux

Post by schmatzler »

Thanks. :) I'm fine with it the way it is. I have never been much into WIKI's, because I think someone that needs this information will find it much easier on this forum than in the Wiki.
User avatar
Jizaboz
Registered users
Registered users
Posts: 148
Joined: Fri Sep 19, 2008 6:46 am
Location: United States
Contact:

Re: [HowTo] Run a secured KillerApp server on Linux

Post by Jizaboz »

Thanks for this guide!
Jizaboz

Image
schmatzler
Registered users
Registered users
Posts: 14
Joined: Tue Jun 12, 2012 7:54 am
Do you own a copy of Tron 2.0?: Yes
What is your favorite Tron character color?: Blue
What type of multiplayer do you like to play?: Deathmatch

Re: [HowTo] Run a secured KillerApp server on Linux

Post by schmatzler »

Just a quick addition: I refined the script that checks if the server is running.
It also runs a second check on my web frontend here to see if the server is really online.

Doing the sidecheck will restart the server if the .exe is still running, but it has lost access to the internet, because it somehow broke. This will also cover things like "Damn, it runs but takes up my CPU". :)

Code: Select all

#!/bin/bash
# if online is NULL, it's down. May change maps, so wait and check again:
if [ -z "$(curl -sSf http://hirnschwund.net/?s=8 | grep "ONLINE")" ]
then
sleep 60
elif [ -z "$(curl -sSf http://hirnschwund.net/?s=8 | grep "ONLINE")" ]
then
pkill TRONSrv.exe
fi

# check daemon
ps -ef | grep -v grep | grep TRONSrv.exe
# if not found - equals to 1, start it
if [ $? -eq 1 ]
then
cd tron && nohup xvfb-run -a wine TRONSrv.exe >/dev/null 2>/dev/null &
else
echo "found, leave."
fi.
Post Reply