• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Custom login server

Newbie Spellweaver
Joined
May 21, 2007
Messages
81
Reaction score
1
Custom login server
Thanks to Kekers for all his help with various things (too many to count :p).

Screenshots
IceMan1300 - Custom login server - RaGEZONE Forums


IceMan1300 - Custom login server - RaGEZONE Forums

(older version, it used direct SQL Server connections, but for simplicity it's now using ODBC)

Description
This Knight Online login server supports the following things (that are not found in the original login server):
- Supports Windows Server 2008, and presumably Windows Vista! (However, the latter will need to be confirmed. :)... I think the reason for this is to do with stored procedures.. possibly how it calls them; otherwise, there's no real apparent difference),
- News support (this is the news that shows up in your client right after logging in!),
- Dynamic server-list (including the currently logged in player counts [the bar] which I may provide a guide on how to make the count accurate for your server),
- Real-time updates to news & server-list,
- IP ban support,
- Automated IP bans for different types of attack recognition,
- Ability to change the port (via configuration),
- Log levels to define what gets outputted (NOTE: The higher the log level, the more output will be generated, and the slower the login server will operate. This is covered in the configuration file.),
- Supports the use of MD5 hashes INCLUDING the use of hash seeds! (var/char column - var/binary isn't supported. For that you will need to use a "custom" T-SQL function),
- Now supports the in-built use of SHA1 hashes *NEW!*,
- Now supports the use of custom T-SQL functions for password hashes! *NEW!*,
- Now has the ability to easily change KO's packet header/footer - you should not have to use it at all, but I did have one person who asked for it :p *NEW!*,
- Erm.. it doesn't use the ACCOUNT_LOGIN procedure, or talks to the database at all upon user request (it instead, caches data for later use) (* this isn't exactly true in 1.10, it will if you use a custom T-SQL function for password hashing... otherwise, it won't at all!),
- Again, erm.. doesn't use a GUI! Hooray for console applications!


Download links
Code:
VERSION 1.10 (LATEST)
http://files.2-stars.net/2009/04/login-server-1.10.zip

VERSION 1.00 (OLD)
http://files.2-stars.net/2009/03/login-server.zip

Changelog
1.10
- Changed the hash configuration settings around, to be slightly more flexible.
- Added an in-built SHA1 hasher.
- Added support for custom T-SQL hash functions.
- Noticed a minor potential issue with MD5 hashes, which I resolved. Nobody's reported any problems yet, so not a moment too soon! :p
- Added the option to NOT use in-game news. Hooray? :p
- Added the option to change the packet header & footer/tail. This is an advanced option that you shouldn't touch unless you're absolutely and positively sure what the packet header & footer/tail is.. and you've changed them manually in the client, and Ebenezer. Otherwise, STAY CLEAR OF IT OR YOU WILL HAVE PROBLEMS. :p
- Added a mutex to the database class, to avoid any crash-causing conflicts which could arise from use of the 'custom T-SQL hash function' addition.
- Updated the configuration file to include the new & updated options. Also better explained the FTP section.

1.00
Main application release, supports:
- In-game news,
- MD5 password hashing (var/char column - var/binary isn't supported),
- IP bans,
- Log levels (to restrict output and speed up execution),
- Listen address & port configuration.

Readme
I have tried to keep this as simple to use as possible, however I will attempt to go over the few simple steps you need to go through, so that you understand.

STEP 1: The download!
You will need to download the login server from or any of the mirrors above.
Save or run? Make sure it is saved, in case you want to revert your configuration file (shouldn't need to though).

STEP 2: Extract ALL of the files to a folder
As the step's titled, you will need to extract all of the files in "login-server.zip" to a folder. It does not matter where; you can even extract it on your desktop.

If you are using Windows ME/XP/2003 or above, you will find Windows supports ZIP extraction. Merely "right-click" on the file and hit "Extract All ...". You will be prompted with a dialog. Just click "Next".
Here you can choose to either type in the folder (directory) name, "Browse" to it, or use the current directory (usually not so much a good idea, as this is stored temporarily and removed when Windows is done with the file). Once you've done that, hit "Next" again. Tick "Show extracted files", and you'll be presented with the folder... and step 3!

If you are, however, using an earlier version of Windows, you can download "WinZIP" from , or the more flexible "WinRAR" from .

STEP 3: Configure the login server
Right-click on "login-server.conf", and hit "Open With", then select "Choose Program...".
You'll see "Notepad" in the list. Select it, tick "Always use the selected program to open this kind of file", and then hit "Open".

The first thing you should is a notice reminding you that sections surrounded by "#"s are commented sections, and are thus not part of the configuration - merely there as a guide to help you. Read, and heed this notice!

IceMan1300 - Custom login server - RaGEZONE Forums


The next thing you should see, is the "LOGIN SERVER CONFIGURATION" block.
Read through this section for an understanding of what each of the settings are for, and what they should be set to. Following this commented section, you will see the actual configuration:
Code:
<Login host = "0.0.0.0"
		  port = "15100"
		  LogLevel = "2"
		  Aujard = "127.0.0.1"
		  version = "1298">

I will go through the first section with you, as a general guide to how things work. However, everything should be well explained in the above commented section.

Now... as explained:
Host should be set to either a specific IP you want to have it listen on (ie: your external IP), or left as 0.0.0.0 to be "bound" to all interfaces. If you leave it as 0.0.0.0, you will be able to connect to your server with ANY IP address you can access your PC with, for example:
127.0.0.1 (loopback adapter)
192.168.0.2 (LAN IP / internal IP)
123.123.123.123 (WAN IP / external IP)

If you are unsure, just leave it as the default "0.0.0.0". This will save any ensuing connectivity drama.

Port should be the port the server listens on; the port the client needs to connect to. Make sure that this is the same in your client (you can check with my Client/Ebenezer Editor). The default is 15**** the usual Knight Online login server port. :)

The log level is entirely up to you. The smaller it is, the faster the login server will operate, however you will be less informed on what's happening.. so if there is a problem, you can use a higher log level to attempt to find the problem. A log level of "3" should suffice in these cases, however there is also an undocumented log level - 255. Be aware that this will be extremely laggy for servers with a lot of accounts; to whom I suggest a log level of "3" for problems.

Aujard is the IP Aujard will be connecting to the server from. Most people shouldn't have to worry about messing with this; it should only apply if you run Ebenezer & Aujard on another server to your login server.

NOTE: This is only used if you have the login server set as the "billing server" in Aujard. I had a few problems with Aujard; matching up the IP was one of the few precautions. You may encounter problems with Aujard, as I did not completely work through packets it sends.. if it does, I suggest you let me know, so I can take a further look at this.

NOTE 2: Remember that Aujard's IP depend on the IP you set in Aujard.ini, to connect to the login server. If it connects to an external IP address, you will need to use the external IP address of the PC Aujard is running on. If it is using 127.0.0.1, you will use 127.0.0.1. If it is using an "internal" IP address, you will need to use the internal IP address of the PC Aujard is running on (ie: 192.168.0.3).

Version is the current client version. You should not have to set this - it will update the version from the VERSION table. I forgot to remove it.

Now you should keep reading the configuration file, so that you can find out what the rest of the settings (there are not many more) must be set to.

STEP 4: Create some news!
At this time, the login server requires news. If you do not want news, do remember you can always set it to a welcome message or something. I will add in the option to disable news later, if anybody really insists. ;)

Now... we decided that it was easier to set the news with a GUI, rather than in a configuration file or database. So, for this, Kekers wrote a nifty little C# application for creating it. This does require you have the .NET Framework 2.0, but most PCs should have that already. If you do not, and you receive an error when attempting to run it, you can download the .NET Framework 2.0 from: .

So, run "News Creator".

You will see a dialog similar to this:
IceMan1300 - Custom login server - RaGEZONE Forums


The news "page" can contain a maximum of three boxes. Each of these requires a title and content.
Once you are done writing up your news, hit "Create News File". A file named "news.kn" will be created in the current folder; which should be the folder that "login-server.exe" is in, otherwise it will not be able to find the news file!

STEP 5: Database setup
Once you have done the above, you can now load up "login-server.exe".
If there are any errors, read what they say, and what they suggest you need to do to correct them.

If there aren't, then we'll proceed!
Assuming your database user was setup like ~95% of all other KO database users, it should tell you that it created two tables for you - IP_BANS and SERVERS.

You will then be prompted to add a server; first the server name, and then the server hostname/domain/DynDNS/No-IP or IP address. These are what your players will see and connect to using the server-list; so make sure they can connect to the IP or hostname/domain/DynDNS/No-IP you use. :)

That said, the server should be running smoothly, and players should be able to connect. If they cannot, please check that you have port forwarded the port you specified in the configuration file (default: 15100), that no firewall is blocking connections to that port, and that they are connecting to the right IP address (you can change the servers manually in the SERVERS table; these will update every 10 minutes, however you can also restart the server for it to be reloaded instantly).

You are done!!

... if, however, it says it couldn't create the tables , this means that your database user does not have access to CREATE tables. Be proud!
You are one of the few who attempt to take care with user permissions. You will need to create the tables manually.. this is why the "sql" folder exists. Both queries are in there. Either load up "table_ip_bans.sql" directly (it should load it up in your "query analyzer"/"query window"), or right-click, "Open with...", "Notepad", copy the contents of the file into your "query analyzer" or "query window" (depending on your SQL Server version, you should know what this is. :)), and execute it. Do the same for "table_servers.sql".

