diff options
Diffstat (limited to 'config/ifstated.xml')
-rw-r--r-- | config/ifstated.xml | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/config/ifstated.xml b/config/ifstated.xml new file mode 100644 index 00000000..5adcf9c4 --- /dev/null +++ b/config/ifstated.xml @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + authng.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + 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. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>Describe your package here</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>ifstated</name> + <version>20041117</version> + <title>ifstated: Settings</title> + <aftersaveredirect>pkg_edit.php?xml=ifstated.xml&id=0&savemsg=Updated</aftersaveredirect> + <menu> + <name>ifstated</name> + <tooltiptext>Modify ifstated settings.</tooltiptext> + <section>Services</section> + <configfile>ifstated.xml</configfile> + <url>/pkg_edit.php?xml=ifstated.xml&id=0</url> + </menu> + <modify_system> + <modifyitem> + <modifyfilename>/etc/sysctl.conf</modifyfilename> + <textneeded>net.inet.carp.preempt=1</textneeded> + </modifyitem> + </modify_system> + <configpath>installedpackages->package->$packagename->configuration->settings</configpath> + <fields> + <field> + <fielddescr>External Test IP</fielddescr> + <fieldname>exttestip</fieldname> + <description>Enter an IP to test external connectivity with. This should be a host with extremely high availability.</description> + <type>input</type> + </field> + <field> + <fielddescr>Internal Test IP</fielddescr> + <fieldname>inttestip</fieldname> + <description>Enter an IP to test internal connectivity with. This should be a host with extremely high availability.</description> + <type>input</type> + </field> + <field> + <fielddescr>Paired Firewall External IP</fielddescr> + <fieldname>pairextip</fieldname> + <description>Enter the real IP of the other firewall's (real) external interface.</description> + <type>input</type> + </field> + <field> + <fielddescr>Paired Firewall Internal IP</fielddescr> + <fieldname>pairintip</fieldname> + <description>Enter the real IP of the other firewall's (real) internal interface.</description> + <type>input</type> + </field> + <field> + <fielddescr>Initial State</fielddescr> + <fieldname>initstate</fieldname> + <description>Enter the desired initial state for this firewall.</description> + <type>select</type> + <options> + <option> + <name>Primary</name> + <value>primary</value> + </option> + <option> + <name>Backup</name> + <value>backup</value> + </option> + </options> + </field> + </fields> + <custom_add_php_command> + conf_mount_rw(); + config_lock(); + global $config; + if ($_POST == "") $_POST = $config['installedpackages']['ifstated']['config']; + $fout = fopen("/usr/local/etc/ifstated.conf","w"); + if($config['installedpackages']['ifstated']['config'] != "") { + fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); + fwrite($fout, "init-state " . $_POST['initstate'] . "\n\n"); + fwrite($fout, "carp_up = \"((carp0 link up) and (carp1 link up))\"\ncarp_down = \"((! carp0 link up) and (! carp1 link up))\"\ncarp_sync= \"((carp0 link up and carp1 link up) or ((!carp0 link up) and (!carp1 link up)))\"\n\n"); + fwrite($fout, "net = '( \"ping -q -c 1 -t 1 " . $_POST['exttestip'] . " > /dev/null\" every 10 and \"ping -q -c 1 -t 1 " . $_POST['inttestip'] . " > /dev/null\" every 10)'\n\n"); + fwrite($fout, "peer = '( \"ping -q -c 1 -t 1 " . $_POST['pairextip'] . " > /dev/null\" every 10 and \"ping -q -c 1 -t 1 " . $_POST['pairintip'] . " > /dev/null\" every 10)'\n\n"); + fwrite($fout, "state auto {\nif \$carp_up {\nset-state primary\n}\nif \$carp_down {\nset-state backup\n}\n}\n\n"); + fwrite($fout, "state primary {\ninit {\nrun \"ifconfig carp0 advskew 10\"\nrun \"ifconfig carp1 advskew 10\"\n}\nif ! \$net {\nset-state demoted\n}\n}\n\nstate demoted {\ninit {\nrun \"ifconfig carp0 advskew 254\"\nrun \"ifconfig carp1 advskew 254\"\n}\nif \$net {\nset-state primary\n}\n}\n\n"); + fwrite($fout, "state promoted {\ninit {\nrun \"ifconfig carp0 advskew 0\"\nrun \"ifconfig carp1 advskew 0\"\n}\nif \$peer or ! \$net {\nset-state backup\n}\n}\n\n"); + fwrite($fout, "state backup {\ninit {\nrun \"ifconfig carp0 advskew 100\"\nrun \"ifconfig carp1 advskew 100\"\n}\nif ! \$carp_sync and \$net and \"sleep 5\" every 10 {\nif (! \$carp_sync) and \$net {\nset-state promoted\n}\n}\n}\n"); + } + fclose($fout); + conf_mount_ro(); + config_unlock(); + mwexec("/usr/bin/killall -HUP ifstated"); + </custom_add_php_command> + <custom_php_install_command> + global $config; + $fout = fopen("/usr/local/etc/rc.d/ifstated.sh","w"); + fwrite($fout,"#!/bin/sh\n\n/usr/local/sbin/ifstated\n"); + fwrite($fout, "# PACKAGE: IFStated\n"); + fwrite($fout, "# EXECUTABLE: ifstated\n"); + fclose($fout); + chmod("/usr/local/etc/rc.d/ifstated.sh", 0755); + </custom_php_install_command> +</packagegui> + |