This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.

Private List Server: Difference between revisions

From BZFlagWiki
Jump to navigation Jump to search
No edit summary
Deliot (talk | contribs)
No edit summary
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Overview=
This article discusses how to create a PRIVATE [[List Server]] and have players authenticate via this server.  This is generally not necessary, since BZFlag clients perform [[Global Registration]] via the official bzflag.org [[List Server]].  However, if a [[BZFS]] server is created within a private LAN network, it may be desirable/necessary to authenticate players locally.
This article discusses how to create a PRIVATE [[List Server]] and have players authenticate via this server.  This is generally not necessary, since BZFlag clients perform [[Global Registration]] via the official bzflag.org [[List Server]].  However, if a [[BZFS]] server is created within a private LAN network, it may be desirable/necessary to authenticate players locally.


=Assumptions=
==Assumptions==
*This article assumes a working [[BZFS]] server is already in place and has been tested.
*This article assumes a working [[BZFS]] server is already in place and has been tested.
*This article assumes the server admin understands how to set up a BZFS groups file (see [[Sample Group File]])
*This article assumes the server admin understands how to set up a BZFS groups file (see [[Sample Group File]])
Line 12: Line 11:
*This article was written using Windows clients to access both the game server and the private [[List Server]].  
*This article was written using Windows clients to access both the game server and the private [[List Server]].  


=Difficulty=
==Difficulty==
While no particular step in this process is overly difficult, there are many steps, and many interactions between steps.  There are multiple points of failure during this process.
While no particular step in this process is overly difficult, there are many steps, and many interactions between steps.  There are multiple points of failure during this process.


=Directions=
==Directions==
 
*Install and test your [[BZFS]] server.  Make sure clients can connect and play the game.
*Install and test your [[BZFS]] server.  Make sure clients can connect and play the game.
*Install PHPBB3 on a web server, configure settings, test that users can REGISTER to the PHPBB3 board.
*Install PHPBB3 on a web server, configure settings, test that users can REGISTER to the PHPBB3 board.
Line 23: Line 21:
  serversettings.php.tmpl (rename to serversettings.php)
  serversettings.php.tmpl (rename to serversettings.php)
  banfunctions.php
  banfunctions.php
*Edit serversettings.php such that it can connect to your PHPBB3 MySQL database.  Note that this example assumes that the same database is used for MySQL tables used by '''bzfls.php''' and by the PHPBB3 installation:
*Edit '''serversettings.php''' such that it can connect to your PHPBB3 MySQL database.  Note that this example assumes that the same database used by '''bzfls.php''' is also used by the PHPBB3 installation:
  $dbhost  = "localhost";
  $dbhost  = "localhost";
  $dbname  = "phpbb3";
  $dbname  = "phpbb3";
Line 29: Line 27:
  $dbpass  = "********";
  $dbpass  = "********";
  $bbdbname = 'phpbb3';
  $bbdbname = 'phpbb3';
