diff --git a/ChangeLog b/ChangeLog index 3580459a5..134d4eb2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ $HeadURL$ * index.php, libraries/cleanup.lib.php, libraries/url_generating.lib.php, libraries/common.lib.php, libraries/select_lang.lib.php: Fix path disclossure while passing array as some params. + * Documentation.html, libraries/ip_allow_deny.lib.php, + libraries/config.default.php: Trust only listed proxies for IP + Allow/Deny. 2006-11-16 Marc Delisle * pmd_pdf.php: export coordinates to PDF page even if the tables diff --git a/Documentation.html b/Documentation.html index 9a0dcdb05..4620e3df9 100644 --- a/Documentation.html +++ b/Documentation.html @@ -501,7 +501,7 @@ GRANT ALL PRIVILEGES ON user_base.* TO 'real_user'@localhost IDENTIFIED BY 'real suggested, perhaps a .htaccess file with the HTTP-AUTH directive or disallowing incoming HTTP requests at one’s router or firewall will suffice (both of which - are beyond the scope of this manual but easily searchable with Google). + are beyond the scope of this manual but easily searchable with Google). @@ -1006,7 +1006,11 @@ ALTER TABLE `pma_column_comments` listed in the allow rules, and not listed in the deny rules. This is the most secure means of using Allow/Deny rules, and was available in Apache by specifying allow and deny rules without - setting any order. + setting any order.

+ + Please also see $cfg['TrustedProxies'] for detecting IP + address behind proxies.
$cfg['Servers'][$i]['AllowDeny']['rules'] array of strings @@ -1447,6 +1451,13 @@ ALTER TABLE `pma_column_comments` Character sets will be shown in same order as here listed, so if you frequently use some of these move them to the top. +
$cfg['TrustedProxies'] array
+
Lists proxies which are trusted for IP Allow/Deny. This list is by + default empty, you need to fill in some trusted proxy servers if you + want to use rules for IP addresses behind proxy. +
+
$cfg['GD2Available'] string
Specifies whether GD >= 2 is available. If yes it can be used for MIME transformations.
diff --git a/libraries/config.default.php b/libraries/config.default.php index 93cb41d9b..71df2e4bb 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -612,6 +612,8 @@ $cfg['GD2Available'] = 'auto'; // Is GD >= 2 available? Set to yes/ // does autodetection, which is a bit expensive for // php < 4.3.0, but it is the only safe vay how to // determine GD version. +$cfg['TrustedProxies'] = array(); // List of trusted proxies for IP allow/deny + /** * SQL Parser Settings */ diff --git a/libraries/ip_allow_deny.lib.php b/libraries/ip_allow_deny.lib.php index 0244946f0..c0bcbf886 100644 --- a/libraries/ip_allow_deny.lib.php +++ b/libraries/ip_allow_deny.lib.php @@ -50,6 +50,8 @@ function PMA_getIp() // Gets the default ip sent by the user if (!empty($REMOTE_ADDR)) { $direct_ip = $REMOTE_ADDR; + } else { + $direct_ip = ''; } // Gets the proxy ip sent by the user @@ -71,7 +73,7 @@ function PMA_getIp() } // end if... elseif... // Returns the true IP if it has been found, else false - if (empty($proxy_ip)) { + if (empty($proxy_ip) || !in_array($direct_ip, $GLOBALS['cfg']['TrustedProxies'])) { // True IP without proxy return $direct_ip; } else {