From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: <199703251728.JAA07221@icarus.icarus.com> Date: Tue, 25 Mar 1997 18:34:02 +0000 From: Nikita Schmidt Subject: Re: Floppy, finger, date In-Reply-To: On Mar 25, Marco Corte wrote: > > Now three new problems: > ... > > 3. How to tell my S3 server (3.1.2G) a "wrong" date so that I doesn't > expire without changing the date on the whole system? > Unfortunately, I'm not really into RedHat distribution, so I cannot say anything about first two problems. As for X server spoofing, my approach is following: 1) build a shared library that defines `time' (see source code below); 2) make a setuid wrapper that starts X server with that library. Since in pre-2.0 versions of glibc LD_PRELOAD fails on setuid executables (more precisely, if real uid != effective uid) even when the library name does not contain slashes (in ld-2.0.so setuid binaries can be LD_PRELOADed with a library if its name is reasonably secure, i.e. contains no slashes), a setuid wrapper is needed to set both real and effective uids to 0 prior to running the X server. That's not good: for example, X server remains rooty and cannot be killed from xinit when the session is over (one has to press ctrl-alt-bs), and there may be some security flaws with this approach, but I couldn't see any other way (rebuilding ld-1.93.so is not worth it). OK, let's take a look at the code. ---------------- libfaketime.c ---------------- #include time_t time (time_t *t) { if (t) *t = 844124400; return 844124400; } -------------------- X.c ---------------------- #include #include #include main (int argc, char *argv[]) { setenv ("LD_PRELOAD", "/usr/local/lib/libfaketime.so", 1); setuid (0); execv ("/usr/X11R6/bin/Xserver", argv); perror ("Cannot execute /usr/X11R6/bin/Xserver"); return 1; } ------------------ Makefile ------------------- FLAGS = -O2 -pipe -fomit-frame-pointer -s XBIN = /usr/X11R6/bin all: X libfaketime.so X: X.c gcc $(FLAGS) -o $@ $< libfaketime.so: libfaketime.c gcc $(FLAGS) -shared -nostdlib -o $@ $< install: all cp libfaketime.so /usr/local/lib mv $(XBIN)/X $(XBIN)/Xserver cp X $(XBIN)/X chown root.root $(XBIN)/X chmod u+s $(XBIN)/X ----------------------------------------------- Be careful with the install part. The idea is that the wrapper described above gets installed in /usr/X11R6/bin and runs Xserver (which can be just a link to the real binary; I did not want to put any particular name in X.c). If you already have something called /usr/X11R6/bin/Xserver, don't run make install, or you'll lose it! Kit -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com