*There are many places in the '''bzfls.php''' file that are customized to the MySQL tables names used in the official BZFlag Global Registration Server.  These MySQL table names may conflict with YOUR table names.  To find them, search '''bzfls.php''' for "bzbb3_" (as seen in the code sample below).  Edit/Replace them as necessary to match the table prefix you used for YOUR phpbb3 MySQL tables:
      '''(before)'''   
      $result = sqlQuery ("
      SELECT g.group_id FROM bzbb3_user_group ug, bzbb3_groups g
      WHERE g.group_id=ug.group_id AND ug.user_pending=0 AND ug.user_id = $playerid");
      '''(after)'''
      $result = sqlQuery ("
      SELECT g.group_id FROM phpbb_user_group ug, phpbb_groups g
      WHERE g.group_id=ug.group_id AND ug.user_pending=0 AND ug.user_id = $playerid");
*For ease of setup, '''bzfls.php''' was edited to house files in the "main" PHPBB3 folder (ex: /usr/share/phpbb3/www/).  The following lines were changed to accomplish this (linux example):
*For ease of setup, '''bzfls.php''' was edited to house files in the "main" PHPBB3 folder (ex: /usr/share/phpbb3/www/).  The following lines were changed to accomplish this (linux example):
  $phpbb_root_path = '/usr/share/phpbb3/www/';
  $phpbb_root_path = '/usr/share/phpbb3/www/';
Line 41: Line 54:
  `user_tokenip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '',  
  `user_tokenip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '',  
*A number of tables must be added to the PHPBB3 database to accommodate player tracking  These tables can be found here:  http://bzflag.svn.sourceforge.net/viewvc/bzflag/trunk/db/support/database_structure.sql?revision=20248&content-type=text/plain.
*A number of tables must be added to the PHPBB3 database to accommodate player tracking  These tables can be found here:  http://bzflag.svn.sourceforge.net/viewvc/bzflag/trunk/db/support/database_structure.sql?revision=20248&content-type=text/plain.
*Edit the [[BZFS]] config file '''-publiclist''' option for the [[BZFS]] server to include a link to '''bzfls.php'''.  See the [[Sample conf]] for more info.  For Example:
*Edit the [[BZFS]] config file '''##List Server Connection##''' section to include something like the following.  See the [[Sample conf]] for more info.  In particular, it is important that '''-publicaddr''' and '''-publiclist''' are ON and set.  The BZFS server isn't "public" in the traditional sense but it is "public" according to our new "private" LAN list server, so the public settings must be ON, and the private '''-q''' setting must be OFF.
-public "My LAN BZFlag Server"
-publicaddr 10.14.101.15:5154
-p 5154
#-q
  -publiclist <nowiki>http://10.14.101.15/phpbb/bzfls.php</nowiki>
  -publiclist <nowiki>http://10.14.101.15/phpbb/bzfls.php</nowiki>
*Edit the [[BZFS]] config file and create any text files necessary to use the '''-userdb''' and '''-groupdb''' options.  See the [[Sample conf]] and [[Sample Group File]] for more info:
*Edit the [[BZFS]] config file and create any text files necessary to use the '''-groupdb''' option.  See the [[Sample conf]] and [[Sample Group File]] for more info:
#userdb stores user to group mappings.
-userdb /path/to/users.txt
  #groupdb stores group to permission mappings.
  #groupdb stores group to permission mappings.
  -groupdb /path/to/groups.txt
  -groupdb /path/to/groups.txt
Line 53: Line 68:
  C:\BZFlag\bzflag.exe -list <nowiki>http://10.14.101.15/phpbb/bzfls.php</nowiki> -configdir c:\bzflag\config\
  C:\BZFlag\bzflag.exe -list <nowiki>http://10.14.101.15/phpbb/bzfls.php</nowiki> -configdir c:\bzflag\config\


=Testing=
==Testing==
    
    
*Restart the [[BZFS]] server.
*Restart the [[BZFS]] server.
Line 67: Line 82:
*A successful GETTOKEN with the private [[List Server]] should display something like:
*A successful GETTOKEN with the private [[List Server]] should display something like:
  TOKEN: 0123456789
  TOKEN: 0123456789
*Once you have a valid token, enter into '''bzfls.php''' for a CHECKTOKENS test:
*Once you have a valid token, visit '''bzfls.php''' again in your web browser for a CHECKTOKENS test:
  CHECKTOKENS - verify player token from game server
  action: CHECKTOKENS - verify player token from game server
checktokens box on the form:
in the checktokens textarea enter the username and token info:
  USER=0123456789
  USER=0123456789
and get back:
and get back:
Line 79: Line 94:
and get back:
and get back:
  server.ip.address:5154 BZFS0026 007b0003000100000000000000003c0000000c000c000c000c020c 000.000.000.000 Server ID String
  server.ip.address:5154 BZFS0026 007b0003000100000000000000003c0000000c000c000c000c020c 000.000.000.000 Server ID String
*If all previous tests are successful, start your BZFS server and attempt to have registered PHPBB3 client players authenticate!!
*If all previous tests are successful, start your BZFS server and attempt to have registered PHPBB3 clients authenticate!!


=Acknowledgments=
==Acknowledgments==
*This guide would not have been possible without the help and guidance of BZFLAG player/admin "Blast".
*This guide would not have been possible without the help and guidance of BZFLAG player/admin "Blast".
*This guide is based on a message board discussion found http://my.bzflag.org/bb/viewtopic.php?f=30&t=16653
*This guide is based on a message board discussion found http://my.bzflag.org/bb/viewtopic.php?f=30&t=16653

Latest revision as of 17:30, 24 October 2011

This article discusses how to create a PRIVATE List Server and have players authenticate via this server. This is generally not necessary, since BZFlag clients perform Global Registration via the official bzflag.org List Server. However, if a BZFS server is created within a private LAN network, it may be desirable/necessary to authenticate players locally.

Assumptions

  • This article assumes a working BZFS server is already in place and has been tested.
  • This article assumes the server admin understands how to set up a BZFS groups file (see Sample Group File)
  • This article assumes the server admin has access to web hosting with MySQL and PHP.
  • This article assumes the server admin understands how to download and install PHPBB3.
  • This article assumes the private List Server will use the same database as PHPBB3.
  • This article assumes the server admin understands how to perform basic editing of PHP code.
  • This article was written using Linux for the BZFS server.
  • This article was written using Windows clients to access both the game server and the private List Server.

Difficulty

While no particular step in this process is overly difficult, there are many steps, and many interactions between steps. There are multiple points of failure during this process.

Directions

  • Install and test your BZFS server. Make sure clients can connect and play the game.
  • Install PHPBB3 on a web server, configure settings, test that users can REGISTER to the PHPBB3 board.
  • In the "main" PHPBB3 folder, (ex: /usr/share/phpbb3/www/), place the following THREE files found in the SVN DB Repository (https://bzflag.svn.sourceforge.net/svnroot/bzflag/trunk/db/):
bzfls.php
serversettings.php.tmpl (rename to serversettings.php)
banfunctions.php
  • Edit serversettings.php such that it can connect to your PHPBB3 MySQL database. Note that this example assumes that the same database used by bzfls.php is also used by the PHPBB3 installation:
$dbhost  = "localhost";
$dbname  = "phpbb3";
$dbuname = "phpbb3";
$dbpass  = "********";
$bbdbname = 'phpbb3';


  • There are many places in the bzfls.php file that are customized to the MySQL tables names used in the official BZFlag Global Registration Server. These MySQL table names may conflict with YOUR table names. To find them, search bzfls.php for "bzbb3_" (as seen in the code sample below). Edit/Replace them as necessary to match the table prefix you used for YOUR phpbb3 MySQL tables:
     (before)    
     $result = sqlQuery ("
     SELECT g.group_id FROM bzbb3_user_group ug, bzbb3_groups g
     WHERE g.group_id=ug.group_id AND ug.user_pending=0 AND ug.user_id = $playerid");
     (after)
     $result = sqlQuery ("
     SELECT g.group_id FROM phpbb_user_group ug, phpbb_groups g
     WHERE g.group_id=ug.group_id AND ug.user_pending=0 AND ug.user_id = $playerid");


  • For ease of setup, bzfls.php was edited to house files in the "main" PHPBB3 folder (ex: /usr/share/phpbb3/www/). The following lines were changed to accomplish this (linux example):
$phpbb_root_path = '/usr/share/phpbb3/www/';
include($phpbb_root_path.'includes/functions.'.$phpEx);
include($phpbb_root_path.'includes/utf/utf_tools.'.$phpEx);
include($phpbb_root_path.'includes/utf/utf_normalizer.'.$phpEx);
include($phpbb_root_path.'serversettings.'.$phpEx);
include($phpbb_root_path.'banfunctions.'.$phpEx);
  • The PHPBB3 phpbb_user MySQL table must have additional fields created to track the BZFLAG players. The fields are user_token, user_tokendate, and user_tokenip:
`user_token` int(10) unsigned NOT NULL DEFAULT '0',
`user_tokendate` int(10) unsigned NOT NULL DEFAULT '0',
`user_tokenip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT , 
-public "My LAN BZFlag Server"
-publicaddr 10.14.101.15:5154
-p 5154
#-q
-publiclist http://10.14.101.15/phpbb/bzfls.php
#groupdb stores group to permission mappings.
-groupdb /path/to/groups.txt
  • Edit the config.cfg file on the BZFlag game client(s) to include the Private List Server address or edit the command line that starts the BZFlag game client(s). In config.cfg:
set list http://10.14.101.15/phpbb/bzfls.php

or for the client command line (Windows example):

C:\BZFlag\bzflag.exe -list http://10.14.101.15/phpbb/bzfls.php -configdir c:\bzflag\config\

Testing

  • Restart the BZFS server.
  • Register one or more test users on the PHPBB3 board you created.
  • Visit the development interface for your private bzfls.php in a web browser. This web page should appear without error from within the PHPBB3 "main" folder. For example:
http://10.14.101.15/phpbb/bzfls.php
  • Compare data from your private List Server with that obtained by visiting the official List Server development interface found at:
http://stats.bzflag.org/bzfls.php
  • Attempt to authenticate with the private List Server by entering information for a PHPBB3 user:
action: GETTOKEN - get a player token
callsign: username
password: password
  • A successful GETTOKEN with the private List Server should display something like:
TOKEN: 0123456789
  • Once you have a valid token, visit bzfls.php again in your web browser for a CHECKTOKENS test:
action: CHECKTOKENS - verify player token from game server

in the checktokens textarea enter the username and token info:

USER=0123456789

and get back:

MSG: checktoken callsign=USER, ip=, token=0123456789  group=Group0 group=Group1
TOKGOOD: USER
BZID: 12345 USER
  • Attempt to see if your server is listed with the private List Server by selecting:
LIST - list servers

and get back:

server.ip.address:5154 BZFS0026 007b0003000100000000000000003c0000000c000c000c000c020c 000.000.000.000 Server ID String
  • If all previous tests are successful, start your BZFS server and attempt to have registered PHPBB3 clients authenticate!!

Acknowledgments