Skip to contentSkip to conversation

patch for svipw etc

PATCH Russell Coker 1 participant 1 message Aug 22, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

The attached patch file adds svipw, sadduser, and sadminpasswd to the spasswd family of programs.

svipw and sadduser are wrappers for vipw and adduser as you might expect. What they do (and the changed spasswd, schsh and schfn programs do) is to wait for the program they run (passwd, vipw, adduser, chsh, or chfn) to complete, then they set the correct security contexts on the /etc/passwd and /etc/shadow files.

The change of /etc/passwd is needed because the new policy has file_type_auto_trans(passwd_t, etc_t, shadow_t) and the /etc/passwd gets created in type shadow_t.

The change of /etc/shadow is just for paranoia. Errors changing the SID of /etc/passwd are reported to the user and logged, errors changing the SID of /etc/shadow are just silently logged to syslog (no point telling the user that system security may be stuffed).

Also should probably have an init script that uses chsid or chcon to set the right context of /etc/passwd, otherwise an inopportune reboot could result in /etc/passwd being unreadable by regular processes (IE "ls -l" would not work).

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

spasswd/Makefile renamed from tmp/selinux/utils/spasswd/Makefile +12 -1
diff -ruN /tmp/selinux/utils/spasswd/Makefile utils/spasswd/Makefile
@@ -1,12 +1,14 @@
 PASSWD=/usr/bin/passwd
 CHFN=/usr/bin/chfn
 CHSH=/usr/bin/chsh
+USERADD=/usr/sbin/useradd
+VIPW=/usr/sbin/vipw
 
 CFLAGS += -Wall -g -I/usr/local/selinux/include
 LDFLAGS += -L/usr/local/selinux/lib
 LIBS += -lsecure
 
-PROGS = spasswd schfn schsh
+PROGS = spasswd sadminpasswd suseradd svipw schfn schsh
 DESTDIR = /usr/local/selinux/bin
 
 all:  $(PROGS)
@@ -17,6 +19,15 @@
 spasswd.o: spasswd.c
 	$(CC) $(CFLAGS) -DPASSWD=\"$(PASSWD)\" -c -o $@ $<
 
+sadminpasswd.o: spasswd.c
+	$(CC) $(CFLAGS) -DADMIN_USE -DPASSWD=\"$(PASSWD)\" -c -o $@ $<
+
+suseradd.o: spasswd.c
+	$(CC) $(CFLAGS) -DADMIN_USE -DPASSWD=\"$(USERADD)\" -c -o $@ $<
+
+svipw.o: spasswd.c
+	$(CC) $(CFLAGS) -DADMIN_USE -DPASSWD=\"$(VIPW)\" -c -o $@ $<
+
 schfn.o: spasswd.c
 	$(CC) $(CFLAGS) -DPASSWD=\"$(CHFN)\" -c -o $@ $<
 
spasswd/spasswd.c renamed from tmp/selinux/utils/spasswd/spasswd.c +94 -8

137 lines not on this page · raw message