Skip to content

Commit 07453d7

Browse files
Merge pull request hestiacp#1542 from serghey-rodin/dpeca-patch-2
Allow /reset/mail/ only from localhost
2 parents 06f6fff + 14c8e56 commit 07453d7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

web/reset/mail/index.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
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+
if ($ip==$arr_key || $ip==$arr_val['NAT']) {
16+
$ok=1;
17+
break;
18+
}
19+
}
20+
if ($ip == $_SERVER['SERVER_ADDR']) $ok=1;
21+
if ($ip == '127.0.0.1') $ok=1;
22+
if ($ok==0) exit;
23+
824
//
925
// sourceforge.net/projects/postfixadmin/
1026
// md5crypt

0 commit comments

Comments
 (0)