Ceci est une ancienne révision du document !
Table des matières
Auth with HopMod-v4
Because Authserver isn't included anymore in HopMod-v4, you'll need to clone the trunk repository:
svn checkout http://hopmod.googlecode.com/svn/trunk/ hopmod-trunk cd hopmod-trunk
Dependencies
With MySQL (recommended)
If you want to use a MySQL Database, you'll need :
- a working MySQL server, with a dedicated database and user for the authserver.
- the MySQL-Client headers (mysql.h), commonly
libmysqlclient-dev
package.
With SQLite3
All requiered dependencies are shipped with HopMod
With a text database
No dependencies requiered
Compile and Install authserver's binary
Compiling Authserver
chmod +x compile.sh ./compile.sh
With MySQL
cd release_build make luasql_mysql cp src/luasql/libluasql_mysql.so ../lib
Configuration
Authserver
With SQLite3
Edit the conf/authserver.conf file, and remove the # at the beginning of this line:
#use_sqlite_database "./db"
Add a # at the beginning of this one:
use_text_database "./log/auths.txt"
With MySQL
Edit the conf/authserver.conf file, and remove the # at the beginning of this line:
#use_mysql_database "hostname" "port" "database" "username" "password" "install_db"
Add a # at the beginning of this one:
use_text_database "./log/auths.txt"
HopMod
All localhost:login
and localhost:admin
should be replaced by your own domain
Auth.lua
Add an auth.lua
file in the conf/ directory of your HopMod installation, with the following :
- auth.lua
auth.directory.server{ id = "localhost", hostname = "localhost", port = 28787 } auth.directory.domain{ id = "localhost:login", server = "localhost" } auth.directory.domain{ id = "localhost:admin", server = "localhost" }
Server.conf
Add the following in your server.conf, replacing content of domains variables by what you set above:
- server.conf
############################################################################### # Authkey configuration for Name protection & Admin ############################################################################### admin_domains "localhost:admin" # Domain for admin invadmin_domains "localhost:admin" # Same auto_invadmin_domains "localhost:admin" # Same, if you want to be auto-invadmin at connection name_reservation_domain "localhost:login" # Domain for name protect stats_use_auth 1 # Use auth with stats stats_auth_domain "localhost:login" # Domain for auth stats_overwrite_name_with_authname 1 # Replace current name with authkey name in stats module "auth/name" # Module for name protect module "auth/invadmin" # Module for auto-invadmin
Using authserver
Run it
To launch the authserver, just do:
./bin/authserver start
In the hopmod-trunk directory
Adding domains
./bin/authserver manage domain add "localhost:login" case_insensitive
./bin/authserver manage domain add "localhost:admin" case_insensitive
Adding users
Before adding users, you have to add domains, described before.
To add an user for name protection, firstly generate a pair of keys:
./bin/utils/keygen
Then copy the output. The first line is the private key, the one that you have to give to the user.
The user add something like this:
authkey "the_user" "private_key" "localhost:login"
in his auth.cfg
The second line is the public_key, you have to add it in the database:
./bin/authserver manage user add "the_user" "localhost:login" "public_key"
Now same for admin, but replace the domain by your admin domain:
The admin add this in his auth.cfg
authkey "the_admin" "private_key" "localhost:admin"
And in the server:
./bin/authserver manage user add "the_user" "localhost:admin" "public_key"
Remember, an authkey is unique, so don't loose it, and create one for each user.
Restart the authserver
After adding an authkey, it's safe to restart the authserver:
./bin/authserver stop
./bin/authserver start
In-Game
Now, all admin, (added in the previous section) should be set automatically to invadmin.
And all users must have their authkey for the server doesn't change their name.
And all stats are recorded into single name, even changing it or IP, if you keep the authkey.