From 3a14c6984da5200d10e4c5a0dcd5e6445ea27025 Mon Sep 17 00:00:00 2001 From: Romain Boissat rboissat Date: Tue, 5 Aug 2014 09:49:35 +0200 Subject: adding initial 'docs' directory with basic files --- docs/bird.md | 9 +++++++++ docs/cisco.md | 9 +++++++++ docs/juniper.md | 9 +++++++++ docs/misc.md | 5 +++++ docs/quagga.md | 9 +++++++++ 5 files changed, 41 insertions(+) create mode 100644 docs/bird.md create mode 100644 docs/cisco.md create mode 100644 docs/juniper.md create mode 100644 docs/misc.md create mode 100644 docs/quagga.md 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 -- cgit v1.2.3 From 592b22a06433ab3aa66f39f5c462af074ed6c992 Mon Sep 17 00:00:00 2001 From: Romain Boissat rboissat Date: Tue, 5 Aug 2014 10:08:45 +0200 Subject: completing HTTP_X_FORWARDED_FOR support --- execute.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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); -- cgit v1.2.3