Bladeren bron

work off package by adding an out-of-the-box server/daemon support

Ralf S. Engelschall 20 jaren geleden
bovenliggende
commit
86181b7eaf
3 gewijzigde bestanden met toevoegingen van 88 en 3 verwijderingen
  1. 38 0
      stunnel/rc.stunnel
  2. 43 0
      stunnel/stunnel.conf
  3. 7 3
      stunnel/stunnel.spec

+ 38 - 0
stunnel/rc.stunnel

@@ -5,12 +5,50 @@
 
 %config
     stunnel_enable="$openpkg_rc_def"
+    stunnel_daemon="no"
+    stunnel_flags=""
     stunnel_log_prolog="true"
     stunnel_log_epilog="true"
     stunnel_log_numfiles="10"
     stunnel_log_minsize="1M"
     stunnel_log_complevel="9"
 
+%common
+    stunnel_logfile="@l_prefix@/var/stunnel/stunnel.log"
+    stunnel_pidfile="@l_prefix@/var/stunnel/stunnel.pid"
+    stunnel_signal () {
+        [ -f $stunnel_pidfile ] && kill -$1 `cat $stunnel_pidfile`
+    }
+
+%status -u @l_susr@ -o
+    stunnel_usable="unknown"
+    stunnel_active="no"
+    rcService stunnel enable yes && \
+        stunnel_signal 0 && stunnel_active="yes"
+    echo "stunnel_enable=\"$stunnel_enable\""
+    echo "stunnel_usable=\"$stunnel_usable\""
+    echo "stunnel_active=\"$stunnel_active\""
+
+%start -u @l_susr@
+    rcService stunnel enable yes || exit 0
+    rcService stunnel active yes && exit 0
+    rcVarIsYes stunnel_daemon || exit 0
+    @l_prefix@/sbin/stunnel $stunnel_flags
+
+%stop -u @l_susr@
+    rcService stunnel enable yes || exit 0
+    rcService stunnel active no  && exit 0
+    rcVarIsYes stunnel_daemon || exit 0
+    stunnel_signal TERM
+    sleep 2
+    rm -f $stunnel_pidfile >/dev/null 2>&1 || true
+
+%restart -u @l_susr@
+    rcService stunnel enable yes || exit 0
+    rcService stunnel active no  && exit 0
+    rcVarIsYes stunnel_daemon || exit 0
+    rc stunnel stop start
+
 %daily -u @l_susr@
     rcService stunnel enable yes || exit 0
     shtool rotate -f \

+ 43 - 0
stunnel/stunnel.conf

@@ -0,0 +1,43 @@
+;;
+;;  stunnel.conf -- SSL Tunnel Daemon Configuration
+;;
+
+;   process parameters
+debug        = 5
+output       = @l_prefix@/var/stunnel/stunnel.log
+pid          = @l_prefix@/var/stunnel/stunnel.pid
+setuid       = @l_nusr@
+setgid       = @l_ngrp@
+
+;   network parameters
+socket       = l:TCP_NODELAY=1
+socket       = r:TCP_NODELAY=1
+
+;   SSL certificate/key
+cert         = @l_prefix@/etc/stunnel/stunnel.pem
+key          = @l_prefix@/etc/stunnel/stunnel.pem
+
+;;
+;;  Tunneling Services
+;;
+
+[https]
+accept       = 443
+connect      = 80
+
+;[pop3s]
+;accept       = 995
+;connect      = 110
+
+;[imaps]
+;accept       = 993
+;connect      = 143
+
+;[ssmtp]
+;accept       = 465
+;connect      = 25
+
+;[ircs]
+;accept       = 994
+;connect      = 6667
+

+ 7 - 3
stunnel/stunnel.spec

@@ -43,6 +43,7 @@ Source0:      http://www.stunnel.org/download/stunnel/src/stunnel-%{version}.tar
 Source1:      stunnel.pem
 Source2:      rc.stunnel
 Source3:      fsl.stunnel
+Source4:      stunnel.conf
 
 #   build information
 Prefix:       %{l_prefix}
@@ -101,10 +102,12 @@ AutoReqProv:  no
     %{l_shtool} mkdir -f -p -m 755 \
         $RPM_BUILD_ROOT%{l_prefix}/var/stunnel
     %{l_make} %{l_mflags} install prefix=$RPM_BUILD_ROOT%{l_prefix}
+    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/stunnel.*.8
-    mv $RPM_BUILD_ROOT%{l_prefix}/etc/stunnel/stunnel.conf-sample \
-       $RPM_BUILD_ROOT%{l_prefix}/etc/stunnel/stunnel.conf
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/stunnel/stunnel.conf-sample
+    %{l_shtool} install -c -m 644 %{l_value -s -a} \
+        %{SOURCE stunnel.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/stunnel/
     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
 
     #   install run-command script
@@ -126,7 +129,8 @@ AutoReqProv:  no
         %{l_files_std} \
         '%not %dir %{l_prefix}/etc/fsl' \
         '%config %{l_prefix}/etc/stunnel/stunnel.*' \
-        '%config %{l_prefix}/etc/fsl/fsl.stunnel'
+        '%config %{l_prefix}/etc/fsl/fsl.stunnel' \
+        '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/stunnel'
 
 %files -f files