From fd35ae36988a56037634d0c3aea37296260e9b45 Mon Sep 17 00:00:00 2001 From: apnar Date: Tue, 28 Aug 2012 19:04:32 +0000 Subject: adding tinc package --- config/tinc/status_tinc.php | 24 +++++ config/tinc/tinc.inc | 173 ++++++++++++++++++++++++++++++++++++ config/tinc/tinc.xml | 97 ++++++++++++++++++++ config/tinc/tinc_config.xml | 209 ++++++++++++++++++++++++++++++++++++++++++++ config/tinc/tinc_hosts.xml | 167 +++++++++++++++++++++++++++++++++++ 5 files changed, 670 insertions(+) create mode 100644 config/tinc/status_tinc.php create mode 100644 config/tinc/tinc.inc create mode 100644 config/tinc/tinc.xml create mode 100644 config/tinc/tinc_config.xml create mode 100644 config/tinc/tinc_hosts.xml (limited to 'config/tinc') 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 @@ + + +"> + + + +1:
+
+
+
+
+2:
+
+
+
+ + + 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 @@ +/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 @@ + + + + + + + + A self-contained VPN solution designed to connect multiple sites together in a secure way. + Describe your package requirements here + Currently there are no FAQ items provided. + tinc + 1.0.18 + VPN: tinc + + + tinc + tinc is a mesh VPN daemon. +
VPN
+ tinc_config.xml + /pkg_edit.php?xml=tinc_config.xml +
+ + tinc + Status of tinc VPN Daemon +
Status
+ /status_tinc.php +
+ + + /usr/local/pkg/ + 0644 + http://www.pfsense.com/packages/config/tinc/tinc.inc + + + /usr/local/pkg/ + 0644 + http://www.pfsense.com/packages/config/tinc/tinc_config.xml + + + /usr/local/pkg/ + 0644 + http://www.pfsense.com/packages/config/tinc/tinc_hosts.xml + + + /usr/local/www/ + 0644 + http://www.pfsense.com/packages/config/tinc/status_tinc.php + + + + tinc + tinc.sh + tincd + + /usr/local/pkg/tinc.inc + + + tinc_install(); + + + tinc_deinstall(); + + +
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 @@ + + + + + + + + tinc + 1.0.18 + VPN: tinc + + + ['installedpackages']['package']['$packagename']['config'] + + + + Config + /pkg_edit.php?xml=tinc_config.xml + + + + Hosts + /pkg.php?xml=tinc_hosts.xml + + + enabled + + + Name + name + This is the name which identifies this tinc daemon. It must be unique for the virtual private network this daemon will connect to. + input + + + Local IP + localip + IP Address of local tunnel interface. This is often the same IP as your routers LAN address, for example 192.168.2.1 + input + + + Local Subnet + localsubnet + Subnet behind this router that should be advertised to the mesh. This is usually your LAN subnet, for example 192.168.2.0/24 + input + + + VPN Netmask + vpnnetmask + 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 + input + + + AddressFamily + addressfamily + 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. + select + + + + + + + + RSA private key + cert_key + RSA private key used for this host. Include the BEGIN and END lines. <br> + textarea + base64 + 7 + 65 + + + RSA public key + cert_pub + RSA public key used for this host. Include the BEGIN and END lines. <br> + textarea + base64 + 7 + 65 + + + Extra Tinc Parameters + extra + Anything entered here will be added at the end of the tinc.conf configuration file. <br> + textarea + base64 + 8 + 65 + + + + Extra Host Parameters + host_extra + Anything entered here will be added just prior to the public certiciate in the host configuration file for this machine. <br> + textarea + base64 + 8 + 65 + + + + Interface Up Script + tinc_up + 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. + textarea + base64 + 8 + 65 + + + + Interface Down Script + tinc_down + This script is executed right before the tinc daemon is going to close. + textarea + base64 + 8 + 65 + + + + Host Up Script + host_up + This script is executed when any host becomes reachable. + textarea + base64 + 8 + 65 + + + + Host Down Script + host_down + This script is executed when any host becomes unreachable. + textarea + base64 + 8 + 65 + + + + Subnet Up Script + subnet_up + This script is executed when any subnet becomes reachable. + textarea + base64 + 8 + 65 + + + + Subnet Down Script + subnet_down + This script is executed when any subnet becomes unreachable. + textarea + base64 + 8 + 65 + + + + /usr/local/pkg/tinc.inc + + tinc_save(); + + 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 @@ + + + + + + + + tinc Hosts + + Currently there are no FAQ items provided. + tinchosts + 1.0.18 + VPN: tinc - Hosts + + ['installedpackages']['package']['$packagename']['config'] + + + + Config + /pkg_edit.php?xml=tinc_config.xml + + + Hosts + /pkg.php?xml=tinc_hosts.xml + + + + enabled + + + + + Name + name + + + Address + address + + + Subnet + subnet + + + Connect at Startup + connect + checkbox + + + + + + + Name + name + Name of this host. + input + + + Address + address + IP address or hostname of server. + input + + + Subnet + subnet + Subnet behind host (like 192.168.254.0/24) + input + 50 + + + Connect at Startup + connect + Try to connect to this host when tinc starts. + checkbox + + + RSA public key + cert_pub + RSA public key used for this host. Include the BEGIN and END lines.<br> + textarea + base64 + 7 + 65 + + + Extra Parameters + extra + Anything entered here will be added just prior to the public certiciate in the host configuration file. <br> + textarea + base64 + 8 + 65 + + + + Host Up Script + host_up + This script will be run when this host becomes reachable. <br> + textarea + base64 + 8 + 65 + + + + Host Down Script + host_down + This script will be run when this host becomes unreachable. <br> + textarea + base64 + 8 + 65 + + + + /usr/local/pkg/tinc.inc + + + + tinc_save(); + + + + + + + tinc_save(); + + -- cgit v1.2.3