diff --git a/security/stunnel/Makefile b/security/stunnel/Makefile
index f0a6ca8a2..c27c8c326 100644
--- a/security/stunnel/Makefile
+++ b/security/stunnel/Makefile
@@ -1,6 +1,5 @@
PLUGIN_NAME= stunnel
-PLUGIN_VERSION= 1.0.4
-PLUGIN_REVISION= 1
+PLUGIN_VERSION= 1.0.5
PLUGIN_COMMENT= Stunnel TLS proxy
PLUGIN_MAINTAINER= ad@opnsense.org
PLUGIN_DEPENDS= stunnel
diff --git a/security/stunnel/src/opnsense/mvc/app/controllers/OPNsense/Stunnel/forms/dialogService.xml b/security/stunnel/src/opnsense/mvc/app/controllers/OPNsense/Stunnel/forms/dialogService.xml
index 2b7f7bb64..dc8008bd9 100644
--- a/security/stunnel/src/opnsense/mvc/app/controllers/OPNsense/Stunnel/forms/dialogService.xml
+++ b/security/stunnel/src/opnsense/mvc/app/controllers/OPNsense/Stunnel/forms/dialogService.xml
@@ -41,6 +41,17 @@
dropdown
+
+ service.chainIntermediateCAs
+
+ checkbox
+ true
+
+
service.cacert
diff --git a/security/stunnel/src/opnsense/mvc/app/models/OPNsense/Stunnel/Stunnel.xml b/security/stunnel/src/opnsense/mvc/app/models/OPNsense/Stunnel/Stunnel.xml
index 13e2f02fd..d81c05a6a 100644
--- a/security/stunnel/src/opnsense/mvc/app/models/OPNsense/Stunnel/Stunnel.xml
+++ b/security/stunnel/src/opnsense/mvc/app/models/OPNsense/Stunnel/Stunnel.xml
@@ -1,6 +1,6 @@
//OPNsense/Stunnel
- 1.0.3
+ 1.0.4
Stunnel TLS encryption proxy
@@ -81,6 +81,10 @@
cert
Please select a valid certificate from the list
+
+ 0
+ Y
+
N
/^([\t\n\v\f\r 0-9a-zA-Z.\-,_\x{00A0}-\x{FFFF}]){0,255}$/u
diff --git a/security/stunnel/src/opnsense/scripts/stunnel/generate_certs.php b/security/stunnel/src/opnsense/scripts/stunnel/generate_certs.php
index 908e7dd70..7d1d8bdb4 100755
--- a/security/stunnel/src/opnsense/scripts/stunnel/generate_certs.php
+++ b/security/stunnel/src/opnsense/scripts/stunnel/generate_certs.php
@@ -28,6 +28,8 @@
*/
require_once('plugins.inc');
+require_once('config.inc');
+require_once('certs.inc');
require_once("legacy_bindings.inc");
use OPNsense\Stunnel\Stunnel;
@@ -43,8 +45,15 @@ foreach ($stunnel->services->service->iterateItems() as $service) {
$srv_certid = (string)$service->servercert;
foreach ($configObj->cert as $cert) {
if ($srv_certid == (string)$cert->refid) {
- $all_certs["{$base_path}/{$this_uuid}.crt"] =
- base64_decode((string)$cert->crt) . "\n" . base64_decode((string)$cert->prv);
+ $all_certs["{$base_path}/{$this_uuid}.crt"] = base64_decode((string)$cert->crt);
+ if (!empty((string)$service->chainIntermediateCAs)) {
+ $certArr = (array)$cert;
+ $chain = ca_chain($certArr);
+ if (!empty($chain)) {
+ $all_certs["{$base_path}/{$this_uuid}.crt"] .= $chain;
+ }
+ }
+ $all_certs["{$base_path}/{$this_uuid}.crt"] .= "\n" . base64_decode((string)$cert->prv);
}
}
if (!empty((string)$service->cacert)) {
diff --git a/security/stunnel/src/opnsense/service/conf/actions.d/actions_stunnel.conf b/security/stunnel/src/opnsense/service/conf/actions.d/actions_stunnel.conf
index 2ab897d8d..e869be423 100644
--- a/security/stunnel/src/opnsense/service/conf/actions.d/actions_stunnel.conf
+++ b/security/stunnel/src/opnsense/service/conf/actions.d/actions_stunnel.conf
@@ -32,6 +32,7 @@ command:
parameters:
type:script
message:stunnel service restart
+description:Restart Stunnel
[status]
command:/usr/local/etc/rc.d/stunnel status; /usr/local/etc/rc.d/identd_stunnel onestatus; exit 0