PHPBB2討論區安裝

此處在RH9安裝環境預設已經將Apache+PHP-Mysql安裝完成,並安裝好PhpMyAdmin資料庫管理介面,以下的安裝過程就很簡單。

1.進入資料庫開設好phpbb2的資料庫

http://SERVER IP/phpMyadmin  登入

新增資料庫: phpbb2  登出

2.下載PHPBB2-2.0.4中文版

3.解壓縮

unzip phpBB2.zip

4.切換到pbpBB2安裝目錄並更改安裝檔案權限

cd /var/www/html/phpBB2

chmod 666 config.php

6.進入PHPBB2的安裝模式

http://SERVER IP/phpBB2

7.輸入以下資料

資料庫伺服主機名稱:locathost

您的資料庫名稱:phpbb2  (要和之前所開設的資料庫名稱一樣)

資料庫使用者帳號:root

資料庫密碼:*********

資料庫的表格字首:phpbb_

---------------

系統管理員電子郵件信箱:自己指定

網域名稱:localhost

主機連接埠:80

....採預設值

系統管理員帳號名稱、密碼:自己指定

按下「開始安裝」

完成安裝

8.刪除install/和contrib/資料夾(安裝完必須刪除,否則有安全漏洞)

路徑 /var/www/html/phpBB2

rm -rf install

rm -rf contrib

9.改回config.php檔案權限

chmod 644 config.php

10.漏洞修補:

■2003/06/25 公佈的一項漏洞,雖然不會直接對您的 phpBB2 造成危害,但是卻可以讓其他有心人士使用你的系統上面的其他檔案!

開啟 admin/admin_styles.php 這個檔案,尋找底下這段文字:

vi admin/admin_styles.php  (路徑 /var/www/html/phpBB2)  紅色字為修改處

// 
// Load default header 
// 
// 
// Check if the user has cancled a confirmation message. 
// 
$phpbb_root_path = "./../"; 

$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE; 
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE; 

if (empty($HTTP_POST_VARS['send_file']))  ----->刪除

   $no_page_header = ( $cancel ) ? TRUE : FALSE;  ---->修改
   require($phpbb_root_path . 'extension.inc');  --->搬移
   require('./pagestart.' . $phpEx); 

if ($cancel) 

   redirect('admin/' . append_sid("admin_styles.$phpEx", true)); 
}

將上面這段文字完整的修改成為底下的模樣:
// 
// Load default header 
// 
// 
// Check if the user has cancled a confirmation message. 
// 
$phpbb_root_path = "./../"; 
require($phpbb_root_path . 'extension.inc'); 

$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE; 
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE; 

$no_page_header = (!empty($HTTP_POST_VARS['send_file']) || $cancel) ? TRUE : FALSE;     --->修改後

require('./pagestart.' . $phpEx); 

if ($cancel) 

   redirect('admin/' . append_sid("admin_styles.$phpEx", true)); 
}

■這是在 2003/06/20 公佈的一項漏洞

vi viewtopic.php   (路徑 /var/www/html/phpBB2) ,並找到底下的字眼: 
if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) 

      $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]); 

else if ( isset($HTTP_GET_VARS['topic']) ) 

      $topic_id = intval($HTTP_GET_VARS['topic']); 
在上面這一段文字之前,新增:
$topic_id = $post_id = false; 
在同樣這個檔案,往下找到如下的字眼:(紅色字為修改處)
$join_sql_table = ( !isset($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 "; 
$join_sql = ( !isset($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id"; 
$count_sql = ( !isset($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts"; 

$order_sql = ( !isset($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; 

將他修改為如下模樣:
$join_sql_table = ( empty($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 "; 
$join_sql = ( empty($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id"; 
$count_sql = ( empty($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts"; 

$order_sql = ( empty($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; 

■這是在 2004/12/10 公佈的一項漏洞

phpBB2 是相當流行的討論版軟體,在 2.0.10 及之前的版本中的 viewtopic.php 使用 urldecode 這個函式,會造成安全漏洞,攻擊者可在編碼中夾入任何指令來執行。

請檢查您的 viewtopic.php:

if (isset($HTTP_GET_VARS['highlight']))
{
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars(urldecode($HTTP_GET_VARS['highlight']))));

將它改成

if (isset($HTTP_GET_VARS['highlight']))
{
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars($HTTP_GET_VARS['highlight'])));

也就是拿掉 urldecode 這個函式。

 

 

11.完成安裝

重新登入[系統管理控制台]進行[基本組態設定]

12.更換左上方LOGO   圖像大小:180x150

路徑: /var/www/html/phpBB2/templates/subSilver/images/logo_phpBB.gif

ncftp -u 帳號 163.26.161.130

輸入密碼

cd /html

get logo_phpBB.gif

bye