Now you are done.

Please be aware that although this has undergone a fair bit of testing, there may be some bugs left in it still. If there are, and you're sure it's not your fault (configuration, not reading and trying the login server's suggestions), please let me know in this thread so that we can get it resolved.

Thanks, and have fun with it. :)
 
Last edited:
Newbie Spellweaver
Joined
May 21, 2007
Messages
81
Reaction score
1
Updated the login server.
Edited the main post, however here is the download link and changelog.

Download
Code:
VERSION 1.10 (LATEST)
http://files.2-stars.net/2009/04/login-server-1.10.zip

VERSION 1.00 (OLD)
http://files.2-stars.net/2009/03/login-server.zip

Changelog
1.10
- Changed the hash configuration settings around, to be slightly more flexible.
- Added an in-built SHA1 hasher.
- Added support for custom T-SQL hash functions.
- Noticed a minor potential issue with MD5 hashes, which I resolved. Nobody's reported any problems yet, so not a moment too soon! :p
- Added the option to NOT use in-game news. Hooray? :p
- Added the option to change the packet header & footer/tail. This is an advanced option that you shouldn't touch unless you're absolutely and positively sure what the packet header & footer/tail is.. and you've changed them manually in the client, and Ebenezer. Otherwise, STAY CLEAR OF IT OR YOU WILL HAVE PROBLEMS. :p
- Added a mutex to the database class, to avoid any crash-causing conflicts which could arise from use of the 'custom T-SQL hash function' addition.
- Updated the configuration file to include the new & updated options. Also better explained the FTP section.

1.00
Main application release, supports:
- In-game news,
- MD5 password hashing (var/char column - var/binary isn't supported),
- IP bans,
- Log levels (to restrict output and speed up execution),
- Listen address & port configuration.
 
Back
Top