Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  4 Jan 2012 22:48:17 -0500 (EST)
From:      Michael Scheidell <scheidell@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/163825: security/barnyard2 won't start after db crash
Message-ID:  <20120105034817.A5EE01D3D3@scanner.secnap.net>
Resent-Message-ID: <201201050350.q053oAgS054896@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         163825
>Category:       ports
>Synopsis:       security/barnyard2 won't start after db crash
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 05 03:50:10 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Michael Scheidell
>Release:        FreeBSD 7.4-RELEASE-p3 i386
>Organization:
SECNAP Network Security
>Environment:
>Description:
	if the machine fails, or the db crashes, mysql will be in recovery mode, and barnyard2 won't start:
       (it seems to be ok if mysql-server is started pretty quickly after rc, but if mysql in recovery mode, barnyard2 won't 
start.  

I want to put mysql-server FIRST, but if you check rcorder:


rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
/usr/local/etc/rc.d/barnyard2
/usr/local/etc/rc.d/snort
/etc/rc.d/LOGIN
/usr/local/etc/rc.d/mysql-server

EVEN IF YOU EDIT barnyard2 rc file and put in 'REQUIRE: DAEMON mysql' then won't help the order.
because barnyard2 has BEFORE: LOGIN, and mysql-server has REQUIRE: LOGIN.
(does barnyard2 REALLY need before login)?
>How-To-Repeat:
crash mysql pretty badly.
>Fix:

	this patch will remove BEFORE: LOGIN if you have any db option, and add the correct REQUIRE: () lines.
        if you have NO db selected, it leaves BEFORE: LOGIN.

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/security/barnyard2/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	23 Sep 2011 22:25:08 -0000	1.11
+++ Makefile	5 Jan 2012 03:37:42 -0000
@@ -37,11 +37,23 @@
 CONFIGURE_ARGS+=	--with-mysql \
 			--with-mysql-includes=${LOCALBASE}/include/mysql \
 			--with-mysql-libraries=${LOCALBASE}/lib/mysql
+SUB_LIST+=		MYSQL=" mysql"
+.else
+SUB_LIST+=		MYSQL=""
 .endif
 
 .if defined(WITH_POSTGRESQL)
 USE_PGSQL=		yes
 CONFIGURE_ARGS+=	--with-postgresql
+SUB_LIST+=		PGSQL=" postgresql"
+.else
+SUB_LIST+=		PGSQL=""
+.endif
+
+.if defined(WITH_POSTGRESQL) || defined(WITH_MYSQL)
+SUB_LIST+=		LOGIN="\# KEYWORD: shutdown" KEYWORD=""
+.else
+SUB_LIST+=		LOGIN="\# BEFORE: LOGIN" KEYWORD="\# KEYWORD: shutdown"
 .endif
 
 .if defined(WITH_SNORT)
Index: files/barnyard2.sh.in
===================================================================
RCS file: /home/pcvs/ports/security/barnyard2/files/barnyard2.sh.in,v
retrieving revision 1.4
diff -u -r1.4 barnyard2.sh.in
--- files/barnyard2.sh.in	12 Oct 2011 00:48:13 -0000	1.4
+++ files/barnyard2.sh.in	5 Jan 2012 03:37:42 -0000
@@ -2,9 +2,9 @@
 # 
 
 # PROVIDE: barnyard2
-# REQUIRE: DAEMON
-# BEFORE: LOGIN
-# KEYWORD: shutdown
+# REQUIRE: DAEMON%%MYSQL%%%%PGSQL%%
+%%LOGIN%%
+%%KEYWORD%%
 
 # Add the following lines to /etc/rc.conf to enable barnyard2:
 # barnyard2_enable (bool):	Set to YES to enable barnyard2


______________________________________________________________________
This email has been scanned and certified safe by SpammerTrap(r). 
For Information please see http://www.spammertrap.com/
______________________________________________________________________  
  
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120105034817.A5EE01D3D3>