Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [SHARE] C4 HDAuth multiserver/floodprotected/bruteprotected (https://postpacific.mmorpg-game.online/showthread.php?t=8307)

humordwarf 17.08.2007 22:40

[SHARE] C4 HDAuth multiserver/floodprotected/bruteprotected
 
...from russia with love =)

http://humordwarf.info/HDAuth104.zip

HDAuth LoginServer 1.04

===== History / История ===

2007-08-17 v1.00
- Initial Release / Первая версия
2007-08-19 v1.01
- new parameter in .ini: ClientPort - Port number for clients (players) connections (emanuel's idea)
- fixed errors in net/mask functions (IPBans related) (thanks Kenjiro)
- changed logic in TempoBano for wrong passwords (see docs changes) (thanks hel)
- added info into docs about SQL queries (see below)
2007-08-19 v1.02
- global crash fix and "red messages" cleanup (thanks Aida)
- fixed server reconnect thing (thankgs Aida)
- added date and time before each message into text log files
- new optional parameter in .ini for [ServerXX]: LocIP - address that will be used for local network connections
this feature uses LocalNet.txt (format same as IPBan.txt) for local networks
when it tuned auth works like a "router" and sends to clients IP of GS depends on client location
for more details about this feature ask Aida @ PP
- now u can use hex format too for BlowFish keys (see .ini for details)
2007-08-20 v1.03
- fixed log files codepage, now used system's current ANSI code page
- added optional SQL query each minute (see bellow) for monitoring online players in DB e.g. for web-site stats (thanks hr)
- added boolean .ini parameters (switchers) for each log types, now u can turn on/off each type of message and for console output and for files (see .ini)
- added new type of log: *.online - about 60 times per hour there will be current online of server (can be used too for creating online stats, etc)
- removed accountmap's warnings flood
- few minor bugfixes
2007-08-21 v1.04
- *-authd.log file/console now "turnable on/off" too (thanks FidoW)


===== Features / Фичи =====
[eng]
- GUI (see below)
- compatible with that AuthD 40504
- same DB-log-files format as 40504
- TempoBano model (see below)
- IP bans by net/mask(see below)
- unlimited number of game servers
- for each GS it uses different MSSQL DB (see below)
[rus]
- ГУЙ (см. ниже)
- совместим с тем самым аутхом 40504
- системный БД-лог-файл в том же формате что и 40504
- ТемпоБано модель (см. ниже)
- баны подсетей (см. ниже)
- неограниченное число игровых серверов
- для каждого гейм-сервера используются разные базы данных (см. ниже)

===== SQL queries / СКУЛ запросы =====
[eng]
- MS-SQL use is minimized, only 3 queries is performed per user login/play/logout
1. when checking password/ban state:
"select password, uid, pay_stat, block_flag, block_flag2 from dbo.user_auth as auth inner join dbo.user_account as acc on auth.account = acc.account where auth.account='{0}'"
2. when GS says "player playing"
"UPDATE dbo.user_account SET last_login={0}, last_world={1}, last_ip='{2}' WHERE uid={3}"
3. and when GS says "player logout"
"UPDATE dbo.user_account SET last_logout={0}, last_world={1}, last_ip='{2}' WHERE uid={3}"
4. (optional) "EXEC UpdateOnline {0},{1}" - calls every minute and sends to SQL server_id with players_online
[rus]
- использование MS-SQL минимизировано, всего 3 запроса использовано на игрока при логине/игре/отключении
1. при проверке пароля/бана:
"select password, uid, pay_stat, block_flag, block_flag2 from dbo.user_auth as auth inner join dbo.user_account as acc on auth.account = acc.account where auth.account='{0}'"
2. при сообщении гейм-сервера "игрок играет"
"UPDATE dbo.user_account SET last_login={0}, last_world={1}, last_ip='{2}' WHERE uid={3}"
3. при сообщении гейм-сервера "игрок отключился"
"UPDATE dbo.user_account SET last_logout={0}, last_world={1}, last_ip='{2}' WHERE uid={3}"
4. (опционально) "EXEC UpdateOnline {0},{1}" - вызывается каждую минуту и посылает SQL серверу айди с онлайном

===== GUI / ГУЙ =====
[eng]
- IPBans editor / reloader for editing IP banned networks
- shows in real - time current server values
- Sockets/Max - number of used sockets/peak
- Players - number of players on all servers
- Servers - number of connected servers
- Uptime - no comments
- Allocated/Peak - allocated memory/peak
- GC - garbage collector current value
- Threads - number of threads in LoginServer
- Handlers - number of handles/descriptors, used in LoginServer

[rus]
- редактор/загружатор забаненных подсетей
- отображает в реальном времени текущие значения сервера
- Sockets/Max - количество подключенных сокетов/пик
- Players - количество игроков на всех серверах
- Servers - количество подключенных игровых серверов
- Uptime - догадайтесь, что
- Allocated/Peak - количество потребляемой сервером памяти/пик
- GC - текущее значение уборщика мусора
- Threads - количество нитей в сервере
- Handlers - количество дескрипторов, используемых сервером

===== Log-files / Лог-файлы =====
[eng]
- for each GS it make directory with server id
- in each directory server creates *.normal *.warning *.cheat *.error *.log files
- *.log files has same format as it was in 40504 (for easy parsing, if need)
[rus]
- для каждого игрового сервера создается папка с номером сервера
- в каждой папке сервер создает файлы *.normal *.warning *.cheat *.error *.log
- *.log файлы имеют тот же формат какой был в 40504 (для последующей обработки, если необходимо)

===== TempoBano / ТемпоБано =====
[eng]
- TempoBano means "ban for few seconds"
- blocks IP if there is flood from it (number of connections from IP per time interval too high)
- blocks Account at selected Server is there is 3 wrong passwords entered (e.g. 3 minutes user will not able to even try)
1.01+: now "hacker" not able to block any account, coz _bad_password_counter_ is different also for each IP
[rus]
- ТемпоБано значит "бан на несколько секунд"
- блокирует IP если с этого адреса идет флуд (количество подключений за промежуток времени превышает допустимый)
- блокирует аккаунт на выбранном сервере если было 3 неправильных ввода парол (например 3 минуты игрок даже не сможет попробовать)
1.01+: теперь "хацкер" не сможет блокировать аккаунты, т.к. _счечик_неправильных_паролÐ µй_ разный так же для разных IP

===== IPBans / Баны по IP =====
[eng]
- each row in list can be in format d.d.d.d/d or just d.d.d.d
- example1: 127.0.0.1 means network 127.0.0.1/32 - only one IP address
- example2: 1xx.xx8.1.0/24 means network 1xx.xx8.1.1 - 1xx.xx8.1.255
[rus]
- каждая строка в списке может быть в формате d.d.d.d/d или просто d.d.d.d
- example1: 127.0.0.1 значит подсеть 127.0.0.1/32 - т.е. один IP адрес
- example2: 1xx.xx8.1.0/24 значит подсеть 1xx.xx8.1.1 - 1xx.xx8.1.255

===== Protocol / Протокол =====
[eng]
- on packet level server is almost same as 40504, BUT it has different order of client-server packets:
1. server sends "hello"
2. client reply "user/pass"
3. server always sends "serverlist"
4. client reply "selectedserver"
5. here server checks user/pass from DB for selected server and do as always, or "wrong password" or "continue"
so, server uses different lin2db for each server (see .ini) and we can use one loginserver for few GS
in same time, if u use same DB-connection string for all servers, it will use same DB for few servers (as ncsoft)
[rus]
- на пакетном уровне сервер почти такой-же как и 40504, НО имеет некоторые различия в пакетах клиент-сервер:
1. сервер посылает "привет"
2. клиент отвечает "логин/пароль"
3. сервер всегда посылает "списоксерверов"
4. клиент отвечает "выбралсервер"
5. и только здесь сервер проверяет логин/пароль из базы выбранного сервера, и продолжает как обычно "неправильный пароль" или "продолжаем"
как мы видим, сервер использует разные базы lin2db для каждого сервера (см .ini) и мы может использовать один логин-сервер для нескольких гейм-серверов
в то же время, если указать одинаковые строки подключений для всех серверов, будет использована одна база для всех (как у нцсофт)

/HD 2007

humordwarf 17.08.2007 22:46

install note:
1. .net 2.0 required
2. old authd not need, old configs not need
3. create any folder
4. put files there
5. edit .ini
6. create SQL user and rights if need
7. run

madar 17.08.2007 22:52

nice mens, thanks for share, btw it "accepts the cxxdh login format"? or can be used with unmodified engine.dll ?

:EDIT:

what about the account hax? i know amped fixes it, but im not using amped :>

humordwarf 17.08.2007 23:07

Quote:

Originally Posted by madar (Post 94831)
nice mens, thanks for share, btw it "accepts the cxxdh login format"? or can be used with unmodified engine.dll ?

:EDIT:

what about the account hax? i know amped fixes it, but im not using amped :>

1. cxxdh
2. "account hax" = GS exploit, not auth

KOC2000 17.08.2007 23:27

gonna try it later..
thanx HD for sharing.

Marios145 17.08.2007 23:29

when i set
UseRSA = true(what is this btw? :P)
the program just crashes after displaying protocol revision without any errors
anyway very nice login :D

humordwarf 17.08.2007 23:37

Quote:

Originally Posted by Marios145 (Post 94834)
when i set
UseRSA = true(what is this btw? :P)
the program just crashes after displaying protocol revision without any errors
anyway very nice login :D

means RSA not implemented

l2pvppower 17.08.2007 23:55

woring c6 ?

SoaPy 18.08.2007 00:02

tnx HD, gonna test it later, looks great.

Insight 18.08.2007 00:37

Thanks HD, great share, in test.

katso 18.08.2007 00:50

Great work and thanks to share it, a doubt, are possible that it blocks the use of L2Walker?

humordwarf 18.08.2007 01:11

well... it maybe may block l2walkers (i didnt tested it) because there is order of packets changed a lot

katso 18.08.2007 01:27

Quote:

Originally Posted by humordwarf (Post 94843)
well... it maybe may block l2walkers (i didnt tested it) because there is order of packets changed a lot

It is what I think, test and I confirm info.
Again thanks to share your great works.

Drag 18.08.2007 01:34

Thanks HD, very helpful

Aida 18.08.2007 07:37

del///////

DevilsAssociate 18.08.2007 07:51

Great share HD

Aikeleer 18.08.2007 08:07

Cool, written in C#?

Aida 18.08.2007 09:11

that it meant

Quote:

TCP2106: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at ab.a(Socket A_0, Byte[] A_1)
at am.b(ad A_0)
at ab.a(IAsyncResult A_0)
Quote:

Specified argument was out of the range of valid values.
Parameter name: newAddress
at System.Net.IPAddress..ctor(Int64 newAddress)
at x.i(ai A_0, q A_1)
writes server in down, nowhere keeps out

Quote:

[Server2]
ID = 2
Name = Server2
Database = Server=127.0.0.1;Database=lin2db;User ID=****;Password=******;Integrated Security=false;
ExtIP = ***.***.***.***
IntIP = 127.0.0.1
Port = 7777
authorizing works, server also but not konnektitsya to authorizing.
GS yells that does not can connected to the server of authorizing

авторизация работает, сервер тоже но не коннектится к авторизации.
GS орет что не может подключится к серверу авторизации, на фаире все разблочено...

humordwarf 18.08.2007 10:37

Quote:

Originally Posted by Aida (Post 94859)
that it meant

[eng]
can not translate to russian yourself? =)
[rus]
Соединение было принудительно разорвано удаленной машиной, не шмогло оно отослать пакет клиенту... видишь там TCP2106 написано? значит это игрока "оторвало"

