Private Server Client Authentication
Private Server Client Authentication
Hello,
I have a private server set up, and it is working well. We play at lunch at school and have between 15 and 25 kids show up to play BZ Flag once a week. The issue I am having is, I'd like to be able to use the CALLSIGN and PASSWORD input for login **WITHOUT** using the global server. We are playing this game on a LAN, and we have the public list server (and forum) blocked for various reasons.
Can anybody suggest a simple way I could set this up?
I understand MySQL, I have PHPmyadmin available and know how to use it, I can edit PHP code if necessary, and can install PHPbb3 if necessary.
A deeper question is, how exactly does the client authenticate? Is there a command line switch I could enable to point the client to a database of my choice?
Thanks,
Dan
I have a private server set up, and it is working well. We play at lunch at school and have between 15 and 25 kids show up to play BZ Flag once a week. The issue I am having is, I'd like to be able to use the CALLSIGN and PASSWORD input for login **WITHOUT** using the global server. We are playing this game on a LAN, and we have the public list server (and forum) blocked for various reasons.
Can anybody suggest a simple way I could set this up?
I understand MySQL, I have PHPmyadmin available and know how to use it, I can edit PHP code if necessary, and can install PHPbb3 if necessary.
A deeper question is, how exactly does the client authenticate? Is there a command line switch I could enable to point the client to a database of my choice?
Thanks,
Dan
- Cobra_Fast
- Dev Monkey
- Posts: 322
- Joined: Sat Oct 07, 2006 11:51 am
- Location: Germany
- Contact:
Re: Private Server Client Authentication
You could set up a custom UserDB, PassDB and GroupDB for your server. (http://my.bzflag.org/w/BZFS_Command_Line_Options -> -userdb -passdb -groupdb) which will allow people to /register and /identify.
I don't know if this makes use of the password field on the "Join Game" screen.
I don't know if this makes use of the password field on the "Join Game" screen.
Re: Private Server Client Authentication
Using the above this will not make use of the password field on the "Join Game" screenCobra_Fast wrote: -userdb -passdb -groupdb) which will allow people to /register and /identify.
I don't know if this makes use of the password field on the "Join Game" screen.
"See a need fill a need"-(Bigweld from the movie "Robots")
Re: Private Server Client Authentication
Use -public but then just add -advertise none.
This will still use the list server, but people won't be able to see it.
This will still use the list server, but people won't be able to see it.
Re: Private Server Client Authentication
Since they are at a school, that will not work. I'm fairly sure the admin of the network won't poke a hole in the firewall for that.mrapple wrote:Use -public but then just add -advertise none.
This will still use the list server, but people won't be able to see it.
In any case, you could run a copy of the list server if you so choose. The source code for the list server is in our SVN repository under trunk/db/, and there was also the start of a rewrite under trunk/web/bzfls2/. I'm doubting that either of them are documented about how to set them up (and I can't quite remember what all worked/didn't work on bzfls2). I'd probably say stick to the one in db since that one is actually known to work. Of that directory, you only need a handful of files. The bzfls.php file is the actual list server. It pulls in a config file, a file for handling bans, and a handful of (large) files from phpBB3.
So basically, you need to install phpBB, and set up the config and paths for the list server. We alias db/ to bzfls.php as well, which is optional (you can point your client directly to the list)
You also need to add a few columns to the phpBB3 user's table:
Code: Select all
`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 '',
For instance, if you have the list installed at http://192.168.20.2/bzfls.php, just set that as the list. Then register a user on your forum and try to auth.
Re: Private Server Client Authentication
My school doesn't block bzflag in general, guess I'm just lucky
Re: Private Server Client Authentication
Thanks. This makes a lot of sense and really helps!blast wrote: In any case, you could run a copy of the list server if you so choose. The source code for the list server is in our SVN repository under trunk/db/...
Re: Private Server Client Authentication
Your school may not block you from playing, but it should certainly block you from hosting a public server.mrapple wrote:My school doesn't block bzflag in general, guess I'm just lucky
- Cobra_Fast
- Dev Monkey
- Posts: 322
- Joined: Sat Oct 07, 2006 11:51 am
- Location: Germany
- Contact:
Re: Private Server Client Authentication
The school's computer room I'm in charge of only let's through port 80 and 8080 so you're able to see the list but won't be able to join any games.
Re: Private Server Client Authentication
OK, getting back to the ORIGINAL discussion:
Here's what I did on Ubuntu:
(1) Installed PHPBB3 and got it working via Synaptic Package Manager.
(2) Downloaded and put into the PHPBB3 folder (/usr/share/phpbb3/www/) the following files:
(3) Entered values for serversettings.php (password replaced with ******:
(4) Did a bit of tweaking to the bzfls.php since my locations are different than the default:
(5) added in missing fields to phpbb_user table:
(6) Recieved errors in bzfls.php regarding a missing table for SERVERBANS, so I made educated guesses about that table and created it, tweaked until errors went away:
(7) Edited mybzconfig.txt file to include the following:
(8) Edited the command line on my BZflag Windows XP client to include the -list value:
Did a few trial runs, and while there were no errors, there were also no sucessful logins. The user table showed no updates to the new fields. There were no logins to the game based on the board USERNAME and PASSWORD.
My guesses regarding errors would be:
(1) There are TWO tables listed under settings, DBNAME and BBDBNAME. I'm not sure what to put for DBNAME, assuming that BBDBNAME would be phpbb3 (the database I created on my MySQL server).
(2) I need more files from the DB trunk folder, I only used three (bzfls, serversettings, banfunctions) that were included in bzfls.php.
(3) the SERVERBANS table is messed up and is somehow causing problems.
(4) I missed something else.
Suggestions are welcome
Dan
Here's what I did on Ubuntu:
(1) Installed PHPBB3 and got it working via Synaptic Package Manager.
(2) Downloaded and put into the PHPBB3 folder (/usr/share/phpbb3/www/) the following files:
Code: Select all
bzfls.php
serversettings.php
banfunctions.php
Code: Select all
<?php
$dbhost = "localhost";
$dbname = "phpbb3";
$dbuname = "phpbb3";
$dbpass = "********";
$bbdbname = 'phpbb3';
?>
Code: Select all
$phpbb_root_path = '/usr/share/phpbb3/www/';
$phpEx = 'php';
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);
Code: Select all
`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 '',
Code: Select all
CREATE TABLE IF NOT EXISTS `phpbb_serverbans` (
`type` varchar(40) NOT NULL DEFAULT '',
`value` int(10) NOT NULL,
`owner` varchar(40) NOT NULL DEFAULT '',
`reason` varchar(40) NOT NULL DEFAULT '',
`active` int(10) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Code: Select all
-publiclist http://10.14.101.15/phpbb/bzfls.php
Code: Select all
C:\BZFlag\bzflag.exe -mute -window -list http://10.14.101.15/phpbb/bzfls.php -configdir c:\bzflag\config\
My guesses regarding errors would be:
(1) There are TWO tables listed under settings, DBNAME and BBDBNAME. I'm not sure what to put for DBNAME, assuming that BBDBNAME would be phpbb3 (the database I created on my MySQL server).
(2) I need more files from the DB trunk folder, I only used three (bzfls, serversettings, banfunctions) that were included in bzfls.php.
(3) the SERVERBANS table is messed up and is somehow causing problems.
(4) I missed something else.
Suggestions are welcome
Dan
Re: Private Server Client Authentication
There should be a log file for bzfls.php defined somewhere in there. You may have to enable it.
Also, you can access the bzfls.php page directly in your browser to verify it is working and then try to do an auth there. Set it to do a LIST or GETTOKEN and fill in the username and password fields (at a minimum) and see if a token gets returned.
Also, you can access the bzfls.php page directly in your browser to verify it is working and then try to do an auth there. Set it to do a LIST or GETTOKEN and fill in the username and password fields (at a minimum) and see if a token gets returned.
Re: Private Server Client Authentication
Not sure how to "enable" the log file other than uncomment it. I already checked the PHP code and put the log file where it was suggested. So far the log file is blank.blast wrote:There should be a log file for bzfls.php defined somewhere in there. You may have to enable it.
Good call on the browser verify, thanks! I already get the HTML page to come up WITHOUT ERROR in my browser, but I didn't understand how to test it or if I'd actually get any results since it was a DEV interface. I just experimented with the "actual" bzfls.php found here and tested it on a real USER:blast wrote:Also, you can access the bzfls.php page directly in your browser to verify it is working and then try to do an auth there. Set it to do a LIST or GETTOKEN and fill in the username and password fields (at a minimum) and see if a token gets returned.
Code: Select all
http://my.bzflag.org/bzfls.php
Code: Select all
TOKEN: 0123456789
Code: Select all
checktokens:
USER=0123456789
Code: Select all
MSG: checktoken callsign=USER, ip=, token=0123456789 group=Group0 group=Group1
TOKGOOD: USER
BZID: 12345 USER
Dan
Re: Private Server Client Authentication
Update...
got bzfls.php to return a valid token, and did a checktoken and that worked. Also, the token ends up in the MySQL database for the user.
Still not sure that the CLIENT is getting/using the token, and the bzfls.php log (bzfls.log) is still blank.
got bzfls.php to return a valid token, and did a checktoken and that worked. Also, the token ends up in the MySQL database for the user.
Still not sure that the CLIENT is getting/using the token, and the bzfls.php log (bzfls.log) is still blank.
Re: Private Server Client Authentication
I think the token system is working, but I don't think clients are using the token to AUTH. The clients have a long pause... and then they just get dumped into the game... nothing on screen about password being correct, etc.
I still think it may have something to do with a missing table in the database. If I try to list the servers from bzfls.php, I don't get my server, instead I get:
Don't know if it's important to the process that my server is listed here. Perhaps it is not.
Dan
I still think it may have something to do with a missing table in the database. If I try to list the servers from bzfls.php, I don't get my server, instead I get:
Code: Select all
Could not drop old serversTable 'phpbb3.servers' doesn't exist
Dan
Re: Private Server Client Authentication
Guess I forgot to mention about this:
http://bzflag.svn.sourceforge.net/viewv ... text/plain
http://bzflag.svn.sourceforge.net/viewv ... text/plain
Re: Private Server Client Authentication
Uh.... yeablast wrote:Guess I forgot to mention about this:
http://bzflag.svn.sourceforge.net/viewv ... text/plain
Thanks, that makes a lot more sense...
I kept thinking there had to be at least one more MySQL table I was missing.
I will mess with this and see what happens.
Appreciate your time Blast.
Dan
Re: Private Server Client Authentication
Ok, I think I FINALLY have everything working. The only other thing I forgot about, and had to tweak, was in the config file to enable the Groups and Users files. I enabled the Passwords file also, but that isn't being used... which makes sense since the TOKEN is what the client needs, and the password is kept safe on the PHPBB board.
In particular, the Groups file was important, otherwise, ANYBODY could join the game, even if they didn't authenticate!!
Blast, thanks for your help... I couldn't have figured this out without you.
I'm going to wait a week, and make sure this works well under a heavy load of kids before I claim total victory.
Blast, would it be worth me doing a WIKI article on this?
Dan
In particular, the Groups file was important, otherwise, ANYBODY could join the game, even if they didn't authenticate!!
Blast, thanks for your help... I couldn't have figured this out without you.
I'm going to wait a week, and make sure this works well under a heavy load of kids before I claim total victory.
Blast, would it be worth me doing a WIKI article on this?
Dan
Re: Private Server Client Authentication
It would... please and thank you!
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
Re: Private Server Client Authentication
OK, my first ever BZFlag Wiki article:
http://my.bzflag.org/w/Private_List_Server
Constructive criticism and corrections welcome
I hope it helps somebody...
Dan
http://my.bzflag.org/w/Private_List_Server
Constructive criticism and corrections welcome
I hope it helps somebody...
Dan
Re: Private Server Client Authentication
The "userdb" isn't necessary unless you are using local groups. The way the current list server works is that you can create groups in phpBB and add users to those groups, and then assign rights to those groups using the "groupdb" file. Global groups are preferred since they are tied to a user account instead of to a username (people can change their name and lose/gain rights if a userdb is used to assign groups).
Re: Private Server Client Authentication
>>The "userdb" isn't necessary unless you are using local groups.
Makes sense. I'll remove -userdb from the wiki article then. I put it in because phpbb users were showing up in the userdb file locally. I assumed as a sort of local caching of users.
Makes sense. I'll remove -userdb from the wiki article then. I put it in because phpbb users were showing up in the userdb file locally. I assumed as a sort of local caching of users.
Re: Private Server Client Authentication
hmm, when i try and do my own Private server list the get tokens and the check tokens .etc work fine but when i do list servers it comes up blank, i changed my server setting, made sure there was no -q changed -publiclist to -publiclist http://maxhostpro.com/bb/bzfls.php, ive had a look at everything, any ideas why its not working?
"See a need fill a need"-(Bigweld from the movie "Robots")
Re: Private Server Client Authentication
I don't see a reason for you to be running a list, enrico123, so I'm not as apt to help you with it. More so considering you can't even capitalize your I's.
Re: Private Server Client Authentication
Did you make sure the client is also using the private list server? I'm assuming YES since you got tokens.enrico123 wrote:hmm, when i try and do my own Private server list the get tokens and the check tokens .etc work fine but when i do list servers it comes up blank, i changed my server setting, made sure there was no -q changed -publiclist to -publiclist http://maxhostpro.com/bb/bzfls.php, ive had a look at everything, any ideas why its not working?
EXAMPLE:
Or on the server site, did you do all of these settings:C:\BZFlag\bzflag.exe -list http:10.14.101.15/phpbb/bzfls.php -configdir c:\bzflag\config\
EXAMPLE:
including BOTH the -publiclist and -publicaddr settings as seen above?-public "My LAN BZFlag Server"
-publicaddr 10.14.101.15:5154
-p 5154
#-q
-publiclist http://10.14.101.15/phpbb/bzfls.php
Dan
Last edited by deliot on Tue Nov 09, 2010 7:14 pm, edited 1 time in total.