From b.candler@pobox.com  Thu Dec 29 10:42:46 2005
Return-Path: <b.candler@pobox.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 031AE16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Dec 2005 10:42:46 +0000 (GMT)
	(envelope-from b.candler@pobox.com)
Received: from thorn.pobox.com (thorn.pobox.com [208.210.124.75])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 12F8043D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Dec 2005 10:42:44 +0000 (GMT)
	(envelope-from b.candler@pobox.com)
Received: from thorn (localhost [127.0.0.1])
	by thorn.pobox.com (Postfix) with ESMTP id 42F68AD
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Dec 2005 05:43:06 -0500 (EST)
Received: from mappit.local.linnet.org (212-74-113-67.static.dsl.as9105.com [212.74.113.67])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by thorn.sasl.smtp.pobox.com (Postfix) with ESMTP id 0823C2109
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Dec 2005 05:43:05 -0500 (EST)
Received: from brian by mappit.local.linnet.org with local (Exim 4.60 (FreeBSD))
	(envelope-from <brian@mappit.local.linnet.org>)
	id 1ErurJ-0002lU-Ba
	for FreeBSD-gnats-submit@freebsd.org; Thu, 29 Dec 2005 10:18:09 +0000
Message-Id: <E1ErurJ-0002lU-Ba@mappit.local.linnet.org>
Date: Thu, 29 Dec 2005 10:18:09 +0000
From: Brian Candler <B.Candler@pobox.com>
Reply-To: Brian Candler <B.Candler@pobox.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ipsec-tools syslogs at 'daemon.info' which doesn't go anywhere
X-Send-Pr-Version: 3.113
X-GNATS-Notify: vanhu@netasq.com

>Number:         91047
>Category:       ports
>Synopsis:       ipsec-tools syslogs at 'daemon.info' which doesn't go anywhere
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    vd
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 29 10:50:03 GMT 2005
>Closed-Date:    Tue Jan 24 09:20:02 GMT 2006
>Last-Modified:  Tue Jan 24 09:20:02 GMT 2006
>Originator:     Brian Candler
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:

	
>Description:

ipsec-tools 0.6.4 from ports

Important error messages are logged at level 'daemon.info'. However the
default /etc/syslog.conf in FreeBSD discards all such messages, and there's
no warning that you need to change anything.

As a result, you get a lot of strange debug messages in /var/log/debug.log,
but not the important messages which tell you the actual problem.

>How-To-Repeat:

Example: set up racoon with world-read permissions on psk.txt. The only
problem reports you see are cryptic messages in /var/log/debug.log which say

Dec 29 08:36:19 candlerb racoon: DEBUG: an undead schedule has been deleted.
Dec 29 08:36:19 candlerb racoon: DEBUG: ===
Dec 29 08:36:19 candlerb racoon: DEBUG: 68 bytes message received from 192.168.1.200[500] to 192.168.1.100[500]
Dec 29 08:36:19 candlerb racoon: DEBUG:  1103a42a 7a3e5e0d 3c390faf 1c8e4a96051 00201 00000000 00000044 4ccc8164 6c301245 fb14f82f 04bceecd 7cdedfba 30c1a596 85cc072e e9c66978 14255c94 67d31786
Dec 29 08:36:19 candlerb racoon: DEBUG: malformed cookie received or the spi expired.

To see the underlying problem you have to run racoon in the foreground (-F)
or change syslog.conf, at which point you see

2005-12-29 09:52:38: ERROR: /usr/local/etc/racoon/psk.txt has weak file permission
2005-12-29 09:52:38: ERROR: failed to open pre_share_key file /usr/local/etc/racoon/psk.txt
2005-12-29 09:52:38: ERROR: couldn't find the pskey for 192.168.1.200.
2005-12-29 09:52:38: ERROR: failed to process packet.
2005-12-29 09:52:38: ERROR: phase1 negotiation failed.
2005-12-29 09:52:38: DEBUG: an undead schedule has been deleted.
2005-12-29 09:52:38: DEBUG: ===
... etc


>Fix:

In plog.c, the syslog messages are mapped as follows:

        { "INFO",               LOG_INFO, },
        { "NOTIFY",             LOG_INFO, },
        { "WARNING",            LOG_INFO, },
        { "ERROR",              LOG_INFO, },
        { "DEBUG",              LOG_DEBUG, },
        { "DEBUG2",             LOG_DEBUG, },

and also the facility is hardcoded to 'daemon':

       openlog(pname, LOG_NDELAY, LOG_DAEMON);

but the default /etc/syslog.conf does not match daemon.info at all:

