[mohaa] MOHAA Linux admin tool - UPDATE

David M. Graham grahd at cwfh.com
Sat Sep 7 23:32:13 EDT 2002


Way to go Shockwave.  Hopefully we will have an excellent tool for us
MOH:AA admins to use.  Look forward to testing it out.........I probably
speak for the group too!... 

 

Firewalker

 

-----Original Message-----
From: [-SF-]Shockwave [mailto:shockwave at clanshortfuse.com] 
Sent: Saturday, September 07, 2002 10:41 AM
To: mohaa at icculus.org
Subject: [mohaa] MOHAA Linux admin tool - UPDATE

 

Hello everyone!

 

I have been working on the programs and am happy to report that the
server component is finished and it appears to be stable after the last
batch of tests I have run.  The client program is also functional, but I
am going to work on it a little more before I release anything just to
be sure I worked out most of the kinks.  In the meantime, I figured it
might be a good idea to let everyone know some more of the technical
details.  This way if anyone has any ideas, comments, questions, or
criticisms I can address them before I release the code.  Hopefully this
will make it a better utility in the long run.  Having said that, here
is a list of the loader's features:

 

- Configuration file

    On startup, a configuration file is read to provide the loader with
information needed to operate the game server and the loader itself.
This is where the command to launch MOHAA is located along with several
other settings that adjust how the loader operates.  If you are running
more than one server on a system, they should each have their own config
file specified on the command line.  Below is a copy of the
configuration file I am currently using:

 

#
#  MOHAA Loader Configuration File
#
#  - All characters after a "#" on a line are comments and will be
ignored.
#  - All blank lines will be ignored.
#  - The only option that must be specified in this file is PROGRAM.
Without
#    it, the loader cannot operate.  All other settings have defaults
already
#    specified within the loader itself.
#

 

#
# Specify the fully qualified path to the game server program including
all
# command line options.
#
PROGRAM = /usr/local/games/MOHAA/mohaa_lnxded +set dedicated 1 +set
cheats 0 +set ui_console 1 +set g_gametype 2 +set sv_maxclients 18 +set
developer 2 +map dm/mohdm1 +exec server.cfg

 

#
# Specify message broadcast interval in seconds.
#
MSG_INTERVAL = 300

#
# Specify if messages are to be printed.  Setting this to anything other
than
# "Y" will suppress message output to the server.  Normal processing
will
# continue regardless of how this is set.
#
MSG_PRINT = Y

 

#
# Specify limit of how many lines of the total message to print during
each
# broadcast.  Setting this to any value less than "1" will not impose
any limit
# at all.  Values of "1" or greater will cause the number of lines
specified by
# this value to print with the appropriate MSG_LINE_DELAY between each
line.
# Once the limit has been reached, the program will pause for the number
of
# seconds indicated by MSG_INTERVAL.
#
MSG_LINE_LIMIT = 0

 

#
# Specify the amount of time to wait between printing each line in
seconds.
#
MSG_LINE_DELAY = 0

#
# Specify server broadcast message content.  Each line of text must
begin with
# the text "MSG_LINE" and will be broadcast in the order it appears
here.  If
# you want to split broadcasts into logical groups using the
MSG_LINE_LIMIT
# setting but don't want to print content for all possible lines in a
given
# grouping, use a null line:
#       e.g.  MSG_LINE = NULL
# The line will count towards the limit, but not be printed.
#
MSG_LINE = Welcome to RAGNAROK!  Server IP: 216.42.80.176
MSG_LINE = Server Admin email: shockwave at clanshortfuse.com
MSG_LINE = No Realism.  Friendly Fire OFF.  Have fun and fight
honorably.

 

#
# Ban messages can be tailored by using the BAN_MSG_START and
BAN_MSG_END
# config variables.  The START component will be printed before the
player's
# name and the END component will be printed after the player's name.
After
# the player has been kicked, the message will be assembled and sent to
the
# console.
#

#
# Specify start text of ban message.
#
BAN_MSG_START =

 

#
# Specify end text of ban message.
#
BAN_MSG_END =

 


#####################
#
# E O F
#

 

    The configuration file is re-read after each message interval has
elapsed to provide for the ability to change every setting with the
exception of PROGRAM.  Simply use a text editor and make whatever
changes you require and they will be picked up during the next message
cycle, whether you have opted to broadcast anything or not.

    I spent some time thinking about how to handle server message
