From trevor@jpj.net  Sat Oct 28 12:51:49 2000
Return-Path: <trevor@jpj.net>
Received: from blues.jpj.net (blues.jpj.net [204.97.17.146])
	by hub.freebsd.org (Postfix) with ESMTP id 60FF537B4C5
	for <freebsd-gnats-submit@freebsd.org>; Sat, 28 Oct 2000 12:51:48 -0700 (PDT)
Received: from localhost (trevor@localhost)
	by blues.jpj.net (right/backatcha) with ESMTP id e9SJph312886
	for <freebsd-gnats-submit@freebsd.org>; Sat, 28 Oct 2000 15:51:43 -0400 (EDT)
Message-Id: <Pine.BSI.4.21.0010281531370.12402-100000@blues.jpj.net>
Date: Sat, 28 Oct 2000 15:51:43 -0400 (EDT)
From: Trevor Johnson <trevor@jpj.net>
To: freebsd-gnats-submit@freebsd.org
Subject: x11/XFree86-4:  install X server without SUID bit

>Number:         22380
>Category:       ports
>Synopsis:       x11/XFree86-4:  install X server without SUID bit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jmz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 28 13:00:01 PDT 2000
>Closed-Date:    Sat Oct 28 16:11:23 PDT 2000
>Last-Modified:  Sat Oct 28 16:11:53 PDT 2000
>Originator:     Trevor Johnson
>Release:        4.1.1-RELEASE i386
>Organization:
myself
>Environment:

only tested under
FreeBSD localhost.localdomain 4.1.1-RELEASE FreeBSD 4.1.1-RELEASE #0: Tue
Sep 26 00:46:59 GMT 2000
jkh@narf.osd.bsdi.com:/usr/src/sys/compile/GENERIC  i386

>Description:

The Xwrapper program has been removed from XFree86 4.x.  I've made a port
of the Xwrapper from XFree86 3.3.6 for use with 4.x.  Using the wrapper
obviates the SUID bit on the X server itself, the presence of which is
worrisome for security.

>How-To-Repeat:

N/A

>Fix:

Apply this patch, which causes the X server to be installed without the
SUID bit, removes the warning about the possible insecurity of this, and
informs users about the x11/wrapper port.

new files:
	files/patch-config_cf_Server_tmpl
	pkg-message

files to remove:
	pkg-install

changed files:
	Makefile

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/x11/XFree86-4/Makefile,v
retrieving revision 1.91
diff -u -r1.91 Makefile
--- Makefile	2000/10/13 12:15:43	1.91
+++ Makefile	2000/10/28 19:26:14
@@ -56,9 +56,6 @@
 .elif defined(USA_RESIDENT)
 .if ${USA_RESIDENT} == NO
 pre-fetch:
-.if !defined(BATCH) && !defined(PACKAGE_BUILDING)
-	${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-.endif
 MASTER_SITES+=	ftp://psych.psy.uq.oz.au/pub/X11R5/ \
 		ftp://ftp.internat.freebsd.org/pub/FreeBSD/X11-Crypto/ \
 		ftp://ftp3.za.freebsd.org/pub/FreeBSD/X11-Crypto/
@@ -68,9 +65,6 @@
 .endif
 .if ${USA_RESIDENT} == YES
 pre-fetch:
-.if !defined(BATCH) && !defined(PACKAGE_BUILDING)
-	${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-.endif
 	@${ECHO}
 	@${ECHO} Assuming that you have fetched a USA-Legal Wraphelp.c.
 .endif
@@ -85,6 +79,7 @@
 .ifndef DISTRIB
 	${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ${PREFIX}/lib
 .endif
+	@${CAT} ${PKGMESSAGE}
 
 .ifdef DISTRIB
 distrib: all install
Index: pkg-install
===================================================================
RCS file: pkg-install
diff -N pkg-install
--- /tmp/cvsscXArUe450	Sat Oct 28 12:26:17 2000
+++ /dev/null	Sat Oct 28 12:14:56 2000
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ "$2" = "POST-INSTALL" -o -n "${PACKAGE_BUILDING}" ]; then
-  exit 0
-fi
-
-/usr/bin/dialog --yesno "XFree86 4.0 may contain vulnerabilities yielding root privileges to local users, due to insecure coding of the setuid root X server. It is not recommended that this port be installed on multi-user systems. Do you wish to accept the security risk and build XFree86 4.0 anyway?" 10 60 || /usr/bin/false
Index: pkg-message
===================================================================
RCS file: pkg-message
diff -N pkg-message
--- /dev/null	Sat Oct 28 12:14:56 2000
+++ pkg-message	Sat Oct 28 10:27:38 2000
@@ -0,0 +1,5 @@
+************************************************************************
+* To improve security, the X server is installed without an SUID bit.  *
+* This is suitable for use with xdm, but not with a startx script.     *
+* If you need to use a startx script, install the x11/wrapper package. *
+************************************************************************
Index: files/patch-config_cf_Server_tmpl
===================================================================
RCS file: patch-config_cf_Server_tmpl
diff -N patch-config_cf_Server_tmpl
--- /dev/null	Sat Oct 28 12:14:56 2000
+++ patch-config_cf_Server_tmpl	Sat Oct 28 10:09:38 2000
@@ -0,0 +1,11 @@
+--- config/cf/Server.tmpl.orig	Fri Feb 18 08:23:07 2000
++++ config/cf/Server.tmpl	Sat Oct 28 10:09:07 2000
+@@ -41,7 +41,7 @@
+ #ifndef SetUIDServerTarget
+ #if InstallServerSetUID
+ #define	SetUIDServerTarget(server,subdirs,objects,libs,syslibs)		@@\
+-ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(INSTUIDFLAGS))
++ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(INSTBINFLAGS))
+ #else
+ #define	SetUIDServerTarget ServerTarget
+ #endif


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: vanilla->jmz 
Responsible-Changed-By: trevor 
Responsible-Changed-When: Sat Oct 28 13:03:22 PDT 2000 
Responsible-Changed-Why:  
misfiled PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22380 
State-Changed-From-To: open->closed 
State-Changed-By: jmz 
State-Changed-When: Sat Oct 28 16:11:23 PDT 2000 
State-Changed-Why:  
Patches committed. Thanks! 

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