Bug 113235 - [patch] dns/maradns problem with startup during boot
Summary: [patch] dns/maradns problem with startup during boot
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-01 21:30 UTC by Šimun Mikecin
Modified: 2007-06-16 13:50 UTC (History)
0 users

See Also:


Attachments
file.diff (2.16 KB, patch)
2007-06-01 21:30 UTC, Šimun Mikecin
no flags Details | Diff
maradns-diff2.txt (4.88 KB, text/plain)
2007-06-02 12:58 UTC, Šimun Mikecin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Šimun Mikecin 2007-06-01 21:30:11 UTC
During boot maradns daemon dies with this kind of log message in /var/log/messages:
May 19 11:55:26 data maradns: HUP signal sent to MaraDNS process

MaraDNS is intended to be run by duende process supervisor which handles signals and standard output of maradns. sending HUP signal to maradns or duende process should restart maradns.
Startup script (maradns.sh) provided by this port does not use duende.

Provided patch changes maradns.sh to use duende for startup.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer 2007-06-01 21:30:20 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 Alex Kapranoff 2007-06-01 21:56:02 UTC
Hello, Simun!

Thanks for the patch againt maradns port! It's mostly ok but I have an
issue.

I've been struggling with FreeBSD's rc.subr to get maradns run under
duende for some time. I'm running duende myself but via dirty hacks.

Your patch solves half of the problem the whole being that we need to
be able to run both maradns and zoneserver under duende.

When you specify "command" var in maradns.sh startup script as
"${prefix}/bin/duende" you cannot independently control any other
process run under duende because "command" is used when searching
ps(1) output for PIDs to kill during restarts or other signals.

Do you have thoughts on this issue?

-- 
Alex Kapranoff.
Comment 3 Šimun Mikecin 2007-06-02 12:58:45 UTC
Here is a patch that should solve all the mentioned problems.
- changed duende source to create PID file by itself
- maradns.sh and zoneserver.sh now use PID file
- changed default MaraDNS UID from 99 to bind(53)
- changed default maraDNS GID from 99 to bind(53)
- changed default duende logger process UID from 66 to nobody(65534)



       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
Comment 4 Alex Kapranoff 2007-06-08 12:32:52 UTC
The patch by Simun works great! I as the maintainter for the port would like
for someone to commit this to our Ports.

Thanks!

* Simun Mikecin <numisemis@yahoo.com> [June 02 2007, 15:58]:
> Here is a patch that should solve all the mentioned problems.
> - changed duende source to create PID file by itself
> - maradns.sh and zoneserver.sh now use PID file
> - changed default MaraDNS UID from 99 to bind(53)
> - changed default maraDNS GID from 99 to bind(53)
> - changed default duende logger process UID from 66 to nobody(65534)
> 
> 
> 
>        
> ____________________________________________________________________________________
> Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
> http://answers.yahoo.com/dir/?link=list&sid=396545469