broadcasts and I tried to develop a structure that would be both easy to
use and flexible.  I have tested every combination I could think of and
everything runs smoothly.  If the explanation given in the configuration
file of how it all works still leaves anyone with questions, please let
me know.  Also, if anyone requires message handling that this system
doesn't support I'd like to hear the specifics.

 

- Command line overrides

    Options can be placed on the command line to override program
defaults not handled by the configuration file.  Here is the output
generated by invoking the loader's --help option:

 

Usage: mohaa_loader [--host host] [--port port] [--cfg filename] [--log
filename] [--ban filename]
       mohaa_loader --defaults
       mohaa_loader --help

 

        --host   IP address or host name: name must resolve to an IP
address
                   (e.g. localhost  or  192.168.1.1  or
www.myserver.com)
        --port   port number
        --cfg    path to configuration file, including filename itself
                   (e.g.  /usr/local/games/MOHAA/yourconfig.cfg)
        --log    path to game server log file, including filename itself
                   (e.g.  /usr/local/games/MOHAA/server.log)
        --ban    path to banned IP file, including filename itself
                   (e.g.  /usr/local/games/MOHAA/badboys.cfg)

 

        --defaults
            prints current program defaults and exits
        --help
            prints this usage information and exits

 

    As you can see, you have the ability to either share or specify
different files for banned IP addresses.  However, it is important to
note that the log files and configuration files for each server you are
running be separate and properly specified on the command line.  Running
the command with the --defaults option will dump the internal program
defaults so you can see what the settings will be if they are not
overridden either on the command line or in the configuration file.

    I also want to take a moment and discuss the --host and --port
options, specifically as they relate to system security.  I have set the
program default for --host to  "localhost" because I didn't employ any
encryption on the socket connections.  Specifying an Internet address
means that the socket will be exposed externally and that might not be
the best idea.  Personally, I use PuTTY (a free utility found here:
http://www.chiark.greenend.org.uk/~sgtatham/putty/ ) to connect to the
game server if I'm using a Windows system or "ssh" from the Linux shell
prompt if I'm on a Linux system because the connection is encrypted.
Once connected, I invoke the program I want to run by using the "screen"
program (e.g. screen batch_file_that_starts_loader).  This allows me to
<Ctrl><A><Ctrl><D> to detach from the process and keep it running.  I
can then disconnect and go about my business.  To regain control, I ssh
back into the server and issue the command "screen -r" to pick up the
process.  I can <Ctrl><C> at any time while connected to the process to
kill it entirely.  I apologize if this is review for any of you, but I
want to be sure I explain the situation thoroughly.

 

- Game server by clients via sockets

    The loader starts the game server using a piped open in order to
feed input to the server process.  Once the server is running, the
loader forks processes to handle server messaging, monitoring output for
kicking banned IP's, and servicing incoming client connections.  If the
client connection process receives a connection request, it forks two
processes to handle input and output from the client respectively.  Each
additional client that connects will receive its own set of I/O
processes as well.  So far I have connected with two clients at the same
time and everything worked well.  The client program operates similarly
and forks to accommodate I/O on separate processes.  The result is
smooth traffic flow without devouring large amounts of server resources.
Unfortunately, I was unable to latch onto the output from the game
server itself directly.  Piped opens, IPC::Open2, and named pipes didn't
seem to allow it much less facilitate good communications with clients
attempting to connect to the loader.  Therefore, server output is
processed by opening filehandles to the server log and tailing it.  The
data is fed to the loader's input channel and subsequently out via
sockets to each client connected.

 

- Banned IP file handling

    As I stated earlier, there is a process running whose job is solely
to monitor server output and react accordingly.  This is the process
that watches for banned players.  When a player connects, it re-reads
the banned IP file and checks it against the players currently connected
to the server.  Upon getting a match, the player in question is kicked
and a ban message is output to the server.

 

======

 

Well, that's about all I have for now.  I've been a little short on
sleep lately, so I apologize in advance for anything I may have omitted.
Next on the list will be finishing off the client program so I can
release everything to those who have expressed an interest in testing.
Any feedback, technical or otherwise, is solicited.  I want to make this
a viable tool for all of us who are responsible for administrating Linux
MOHAA game servers and the best way to do that is to maintain an open
forum.  Thanks for your time and I'll let everyone know when the client
is finished.  With any luck it will be either today or tomorrow.

 

 

Shockwave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/mohaa/attachments/20020907/00c53e02/attachment.htm>


More information about the Mohaa mailing list