OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: /bin/sh on /etc/rc terminated - pipes in httpd.conf?

From: Dan Harnett (danhnfol.com)
Date: Fri Aug 20 2004 - 11:17:24 CDT


On Fri, Aug 20, 2004 at 09:08:10AM -0400, Dan Harnett wrote:
> I highly recommend using marc.theaimsgroup.com for searching mailing
> list archives.
>
> http://marc.theaimsgroup.com/?l=openbsd-misc&m=109097594100085&w=2
>
> There is even a PR open.
>
> A quick workaround is to trap SIGTERM in /etc/rc.local if httpd is
> started.
>

Actually, the patch I posted still had a chance of failure if the
subshell died before apache sent the signal. This should fix it.

Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.250
diff -u -p -r1.250 rc
--- rc 7 Aug 2004 00:50:25 -0000 1.250
+++ rc 20 Aug 2004 16:09:52 -0000
-26,9 +26,9 stripcom() {
 
 stty status '^T'
 
-# Set shell to ignore SIGINT (2), but not children;
+# Set shell to ignore SIGINT (2) and SIGTERM (15), but not children;
 # shell catches SIGQUIT (3) and returns to single user after fsck.
-trap : 2
+trap : 2 15
 trap : 3 # shouldn't be needed
 
 HOME=/; export HOME
-537,7 +537,7 fi
 if [ "X${httpd_flags}" != X"NO" ]; then
         # Clean up left-over httpd locks
         rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
- echo -n ' httpd'; /usr/sbin/httpd ${httpd_flags}
+ echo -n ' httpd'; ( /usr/sbin/httpd ${httpd_flags} )
 fi
 
 if [ "X${ftpd_flags}" != X"NO" ]; then