Hello E*PvP,
As a a lot of servers closed recently, I'll teach you how to make a decent server, because some servers here are just open to every kind of hacks...
So lets go
So, now we'll see how to setup decent firewall rules.
[Only registered and activated users can see links. Click Here To Register...]
(to open your windows firewall, simply type "fire" in your search windows bar, and clic on the first result, i mean this one:
[Only registered and activated users can see links. Click Here To Register...])
Now lets see the 3 required rules that I made.
Okay well... now we have a secure game server, basic issues are patched.
* - PHP & Appache installation
Please, setup your web server your self! download [Only registered and activated users can see links. Click Here To Register...] here and [Only registered and activated users can see links. Click Here To Register...] here. Why ? Because some softwares "all in one" might contain obvious security issues in the panel that they give. So please delete (or secure) this panel.In fact these software are mainly made for local development, not for public website. And, almost all of these softwares will run a MySQL DB.. but we don't need it, and it will use your RAM.
a - web firewall
Here is the firewall rules for the second machine (or the web-related rules if you are using only one VPS) ignore this step if you are using a classic web-host (with cpanel and so on)
[Only registered and activated users can see links. Click Here To Register...]
Okay and now lets see the 2 rules that I made:
Okay... now we have a decent firewall protection, lets see the web-releated issues.
b - SQL Injections
A lot of shaiya PHP scripts are using GET or POST and then a SQL query, with the wished variables. The problem is, if you are not using the pdo bind functions, or any other function that make put a variable in your query with a decent way, any kid will be able to drop your databases.
Now lets see 3 exemples:
1 - file: exemple_odbc_unsafe.php
So this script is unsecure, because we can inject any SQL code. for exemple, lets try with this username:
in fact, if we put this "username", we will delete all our accounts. SO PLS DONT DO THIS (if you just deleted your accounts, because you didn't use your brain no matter if I put it in the requirements, you can still resotre your accounts by using [Only registered and activated users can see links. Click Here To Register...].)
2 - file: exemple_odbc_safe.php
This script is safe, because we are using a funcntion that make our $_POST vars secure, and we can't inject SQL code.
3 - file: exemple_pdo_sqlsrv.php
This script is safe, because we are using PDO::BindParam function, so we can't inject SQL code.
So
Now lets see an last exemple, lets check if [Only registered and activated users can see links. Click Here To Register...] is secure:
proc.php line 19
The vars $ItemName will be used later in our sql vars
So its not secure at all to put this script in your public website. (I made it for my admin panel months ago)
So how to secure this script, and make it usable for your public area?
Lets secure this script, at each time you'll have a variable declared as a query, it should be like:
And so, at each odbc_exec(), we should use odbc_execute() instead
proc.php line 40
Yeah, in fact, its really simple!
The secure ps_login.exe can be found [Only registered and activated users can see links. Click Here To Register...].
OTHER DOWNLOADS
The secure ps_dbagent episode 4 can be found here. (patched item dupe)
The secure ps_dbagent episode 5.4 can be found here. (patched item dupe)
And secure ps_dbagent episode 6.3 (for Juuf's or Shen's files) can be found here. (patched item dupe)
As I inveted you to use lastest SQL Server versions, here is some edited dll that I made to help you to upgrade your SQL server. In fact, with these modification you won't be able to use SQL Server 2012 and greater.
Edited 5.4 itemmall dll can be found here.
Edited Juuf's EP 6 dll can be found here.
Edited lastest Shen's dll can be found here.
Edited Shen's dll (with wings) can be found here.
I'm still uploading these files, pls wait.
Now you have a decent server, so your server should stay online for a long time.
Have fun!
As a a lot of servers closed recently, I'll teach you how to make a decent server, because some servers here are just open to every kind of hacks...
So lets go
I / System Requirements
- A decent host
- If possible, having 2 servers would be better (one for your WEB server, and the other one for your GAME & sql server)
- I would recomand you to use lastest Windows Server OS & lastest SQL Server (so Windows Server 2012 R2 & [Only registered and activated users can see links. Click Here To Register...] nowdays). In fact, almost every one are still using windows server 2008 R2 or SQL Server 2005....
II / Basic game-server protection
So, now we'll see how to setup decent firewall rules.
[Only registered and activated users can see links. Click Here To Register...]
(to open your windows firewall, simply type "fire" in your search windows bar, and clic on the first result, i mean this one:
[Only registered and activated users can see links. Click Here To Register...])
Now lets see the 3 required rules that I made.
- The first one "Login & Game Shaiya Server" simply open 30800 & 30810 port (TCP only) others shaiya ports HAVE TO BE CLOSED, or we will be able to close your server remotly and so on
- The second one "RDP && SSH" will allow you to use windows RDP to access to your server, I mean this tool:
[Only registered and activated users can see links. Click Here To Register...]
For this rule, please set "remote adress" to your own home adress. Why ? Because if someone know your password, he won't be able to use it.
Note: I'm using custom RDP port, mine is 15000 but change it if you want. default one is TCP port 3389.
- The lastest rule is for SQL Server. if you have 2 VPS, set "remote adress" to you web server adress, else delete this rule if you are running your web server & your sql server on the same VPS. In fact, no one will be able to connect to your SQL Server, no matter if your password is Shaiya123 or a secure one.
Okay well... now we have a secure game server, basic issues are patched.
III / Basic Web server protection
* - PHP & Appache installation
Please, setup your web server your self! download [Only registered and activated users can see links. Click Here To Register...] here and [Only registered and activated users can see links. Click Here To Register...] here. Why ? Because some softwares "all in one" might contain obvious security issues in the panel that they give. So please delete (or secure) this panel.In fact these software are mainly made for local development, not for public website. And, almost all of these softwares will run a MySQL DB.. but we don't need it, and it will use your RAM.
a - web firewall
Here is the firewall rules for the second machine (or the web-related rules if you are using only one VPS) ignore this step if you are using a classic web-host (with cpanel and so on)
[Only registered and activated users can see links. Click Here To Register...]
Okay and now lets see the 2 rules that I made:
- The first one allow TCP HTTP && HTTPS (80 & 443 ports)
- The second one is, once again, for RDP. with, once again "remote adress" set to my home adress.
Okay... now we have a decent firewall protection, lets see the web-releated issues.
b - SQL Injections
A lot of shaiya PHP scripts are using GET or POST and then a SQL query, with the wished variables. The problem is, if you are not using the pdo bind functions, or any other function that make put a variable in your query with a decent way, any kid will be able to drop your databases.
Now lets see 3 exemples:
1 - file: exemple_odbc_unsafe.php
So this script is unsecure, because we can inject any SQL code. for exemple, lets try with this username:
Code:
Trayne01'; DELETE FROM PS_UserData.dbo.Users_Master;--
2 - file: exemple_odbc_safe.php
This script is safe, because we are using a funcntion that make our $_POST vars secure, and we can't inject SQL code.
3 - file: exemple_pdo_sqlsrv.php
This script is safe, because we are using PDO::BindParam function, so we can't inject SQL code.
So
Now lets see an last exemple, lets check if [Only registered and activated users can see links. Click Here To Register...] is secure:
proc.php line 19
PHP Code:
if (isset($_POST['Var1']))
{
$DisplayItemName=$_POST['Var1'];
$replace = array(
"'" => "_",
"é" => "e",
"è" => "e",
"ê" => "e",
"î" => "i",
//"ï" => "i",
"à" => "a",
"û" => "u",
"ô" => "o"
);
//$newstr = utf8_encode(str_replace_assoc($replace,$_POST['Var1']));
$newstr = str_replace_assoc($replace,$_POST['Var1']);
$ItemName=$newstr;
PHP Code:
$CheckItemNumber="SELECT Grade from dbo.Items WHERE ItemName like '$ItemName'";
So how to secure this script, and make it usable for your public area?
Lets secure this script, at each time you'll have a variable declared as a query, it should be like:
PHP Code:
$CheckItemNumber=odbc_prepare("SELECT Grade from dbo.Items WHERE ItemName like ? ;");
proc.php line 40
PHP Code:
$retour=odbc_execute($CheckItemNumber,array($ItemName));
IV / Others basics exploits & issues
The secure ps_login.exe can be found [Only registered and activated users can see links. Click Here To Register...].
OTHER DOWNLOADS
The secure ps_dbagent episode 4 can be found here. (patched item dupe)
The secure ps_dbagent episode 5.4 can be found here. (patched item dupe)
And secure ps_dbagent episode 6.3 (for Juuf's or Shen's files) can be found here. (patched item dupe)
As I inveted you to use lastest SQL Server versions, here is some edited dll that I made to help you to upgrade your SQL server. In fact, with these modification you won't be able to use SQL Server 2012 and greater.
Edited 5.4 itemmall dll can be found here.
Edited Juuf's EP 6 dll can be found here.
Edited lastest Shen's dll can be found here.
Edited Shen's dll (with wings) can be found here.
I'm still uploading these files, pls wait.
- If you are using a weird database, [Only registered and activated users can see links. Click Here To Register...]
Now you have a decent server, so your server should stay online for a long time.
Have fun!