а по поводу
Specified argument was out of the range of valid values.
Parameter name: newAddress

тут видимо кривой IP-адрес...

emanuel 18.08.2007 10:47

Amazing, thx HD Great share !:thumbleft:
How can i change the auth port?? ( 2016 )

madar 18.08.2007 11:49

Quote:

Originally Posted by T@LisM@N (Post 94869)
такая же фигня неконектиться к базе :(

sdgjklhatrkljwehtreklhssdfukhtruithertipheatui

mens

hel 18.08.2007 14:13

Quote:

Originally Posted by humordwarf
- blocks Account at selected Server is there is 3 wrong passwords entered (e.g. 3 minutes user will not able to even try)

... then any bad guy may ban everyone with bad password attempts, with knowing only his acc name... right? i think, temp ip banning better here.
/rus
тогда каждый ушлепок-хацкер может простым флудом авторизацией любого чувака, даже админа забанить на три минуты, а если хацкер напишет прогу для цикличного посыла по 4 пакета левой авторизации - так бедный владелец акка не зайдет в игру пока эту прогу не выключат, весело - правда? :)
лучше реализовать ип-бан, вместо аккаунтобана. /

Aida:
there's some antileecher protection in config? ;)
/rus
гыгы, при первом же взгляде на вырезку из конфига понятна ошибка - подумай чуток, это видимо антиличерская защита :)