Content-Description: 2334080097-maradns-diff2.txt
> diff -urN maradns.old/Makefile maradns/Makefile
> --- maradns.old/Makefile	Sat May 26 00:11:42 2007
> +++ maradns/Makefile	Sat Jun  2 13:42:52 2007
> @@ -7,6 +7,7 @@
>  
>  PORTNAME=	maradns
>  PORTVERSION=	1.2.12.06
> +PORTREVISION=	1
>  CATEGORIES=	dns
>  MASTER_SITES=	http://www.maradns.org/download/1.2/${PORTVERSION}/ \
>  		http://kapranoff.ru/~kappa/files/
> @@ -57,6 +58,7 @@
>  	${MKDIR} ${PREFIX}/etc/maradns
>  	${INSTALL_DATA} ${WRKSRC}/doc/en/examples/example_csv2 \
>   		${PREFIX}/etc/maradns/example_csv2
> +	${MKDIR} ${PREFIX}/etc/maradns/logger
>  	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
>   		'-e s!%%SERVICE%%!maradns!g' \
>   		${FILESDIR}/rc_d.sh > ${PREFIX}/etc/rc.d/maradns.sh
> diff -urN maradns.old/files/patch-MaraDns.h maradns/files/patch-MaraDns.h
> --- maradns.old/files/patch-MaraDns.h	Thu Jan  1 01:00:00 1970
> +++ maradns/files/patch-MaraDns.h	Sat Jun  2 13:47:33 2007
> @@ -0,0 +1,22 @@
> +--- MaraDns.h.orig	Sat Jun  2 13:46:12 2007
> ++++ MaraDns.h	Sat Jun  2 13:47:12 2007
> +@@ -75,16 +75,16 @@
> +      line to point to Bash
> +  */
> + 
> +-#define MARADNS_DEFAULT_UID 99
> ++#define MARADNS_DEFAULT_UID 53
> + 
> + /* The default GID (Group ID) that MaraDNS has; see the default UID notes
> +    above.  Again: CHANGE THE MARARC MAN PAGE IF YOU CHANGE THIS VALUE */
> +-#define MARADNS_DEFAULT_GID 99
> ++#define MARADNS_DEFAULT_GID 53
> + 
> + /* The UID that the Duende logging process uses.  CHANGE THE DUENDE MAN
> +    PAGE IF YOU CHANGE THIS VALUE (same general process as changing the
> +    mararc man page; the source file for the duende man page is duende.ej) */
> +-#define DUENDE_LOGGER_UID 66
> ++#define DUENDE_LOGGER_UID 65534
> + 
> + /* The directory that Duende runs in.  This directory has to exist for
> +    Duende to be able to run.  Again, IF YOU CHANGE THIS, CHANGE THE
> diff -urN maradns.old/files/patch-tools_Makefile maradns/files/patch-tools_Makefile
> --- maradns.old/files/patch-tools_Makefile	Thu Jan  1 01:00:00 1970
> +++ maradns/files/patch-tools_Makefile	Sat Jun  2 13:38:29 2007
> @@ -0,0 +1,11 @@
> +--- tools/Makefile.orig	Sat Jun  2 13:33:56 2007
> ++++ tools/Makefile	Sat Jun  2 13:38:09 2007
> +@@ -27,7 +27,7 @@
> + 	$(CC) $(FLAGS) -o benchmark benchmark.c $(OBJECTS) $(POBJECTS)
> + 
> + duende: duende.c 
> +-	$(CC) $(FLAGS) -o duende duende.c
> ++	$(CC) $(FLAGS) -o duende duende.c -lutil
> + 
> + strip.control: strip.control.c
> + 	$(CC) $(FLAGS) -o strip.control strip.control.c
> diff -urN maradns.old/files/patch-tools_duende.c maradns/files/patch-tools_duende.c
> --- maradns.old/files/patch-tools_duende.c	Thu Jan  1 01:00:00 1970
> +++ maradns/files/patch-tools_duende.c	Sat Jun  2 13:41:25 2007
> @@ -0,0 +1,52 @@
> +--- tools/duende.c.orig	Sat Jun  2 13:40:35 2007
> ++++ tools/duende.c	Sat Jun  2 13:41:01 2007
> +@@ -35,10 +35,13 @@
> + #include <signal.h>
> + #include <stdio.h>
> + #include <stdlib.h>
> ++#include <string.h>
> + #include <syslog.h>
> ++#include <sys/param.h>
> + #include <sys/time.h>
> + #include <sys/types.h>
> + #include <sys/wait.h>
> ++#include <libutil.h>
> + #include <unistd.h>
> + #include "../MaraDns.h"
> + 
> +@@ -139,6 +142,9 @@
> +     int exit_status;
> +     pid_t pid, log_pid;
> +     int stream1[2]; /* Used for piping */
> ++    struct pidfh *pfh;
> ++    char *name;
> ++    char *pidfile;
> +     if(argv[0] == NULL || argv[1] == NULL) {
> +         printf("Usage: duende [program] [arguments]\n");
> + 	exit(1);
> +@@ -202,7 +208,24 @@
> + 	    log_helper(argv[1],stream1[0]);
> +             syslog(LOG_ALERT,"log_helper finished, terminating\n");
> + 	    exit(1);
> +-	    } 
> ++	    }
> ++        
> ++        name = strrchr(argv[1], '/');
> ++        if (name && *name != '\0') {
> ++          pidfile = malloc(strlen("/var/run/") + strlen(name) + strlen(".pid") + 1);
> ++          if (pidfile) {
> ++            strcpy(pidfile, "/var/run/");
> ++            strcat(pidfile, name);
> ++            strcat(pidfile, ".pid");
> ++            remove(pidfile);
> ++            pfh = pidfile_open(pidfile, 0600, &pid);
> ++            if (pfh) {
> ++                pidfile_write(pfh);
> ++                pidfile_close(pfh);
> ++            }
> ++            free(pidfile);
> ++          }
> ++        }
> +         for(;;) {
> + 	    /* If we got a HUP signal, send it to the child */
> + 	    if(got_hup_signal == 1) {
> diff -urN maradns.old/files/rc_d.sh maradns/files/rc_d.sh
> --- maradns.old/files/rc_d.sh	Mon Feb 20 21:46:57 2006
> +++ maradns/files/rc_d.sh	Sat Jun  2 13:14:49 2007
> @@ -28,11 +28,11 @@
>  
>  name="%%SERVICE%%"
>  rcvar=`set_rcvar`
> -command="${prefix}/sbin/${name}"
> -command_args="| /usr/bin/logger -p daemon.notice -t %%SERVICE%% &"
> +command="${prefix}/bin/duende"
> +pidfile="/var/run/${name}.pid"
>  
>  load_rc_config $name
>  
> -flags="${%%SERVICE%%_flags}"
> +flags="${prefix}/sbin/${name} ${%%SERVICE%%_flags}"
>  
>  run_rc_command "$1"
> diff -urN maradns.old/pkg-plist maradns/pkg-plist
> --- maradns.old/pkg-plist	Thu Dec 14 14:45:02 2006
> +++ maradns/pkg-plist	Fri Jun  1 21:51:52 2007
> @@ -7,6 +7,7 @@
>  etc/rc.d/maradns.sh
>  etc/rc.d/zoneserver.sh
>  etc/maradns/example_csv2
> +@dirrmtry etc/maradns/logger
>  @dirrmtry etc/maradns
>  sbin/maradns
>  sbin/zoneserver


-- 
Alex Kapranoff,
$n=["1another7Perl213Just3hacker49"=~/\d|\D*/g];
$$n[0]={grep/\d/,@$n};print"@$n{1..4}\n"
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2007-06-08 16:07:01 UTC
State Changed
From-To: feedback->open

Maintainer approved.
Comment 6 Pav Lucistnik freebsd_committer 2007-06-16 13:28:47 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 7 dfilter service freebsd_committer 2007-06-16 13:42:22 UTC
pav         2007-06-16 12:42:14 UTC

  FreeBSD ports repository

  Modified files:
    dns/maradns          Makefile pkg-plist 
    dns/maradns/files    rc_d.sh 
  Added files:
    dns/maradns/files    patch-MaraDns.h patch-tools_Makefile 
                         patch-tools_duende.c 
  Log:
  - change duende source to create PID file by itself
  - maradns.sh and zoneserver.sh now use PID file
  - change default MaraDNS UID from 99 to bind(53)
  - change default maraDNS GID from 99 to bind(53)
  - change default duende logger process UID from 66 to nobody(65534)
  - create empty etc/logger directory
  
  PR:             ports/113235
  Submitted by:   Simun Mikecin <numisemis@yahoo.com>
  Approved by:    Alex Kapranoff <alex@kapranoff.ru> (maintainer)
  
  Revision  Changes    Path
  1.56      +2 -0      ports/dns/maradns/Makefile
  1.1       +22 -0     ports/dns/maradns/files/patch-MaraDns.h (new)
  1.1       +11 -0     ports/dns/maradns/files/patch-tools_Makefile (new)
  1.1       +52 -0     ports/dns/maradns/files/patch-tools_duende.c (new)
  1.4       +4 -4      ports/dns/maradns/files/rc_d.sh
  1.22      +3 -1      ports/dns/maradns/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"