*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err	/var/log/messages
security.*					/var/log/security
auth.info;authpriv.info				/var/log/auth.log
mail.info					/var/log/maillog
lpr.info					/var/log/lpd-errs
ftp.info					/var/log/xferlog

So some solutions might be:

(1) Patch racoon to change LOG_INFO to LOG_NOTICE or above

(2) Patch racoon to change LOG_DAEMON to LOG_SECURITY

(3) Change the base system syslog.conf to include

daemon.info					/var/log/daemon

(4) The port postinstall script to add a line like the above to syslog.conf
if required

(5) Install /usr/local/share/doc/ipsec-tools/README.syslog documenting this
problem, and include a big asterisked warning in pkg-descr and display it
at port install time

Choice between these five bikesheds is left to the reader, but I don't think
the current situation is desirable.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Thu Dec 29 11:54:17 UTC 2005 
State-Changed-Why:  
Awaiting maintainers feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91047 

From: VANHULLEBUS Yvan <vanhu@netasq.com>
To: bug-followup@FreeBSD.org, B.Candler@pobox.com
Cc:  
Subject: Re: ports/91047: ipsec-tools syslogs at 'daemon.info' which doesn't go anywhere
Date: Fri, 30 Dec 2005 11:34:42 +0100

 --/9DWx/yDrRhgMJTb
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hi.
 
 For that specific file permission problem, this is documented in
 racoon.conf's man page....
 
 However, sending syslogs to /dev/null (well, that's the result...) by
 default is not a good idea for such a daemon !
 
 The best (and quicker) short term solution is probably to patch racoon
 to use LOG_SECURITY instead of LOG_DAEMON, here is a quick patch for
 that (ready to insert in port's files dir). But be careful about
 setting racoon in debug mode after that, you may really have *lots* of
 messages then !!!
 
 
 A better mid-term solution will probably be to allow such parameters
 to be configured in racoon.conf, I'll do that for a futur major
 version (0.7 ?) of ipsec-tools.
 
 I'll also try to improve racoon's reaction when having such a weak psk
 file (send a more explicit message in debug ? refuse to start ? read
 anyways the file but send explicit warnings ?).
 
 
 Yvan.
 
 -- 
 NETASQ - Secure Internet Connectivity
 http://www.netasq.com
 
 --/9DWx/yDrRhgMJTb
 Content-Type: text/x-csrc; charset=us-ascii
 Content-Disposition: attachment; filename="patch-racoon-plog.c"
 
 --- src/racoon/plog.c.orig	Fri Dec 30 11:28:03 2005
 +++ src/racoon/plog.c	Fri Dec 30 11:28:18 2005
 @@ -224,7 +224,7 @@ ploginit()
  		return;
  	}
  
 -        openlog(pname, LOG_NDELAY, LOG_DAEMON);
 +        openlog(pname, LOG_NDELAY, LOG_SECURITY);
  }
  
  void
 
 --/9DWx/yDrRhgMJTb--

From: Brian Candler <B.Candler@pobox.com>
To: VANHULLEBUS Yvan <vanhu@netasq.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/91047: ipsec-tools syslogs at 'daemon.info' which doesn't go anywhere
Date: Fri, 30 Dec 2005 12:07:30 +0000

 On Fri, Dec 30, 2005 at 11:34:42AM +0100, VANHULLEBUS Yvan wrote:
 > I'll also try to improve racoon's reaction when having such a weak psk
 > file (send a more explicit message in debug ? refuse to start ? read
 > anyways the file but send explicit warnings ?).
 
 Duplicating all ERRORs at DEBUG level is another option I hadn't considered,
 but seems rather wasteful.
 
 I have no issue with the quality of error messages produced by racoon - in
 fact they're excellent. The problem was simply that I couldn't see them :-)
 
 I don't think making 'weak psk security' errors a special case is the
 solution. Rather, I think it's necessary to make _all_ error messages
 properly visible.
 
 Regards,
 
 Brian.
 
 P.S. another option: make the ipsec-tools port log errors to a file by
 default, rather than syslog, by appropriate choice of default racoon_flags.
State-Changed-From-To: feedback->open 
State-Changed-By: vd 
State-Changed-When: Tue Jan 24 09:08:05 UTC 2006 
State-Changed-Why:  
Maintainer sent a patch 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91047 
Responsible-Changed-From-To: freebsd-ports-bugs->vd 
Responsible-Changed-By: vd 
Responsible-Changed-When: Tue Jan 24 09:09:11 UTC 2006 
Responsible-Changed-Why:  
I will take it 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91047 
State-Changed-From-To: open->closed 
State-Changed-By: vd 
State-Changed-When: Tue Jan 24 09:19:30 UTC 2006 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=91047 
>Unformatted:
