Using REGEX for your user names

 

REGEX is a text formatting tool supported by Admin Mod , which allows you to so a number of things, including using special characters in user names, using partial names for protection or blocking, and protecting clan tags

 

Getting started with REGEX and AM:

 

It's important to realize up from that once you switch on REGEX you have to adapt your users.ini to match the REGEX rules.

 

In order to utilize REGEX in Admin Mod, you first must set the value of the use_regex cvar in your server.cfg file to "1" to enable it.

 

Once enabled, you can use a partial name in your users.ini file, for example, to protect your clan tag. Let's say your clan uses the tag [AMbT]. You could make users.ini entries like this:

 

    \[AMbT\]Jaguar:PaSsWoRd:65535

    \[AMbT\]Rope:paSSwOrd:65535

    \[AMbT\]:PAssWOrd:16384

 

The above entries would allow Jaguar and Rope to connect using the clan tag, if they successfully authenticate, but will not allow anyone who is not listed in users.ini to connect with the [AMbT] tag. Note that with this setup, anyone who is not listed by username, but who uses the tag and supplies the correct password, would be given only reserved nickname access (16384) and nothing else in the above example.

 

Note that the brackets in the above example are both preceded by back-slash characters ("\"). The back-slash character denotes that the character to the right of it is to be treated as a text character, rather than as an operator. In other words, it allows non-alphanumeric characters to be used as part of a username. This is especially helpful when you are wanting to assign a username that includes any of the "forbidden characters." As a general rule, any character not listed below should be escaped (preceded with a back-slash) when using REGEX.

 

A-Z

a-z

0-9

-    _   /   .

 

A complete discussion of REGEX, it's uses and detailed explanation is beyond the scope of this manual. If you need REGEX support with Admin Mod, feel free to post your questions in the Admin Mod Forums.

 


More information about REGEX can be found on the web. Here's one of the many resources available:

 

http://www.delorie.com/gnu/docs/regex/regex_toc.html

 

Setting up your users.ini file

The users.ini file is where you will store all of the player names, passwords, and access levels of the players that you want to have privileges on your server. In the interest of being complete, but not confusing some, we will start simple here and get more technical as we go. The sample users.ini file that comes in the Admin Mod distribution is documented with internal comments, as well.

 

The format of the users.ini like this:

 

username:password:access_level

 

This file controls the access levels of administrators. To be an administrator on the server, your name or WONID must be in this folder with an adequate password and access level.  The users.ini file also serves as a nick and WONID protector (the second is obviously useless).

 

Without the appropriate password, a user with a playername identified in the users.ini file and the wrong password will not be able to play on the server. The users.ini file uses permissions for allowing access to command levels, which are described below.

 

There are two ways to identify users in this file and give them access:

 

playername:password:accesslevel

 

or

 

wonid:password:accesslevel

 

More information about access levels, how they are determined and what mean is contained at the end of this documentation section.

 

Each method of specifying the user's identity (player name or WONID) offers its own different advantages and disadvantages:

 

Player name:

Using someone's player name to give them access to ADMIN commands means that, to use the commands, the person has to use the name exactly as it is in the users.ini file. (Names AND passwords are case sensitive.)   However, they can use the name and password provided on any computer, at any time.

 

WONID:

Using someone's WONID to give them access to ADMIN commands has the advantage of letting a player use any name he wishes while playing, because, as long as he stays on the same computer, his WONID will not change.  On the other hand, because of the way the WONID is calculated, if the player who has access to ADMIN commands attempts to play on another computer, he will be unable to access those commands.  And if the user is on his computer, but does not have the appropriate password, he will be kicked from the server to which he should normally have access.  Had the permission been given through the use of the player name, he would have been able to access the server with a different name.

 

If permissions were to be given to 4 players, the users.ini file would look like this:

 

PlayerX:password1:65535

Gerg:password1:65535

Bud-froggy:password2:65535

12345678:password3:199

 

This would give PlayerX an access level of 65535 if, in his setinfo line, he had the appropriate password listed. For more information, see Client configuration via setinfo commands elsewhere in this documentation.

 

Players Gerg and Bud-froggy would have an access level of 65535 with two different passwords. The player with a WONID of 12345678 would have an access level of 199 with a password of "password3" and would be able to change his or her name and still retain admin access, since the WONID is what is being used to identify him/her, and that value always stays the same for any one Half-Life installation.

 

You can put as many player WON IDs, names and access levels as needed in the users.ini file.

 

As you can see, access relies on the equation between two things: name/WONID and password. In the same users.ini file, multiple players can have the same password, and the same player name can have different access levels with different passwords.

 

Do not write something like this:

 

player:testpass:199

player:testpass:65535

 

The users.ini file is read from top to bottom, so no matter what the second line will either be ignored or will create errors.

 

To overcome the problem of playername/WONID, you could grant the same access level for a playername and WONID with the same password. For example, if your name id PlayerX, and your WONID is 123445678,

your users.ini file could look like this:

 

12345678:testpass:65535

PlayerX:testpass:65535

 

This will allow a player to change names while at home (i.e. when authenticating via WON ID), and he can use his "normal" name (PlayerX) when on the road. You could also give multiple permissions for different names with the same password.

 

 

PERMISSIONS AND ACCESS LEVELS, AND WHAT THEY ALL MEAN

 

You determine a user’s permissions by adding up the access levels for all of the commands you want that person to be able to use on the server. We have provided a friendly little javascript calculator that will do the work for you (if you are reading this in HTML format, that is). The chart below shows the access levels, and the associated Admin Mod commands, followed by some simple instructions covering how to calculate the correct access level for the commands you want to provide to the user.

 

Explanation of how this all works:

 

So, If I wanted to give JoeUser access to only the admin_kick, admin_ban and admin_unban commands, I would add the access levels for those commands together:  

 

128+256=384

 

So, that is the number that I would place in the users.ini file to grant him that access. If I wanted to allow BrunoMan access only to a reserved spot on the server, I would use an access level of 32768. If I decided to give BrunoMan additional access to the admin_say command, then I would add his reserve slot access value to the admin_say command value:

 

32768+64=32832.

 

For a handy access level calculator (HTML only) that will help you add up the numbers to get the right access levels, see the Access Levels page in the Admin Mod Reference section of this documentation.

 

Note that if you give a user access to a given level, you are giving access to all commands in that level (level 512 gives access to admin.cfg, admin_servercfg and admin_hostname, for example). You cannot selectively give access to only one command in a given level – they come as a package. They have been grouped in a way that makes good logical sense, though, so you will not likely find the grouping to be a problem. If you are an adventurous scripter, you can modify the access levels for each command and create your own custom security levels, but that is beyond the scope of this configuration document.

 

Here is a table showing the default Admin Mod access level values and their corresponding commands:

 

Access Level

Commands Allowed

all players

(public commands)

    admin_listmaps

    admin_nextmap

    admin_messagemode

    admin_nomessagemode

    admin_timeleft

    admin_userlist

    admin_version

    say currentmap

    say nextmap

    say timeleft

1

    admin_vote_restart

    say mapvote

    say rockthevote

    say vote <map>

    admin_vote_kick

    admin_vote_map

2

    admin_cancelvote

    admin_denymap

    admin_restartround

    say cancelvote

    say denymap

    admin_fraglimit

    admin_map

    admin_startvote

    admin_timelimit

4

    admin_prematch

    admin_reload

8

    admin_pause

    admin_unpause

16

    admin_pass

    admin_nopass

32

 

    admin_friendlyfire

    admin_gravity

    admin_teamplay

    admin_balance

64

    admin_chat

    admin_say

    admin_ssay

    admin_csay

    admin_psay

128

    admin_slap

    admin_slay

    admin_slayteam

    admin_kick

256

    admin_ban

    admin_unban

512

    admin_cfg

    admin_servercfg

    admin_hostname

1024

    (unused)

2048

    admin_gag

    admin_ungag

4096

    makes player immune to

    admin commands damage

8192

    admin_godmode

    admin_noclip

    admin_stack

    admin_teleport

    admin_userorigin

    admin_ct ( CS [Counter-Strike game mod] )

    admin_t (CS)

    admin_blue ( TFC [Team Fortress Classic game mod] )

    admin_green (TFC)

    admin_red (TFC)

    admin_yellow (TFC)

    admin_enableallweapons

    admin_enableequipment

    admin_enablemenu

    admin_enableweapon

    admin_restrictallweapons

    admin_restrictequipment

    admin_restrictmenu

    admin_restrictweapon

    admin_weaponscheck

    admin_fun

    admin_disco

    admin_llama

    admin_unllama

    admin_listspawn

    admin_movespawn

    admin_removespawn

    admin_spawn

16384

allow this user to use a reserved nickname

32768

allow this user to use a reserved spot

65536

admin_rcon access (use with caution)

admin_execall

admin_execclient

admin_execteam