From owner-FreeBSD-users-jp@jp.freebsd.org  Fri Jul 11 12:47:10 1997
Received: by jaz.jp.freebsd.org (8.8.6+2.7Wbeta5/8.7.3) id MAA06685
	Fri, 11 Jul 1997 12:47:10 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.6+2.7Wbeta5/8.7.3) with ESMTP id MAA06676
	for <FreeBSD-users-jp@jp.freebsd.org>; Fri, 11 Jul 1997 12:47:03 +0900 (JST)
Received: from bax.de.mtex.co.jp (bax.mtex.co.jp [192.168.31.133]) by proxyout.mtex.co.jp (8.8.6/3.5Wpl504/01/97) with ESMTP id MAA18115 for <FreeBSD-users-jp@jp.freebsd.org>; Fri, 11 Jul 1997 12:46:23 +0900 (JST)
Received: by bax.de.mtex.co.jp (3.5Wpl5) id MAA11739; Fri, 11 Jul 1997 12:46:22 +0900 (JST)
Received: by purple.de.mtex.co.jp (3.5Wpl5) id MAA23429; Fri, 11 Jul 1997 12:46:21 +0900 (JST)
To: FreeBSD-users-jp@jp.freebsd.org
In-Reply-To: Your message of "Fri, 11 Jul 1997 11:35:32 +0900"
References: <199707110235.LAA25369@hop.aa.cs.keio.ac.jp>
X-Mailer: Mew version 1.85 on Emacs 19.28.1 / Mule 2.3
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Message-Id: <19970711124620H.konuma@purple.de.mtex.co.jp>
Date: Fri, 11 Jul 1997 12:46:20 +0900
From: Masaki KONUMA <konuma@de.mtex.co.jp>
X-Dispatcher: imput version 970701
Lines: 59
Reply-To: FreeBSD-users-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: FreeBSD-users-jp 15680
Subject: [FreeBSD-users-jp 15680] Re: [Q]set SUID root
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org

From: Keisuke Inoue / $B0f>e7I2p(B <keisuke@aa.cs.keio.ac.jp>
Subject: [FreeBSD-users-jp 15673] Re: [Q]set SUID root
Date: Fri, 11 Jul 1997 11:35:32 +0900

> setuid root$B$5$l$?(Bscript$B$O(B($B%;%-%e%j%F%#%[!<%k$K$J$k$+$i(B)root
> $B8"8B$G$O<B9T$5$l$^$;$s!#$@$+$i!"DL>o$O(Bwrapper program$B$r(B
> setuid root$B$7$F$*$$$F$=$3$+$i(Bscript$B$r<B9T$7$^$9!#$7$+$7!"(B
> perl$B$N>l9g$O$3$N$h$&$J(BOS$B$G$b(Bsetuid root$B$r(Bemulate$B$9$k5!G=$,$"$C(B
> $B$F!"$=$l$,(BFreeBSD$B$NI8=`$@$H(B/usr/bin/suidperl$B$G$9!#(B

$B$H$$$&$3$H$O!"5U$K(B suidperl $B$,$J$/$F$b(B wrapper $B$,$"$l$P$$$$$C$F$3$H(B
$B$G$9$M!#(B

$B$^$8$a$KC5$7$?$i(B perl5.004/eg/wrapsuid $B$C$F$$$&$N$,$"$j$^$7$?!#(B
wrapper $B$r@8@.$9$k%9%/%j%W%H$G$9!#@bL@$O%9%/%j%W%H$NCf$K$"$j$^$9!#(B
2 $B2U=j=$@5$,I,MW$G$9!#G0$N$?$a%Q%C%A$rE:IU$7$^$9!#(B

 -r-sr-xr-x  1 root  bin  3674 Jul 10 16:18 /usr/local/bin/imget

$B$K!"(B ./wrapsuid /usr/local/bin/imget $B$r<B9T$9$k$H!"(B

 -r-xr-xr-x  1 root  bin  3674 Jul 10 16:18 /usr/local/bin/.imget
 -r-sr-xr-x  1 root  bin  ???  Jul 10 ??:?? /usr/local/bin/imget

$B$N$h$&$J46$8$K$J$k$s$G$7$g$&$M!#(B
.imget $B$,85$N%9%/%j%W%H$G(B imget $B$,(B wrapper $B$G$9!#(B

$B$9$$$^$;$s!#(Bimget $B$G$O;n$7$F$^$;$s!#(BFreeBSD(98)2.2.1-R + Perl5.003 $B$G!"(B
suidperl $B$H(B sperl5.003 $B$rL5$/$7$F!"(B
	#!/usr/local/bin/perl
	print '$>:', $>, ' $<:', $<, "\n";
$B$,(B wapper $B;H$C$F(B suid $B=PMh$F$k$3$H$O3NG'$G$-$^$7$?!#(B

> # $B$I$J$?$+$h$jL@3N$G@53N$J@bL@$r$*4j$$$7$^$9!#(B(^^;

# man perlsec $B$G=<J,$+$H!#(B
# $BOBLu$,(B http://www.bekkoame.or.jp/~syunji/perl/man/ $B$K$"$j$^$9!#(B

--
$B>.>B2m<y(B <konuma@de.mtex.co.jp>

-----------------------------------------------------
--- wrapsuid~	Fri Jul 11 11:54:03 1997
+++ wrapsuid	Fri Jul 11 11:56:44 1997
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
 'di';
 'ig00';
 #
@@ -56,7 +56,7 @@
 }
 ';
     close C;
-    system '/bin/cc', ".tmp$$.c", '-o', $file;
+    system '/usr/bin/cc', ".tmp$$.c", '-o', $file;
     die "Can't compile new $_" if $?;
     chmod $mode, $file;
     chown $uid, $gid, $file;
