aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/stunnel.xml15
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/stunnel.xml b/packages/stunnel.xml
index 611f614c..aa348bd3 100644
--- a/packages/stunnel.xml
+++ b/packages/stunnel.xml
@@ -70,13 +70,18 @@
</fields>
<custom_php_install_command>
system("mkdir /var/tmp/stunnel 2>/dev/null");
+ system("/usr/bin/openssl req -new -x509 -days 365 -nodes -out /usr/local/etc/stunnel/stunnel.pem -keyout /usr/local/etc/stunnel/stunnel.pem");
+ system("chmod a-r /usr/local/etc/stunnel/stunnel.pem");
+ system("chmod u+r /usr/local/etc/stunnel/stunnel.pem");
+ system("mkdir -p /var/tmp/stunnel/var/tmp");
+ system("chmod a+rw /var/tmp/stunnel/var/tmp/.");
</custom_php_install_command>
<custom_php_deinstall_command>
system("rm -rf /var/tmp/stunnel 2>/dev/null");
+ system("rm -rf /usr/local/etc/stunnel/stunnel.pem");
</custom_php_deinstall_command>
- <custom_add_php_command>
- global $config;
- $fout = fopen("/usr/local/etc/stunnel.conf","w");
+ <custom_add_php_command_late>
+ $fout = fopen("/usr/local/etc/stunnel/stunnel.conf","w");
fwrite($fout, "cert = /usr/local/etc/stunnel/mail.pem \n");
fwrite($fout, "chroot = /var/tmp/stunnel \n");
fwrite($fout, "setuid = stunnel \n");
@@ -84,10 +89,10 @@
foreach($config['installedpackages']['stunnel']['config'] as $pkgconfig) {
fwrite($fout, "\n[" . $pkgconfig['description'] . "]\n");
fwrite($fout, "accept = " . $pkgconfig['localip'] . ":" . $pkgconfig['localport'] . "\n");
- fwrite($fout, "accept = " . $pkgconfig['redirectip'] . ":" . $pkgconfig['redirectport'] . "\n\n");
+ fwrite($fout, "connect = " . $pkgconfig['redirectip'] . ":" . $pkgconfig['redirectport'] . "\n\n");
}
fclose($fout);
system("/usr/bin/killall stunnel 2>/dev/null");
system("/usr/local/sbin/stunnel 2>/dev/null");
- </custom_add_php_command>
+ </custom_add_php_command_late>
</packagegui>