diff --git a/emhttp/plugins/dynamix/OutgoingProxy.page b/emhttp/plugins/dynamix/OutgoingProxy.page new file mode 100644 index 000000000..7b5474270 --- /dev/null +++ b/emhttp/plugins/dynamix/OutgoingProxy.page @@ -0,0 +1,314 @@ +Menu="OutgoingProxyManager" +Title="Outgoing Proxy Manager" +Tag="icon-network" +--- + + +
+ + diff --git a/emhttp/plugins/dynamix/OutgoingProxy.php b/emhttp/plugins/dynamix/OutgoingProxy.php new file mode 100644 index 000000000..4ea3c6209 --- /dev/null +++ b/emhttp/plugins/dynamix/OutgoingProxy.php @@ -0,0 +1,50 @@ + $proxy_1_status, 'proxy_status_2' => $proxy_2_status, 'proxy_status_3' => $proxy_3_status )); + break; + + default: + outgoingproxy_log("Undefined POST action - ".$_POST['action']."."); + break; +} +?> diff --git a/emhttp/plugins/dynamix/OutgoingProxyManager.page b/emhttp/plugins/dynamix/OutgoingProxyManager.page new file mode 100644 index 000000000..91c1bf768 --- /dev/null +++ b/emhttp/plugins/dynamix/OutgoingProxyManager.page @@ -0,0 +1,6 @@ +Menu="NetworkServices" +Type="xmenu" +Title="Outgoing Proxy Manager" +Icon="icon-network" +Tag="icon-network" +--- diff --git a/emhttp/plugins/dynamix/include/OutgoingProxyLib.php b/emhttp/plugins/dynamix/include/OutgoingProxyLib.php new file mode 100644 index 000000000..0a3b07b23 --- /dev/null +++ b/emhttp/plugins/dynamix/include/OutgoingProxyLib.php @@ -0,0 +1,108 @@ + '', + 'user' => '', + 'pass' => '', + ]; + + if ($cfg_url) { + /* Parse the URL by removing the user and password. */ + $urlComponents = parse_url($cfg_url); + + /* Parse user, password, host, and port from stored URL. */ + $host = isset($urlComponents['host']) ? $urlComponents['host'] : ''; + $port = isset($urlComponents['port']) ? $urlComponents['port'] : ''; + $user = isset($urlComponents['user']) ? $urlComponents['user'] : ''; + $pass = isset($urlComponents['pass']) ? $urlComponents['pass'] : ''; + + /* Return array of url, user, and password. */ + $return['url'] = "http://".$host.':'.$port; + + /* Extract the credentials. */ + if (strpos($cfg_url, '%') !== false) { + /* The credentials are urlencoded. */ + $return['user'] = urldecode($user); + $return['pass'] = urldecode($pass); + } else { + /* The credentials are not urlencoded. */ + $return['user'] = $user; + $return['pass'] = $pass; + } + } + + return($return); +} +?> diff --git a/emhttp/plugins/dynamix/scripts/outgoingproxy.sh b/emhttp/plugins/dynamix/scripts/outgoingproxy.sh new file mode 100644 index 000000000..5858ac9a0 --- /dev/null +++ b/emhttp/plugins/dynamix/scripts/outgoingproxy.sh @@ -0,0 +1,117 @@ +#!/usr/bin/php + $value) { + $iniString .= "$key=\"$value\"\n"; + } + + /* Write the INI string to a file. */ + file_put_contents($proxy_config_file, $iniString); + + /* Let things settle. */ + sleep(1); + + /* Now run the proxy setup script. */ + if (is_executable("/usr/local/sbin/set_proxy")) { + exec("at -M -f /usr/local/sbin/set_proxy now 2>/dev/null"); + + outgoingproxy_log("'set_proxy' script executed"); + } else { + outgoingproxy_log("'set_proxy' script does not exist"); + } +} + +/* Main entry point, */ +switch ($argv[1]) { + case 'apply': + apply(); + break; + + default: + echo("Error: 'outgoingproxy.sh {$argv[1]}' not understood\n"); + echo("outgoingproxy.sh usage: 'apply'\n"); + exit(0); + break; +} +?>