Kenjiro 18.08.2007 17:43

Great share... amazing... taking my jaw from the floor... w.o.w.

But i think it should be (documentation bug?):
example2: 1xx.xx8.1.0/24 means network 1xx.xx8.1.1 - 1xx.xx8.1.255
24 instead of 8 - this is correct CIDR notation (1xx.xx8.1.0/8 means 192.0.0.0 - 1xx.xx5.2xx.xx5).

mcrabben7 18.08.2007 18:21

GJ HD :) Keep rockin'

Jarohe 18.08.2007 19:20

Good work.

Thanks.

humordwarf 18.08.2007 21:56

Quote:

Originally Posted by Kenjiro (Post 94884)
But i think it should be (documentation bug?):
example2: 1xx.xx8.1.0/24 means network 1xx.xx8.1.1 - 1xx.xx8.1.255
24 instead of 8 - this is correct CIDR notation (1xx.xx8.1.0/8 means 192.0.0.0 - 1xx.xx5.2xx.xx5).

u know what is most funny... i implemented inversed CIDR notation %)
fuck... what the mistake...

have to fix that o_O

*confused*

humordwarf 18.08.2007 22:06

Quote:

Originally Posted by hel (Post 94875)
... then any bad guy may ban everyone with bad password attempts, with knowing only his acc name... right? i think, temp ip banning better here.
/rus
тогда каждый ушлепок-хацкер может простым флудом авторизацией любого чувака, даже админа забанить на три минуты, а если хацкер напишет прогу для цикличного посыла по 4 пакета левой авторизации - так бедный владелец акка не зайдет в игру пока эту прогу не выключат, весело - правда? :)
лучше реализовать ип-бан, вместо аккаунтобана. /

