Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 29-05-2009, 09:49 AM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
10 biện pháp bảo mật cho 4rum
10 biện pháp bảo mật cho 4rum Sau 1 thời gian làm 4rum thì em có rút ra được 1 số kinh nghiệm bảo mất cho site mà em học hỏi được từ rất nhiều nơi, tuy nhiên cũng có 1 số cách riêng của em. Hôm nay em tổng hợp lại post lên đây cho anh em nào mới tập làm web tham khảo. Mấy pro đừng cười chê em nha, ai có cách nào hay hơn thì post lên đây luôn cho mọi người cùng nhau học hỏi!


1/ Thay đổi toàn bộ cấu trúc source code site của bạn. Nếu có thời gian rãnh thì bạn nên thay đổi toàn bộ cấu trúc thư mục, đừng bao giờ để cấu trúc mặc định. Ví dụ như: admincp, modcp,...

2/ Nên bỏ bản quyền, hoặc mã nguồn của 4rum mình đang sử dụng đi, chớ có để Power by Vbulletin 3.6.4 hay đại loại là gì đó. Tại sao ah? Câu trả lời sẽ là khi hacker tìm thấy 1 lỗi bảo mật của 1 loại source code nào đó thì sẽ tiến hành search trên google 1 từ khóa nhạy cảm nào đó! Nếu ta vẫn giữ nguyên thì google sẽ nắm đầu site bạn ra liệt kê trên kết quả tìm kiếm và tèn tén ten, site bạn trở thành món đồ thực hành của tụi hacker.

3/ Thường xuyên update phiên bản mới nhất cho 4rum! Vì như vậy sẽ tránh được lỗi bảo mật!

4/ Đặt firewall chống ddos cho 4rum! Có rất nhiều loại firewall, bạn cứ chọn cái nào kool, thích hợp nhất cài đặt cho 4rum mình (vào các site tin học mà tìm nhá). Tuy có hơi bất tiện cho mem khi truy cập nhưng phòng cháy vẫn hơn chữa cháy mà!
Hoặc có 1 loại firewall rất đơn giản nhưng hiệu quả chống ddos rất cao đó là chức năng Password Protect Directory, (đa số các host cpanel đều có chức năng này), bạn dùng chức năng này để bảo vệ cho thư mục root. Ý nghĩa là: khi có khách truy cập vào 4rum thì sẽ hiện ra 1 thông báo yêu cầu nhập user và pass,họ sẽ tiến hành điền pass và user vào . Còn các cỗ máy để ddos không thể làm được điều này. Ví dụ: như VNU của chúng ta bị ddos cũng đang mở firewall này đó.

5/ Bảo vệ fire cấu hình. Cái này rất quan trọng, vì nếu lỡ hacker có được con shell trên host của bạn rồi thì nó cũng sẽ chẳng làm ji đuợc đến cái database của chúng ta trừ khi bị nó get root! Ta tiến hành làm như sau:
B1: Tạo 1 file có tên datasite.php có nội dung của file config.php, trong thư mục #data.
B2: Xóa hết toàn bộ nội dung của file config.php, thay bằng đoạn code sau:
Code:
<?php include "#data/datasite.php" ?>
B3: Mã hóa file . Bạn dùng 1 tool zend code nào đó kool kool mà hạcker ko thể giải mã được tiến hành mã hóa các file quan trọng.
B4: Quan trong nhất nè, bạn CHMOD thư mục #data thành 111, nếu host ko hỗ trợ thì CHMOD là 711 cũng đuơc. Nếu làm đúng file sẽ mất tiêu thư mục #data y như thư mục rỗng
==>Vậy là xong!

6/ Dùng ảnh xác nhận để chống flood member .Mở chúc năng này như sau:
B1: vào admincp/vbulletin option /User Registration Options
B2: Ảnh xác nhận ,chọn đồng ý
B3: vào vbulletin options /Help Server Settings and Optimization Options
Mục GD Version chọn GD 2

7/ Backup database thường xuyên ,vào Import & Maintenance/Database Backup để làm
Khi cần có thể dùng 1 cái script backup nào đó như bigdump chẳng hạn để khôi phục lại ....

8/ Bảo vệ link admincp, cái này ở phần 1 tôi có nói rồi. Bạn hãy change link admin sao cho độc độc á, ví dụ như: maiyeuemthanhxuan/index.php . Sau đó dùng chức năng Password Protect Directory để thêm 1 lớp pass bảo vệ nữa. Như vậy nếu có xui xẻo bị lộ pass admin cũng chẳng sao, hacker phải mò ra cái pass bảo vệ này, mò ko ra nó cũng nản ah! hehe

Đoạn code sau đây sẽ báo cho bạn biết khi có người cố gắng đột nhập vô admincp nè:
Code:
vB3.5 Email notification if someone attempts to access your Admin or Mod CP
Version 1.0.1
(By Boofo)

What does this modification do?
When someone tries to login to your Admin CP or Mod CP, you will get an email that contains the username they tried, the password they tried, their IP address, hostname, number of strikes, referrer, script, and the date & time of the attempt. It also will now distinguish itself in the message subject between a failed Admin CP attempt and a failed Mode CP attempt, so you will know right off which CP they tried to login to.

NOTE: To alleviate anyone getting upset about plain text passwords being transmitted from the server, the ONLY time a plain text password is sent, is when it is a failed login attempt. It is not stored on the server anywhere and no hashed passwords are ever revealed to anyone. I think it's good to know if anyone is getting close to what my CP password is so I can change it if necessary.

