diff options
-rw-r--r-- | docs/bird.md | 9 | ||||
-rw-r--r-- | docs/cisco.md | 9 | ||||
-rw-r--r-- | docs/juniper.md | 9 | ||||
-rw-r--r-- | docs/misc.md | 5 | ||||
-rw-r--r-- | docs/quagga.md | 9 | ||||
-rw-r--r-- | execute.php | 11 |
6 files changed, 50 insertions, 2 deletions
diff --git a/docs/bird.md b/docs/bird.md new file mode 100644 index 0000000..068f645 --- /dev/null +++ b/docs/bird.md @@ -0,0 +1,9 @@ +# Looking Glass: BIRD configuration and tips. + +Easy to deploy Looking Glass made in PHP. + +## Security and user access + +## Configuration + +## Debug diff --git a/docs/cisco.md b/docs/cisco.md new file mode 100644 index 0000000..17ad0fe --- /dev/null +++ b/docs/cisco.md @@ -0,0 +1,9 @@ +# Looking Glass: Cisco IOS configuration and tips. + +Easy to deploy Looking Glass made in PHP. + +## Security and user access + +## Configuration + +## Debug diff --git a/docs/juniper.md b/docs/juniper.md new file mode 100644 index 0000000..6de658f --- /dev/null +++ b/docs/juniper.md @@ -0,0 +1,9 @@ +# Looking Glass: Juniper JunOS configuration and tips. + +Easy to deploy Looking Glass made in PHP. + +## Security and user access + +## Configuration + +## Debug diff --git a/docs/misc.md b/docs/misc.md new file mode 100644 index 0000000..9c29361 --- /dev/null +++ b/docs/misc.md @@ -0,0 +1,5 @@ +# Looking Glass: Miscellaneous information + +## Topic 1 + +## Topic 2 diff --git a/docs/quagga.md b/docs/quagga.md new file mode 100644 index 0000000..b3cbc0d --- /dev/null +++ b/docs/quagga.md @@ -0,0 +1,9 @@ +# Looking Glass: Quagga/Zebra configuration and tips. + +Easy to deploy Looking Glass made in PHP. + +## Security and user access + +## Configuration + +## Debug diff --git a/execute.php b/execute.php index a6f0a15..12d819e 100644 --- a/execute.php +++ b/execute.php @@ -22,6 +22,13 @@ require_once 'config.php'; require_once 'routers/router.php'; +// From where the user *really* comes from. +if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $requester = $_SERVER['HTTP_X_FORWARDED_FOR']; +} else { + $requester = $_SERVER['REMOTE_ADDR']; +} + function process_output($output) { global $config; @@ -57,7 +64,7 @@ function process_output($output) { // Obvious spam if (!isset($_POST['dontlook']) || !empty($_POST['dontlook'])) { - log_to_file('Spam detected from '.$_SERVER['REMOTE_ADDR'].'.'); + log_to_file('Spam detected from '.$requester.'.'); die('Spam detected'); } @@ -69,7 +76,7 @@ if (isset($_POST['query']) && !empty($_POST['query']) && $parameters = htmlspecialchars($_POST['parameters']); // Do the processing - $router = Router::instance($hostname, $_SERVER['REMOTE_ADDR']); + $router = Router::instance($hostname, $requester); try { $output = $router->send_command($query, $parameters); |