UnGateway

version 102 Beta
Michiel "El Muerte" Hendriks
elmuerte@drunksnipers.com
http://ungateway.elmuerte.com

Introduction

UnGateway is a system that provides additional methods for server administration. It's a base system that can easily be extended to support additional protocols.

At the moment it provides a Telnet server with VT102 terminal emulation, it behaves much like the Bash shell.
The telnet server has been tested with the Linux telnet client and a MS Windows telnet client: PuTTY. The MS Telnet client that comes with every MS Windows version also works, but it's advised to use a different telnet client (like PuTTY, free software).

Security notice: the telnet protocol is plain text, there is no form of encryption. On the side note: the UT2004 webadmin does not have any better protection.

Additionally from version 102 beta the IRC daemon is also functional. The IRC server works pretty much like any other IRC server, so a normal IRC client should work.
Not every function of the IRC protocol has been implemented, but at the moment it's functional.

Installation

Copy the .u and .int files to the System directory.
Add the following to your system configuration (UT2004.ini):
[Engine.GameEngine]
ServerActors=UnGateway.GatewayDaemon
This is all you need to install the system. Now you will have to configure the interfaces and applications.

Configuration

Applications

Applications contain the commands you can enter into the system. There are a couple of application included with the system.
To install a application to have to add it to the application list of the GatewatDaemon in the system configuration:

[UnGateway.GatewayDaemon]
ApplicationClasses=<application class 1>
ApplicationClasses=<application class 2>
ApplicationClasses=...
You can add as many application classes as you want.

The following application classes are included with the system:
class namedescription
UnGateway.GAppDebugContains debug commands, there's no need to install this application
UnGateway.GAppDefaultContain default commands like "help" and "quit"
UnGateway.GAppCronProvides a cron daemon to program commands to be executed at a set time.
UGUT2004.GAppSystemProvides general system commands for UT2004, like shutdown and servertravel
UGUT2004.GAppSettingsContains commands to change settings and maplists
For an overview of all available commands and some additional information checkt the UnGateway-help.html file

Interfaces

Out of the box UnGateway doesn't do much. You need to configure interfaces and applications that are available. To add an interface add the following to your system configuration:

[UnGateway.GatewayDaemon]
InterfaceClasses=<interface class 1>
InterfaceClasses=<interface class 2>
InterfaceClasses=...

The following interface classes are available:
class namedescription
UnGateway.GITelnetdTelnet server, emulates a VT102 terminal server
UnGateway.GIIRCdIRC server

Other options

Besides the interfaces and the applications you can also change the following setting. However, most of these don't require any changes.
[UnGateway.GatewayDaemon]
Verbose=0
AuthClass=UnGateway.GAuthSystem
CmdAliases=(alias="reboot",command="shutdown now \"restarting the server, please return in a couple of second\"")
CmdAliases=(alias="p",command="players %@")
...
Verbose
This sets the log verbosity. It's a binary list of flags: Error = 1; Warning = 2; Info = 4; Event = 8; Debug = 128. You probably only want to set the Error flag and maybe the Warning flag.
AuthClass
This is the authentication system used to authenticate the logins. The system comes with one system UnGateway.GAuthSystem, this will just used the UT2004's AccessControll class to validate the logins.
CmdAliases
This will allow you to create aliases for certain commands. You can have as many aliases as you want, you can only use real commands in the command value of the alias. Aliases have a higher priority than the actual commands. these aliases are system wide, so every user can use these aliases. By default no aliases have been configured.

General interface configuration

Each interface has the following configuration options. Additional configuration options may be available per interface.
iListenPort=0
bUseNextAvailable=false
iMaxClients=10
AccessPolicy=(hostmask="*",policy=AP_Allow)
...
iListenPort
The TCP port to listen on for incoming connections. By default the built-in interfaces have not configured any listen port. So you will have to set them up correctly before you start the server.
bUseNextAvailable
If the listen port is already in use, use the next available port to bind to. It's adviced to set this value to false.
iMaxClients
The maximum number of clients allowed. If the max has been reached, new clients will be denied.
AccessPolicy
This controlls from which IP mask client may or may not connect from. The default policy is to accept clients from any IP mask. The order of the AccessPolicy is important, the last match has the final ruling.
The hostmask can contain the following wildcards: * = zero or more matches; ? = one single character.
The policy can either be AP_Allow or AP_Deny

Application configuration

Some applications have configurable options. Unless stated otherwise, all configurations belong in the system configuration.

UnGateway.GAppCron

[UnGateway.GAppCron]
CronClass=UnGateway.Cron
CronClass
the Cron daemon class, no need to change this

UnGateway.Cron

[UnGateway.Cron]
DummyClientClass=UnGateway.CronClient
Crontab=(Command="somecommand",Type=EC_Delay,Time="5",Desc="added by Admin",bDisabled=False)
...
DummyClientClass
The dummy client used to capture the output of commands. No need to change this
Crontab
The cron configuration. You can add as many cron entries as you want.
fielddescription
Commandthe command to secute
TypeEC_Delay or EC_Time
Timetime configuration, format depends on the value of Type.
Descdescription
bDisabledwhen true the command will never be executed
EC_Delay
The command will be executed after set number of minutes after the level has been loaded.
EC_Time
The command will be executed when the set time has been reached.
Time field format, 5 fields: minute hour day month day_of_week
minute:0-59
hour:0-23
day:0-31
month:0-11
day_of_week:0-6
A * can be used as wild card. Optionally each field can have a divider for re-occurance: val/div. For example a field has the value: "0/5". This means that it will match: time % div == val -> time % 5 == 0. If time is minutes then it will match every 5 minutes, 1/5 will also match every 5 minutes, except that it's the 2nd minute of every 5 minutes, 5/5 will never match. A wildcard in a divider will be changed to 0: * /5 -> 0/5, 0/ * -> 0/0 (never matches)

UnGateway.CronClient

[UnGateway.CronClient]
bSilent=false
bExternalLog=false
LogFilename="crondaemon_%P"
bSilent
only log errors
bExternalLog
use and external log file
LogFilename
Log filename to use. The following formatting rules are accepted:
%Pserver port
%Yyear
%Mmonth
%Dday
%Hhour
%Iminute
%Ssecond
%Wday of the week

Interface configuration

Most interfaces (or it's client handlers) have additional configuration options.

UnGateway.GITelnetd

No additional configuration options for the interface. But the client handler has some options.

UnGateway.GCTelnet

[UnGateway.GCTelnet]
CommandPrompt="%username%@%computername%:~$ "
iMaxLogin=3
fDelayInitial=0.0
fDelayWrongPassword=5.0
bDisableAuth=false
bEnablePager=true
bSaveHistory=false
CommandHistoryClass=UnGateway.TelnetCommandHistory
ChatMode=CM_Disabled
bShowMotd=true
MOTD=...
MOTD=...
...
CommandPrompt
The command prompt format. The following replacements can be used:
%username%, %computername%, %hostname%, %hostaddress%, %clientaddress%
iMaxLogin
The maximum login tries before the connection is closed.
fDelayInitial
the number of seconds to wait before the user can try to log in.
fDelayWrongPassword
Number of seconds to wait before a user can try to log in again. this prevents brute forcing a password.
bDisableAuth
Disable authentication completely. You should not do this, it will allow everybody to login without a username and password.
bEnablePager
The pager is the automatic scroll feature that allows users to scroll up or down when a command output is more than could fit on the screen.
bSaveHistory
Save each user's command history to the UnGateway.ini file. This will add some useless overhead during login and logout.
CommandHistoryClass
The class to spawn for saving\loading the command history
ChatMode
The intial chat mode. With full chat mode everything the user enters will be a chat command. With partial chat only part of the screen is reserved for messages and only when the user uses the say command it will be considerd as a chat message.
CM_DisabledDisabled
CM_FullFull chat mode
CM_PartialPartial chat mode
When logged in you can use the following commands to change the chat mode:
Alt+ctoggle partial chat mode
Alt+Cfull chat mode
Note: instead of Alt the Esc can be used
bShowMotd
Show the message of the day
MOTD
The Messsage Of The Day.

UnGateway.GIIRCd

No additional configuration options for the interface. But the client handler has some options.

UnGateway.GCIRC

[UnGateway.GCIRC]
bShowMotd=true
bMustLogin=false
MaxChannels=2
bAllowCreateChannel=false
MOTD=...
MOTD=...
...
bShowMotd
Show the message of the day on login
bMustLogin
if set the user must login with a valid username and password when they register
MaxChannels
Maximum Channels a user can join
bAllowCreateChannel
Allow channel creation. It's strongly adviced not to enable this
MOTD
The message of the day. You can use the following replacements: %hostname%, %channels%

Usage

Ofcourse each interface work differently.

Telnet

Any telnet client should work with the telnet server, however for MS Window I advise you to use the free client PuTTY. It's much better than the standard MS Telnet client.

The rest of the system works pretty much like a GNU BASH shell. Here's an overview of all special keyboard commands:
keydescription
backspacedelete the previous character
tabperform tab completion to complete the current command.
Note: currently this only works for the commands, not the command parameters
Alt+ctoggle partial chat mode
Alt+Center full chat mode. to exit the full chat mode press Ctrl+D
Ctrl+Amove the cursor to the beginning of the line
Ctrl+Ddelete the next character, on an empty line: logout
Ctrl+Emove the cursor to the end of the line
Ctrl+Kcut the text from the cursor to the end of the line to the clipboard
Ctrl+Ypaste the current clipboard buffer
Arrow downscroll forward in the history
Arrow leftmove the cursor to the left
Arrow rightmove the cursor to the right
Arrow upscroll back in the history

By default the internal pager is enbaled. This means if a command shows more information that you have room on your screen it will start the pager that will allow you to scroll up (PageUp) and scroll down (PageDown) to view all data. To exit the pager either press Ctrl+C or Q.

IRC

The IRC server works pretty much like any other IRC server. However not all functionality is has been implemented.
By default two channels are created, the game channel and the admin channel (&Admin). The name of the game channel is contructed from the server's IP and port. By default the available IRC channels are listed in the MOTD, otherwise you can use the /list command to list all available channels.

Game channel

The game channel is much like a normal IRC channel, by default everything you say will be said on the server, and vice versa. The players in the game join and part this channel automatically.

Admin channel (&Admin)

The admin channel is a special channel (and only local on a server) where you can enter the UnGateway commands. These commands have to be prefixed with a . (a period). Commands not prefixed with a . will just be said on the admin channel, other IRC admins logged in on this channel will also see this.
The admin channel is only available to logged in admins.

Logging in

There are two ways you can log in. If you specify a password during login the system will automatically try to log you in as an admin. If you don't specify a password you will log in as a normal user.
To log in as an admin you will have to use the /oper command.
When you are logged in as an IRC Oper/Admin you will be able to join the Admin channel, and you can see the complete user details when using /whois.