Skip to content

Commit b7c19a8

Browse files
authored
Allow /reset/mail/ only from localhost
Block connection from outside, that could brute force password guessing
1 parent 06f6fff commit b7c19a8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

web/reset/mail/index.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55

66
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
77

8+
// Checking IP of incoming connection, checking is it NAT address
9+
$ok=0;
10+
$ip=$_SERVER['REMOTE_ADDR'];
11+
exec (VESTA_CMD."v-list-sys-ips json", $output, $return_var);
12+
$output=implode('', $output);
13+
$arr=json_decode($output, true);
14+
foreach ($arr as $arr_key => $arr_val) {
15+
// search for NAT IPs and allow them
16+
if ($ip==$arr_key || $ip==$arr_val['NAT']) {
17+
$ok=1;
18+
break;
19+
}
20+
}
21+
if ($ip == $_SERVER['SERVER_ADDR']) $ok=1;
22+
if ($ip == '127.0.0.1') $ok=1;
23+
if ($ok==0) exit;
24+
825
//
926
// sourceforge.net/projects/postfixadmin/
1027
// md5crypt

0 commit comments

Comments
 (0)