HOWTO: wesnothd + user_handler=forum

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
psymin
Posts: 3
Joined: November 10th, 2009, 3:57 pm

HOWTO: wesnothd + user_handler=forum

Post by psymin »

I'm posting this here for folks who might be interested in attempting to set up wesnothd (on linux) with forum_user_handler without having to install PHPBB.

When building the project, it looks like you might need to use scons with "forum_user_handler=true"

Code: Select all

scons forum_user_handler=true build=release -j 2
Spoiler:
Below is a copy of wethnothd.cfg

Code: Select all

# This is a wesnothd.cfg configuration file for the wesnoth daemon

passwd=wesnoth
versions_accepted="*"
disallow_names=blah,foobar
user_handler=forum

[user_handler]
        db_name="wesnoth"
        db_host="localhost"
        db_user="wesnoth"
        db_password="wesnoth"
        db_users_table=users
        db_extra_table=extra
        db_banlist_table=ban
[/user_handler]

motd="This is a message of the day"
fifo_path=/path/to/fifo_file
replay_save_path=/path/to/replay
room_save_file=/path/to/room_save
save_replays=true

# below are some other variables I haven't set yet

#allow_remote_shutdown
#ban_save_file
#compress_stored_rooms
#connections_allowed
#max_messages
#messages_time_period
#new_room_policy

Below is a mysqldump of a functional db for wesnothd.

Code: Select all

-- MySQL dump 10.16  Distrib 10.1.40-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: wesnoth
-- ------------------------------------------------------
-- Server version       10.1.40-MariaDB-0ubuntu0.18.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `ban`
--

DROP TABLE IF EXISTS `ban`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ban` (
  `ban_userid` varchar(100) NOT NULL,
  `ban_end` int(10) unsigned NOT NULL DEFAULT '0',
  `ban_ip` varchar(100) DEFAULT NULL,
  `ban_email` varchar(100) DEFAULT NULL,
  `ban_exclude` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`ban_userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ban`
--

LOCK TABLES `ban` WRITE;
/*!40000 ALTER TABLE `ban` DISABLE KEYS */;
/*!40000 ALTER TABLE `ban` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `extra`
--

DROP TABLE IF EXISTS `extra`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `extra` (
  `username` varchar(100) NOT NULL,
  `user_lastvisit` int(10) unsigned NOT NULL DEFAULT '0',
  `user_is_moderator` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `extra`
--

LOCK TABLES `extra` WRITE;
/*!40000 ALTER TABLE `extra` DISABLE KEYS */;
INSERT INTO `extra` VALUES ('cody',1563481817,1),('psymin',1563481413,1);
/*!40000 ALTER TABLE `extra` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
  `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_type` tinyint(2) NOT NULL DEFAULT '0',
  `username` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
  `user_password` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
  `user_email` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
  PRIMARY KEY (`user_id`),
  KEY `user_type` (`user_type`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (48,0,'psymin','$2y$10$c5QidVUajbHwlL43m/q96O4yw7Iy3XtBw6gDfOKNbyPIRahvyNbk6','email1@example.com'),(49,0,'cody','$2b$10$HAU9bliK54.OjUlqmhh0wOo5gS9qc5maiJF3nMLL8W/.OvC3DGe7O','email2@example.com');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2019-07-18 20:31:48

It has a "psymin" user, and a "cody" user.
The "user" table was created by installing PHPBB3.2 so it has a lot of excess data that should be able to be removed/trimmed (edit: I've trimmed it now).
It appears to use bcrypt for the user passwords, like "$2y$10$5LnW9IJTzuN36F6CrLMvOe8kvrhr0oPxezJCDCH90OpNR9cFkGyau" for cody's password of "password". (edit: tested updating password with a bcrypt hash and it works)

I'm certain that I've made a few mistakes in the db, like with charset, but it does appear to function.
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: HOWTO: wesnothd + user_handler=forum

Post by Tad_Carlucci »

Also, there are web-based tools to encode the password. Its been a couple years so I forget which I used when working on the new password hashing. I just copy-and-pasted the results into the INSERT and recreated the entire database. It would not take much, though, to do a little account creator/password changer page on a personal web server. In fact, you could probably automate the entire process and just publish your PHP script (on the Wiki) to ease the entire process for future users.
I forked real life and now I'm getting merge conflicts.
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: HOWTO: wesnothd + user_handler=forum

Post by Pentarctagon »

There is also this PR, that will hopefully be merged at some point, which would affect this as well.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: HOWTO: wesnothd + user_handler=forum

Post by Pentarctagon »

For 1.15+, there's also now table_definitions.sql, which has all the table structures needed.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Post Reply