From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Jul 27 03:00:02 2007 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D823716A478 for ; Fri, 27 Jul 2007 03:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AFFC313C468 for ; Fri, 27 Jul 2007 03:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l6R30294039654 for ; Fri, 27 Jul 2007 03:00:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l6R302eL039653; Fri, 27 Jul 2007 03:00:02 GMT (envelope-from gnats) Resent-Date: Fri, 27 Jul 2007 03:00:02 GMT Resent-Message-Id: <200707270300.l6R302eL039653@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Chris Cowart Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B465716A417 for ; Fri, 27 Jul 2007 02:52:34 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 9840113C467 for ; Fri, 27 Jul 2007 02:52:34 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l6R2qYTJ083327 for ; Fri, 27 Jul 2007 02:52:34 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l6R2qYrm083325; Fri, 27 Jul 2007 02:52:34 GMT (envelope-from nobody) Message-Id: <200707270252.l6R2qYrm083325@www.freebsd.org> Date: Fri, 27 Jul 2007 02:52:34 GMT From: Chris Cowart To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: ports/114952: net-mgmt/net-snmp4 rc script starts snmpd without being enabled X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jul 2007 03:00:03 -0000 >Number: 114952 >Category: ports >Synopsis: net-mgmt/net-snmp4 rc script starts snmpd without being enabled >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 27 03:00:02 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Chris Cowart >Release: 6.2_REL >Organization: RSSP-IT, UC Berkeley >Environment: FreeBSD stingray.rescomp.berkeley.edu 6.2-RELEASE-p4 FreeBSD 6.2-RELEASE-p4 #0: Mon May 21 21:36:00 PDT 2007 root@stingray.rescomp.berkeley.edu:/usr/obj/usr/src/sys/RCBSD_1 i386 >Description: I'm referring to the port Makefile with FreeBSD Id: $FreeBSD: ports/net-mgmt/net-snmp4/Makefile,v 1.105 2007/06/21 06:59:36 rafan Exp $ Line 139 of the Makefile installs files/snmpd.sh.sample into /usr/local/etc/rc.d/snmpd.sh. This is *not* a FreeBSD-style rc script. It simply switches on "$1" for the word start or stop and performs that action. It does *not* use /etc/rc.subr to determine whether snmpd has been enabled. As a result, snmpd will be started during boot on any machine where the port net-mgmt/net-snmp4 is installed. Some would consider this to be a security problem. >How-To-Repeat: >Fix: I've included a patch that creates a FreeBSD-style rc script in files and updates the port to install it. Patch attached with submission follows: diff -Nrub net-snmp4-orig/Makefile net-snmp4-mine/Makefile --- net-snmp4-orig/Makefile 2007-07-26 18:02:09.000000000 -0700 +++ net-snmp4-mine/Makefile 2007-07-26 17:59:24.000000000 -0700 @@ -82,7 +82,7 @@ snmpstatus snmptest snmptranslate snmptrap snmpwalk SBIN= snmpd snmptrapd -STARTUP_FILE= ${PREFIX}/etc/rc.d/snmpd.sh +STARTUP_FILE= ${PREFIX}/etc/rc.d/snmpd CONFLICTS= net-snmp-5.* @@ -135,8 +135,8 @@ @for F in ${WRKSRC}/EXAMPLE.conf ${WRKSRC}/agent/mibgroup/examples/ucdDemoPublic.conf; do \ ${INSTALL_DATA} $$F ${PREFIX}/share/examples/ucd-snmp ; done @if [ ! -f ${STARTUP_FILE} ]; then \ - ${ECHO} "Creating ${PREFIX}/etc/rc.d/snmpd.sh startup file."; \ - ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/snmpd.sh.sample ${STARTUP_FILE}; \ + ${ECHO} "Creating ${STARTUP_FILE} startup file."; \ + ${INSTALL_SCRIPT} -m 755 ${FILESDIR}/snmpd ${STARTUP_FILE}; \ fi .include diff -Nrub net-snmp4-orig/files/snmpd net-snmp4-mine/files/snmpd --- net-snmp4-orig/files/snmpd 1969-12-31 16:00:00.000000000 -0800 +++ net-snmp4-mine/files/snmpd 2007-07-26 18:00:37.000000000 -0700 @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: snmpd +# REQUIRE: DAEMON +# +# Add the following line to /etc/rc.conf to enable snmpd: +# +# snmpd_enable="YES" +# + +snmpd_enable=${snmpd_enable:-"NO"} +snmpd_flags=${snmpd_flags:-"-p /var/run/snmpd.pid"} + +. /etc/rc.subr + +name=snmpd +rcvar=`set_rcvar` + +command=/usr/local/sbin/${name} +pidfile=/var/run/${name}.pid + +load_rc_config ${name} +run_rc_command "$1" diff -Nrub net-snmp4-orig/pkg-plist net-snmp4-mine/pkg-plist --- net-snmp4-orig/pkg-plist 2007-07-26 17:48:02.000000000 -0700 +++ net-snmp4-mine/pkg-plist 2007-07-26 18:02:23.000000000 -0700 @@ -19,7 +19,7 @@ bin/snmpusm bin/snmpvacm bin/snmpwalk -etc/rc.d/snmpd.sh +etc/rc.d/snmpd include/ucd-snmp/agent_index.h include/ucd-snmp/agent_read_config.h include/ucd-snmp/agent_registry.h >Release-Note: >Audit-Trail: >Unformatted: