diff --git a/net/tinc/Makefile b/net/tinc/Makefile
index e58ded59a..41e14819d 100644
--- a/net/tinc/Makefile
+++ b/net/tinc/Makefile
@@ -1,5 +1,5 @@
PLUGIN_NAME= tinc
-PLUGIN_VERSION= 0.1
+PLUGIN_VERSION= 0.2
PLUGIN_COMMENT= Tinc VPN
PLUGIN_DEPENDS= tinc
PLUGIN_MAINTAINER= ad@opnsense.org
diff --git a/net/tinc/src/etc/inc/plugins.inc.d/if_tinc.inc b/net/tinc/src/etc/inc/plugins.inc.d/if_tinc.inc
new file mode 100644
index 000000000..46039fd6e
--- /dev/null
+++ b/net/tinc/src/etc/inc/plugins.inc.d/if_tinc.inc
@@ -0,0 +1,105 @@
+ array('tinc'),
+ 'remote' => 'vpn',
+ );
+
+ return $logfacilities;
+}
+
+function if_tinc_services()
+{
+ global $config;
+
+ $services = array();
+ $is_enabled = false;
+ if (isset($config['OPNsense']['proxy']['general']['enabled']) && $config['OPNsense']['proxy']['general']['enabled'] == 1) {
+ if (isset($config['OPNsense']['Tinc']['networks']['network'])) {
+ if (!isset($config['OPNsense']['Tinc']['networks']['network'][0])) {
+ $networks = array($config['OPNsense']['Tinc']['networks']['network']);
+ } else {
+ $networks = $config['OPNsense']['Tinc']['networks']['network'];
+ }
+ foreach ($networks as $network) {
+ if (!empty($network['enabled'])) {
+ $is_enabled = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if ($is_enabled) {
+ $services[] = array(
+ 'description' => gettext('Tinc server'),
+ 'configd' => array(
+ 'restart' => array('tinc restart'),
+ 'start' => array('tinc start'),
+ 'stop' => array('tinc stop'),
+ ),
+ 'name' => 'tincd',
+ );
+ }
+
+ return $services;
+}
+
+function if_tinc_interfaces()
+{
+ global $config;
+
+ $interfaces = array();
+
+ if (isset($config['OPNsense']['Tinc']['networks']['network'])) {
+ if (!isset($config['OPNsense']['Tinc']['networks']['network'][0])) {
+ $networks = array($config['OPNsense']['Tinc']['networks']['network']);
+ } else {
+ $networks = $config['OPNsense']['Tinc']['networks']['network'];
+ }
+ foreach ($networks as $network) {
+ if (!empty($network['enabled'])) {
+ $oic = array('enable' => true);
+ $oic['if'] = 'tinc';
+ $oic['descr'] = 'TincVPN';
+ $oic['type'] = 'none';
+ $oic['virtual'] = true;
+ $oic['networks'] = array();
+ $interfaces['tinc'] = $oic;
+ break;
+ }
+ }
+ }
+
+ return $interfaces;
+}
diff --git a/net/tinc/src/etc/rc.d/opnsense-tincd b/net/tinc/src/etc/rc.d/opnsense-tincd
new file mode 100755
index 000000000..1e3362ce4
--- /dev/null
+++ b/net/tinc/src/etc/rc.d/opnsense-tincd
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: tincd
+# REQUIRE: SERVERS
+# KEYWORD: shutdown
+#
+
+. /etc/rc.subr
+
+name=opnsense-tincd
+
+stop_cmd=tincd_stop
+start_cmd=tincd_start
+
+# stop tincd
+tincd_stop()
+{
+ echo "stopping tincd"
+ /usr/local/opnsense/scripts/OPNsense/Tinc/tincd.py stop
+}
+
+# start tincd
+tincd_start()
+{
+ echo "starting tincd"
+ /usr/local/opnsense/scripts/OPNsense/Tinc/tincd.py start
+}
+
+run_rc_command $1
diff --git a/net/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/ServiceController.php b/net/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/ServiceController.php
index 1ed8d1916..0da9416a3 100644
--- a/net/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/ServiceController.php
+++ b/net/tinc/src/opnsense/mvc/app/controllers/OPNsense/Tinc/Api/ServiceController.php
@@ -37,7 +37,6 @@ use \OPNsense\Core\Backend;
*/
class ServiceController extends ApiControllerBase
{
-
/**
* reconfigure captive portal
*/
@@ -53,4 +52,49 @@ class ServiceController extends ApiControllerBase
return array("status" => "failed");
}
}
+
+ /**
+ * start tinc service (in background)
+ * @return array
+ */
+ public function startAction()
+ {
+ if ($this->request->isPost()) {
+ $backend = new Backend();
+ $response = $backend->configdRun("tinc start", true);
+ return array("response" => $response);
+ } else {
+ return array("response" => array());
+ }
+ }
+
+ /**
+ * stop tinc service
+ * @return array
+ */
+ public function stopAction()
+ {
+ if ($this->request->isPost()) {
+ $backend = new Backend();
+ $response = $backend->configdRun("tinc stop");
+ return array("response" => $response);
+ } else {
+ return array("response" => array());
+ }
+ }
+
+ /**
+ * restart tinc service
+ * @return array
+ */
+ public function restartAction()
+ {
+ if ($this->request->isPost()) {
+ $backend = new Backend();
+ $response = $backend->configdRun("tinc restart");
+ return array("response" => $response);
+ } else {
+ return array("response" => array());
+ }
+ }
}
diff --git a/net/tinc/src/opnsense/mvc/app/models/OPNsense/Tinc/ACL/ACL.xml b/net/tinc/src/opnsense/mvc/app/models/OPNsense/Tinc/ACL/ACL.xml
new file mode 100644
index 000000000..91fe58bcd
--- /dev/null
+++ b/net/tinc/src/opnsense/mvc/app/models/OPNsense/Tinc/ACL/ACL.xml
@@ -0,0 +1,11 @@
+