mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 13:24:25 -07:00
Allow whitelisting specific IP for /api/
This commit is contained in:
parent
f4b64b4b4e
commit
b40ebe07e2
1 changed files with 13 additions and 1 deletions
|
@ -1,6 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
|
define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
|
||||||
exit;
|
|
||||||
|
$allowed_host=0;
|
||||||
|
$check_file="/usr/local/vesta/conf_web/allow_ip_for_api.conf";
|
||||||
|
if (file_exists($check_file)) {
|
||||||
|
$file_content=file($check_file);
|
||||||
|
if (is_array($file_content)) {
|
||||||
|
foreach ($file_content as $line) {
|
||||||
|
if (trim($line) == $_SERVER['REMOTE_ADDR']) {$allowed_host=1; break;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($allowed_host == 0) exit;
|
||||||
|
|
||||||
if (isset($_POST['user']) || isset($_POST['hash'])) {
|
if (isset($_POST['user']) || isset($_POST['hash'])) {
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue