From 981f03e5a9d51174667732340135fd7d1d71ebe9 Mon Sep 17 00:00:00 2001 From: Scott Dale Date: Mon, 23 Jul 2007 03:20:36 +0000 Subject: [PATCH] new ipsec widget --- usr/local/www/widgets/include/ipsec.inc | 54 ++++ .../www/widgets/widgets/ipsec.widget.php | 240 ++++++++++++++++++ 2 files changed, 294 insertions(+) create mode 100644 usr/local/www/widgets/include/ipsec.inc create mode 100644 usr/local/www/widgets/widgets/ipsec.widget.php diff --git a/usr/local/www/widgets/include/ipsec.inc b/usr/local/www/widgets/include/ipsec.inc new file mode 100644 index 0000000000..0a7bb2c04e --- /dev/null +++ b/usr/local/www/widgets/include/ipsec.inc @@ -0,0 +1,54 @@ + 'LAN', 'wan' => 'WAN'); + $carpips = find_number_of_needed_carp_interfaces(); + for($j=0; $j<$carpips; $j++) { + $interfaceip = find_interface_ip("carp" . $j); + $iflabels['carp' . $j] = $interfaceip; + } + for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { + $realinterface = convert_friendly_interface_to_real_interface_name('opt' . $j); + $iflabels['opt' . $j] = find_interface_ip($realinterface); + } + $interfaceip = $iflabels[$tunnel['interface']]; + } else { + $realinterface = convert_friendly_interface_to_real_interface_name($if); + $interfaceip = find_interface_ip($realinterface); + } + return $interfaceip; +} + +function output_ipsec_tunnel_status($tunnel) { + global $g, $config, $sad; + $if = "WAN"; + $interfaceip = get_ipsec_tunnel_src($tunnel); + $interfaceip = strtolower($interfaceip); + + $foundsrc = false; + $founddst = false; + foreach($sad as $sa) { + $sourceIF = find_ip_interface($sa['src']); + $sourceIF = convert_real_interface_to_friendly_interface_name($sourceIF); + if($sourceIF == $tunnel['interface']) + $foundsrc = true; + if($sa['dst'] == $tunnel['remote-gateway']) + $founddst = true; + } + if($foundsrc && $founddst) { + /* tunnel is up */ + $iconfn = true; + } else { + /* tunnel is down */ + $iconfn = false; + } + return $iconfn; +} + + +?> \ No newline at end of file diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php new file mode 100644 index 0000000000..c1dd987dc8 --- /dev/null +++ b/usr/local/www/widgets/widgets/ipsec.widget.php @@ -0,0 +1,240 @@ +, Manuel Kasper + and Jonathan Watt . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +?> + +
 
+ +
+
+ + + + + + + + + + + + + + + + +
Active TunnelsInactive Tunnels
+

+ + + + Note:
+
+
+ You can configure your IPSEC + here. +
+

+
+
+
+ + + + + +