Credits:
Thanks to EvilLS1 for making the vB 3.0 version of this modification on which this update is based and released with permission.

Version Information:
Version 1.0.0 --Initial release
Version 1.0.1 --Fixed user name being wrong on a user attempt.


Installation overview:
--------------------------------------
Files to edit: (2)
--incudes/adminfunctions.php
--login.php


Installation Instructions:
--------------------------------------
In incudes/adminfunctions.php

Find:
--------------------------------------

<form action="../login.php" method="post" name="loginform" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf); js_do_options(this)">

--------------------------------------
REPLACE it with:
--------------------------------------

<?php
if ($logintype=='cplogin' OR $logintype=='modcplogin')
**
echo '<form action="../login.php" method="post" name="loginform" onsubmit="document.forms.loginform.vbpassword.valu e=document.forms.loginform.vb_login_password.value ; md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf); js_do_options(this)">';
}
else
**
echo '<form action="../login.php" method="post" name="loginform" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf); js_do_options(this)">';
}
?>

--------------------------------------
Find:
--------------------------------------

<input type="hidden" name="vb_login_md5password_utf" value="" />

--------------------------------------
BELOW it add:
--------------------------------------

<input type="hidden" name="vbpassword" value="" />

--------------------------------------
In login.php

Find:
--------------------------------------

'vb_login_md5password_utf' => TYPE_STR,

--------------------------------------
BELOW it add:
--------------------------------------

'vbpassword' => TYPE_STR,

--------------------------------------
Find:
--------------------------------------

$strikes = verify_strike_status($vbulletin->GPC['vb_login_username']);

--------------------------------------
BELOW it add:
--------------------------------------

$username = $vbulletin->GPC['vb_login_username'];
$fapassword = $vbulletin->GPC['vbpassword'];
$fdate = date('l, F jS, Y');
$ftime = date('g:i:s a');
$fdatetime = "Date/Time: $fdate at $ftime \r\n";
$fscriptpath = "Script: http://$_SERVER[HTTP_HOST]" . SCRIPTPATH . "\r\n";
$freferer = 'Referrer: ' . REFERRER . "\r\n";
$fusername = "Username tried: $username \r\n";
$fpassword = "Password tried: $fapassword \r\n";
$fipaddress = 'IP Address: ' . IPADDRESS . "\r\n";
$iphostname = "Host: " . @gethostbyaddr(IPADDRESS) . "\r\n";
if ($vbulletin->userinfo['userid'] > 0)
**
$realname = "\nUSER ATTEMPT: " . $vbulletin->options['bbtitle'] . " has identified this registered user as: " . $vbulletin->userinfo['username'] . "\r\n";
}

--------------------------------------
Find:
--------------------------------------

// log this error if attempting to access the control panel
require_once(DIR . '/includes/functions_log_error.php');

--------------------------------------
BELOW it add:
--------------------------------------

$fstrk = "Strikes: $GLOBALS[strikes] out of 5 \r\n";
if ($vbulletin->GPC['logintype'] === 'cplogin')
**
$subject= 'WARNING: Failed Admin CP logon in ' . $vbulletin->db->appname . ' ' . $vbulletin->options['templateversion'] . "\r\n\r\n";
$message="Someone is trying to login to your " . $vbulletin->options['bbtitle'] . " Admin CP!\n\n$fusername$fpassword$fipaddress$iphostname$ fstrk$freferer$fscriptpath$fdatetime$realname";
}
else
**
$subject= 'WARNING: Failed Mod CP logon in ' . $vbulletin->db->appname . ' ' . $vbulletin->options['templateversion'] . "\r\n\r\n";
$message="Someone is trying to login to your " . $vbulletin->options['bbtitle'] . " Mod CP!\n\n$fusername$fpassword$fipaddress$iphostname$ fstrk$freferer$fscriptpath$fdatetime$realname";
}
vbmail($vbulletin->options['webmasteremail'], $subject, $message, true);
-----------------------------------
Hoặc là có cách khác nữa nè, cách này hiệu quả vô cùng. Bạn xóa file index.php của admincp đi, khi nào cần dùng rồi up lên. hehe! Lợi hại ko, hacker nó sẽ ko thể đăng nhập vào admincp được!

9/ Quy định về đặt pass. Cái này chắc ai cũng biết. Không được đặt pass trùng nhau giữa pass yahoo, pass host, pass admin ,....

10/ CHMOD cho site. Cái này cũng rất quan trọng, tránh bị local. Bạn ko nên CHMOD là 777. Khi có chuyện cần phải CHMOD 777, ví dụ như backup 4rum thì sau khi xong việc phải CHMOD lại như cũ. CHMOD sao cho hợp lý bây h, tùy theo từng host mà việc CHMOD cũng # nhau, nhưng tốt nhất là bạn CHMOD sao cho nhỏ nhất mà site của bạn vẫn load bình thuờng, ko bị hạn chế chức năng. Như tôi, tôi CHMOD root là 710 , folder là 701, file là 644.

Nếu như bạn áp dụng tất cả các biện pháp trên đây vào site của mình thì tôi bảo đảm hacker rất khó mà xơi site của bạn. Chỉ trừ trường hợp gặp thằng nào pro đỉnh quá thì thôi, chịu thua nó đi!
=== Sưu tập ===
  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời



Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 05:39 AM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.