diff options
author | apnar <jlukens@botch.com> | 2012-08-28 19:04:32 +0000 |
---|---|---|
committer | apnar <jlukens@botch.com> | 2012-08-28 19:04:32 +0000 |
commit | fd35ae36988a56037634d0c3aea37296260e9b45 (patch) | |
tree | a00034e110ebd9af8bb6defb9f00048a076a3a76 /config/tinc | |
parent | b45d015aecc992c5a225118a5101ce7b83752d8e (diff) | |
download | pfsense-packages-fd35ae36988a56037634d0c3aea37296260e9b45.tar.gz pfsense-packages-fd35ae36988a56037634d0c3aea37296260e9b45.tar.bz2 pfsense-packages-fd35ae36988a56037634d0c3aea37296260e9b45.zip |
adding tinc package
Diffstat (limited to 'config/tinc')
-rw-r--r-- | config/tinc/status_tinc.php | 24 | ||||
-rw-r--r-- | config/tinc/tinc.inc | 173 | ||||
-rw-r--r-- | config/tinc/tinc.xml | 97 | ||||
-rw-r--r-- | config/tinc/tinc_config.xml | 209 | ||||
-rw-r--r-- | config/tinc/tinc_hosts.xml | 167 |
5 files changed, 670 insertions, 0 deletions
diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php new file mode 100644 index 00000000..17b8e48c --- /dev/null +++ b/config/tinc/status_tinc.php @@ -0,0 +1,24 @@ +<?php + +$pgtitle = array(gettext("Status"), "tinc"); +require("guiconfig.inc"); +require_once("tinc.inc"); + +include("head.inc"); ?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?=$jsevents["body"]["onload"];?>"> +<?php include("fbegin.inc"); ?> + + +1:<BR> +<pre> +<?php print tinc_status_1(); ?> +</pre> +<BR> +2:<BR> +<pre> +<?php print tinc_status_2(); ?> +</pre> + + +<?php include("fend.inc"); ?> diff --git a/config/tinc/tinc.inc b/config/tinc/tinc.inc new file mode 100644 index 00000000..c191de5a --- /dev/null +++ b/config/tinc/tinc.inc @@ -0,0 +1,173 @@ +<?php + +if(!isset($_GET['id']) and !isset($_POST['id'])) { + if($GLOBALS['config']['installedpackages']['tinchosts']['savemsg']) { + $savemsg=$GLOBALS['config']['installedpackages']['tinchosts']['savemsg']; + unset($GLOBALS['config']['installedpackages']['tinchosts']['savemsg']); + write_config(); + } + +} + +$hosts=$config['installedpackages']['tinchosts']['config']; +is_array($hosts) ? $num_hosts=count($hosts) : $num_hosts=0; +if(!isset($_GET['id']) and !isset($_POST['id']) and $num_hosts) { + for ($i=0;$i<$num_hosts;$i++) { + $host=$hosts[$i]; + } +} + + +function tinc_save() { + $GLOBALS['config']['installedpackages']['tinchosts']['savemsg']=''; + conf_mount_rw(); + config_lock(); + exec("/bin/mv -f /usr/local/etc/tinc /usr/local/etc/tinc.old"); + safe_mkdir("/usr/local/etc/tinc"); + safe_mkdir("/usr/local/etc/tinc/hosts"); + exec("touch /usr/local/etc/tinc/WARNING-ENTIRE_DIRECTORY_ERASED_ON_SAVE_FROM_GUI"); + $tincconf = $GLOBALS['config']['installedpackages']['tinc']['config'][0]; + $fout = fopen("/usr/local/etc/tinc/tinc.conf","w"); + fwrite($fout, "name=".$tincconf['name']."\n"); + fwrite($fout, "AddressFamily=".$tincconf['addressfamily']."\n"); + if(!is_array($GLOBALS['config']['installedpackages']['tinchosts']['config'])) { $GLOBALS['config']['installedpackages']['tinchosts']['config']=Array(); } + foreach($GLOBALS['config']['installedpackages']['tinchosts']['config'] as $host) { + if($host['connect']) + { + fwrite($fout, "ConnectTo=" . $host['name'] . "\n"); + } + + $_output = "Address=".$host['address']."\n"; + $_output .= "Subnet=".$host['subnet']."\n"; + $_output .= base64_decode($host['extra'])."\n"; + $_output .= base64_decode($host['cert_pub'])."\n"; + file_put_contents('/usr/local/etc/tinc/hosts/'.$host['name'],$_output); + if($host['host_up']) + { + file_put_contents('/usr/local/etc/tinc/hosts/'.$host['name'].'-up',base64_decode($host['host_up'])."\n"); + chmod('/usr/local/etc/tinc/hosts/'.$host['name'].'-up', 0744); + } + if($host['host_down']) + { + file_put_contents('/usr/local/etc/tinc/hosts/'.$host['name'].'-down',base64_decode($host['host_down'])."\n"); + chmod('/usr/local/etc/tinc/hosts/'.$host['name'].'-down', 0744); + } + } + fwrite($fout, base64_decode($tincconf['extra'])."\n"); + fclose($fout); + $_output = "Subnet=" . $tincconf['localsubnet'] . "\n"; + $_output .= base64_decode($tincconf['host_extra']) . "\n"; + $_output .= base64_decode($tincconf['cert_pub']) . "\n"; + file_put_contents('/usr/local/etc/tinc/hosts/' . $tincconf['name'],$_output); + file_put_contents('/usr/local/etc/tinc/rsa_key.priv',base64_decode($tincconf['cert_key'])."\n"); + chmod("/usr/local/etc/tinc/rsa_key.priv", 0600); + if($tincconf['tinc_up']) + { + $_output = base64_decode($tincconf['tinc_up']) . "\n"; + } + else + { + $_output = "ifconfig \$INTERFACE " . $tincconf['localip'] . " netmask " . $tincconf['vpnnetmask'] . "\n"; + } + file_put_contents('/usr/local/etc/tinc/tinc-up',$_output); + chmod("/usr/local/etc/tinc/tinc-up", 0744); + if($tincconf['tinc_down']) + { + file_put_contents('/usr/local/etc/tinc/tinc-down',base64_decode($tincconf['tinc_down']) . "\n"); + chmod("/usr/local/etc/tinc/tinc-down", 0744); + } + if($tincconf['host_up']) + { + file_put_contents('/usr/local/etc/tinc/host-up',base64_decode($tincconf['host_up']) . "\n"); + chmod("/usr/local/etc/tinc/host-up", 0744); + } + if($tincconf['host_down']) + { + file_put_contents('/usr/local/etc/tinc/host-down',base64_decode($tincconf['host_down']) . "\n"); + chmod("/usr/local/etc/tinc/host-down", 0744); + } + if($tincconf['subnet_up']) + { + file_put_contents('/usr/local/etc/tinc/subnet-up',base64_decode($tincconf['subnet_up']) . "\n"); + chmod("/usr/local/etc/tinc/subnet-up", 0744); + } + if($tincconf['subnet_down']) + { + file_put_contents('/usr/local/etc/tinc/subnet-down',base64_decode($tincconf['subnet_down']) . "\n"); + chmod("/usr/local/etc/tinc/subnet-down", 0744); + } + system("/usr/local/etc/rc.d/tinc.sh restart 2>/dev/null"); + rmdir_recursive("/usr/local/etc/tinc.old"); + conf_mount_ro(); + config_unlock(); +} + +function tinc_status_1() { + list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeb,$atime,$mtimeb,$ctime,$blksize,$blocks)=stat("/var/log/tinc.log"); + exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR1"); + exec("tail -c +" . $sizeb . " /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); + $output=""; + foreach($result as $line) + { + $output .= $line . "\n"; + } + return $output; +} + +function tinc_status_2() { + list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeb,$atime,$mtimeb,$ctime,$blksize,$blocks)=stat("/var/log/tinc.log"); + exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR2"); + exec("tail -c +" . $sizeb . " /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); + $output=""; + foreach($result as $line) + { + $output .= $line . "\n"; + } + return $output; +} + +function tinc_install() { + safe_mkdir("/usr/local/etc/tinc"); + safe_mkdir("/usr/local/etc/tinc/hosts"); +# make_dirs("/var/tmp/tinc/var/tmp/run/tinc"); +# system("/usr/sbin/chown -R tinc:tinc /var/tmp/tinc"); + $_rcfile['file']='tinc.sh'; + $_rcfile['start'].="/usr/local/sbin/tincd --config=/usr/local/etc/tinc\n\t"; + $_rcfile['stop'].="/usr/local/sbin/tincd --kill \n\t"; + write_rcfile($_rcfile); + unlink_if_exists("/usr/local/etc/rc.d/tincd"); + + conf_mount_rw(); + config_lock(); +/* + # find next free optional interface number + for ($i = 1; $i <= count($GLOBALS['config']['interfaces']); $i++) { + if (!$GLOBALS['config']['interfaces']["opt{$i}"]) + break; + } + $newifname = 'opt' . $i; + $descr = "TINC"; + $GLOBALS['config']['interfaces'][$newifname] = array(); + $GLOBALS['config']['interfaces'][$newifname]['descr'] = $descr; + + uksort($GLOBALS['config']['interfaces'], "compare_interface_friendly_names"); + + $GLOBALS['config']['interfaces'][$newifname]['if'] = "tun0"; +*/ + + /* XXX: Do not remove this. */ + mwexec("/bin/rm -f /tmp/config.cache"); + + write_config(); + + conf_mount_ro(); + config_unlock(); +} + +function tinc_deinstall() { + rmdir_recursive("/var/tmp/tinc"); + rmdir_recursive("/usr/local/etc/tinc*"); + unlink_if_exists("/usr/local/etc/rc.d/tinc.sh"); +} + +?> diff --git a/config/tinc/tinc.xml b/config/tinc/tinc.xml new file mode 100644 index 00000000..6c82529b --- /dev/null +++ b/config/tinc/tinc.xml @@ -0,0 +1,97 @@ +<?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$ */ +/* ========================================================================== */ +/* + tinc.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007-2008 Scott Ullrich + 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>A self-contained VPN solution designed to connect multiple sites together in a secure way.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>tinc</name> + <version>1.0.18</version> + <title>VPN: tinc</title> + <!-- Menu is where this packages menu will appear --> + <menu> + <name>tinc</name> + <tooltiptext>tinc is a mesh VPN daemon.</tooltiptext> + <section>VPN</section> + <configfile>tinc_config.xml</configfile> + <url>/pkg_edit.php?xml=tinc_config.xml</url> + </menu> + <menu> + <name>tinc</name> + <tooltiptext>Status of tinc VPN Daemon</tooltiptext> + <section>Status</section> + <url>/status_tinc.php</url> + </menu> + + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/tinc/tinc.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/tinc/tinc_config.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/tinc/tinc_hosts.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/tinc/status_tinc.php</item> + </additional_files_needed> + + <service> + <name>tinc</name> + <rcfile>tinc.sh</rcfile> + <executable>tincd</executable> + </service> + <include_file>/usr/local/pkg/tinc.inc</include_file> + + <custom_php_install_command> + tinc_install(); + </custom_php_install_command> + <custom_php_deinstall_command> + tinc_deinstall(); + </custom_php_deinstall_command> + +</packagegui> diff --git a/config/tinc/tinc_config.xml b/config/tinc/tinc_config.xml new file mode 100644 index 00000000..0d9ae2aa --- /dev/null +++ b/config/tinc/tinc_config.xml @@ -0,0 +1,209 @@ +<?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$ */ +/* ========================================================================== */ +/* + tinc_config.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007-2008 Scott Ullrich + 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> + <name>tinc</name> + <version>1.0.18</version> + <title>VPN: tinc</title> + + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['package']['$packagename']['config']</configpath> + + <tabs> + <tab> + <text>Config</text> + <url>/pkg_edit.php?xml=tinc_config.xml</url> + <active/> + </tab> + <tab> + <text>Hosts</text> + <url>/pkg.php?xml=tinc_hosts.xml</url> + </tab> + </tabs> + <advanced_options>enabled</advanced_options> + <fields> + <field> + <fielddescr>Name</fielddescr> + <fieldname>name</fieldname> + <description>This is the name which identifies this tinc daemon. It must be unique for the virtual private network this daemon will connect to.</description> + <type>input</type> + </field> + <field> + <fielddescr>Local IP</fielddescr> + <fieldname>localip</fieldname> + <description>IP Address of local tunnel interface. This is often the same IP as your routers LAN address, for example 192.168.2.1</description> + <type>input</type> + </field> + <field> + <fielddescr>Local Subnet</fielddescr> + <fieldname>localsubnet</fieldname> + <description>Subnet behind this router that should be advertised to the mesh. This is usually your LAN subnet, for example 192.168.2.0/24</description> + <type>input</type> + </field> + <field> + <fielddescr>VPN Netmask</fielddescr> + <fieldname>vpnnetmask</fieldname> + <description>This is the Netmask that defines what traffic is routed to the VPNs tunnel interface. It is usually broader then your local netmask, for example 255.255.0.0</description> + <type>input</type> + </field> + <field> + <fielddescr>AddressFamily</fielddescr> + <fieldname>addressfamily</fieldname> + <description>This option affects the address family of listening and outgoing sockets. If "any" is selected, then depending on the operating system both IPv4 and IPv6 or just IPv6 listening sockets will be created.</description> + <type>select</type> + <options> + <option> + <name>ipv4</name> + <value>ipv4</value> + </option> + <option> + <name>ipv6</name> + <value>ipv6</value> + </option> + <option> + <name>any</name> + <value>any</value> + </option> + </options> + </field> + <field> + <fielddescr>RSA private key</fielddescr> + <fieldname>cert_key</fieldname> + <description>RSA private key used for this host. Include the BEGIN and END lines. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>7</rows> + <cols>65</cols> + </field> + <field> + <fielddescr>RSA public key</fielddescr> + <fieldname>cert_pub</fieldname> + <description>RSA public key used for this host. Include the BEGIN and END lines. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>7</rows> + <cols>65</cols> + </field> + <field> + <fielddescr>Extra Tinc Parameters</fielddescr> + <fieldname>extra</fieldname> + <description>Anything entered here will be added at the end of the tinc.conf configuration file. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Extra Host Parameters</fielddescr> + <fieldname>host_extra</fieldname> + <description>Anything entered here will be added just prior to the public certiciate in the host configuration file for this machine. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Interface Up Script</fielddescr> + <fieldname>tinc_up</fieldname> + <description>This script is executed right after the tinc daemon has connected to the virtual network device. By default a tinc-up file is created that brings up the tinc interface with the IP Address and Netmask specified above. Entering a value here complely replaces the default script so be sure to bring up the interface in this script.</description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Interface Down Script</fielddescr> + <fieldname>tinc_down</fieldname> + <description>This script is executed right before the tinc daemon is going to close.</description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Host Up Script</fielddescr> + <fieldname>host_up</fieldname> + <description>This script is executed when any host becomes reachable.</description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Host Down Script</fielddescr> + <fieldname>host_down</fieldname> + <description>This script is executed when any host becomes unreachable.</description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Subnet Up Script</fielddescr> + <fieldname>subnet_up</fieldname> + <description>This script is executed when any subnet becomes reachable.</description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Subnet Down Script</fielddescr> + <fieldname>subnet_down</fieldname> + <description>This script is executed when any subnet becomes unreachable.</description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + </fields> + <include_file>/usr/local/pkg/tinc.inc</include_file> + <custom_php_resync_config_command> + tinc_save(); + </custom_php_resync_config_command> +</packagegui> diff --git a/config/tinc/tinc_hosts.xml b/config/tinc/tinc_hosts.xml new file mode 100644 index 00000000..683d81ac --- /dev/null +++ b/config/tinc/tinc_hosts.xml @@ -0,0 +1,167 @@ +<?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$ */ +/* ========================================================================== */ +/* + tinc_hosts.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007-2009 Scott Ullrich + 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>tinc Hosts</description> + <requirements></requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>tinchosts</name> + <version>1.0.18</version> + <title>VPN: tinc - Hosts</title> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['package']['$packagename']['config']</configpath> + + <tabs> + <tab> + <text>Config</text> + <url>/pkg_edit.php?xml=tinc_config.xml</url> + </tab> + <tab> + <text>Hosts</text> + <url>/pkg.php?xml=tinc_hosts.xml</url> + <active/> + </tab> + </tabs> + <advanced_options>enabled</advanced_options> + + <!-- adddeleteeditpagefields items will appear on the first page where you can add / delete or edit + items. An example of this would be the nat page where you add new nat redirects --> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Name</fielddescr> + <fieldname>name</fieldname> + </columnitem> + <columnitem> + <fielddescr>Address</fielddescr> + <fieldname>address</fieldname> + </columnitem> + <columnitem> + <fielddescr>Subnet</fielddescr> + <fieldname>subnet</fieldname> + </columnitem> + <columnitem> + <fielddescr>Connect at Startup</fielddescr> + <fieldname>connect</fieldname> + <type>checkbox</type> + </columnitem> + + </adddeleteeditpagefields> + <!-- fields gets invoked when the user adds or edits a item. the following items + will be parsed and rendered for the user as a gui with input, and selectboxes. --> + <fields> + <field> + <fielddescr>Name</fielddescr> + <fieldname>name</fieldname> + <description>Name of this host.</description> + <type>input</type> + </field> + <field> + <fielddescr>Address</fielddescr> + <fieldname>address</fieldname> + <description>IP address or hostname of server.</description> + <type>input</type> + </field> + <field> + <fielddescr>Subnet</fielddescr> + <fieldname>subnet</fieldname> + <description>Subnet behind host (like 192.168.254.0/24)</description> + <type>input</type> + <size>50</size> + </field> + <field> + <fielddescr>Connect at Startup</fielddescr> + <fieldname>connect</fieldname> + <description>Try to connect to this host when tinc starts.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>RSA public key</fielddescr> + <fieldname>cert_pub</fieldname> + <description>RSA public key used for this host. Include the BEGIN and END lines.<br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>7</rows> + <cols>65</cols> + </field> + <field> + <fielddescr>Extra Parameters</fielddescr> + <fieldname>extra</fieldname> + <description>Anything entered here will be added just prior to the public certiciate in the host configuration file. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Host Up Script</fielddescr> + <fieldname>host_up</fieldname> + <description>This script will be run when this host becomes reachable. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + <field> + <fielddescr>Host Down Script</fielddescr> + <fieldname>host_down</fieldname> + <description>This script will be run when this host becomes unreachable. <br></description> + <type>textarea</type> + <encoding>base64</encoding> + <rows>8</rows> + <cols>65</cols> + <advancedfield/> + </field> + </fields> + <include_file>/usr/local/pkg/tinc.inc</include_file> + <custom_add_php_command> + </custom_add_php_command> + <custom_php_resync_config_command> + tinc_save(); + </custom_php_resync_config_command> + <custom_php_command_before_form> + </custom_php_command_before_form> + <custom_php_after_form_command> + </custom_php_after_form_command> + <custom_delete_php_command> + tinc_save(); + </custom_delete_php_command> +</packagegui> |