[eng]
yes. u right, i'll fix it, but solution will be different: i'll add to this thing ip checking... should be like 3 password try per ip per account@server... e.g. per each IP@account@server own counter

[rus]
ты прав, надо пофиксить, но решение будет таким: я в это добавлю проверку адреса... должно быть типа три попытки с одного IP на акк на сервере... т.е. на каждый IP@account@server свой счетчик

humordwarf 18.08.2007 22:13

Quote:

Originally Posted by emanuel (Post 94866)
How can i change the auth port?? ( 2016 )


what for ?

humordwarf 18.08.2007 22:20

Quote:

Originally Posted by Aikeleer (Post 94858)
Cool, written in C#?

yeah, last months i love this language more and more =) somewhy...
any language is good, but speed of developing in C# is faster than on Java from Sun, same as resulting binary code execution speed...

humordwarf 19.08.2007 03:19

x.x1 now available, first post updated

- new parameter in .ini: ClientPort - Port number for clients (players) connections (emanuel's idea)
- fixed errors in net/mask functions (IPBans related) (thanks Kenjiro)
- changed logic in TempoBano for wrong passwords (see docs changes) (thanks hel)
- added info into docs about SQL queries (see below)

petre1980 19.08.2007 04:04

Verry good HD. Thanks.

FidoW 19.08.2007 09:06

Good job!

A suggestion: the blowfish maybe possible the be written in HEX format instead as string ?

Phantom2005 19.08.2007 10:15

Amazing as always. I suggest the same thing as FidoW says, blowfish in HEX format, it'll make things alot easier.

emanuel 19.08.2007 11:40

Quote:

Originally Posted by Phantom2005 (Post 94919)
Amazing as always. I suggest the same thing as FidoW says, blowfish in HEX format, it'll make things alot easier.

For the blowfish key you can use Lineage II Script maker v4 ( system part )

Xari0n 19.08.2007 12:07

Humordwarf thanx for share
Can u make your auth support C5 client
/rus если не сложно и есть желание, сделай пожалуйста возможность подключения ц4 клиентом, уже очень хорошая штука /rus

Forcer 19.08.2007 12:23

Hmmm...would be nice, if hd will create "switch" for chronicles, C4\C5.
It will be nice multiplatform auth server %)
No more hexing, or questions "auth c5 plix plox".

Certainly, if it possible...

humordwarf 19.08.2007 13:46

Quote:

Originally Posted by Forcer (Post 94927)
Hmmm...would be nice, if hd will create "switch" for chronicles, C4\C5.
It will be nice multiplatform auth server %)
No more hexing, or questions "auth c5 plix plox".

Certainly, if it possible...

its impossible right now... main problem: i know nothing about C5 protocol, have no such C5 server, etc...

l2online 19.08.2007 15:01

C4: http://www.l2jserver.com/svn/branche...serverpackets/

C5: http://www.l2jserver.com/svn/branche...serverpackets/

T0(AKA INTERLUDE NOT C6): http://www.l2jserver.com/svn/trunk/L...serverpackets/

~Marquis~ 19.08.2007 15:03

humordwarf = god
Your share is neat, great, it's become an habit now.. :)

petre1980 19.08.2007 15:20

One small sugestion, i have created a personalized "Terms and Conditions" for my server and it seems that a player will automatically login without accepting the Terms. HD can you make the player login only by clicking to "Accept" and disconect if not ?


All times are GMT. The time now is 23:21.