Multiple small fixes to policycoreutils
Subsystems (2)
Add newrole audit message on login failure.
Add -fPIE and -pie to build of restorecond.
Add /var/log/wtmp to restorecond.conf watch list
Fix genhomedircon, semanage, semodule_expand man pages.
newrole/newrole.c +1 -0
@@ -1028,6 +1028,7 @@ {fprintf (stderr,_ ("newrole: incorrect password for %s\n" ), pw.pw_name); +send_audit_message (0 , old_context, new_context, ttyn); goto err_close_pam; }
restorecond/Makefile +3 -2
@@ -5,8 +5,9 @@ INITDIR = $(DESTDIR)/etc/rc.d/init.d SELINUXDIR = $(DESTDIR)/etc/selinux -CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIE LDLIBS += -lselinux -lsepol -L$(PREFIX)/lib all: restorecond
restorecond/restorecond.conf +1 -0
@@ -2,5 +2,6 @@ /etc/samba/secrets.tdb /etc/mtab /var/run/utmp +/var/log/wtmp ~/public_html ~/.mozilla/plugins/libflashplayer.so
scripts/genhomedircon.8 +17 -22
@@ -45,35 +45,30 @@ .SH DESCRIPTION .PP This utility is used to generate file context configuration entries for -user home directories based on their default roles and is run when building -the policy. It can also be run when ever the -.I /etc/selinux/<<SELINUXTYPE>>/users/local.users -file is changed +user home directories based on their +.B prefix +entry in the the +.B semanage user record. +genhomedircon is run when building +the policy. It is also run automaticaly when ever the +.B semanage +utility modifies +.B user +or +.B login +records. Specifically, we replace HOME_ROOT, HOME_DIR, and ROLE macros in the .I /etc/selinux/<<SELINUXTYPE>>/contexts/files/homedir_template -file with generic and user-specific values. -.I local.users -file. If a user has more than one role in -.I local.users, -.B genhomedircon -uses the first role in the list. +file with generic and user-specific values. HOME_ROOT and HOME_DIR is replaced with each distinct location where login users homedirectories are located. Defaults to /home. ROLE is replaced based on the prefix entry in the +.B user +record. .PP -If a user is not listed in -.I local.users, -.B genhomedircon -assumes that the user's home dir will be found in one of the -HOME_ROOTs. -When looking for these users, -.B genhomedircon -only considers real users. "Real" users (as opposed -to system users) are those whose UID is greater than or equal +genhomedircon searches through all password entires for all "login" user home directories, (as opposed +to system users). Login users are those whose UID is greater than or equal .I STARTING_UID (default 500) and whose login shell is not "/sbin/nologin", or "/bin/false". .PP -Users who are explicitly defined in -.I local.users, -are always "real" (including root, in the default configuration). .SH AUTHOR This manual page was originally written by .I Manoj Srivastava <[email protected]>,
semanage/semanage.8 +4 -1
@@ -7,7 +7,7 @@ .br .B semanage login \-{a|d|m} [\-sr] login_name .br -.B semanage user \-{a|d|m} [\-LrR] selinux_name +.B semanage user \-{a|d|m} [\-LrRP] selinux_name .br .B semanage port \-{a|d|m} [\-tr] [\-p protocol] port | port_range .br
@@ -71,6 +71,9 @@ .I \-R, \-\-role SELinux Roles. You must enclose multiple roles within quotes, separate by spaces. Or specify \-R multiple times. .TP +.I \-P, \-\-prefix +SELinux Prefix. Prefix added to home_dir_t and home_t for labeling users home directories. +.TP .I \-s, \-\-seuser SELinux user name .TP
semodule_expand/semodule_expand.8 +1 -1
@@ -18,7 +18,7 @@ .SH "OPTIONS" .TP .B \-V -verbose mode +show version .TP .B \-c [version] policy version to create
restorecond/Makefile line 10
Quoted 7 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
restorecond/Makefile +3
-2-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIE
I would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Christopher J. PeBenito
Quoted 2 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 11 lines
restorecond/Makefile line 10
Quoted 6 lines
restorecond/Makefile +3
-2-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 18 lines · Daniel J Walsh
Quoted 6 lines · Christopher J. PeBenito
Quoted 2 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 11 lines
restorecond/Makefile line 10
Quoted 6 lines
restorecond/Makefile +3
-2-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
Quoted 3 lines
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)
Why does this need to be special? "?=" means if the variable isn't already set (setting CFLAGS to "" counts as set), then its set with the right side. This assignment won't happen if CFLAGS is set:
CFLAGS ?= -g -Werror -Wall -W
So in your spec file you just change your make command to make CFLAGS="-fPIE" LDFLAGS="-pie", then you'll get the behavior of the patch above. Keeping the makefile as is will keep the defaults safe, and then distros can set things whichever way they want with CFLAGS and LDFLAGS and not have extra compile/linking flags pop up.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 33 lines · Christopher J. PeBenito
Quoted 22 lines · Daniel J Walsh
Quoted 8 lines · Christopher J. PeBenito
Quoted 3 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 12 lines
restorecond/Makefile line 10
Quoted 7 lines
restorecond/Makefile +3
-2-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
Quoted 4 lines
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)Why does this need to be special? "?=" means if the variable isn't already set (setting CFLAGS to "" counts as set), then its set with the right side. This assignment won't happen if CFLAGS is set:
Quoted 9 lines
CFLAGS ?= -g -Werror -Wall -W
So in your spec file you just change your make command to
make CFLAGS="-fPIE" LDFLAGS="-pie", then you'll get the behavior of the patch above. Keeping the makefile as is will keep the defaults safe, and then distros can set things whichever way they want with CFLAGS and LDFLAGS and not have extra compile/linking flags pop up.
No because this will effect all the Makefiles, not just the daemon ones. I do not want to build restorecon/setfiles etc with -fPIE.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 31 lines · Daniel J Walsh
Quoted 30 lines · Christopher J. PeBenito
Quoted 17 lines · Daniel J Walsh
Quoted 5 lines · Christopher J. PeBenito
Quoted 2 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 10 lines
restorecond/Makefile
Quoted 6 lines
restorecond/Makefile +2
-3-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
Quoted 4 lines
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)Why does this need to be special? "?=" means if the variable isn't already set (setting CFLAGS to "" counts as set), then its set with the right side. This assignment won't happen if CFLAGS is set:
CFLAGS ?= -g -Werror -Wall -W
Quoted 9 lines
Quoted 7 lines
So in your spec file you just change your make command to
make CFLAGS="-fPIE" LDFLAGS="-pie", then you'll get the behavior of the patch above. Keeping the makefile as is will keep the defaults safe, and then distros can set things whichever way they want with CFLAGS and LDFLAGS and not have extra compile/linking flags pop up.No because this will effect all the Makefiles, not just the daemon ones. I do not want to build restorecon/setfiles etc with -fPIE.
What about a top-level USE_PIE makefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.
Karl
Quoted 7 lines
Signature · 4 lines
-- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 39 lines · Karl MacMillan
Quoted 38 lines · Daniel J Walsh
Quoted 37 lines · Christopher J. PeBenito
Quoted 17 lines · Daniel J Walsh
Quoted 5 lines · Christopher J. PeBenito
Quoted 2 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 10 lines
restorecond/Makefile
Quoted 6 lines
restorecond/Makefile +2
-3-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
Quoted 4 lines
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)Why does this need to be special? "?=" means if the variable isn't already set (setting CFLAGS to "" counts as set), then its set with the right side. This assignment won't happen if CFLAGS is set:
CFLAGS ?= -g -Werror -Wall -W
So in your spec file you just change your make command to
make CFLAGS="-fPIE" LDFLAGS="-pie", then you'll get the behavior of the patch above. Keeping the makefile as is will keep the defaults safe, and then distros can set things whichever way they want with CFLAGS and LDFLAGS and not have extra compile/linking flags pop up.
Quoted 5 lines
Quoted 2 lines
No because this will effect all the Makefiles, not just the daemon ones. I do not want to build restorecon/setfiles etc with -fPIE.
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.
No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 43 lines · Joshua Brindle
Quoted 42 lines · Karl MacMillan
Quoted 40 lines · Daniel J Walsh
Quoted 28 lines · Christopher J. PeBenito
Quoted 17 lines · Daniel J Walsh
Quoted 5 lines · Christopher J. PeBenito
Quoted 2 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 10 lines
Review
Quoted 6 lines
(quoted diff) +2
-3-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general, especially not to the override. The default flags should be pretty basic, IMO.
Quoted 4 lines
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)Why does this need to be special? "?=" means if the variable isn't already set (setting CFLAGS to "" counts as set), then its set with the right side. This assignment won't happen if CFLAGS is set:
Quoted 9 lines
CFLAGS ?= -g -Werror -Wall -W
So in your spec file you just change your make command to
make CFLAGS="-fPIE" LDFLAGS="-pie", then you'll get the behavior of the patch above. Keeping the makefile as is will keep the defaults safe, and then distros can set things whichever way they want with CFLAGS and LDFLAGS and not have extra compile/linking flags pop up.No because this will effect all the Makefiles, not just the daemon ones. I do not want to build restorecon/setfiles etc with -fPIE.
Quoted 8 lines
Quoted 2 lines
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
No, because then all compiled apps become -pie. We only want this on the daemons.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 63 lines
From: Daniel J Walsh [mailto:[email protected]]
Quoted 12 lines · Joshua Brindle
Quoted 11 lines · Karl MacMillan
Quoted 10 lines · Daniel J Walsh
Quoted 9 lines · Christopher J. PeBenito
Quoted 7 lines · Daniel J Walsh
Quoted 5 lines · Christopher J. PeBenito
Quoted 2 lines · Daniel J Walsh
Add -fPIE and -pie to build of restorecond.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Review
Quoted 6 lines
(quoted diff) +2
-3-CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIEI would say that this shouldn't be added in general,
especially
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
not to the override. The default flags should be
pretty basic,
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 3 lines
IMO.
How about if we change
LDFLAGS ?= ?= $(RANDLDFLAG)
override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 $(RANDCFLAG)Why does this need to be special? "?=" means if the
variable isn't
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
already set (setting CFLAGS to "" counts as set), then
its set with
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the right side. This assignment won't happen if CFLAGS is set:
CFLAGS ?= -g -Werror -Wall -W
So in your spec file you just change your make command to
make CFLAGS="-fPIE" LDFLAGS="-pie", then you'll get thebehavior of the
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
patch above. Keeping the makefile as is will keep the defaults safe, and then distros can set things whichever way they
want with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
CFLAGS and LDFLAGS and not have extra compile/linking
flags pop up.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
No because this will effect all the Makefiles, not just
the daemon
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
ones. I do not want to build restorecon/setfiles etc with -fPIE.
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.
Quoted 8 lines
Quoted 5 lines
No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
No, because then all compiled apps become -pie. We only want this on the daemons.
Why does it matter?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 2 lines · Daniel J Walsh
Quoted 1 line · Joshua Brindle
Karl MacMillan wrote:
<snip>
Quoted 11 lines
Quoted 9 lines
Quoted 3 lines
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
No, because then all compiled apps become -pie. We only want this on the daemons.
What about this instead?
Makefile +0 -0
@@ -1,10 +1,15 @@ SUBDIRS=libsepol libselinux libsemanage SUBDIRS=libsepol libselinux libsemanage checkpolicy policycoreutils #
policy
PYSUBDIRS=libselinux libsemanage
+
+# Turn on PIE for programs / daemons that support it. Default +# is off (0).
+export USE_PIE=0
ifeq ($(DEBUG),1)
export CFLAGS = -g3 -O0 -gdwarf-2 -fno-strict-aliasing -Wall -Wshadow export LDFLAGS = -g
endif
+
install relabel:
@for subdir in $(SUBDIRS); do \
policycoreutils/newrole/newrole.c +1 -0
@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) {fprintf (stderr,_ ("newrole: incorrect password for %s\n" ), pw.pw_name); +send_audit_message (0 , old_context, new_context, ttyn); goto err_close_pam; }
policycoreutils/restorecond/Makefile +8 -2
@@ -5,9 +5,15 @@ INITDIR = $(DESTDIR)/etc/rc.d/init.d INITDIR = $(DESTDIR)/etc/rc.d/init.d SELINUXDIR = $(DESTDIR)/etc/selinux -CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +CFLAGS ?= -Werror -Wall -W LDLIBS += -lselinux -lsepol -L$(PREFIX)/lib + +ifeq ($(USE_PIE),1) + override LDFLAGS += -pie + override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIE +else + override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +endif all: restorecond
policycoreutils/restorecond/restorecond.conf +1 -0
@@ -2,5 +2,6 @@ /etc/samba/secrets.tdb /etc/mtab /var/run/utmp +/var/log/wtmp ~/public_html ~/.mozilla/plugins/libflashplayer.so
policycoreutils/scripts/genhomedircon.8 +17 -22
@@ -45,35 +45,30 @@ Indicates the selinux type of this insta .SH DESCRIPTION .PP This utility is used to generate file context configuration entries for -user home directories based on their default roles and is run when building -the policy. It can also be run when ever the -.I /etc/selinux/<<SELINUXTYPE>>/users/local.users -file is changed +user home directories based on their +.B prefix +entry in the the +.B semanage user record. +genhomedircon is run when building +the policy. It is also run automaticaly when ever the +.B semanage +utility modifies +.B user +or +.B login +records. Specifically, we replace HOME_ROOT, HOME_DIR, and ROLE macros in the .I /etc/selinux/<<SELINUXTYPE>>/contexts/files/homedir_template -file with generic and user-specific values. -.I local.users -file. If a user has more than one role in -.I local.users, -.B genhomedircon -uses the first role in the list. +file with generic and user-specific values. HOME_ROOT and HOME_DIR is replaced with each distinct location where login users homedirectories are located. Defaults to /home. ROLE is replaced based on the prefix entry in the +.B user +record. .PP -If a user is not listed in -.I local.users, -.B genhomedircon -assumes that the user's home dir will be found in one of the -HOME_ROOTs. -When looking for these users, -.B genhomedircon -only considers real users. "Real" users (as opposed -to system users) are those whose UID is greater than or equal +genhomedircon searches through all password entires for all "login" user home directories, (as opposed +to system users). Login users are those whose UID is greater than or equal .I STARTING_UID (default 500) and whose login shell is not "/sbin/nologin", or "/bin/false". .PP -Users who are explicitly defined in -.I local.users, -are always "real" (including root, in the default configuration). .SH AUTHOR This manual page was originally written by .I Manoj Srivastava <[email protected]>,
policycoreutils/semanage/semanage.8 +1 -1
@@ -7,7 +7,7 @@ semanage \- SELinux Policy Management to .br .B semanage login \-{a|d|m} [\-sr] login_name .br -.B semanage user \-{a|d|m} [\-LrR] selinux_name +.B semanage user \-{a|d|m} [\-LrRP] selinux_name .br .B semanage port \-{a|d|m} [\-tr] [\-p protocol] port | port_range .br
@@ -71,6 +71,9 @@ MLS/MCS Security Range (MLS/MCS Systems .I \-R, \-\-role SELinux Roles. You must enclose multiple roles within quotes,
separate by spaces. Or specify \-R multiple times.
.TP
+.I \-P, \-\-prefix
+SELinux Prefix. Prefix added to home_dir_t and home_t for labeling users home directories. +.TP
.I \-s, \-\-seuser
SELinux user name
.TP
policycoreutils/semodule_expand/semodule_expand.8 +1 -1
@@ -18,7 +18,7 @@ together a set of packages into a single .SH "OPTIONS" .TP .B \-V -verbose mode +show version .TP .B \-c [version] policy version to create
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 18 lines
From: Karl MacMillan [mailto:[email protected]]
Quoted 2 lines · Daniel J Walsh
Quoted 1 line · Joshua Brindle
Karl MacMillan wrote:
<snip>
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
done and done.
No, because then all compiled apps become -pie. We only
want this on
Quoted 2 lines
the daemons.
What about this instead?
Why doesn't make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie" work? Why does it matter if everything is built pie?
This is distro specific (gentoo completely overrides the CFLAGS and LDFLAGS, I'm not sure what debian does). I don't think whether or not to override the user CFLAGS with non-critical things (e.g., things necessary to build the app like -I($PREFIX)/include) is appropriate for the upstream makefiles.
For that matter, anyone know why -D_FILE_OFFSET_BITS=64 is in the override?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 14 lines · Joshua Brindle
Quoted 14 lines
From: Karl MacMillan [mailto:[email protected]]
Quoted 2 lines · Daniel J Walsh
Quoted 1 line · Joshua Brindle
Karl MacMillan wrote:
<snip>
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
No, because then all compiled apps become -pie. We only
want this on
Quoted 2 lines
the daemons.
What about this instead?
Why doesn't make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie" work? Why does it matter if everything is built pie?
There are performance costs associated with pie, particularly at startup. Talking to Dan though, he doesn't think it is enough to not just build everything as pie.
Resend below that I will apply unless there are other objections.
Quoted 9 lines
This is distro specific (gentoo completely overrides the CFLAGS and LDFLAGS, I'm not sure what debian does). I don't think whether or not to override the user CFLAGS with non-critical things (e.g., things necessary to build the app like -I($PREFIX)/include) is appropriate for the upstream makefiles.
For that matter, anyone know why -D_FILE_OFFSET_BITS=64 is in the override?
I wondered that as well - Dan?
Karl
policycoreutils/newrole/newrole.c +1 -0
@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) {fprintf (stderr,_ ("newrole: incorrect password for %s\n" ), pw.pw_name); +send_audit_message (0 , old_context, new_context, ttyn); goto err_close_pam; }
policycoreutils/restorecond/restorecond.conf +1 -0
@@ -2,5 +2,6 @@ /etc/samba/secrets.tdb /etc/mtab /var/run/utmp +/var/log/wtmp ~/public_html ~/.mozilla/plugins/libflashplayer.so
policycoreutils/scripts/genhomedircon.8 +17 -22
@@ -45,35 +45,30 @@ Indicates the selinux type of this insta .SH DESCRIPTION .PP This utility is used to generate file context configuration entries for -user home directories based on their default roles and is run when building -the policy. It can also be run when ever the -.I /etc/selinux/<<SELINUXTYPE>>/users/local.users -file is changed +user home directories based on their +.B prefix +entry in the the +.B semanage user record. +genhomedircon is run when building +the policy. It is also run automaticaly when ever the +.B semanage +utility modifies +.B user +or +.B login +records. Specifically, we replace HOME_ROOT, HOME_DIR, and ROLE macros in the .I /etc/selinux/<<SELINUXTYPE>>/contexts/files/homedir_template -file with generic and user-specific values. -.I local.users -file. If a user has more than one role in -.I local.users, -.B genhomedircon -uses the first role in the list. +file with generic and user-specific values. HOME_ROOT and HOME_DIR is replaced with each distinct location where login users homedirectories are located. Defaults to /home. ROLE is replaced based on the prefix entry in the +.B user +record. .PP -If a user is not listed in -.I local.users, -.B genhomedircon -assumes that the user's home dir will be found in one of the -HOME_ROOTs. -When looking for these users, -.B genhomedircon -only considers real users. "Real" users (as opposed -to system users) are those whose UID is greater than or equal +genhomedircon searches through all password entires for all "login" user home directories, (as opposed +to system users). Login users are those whose UID is greater than or equal .I STARTING_UID (default 500) and whose login shell is not "/sbin/nologin", or "/bin/false". .PP -Users who are explicitly defined in -.I local.users, -are always "real" (including root, in the default configuration). .SH AUTHOR This manual page was originally written by .I Manoj Srivastava <[email protected]>,
policycoreutils/semanage/semanage.8 +1 -1
@@ -7,7 +7,7 @@ semanage \- SELinux Policy Management to .br .B semanage login \-{a|d|m} [\-sr] login_name .br -.B semanage user \-{a|d|m} [\-LrR] selinux_name +.B semanage user \-{a|d|m} [\-LrRP] selinux_name .br .B semanage port \-{a|d|m} [\-tr] [\-p protocol] port | port_range .br
@@ -71,6 +71,9 @@ MLS/MCS Security Range (MLS/MCS Systems .I \-R, \-\-role SELinux Roles. You must enclose multiple roles within quotes,
separate by spaces. Or specify \-R multiple times.
.TP
+.I \-P, \-\-prefix
+SELinux Prefix. Prefix added to home_dir_t and home_t for labeling users home directories. +.TP
.I \-s, \-\-seuser
SELinux user name
.TP
policycoreutils/semodule_expand/semodule_expand.8 +1 -1
@@ -18,7 +18,7 @@ together a set of packages into a single .SH "OPTIONS" .TP .B \-V -verbose mode +show version .TP .B \-c [version] policy version to create
Signed-off by: Karl MacMillan <[email protected]>
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 30 lines
From: Karl MacMillan [mailto:[email protected]]
Quoted 8 lines · Joshua Brindle
Quoted 8 lines
From: Karl MacMillan [mailto:[email protected]]
Quoted 2 lines · Daniel J Walsh
Quoted 1 line · Joshua Brindle
Karl MacMillan wrote:
<snip>
Quoted 1 line
Quoted 1 line
Quoted 1 line
What about a top-level
USE_PIEmakefile variable thatdirects all
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
sub-Makefiles to set PIE flags if appropriate for that
module? By
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
default it would be off. This gets the behavior you
want without
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
having to carry a patch and keeps the current behavior.
No patch necessary, like Chris said make CFLAGS="-fPIE
-02 -Werror
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
-Wall" LDFLAGS="-pie"
done and done.
No, because then all compiled apps become -pie. We only
want this on
Quoted 2 lines
the daemons.
What about this instead?
Quoted 9 lines
Quoted 1 line
Why doesn't make CFLAGS="-fPIE -02 -Werror -Wall"
LDFLAGS="-pie" work?
Quoted 2 lines
Why does it matter if everything is built pie?
There are performance costs associated with pie, particularly at startup. Talking to Dan though, he doesn't think it is enough to not just build everything as pie.
Yea, I don't think startup costs on checkpolicy, semodule, setfiles and so on are a big deal, not worth adding extra distro dependant logic into the make system. The actual issue though is that prelinking doesn't do anything on pie binaries, which is no big deal here, prelinking won't do much anyway.
Quoted 2 lines
Resend below that I will apply unless there are other objections.
It's the same patch sans the make stuff right? Looks fine to me
Quoted 7 lines
Quoted 2 lines
This is distro specific (gentoo completely overrides the CFLAGS and LDFLAGS, I'm not sure what debian does). I don't think
whether or not
Quoted 4 lines
to override the user CFLAGS with non-critical things (e.g., things necessary to build the app like -I($PREFIX)/include) is appropriate for the upstream makefiles.
Quoted 6 lines
Quoted 3 lines
For that matter, anyone know why -D_FILE_OFFSET_BITS=64 is in the override?
I wondered that as well - Dan?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 18 lines · Karl MacMillan
Quoted 17 lines · Joshua Brindle
Quoted 17 lines
From: Karl MacMillan [mailto:[email protected]]
Quoted 2 lines · Daniel J Walsh
Quoted 1 line · Joshua Brindle
Karl MacMillan wrote:
<snip>
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
No, because then all compiled apps become -pie. We only
want this on
Quoted 2 lines
the daemons.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
What about this instead?
Why doesn't make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie" work? Why does itmatter if everything is built pie?
There are performance costs associated with pie, particularly at startup. Talking to Dan though, he doesn't think it is enough to not just build everything as pie.
Resend below that I will apply unless there are other objections.
Agreed.
Quoted 6 lines
Quoted 6 lines
This is distro specific (gentoo completely overrides the CFLAGS and LDFLAGS, I'm not sure what debian does). I don't think whether or not to override the user CFLAGS with non-critical things (e.g., things necessary to build the app like -I($PREFIX)/include) is appropriate for the upstream makefiles.
Quoted 9 lines
Quoted 3 lines
For that matter, anyone know why -D_FILE_OFFSET_BITS=64 is in the override?
I wondered that as well - Dan?
Karl
That was not my doing.
Quoted 126 lines
diff -r
fdaf7172a43epolicycoreutils/newrole/newrole.cpolicycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +1
-0@@ -1028,6 +1028,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, _("newrole: incorrect password for %s\n"), pw.pw_name); + send_audit_message(0, old_context, new_context, ttyn); goto err_close_pam; }diff -r
fdaf7172a43epolicycoreutils/restorecond/restorecond.conf
---a/policycoreutils/restorecond/restorecond.confWed Nov 15
15:49:31 2006 -0500
+++b/policycoreutils/restorecond/restorecond.confThu Nov 16
17:03:40 2006 -0500policycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +1
-0@@ -2,5 +2,6 @@ /etc/samba/secrets.tdb /etc/mtab /var/run/utmp +/var/log/wtmp ~/public_html ~/.mozilla/plugins/libflashplayer.sodiff -r
fdaf7172a43epolicycoreutils/scripts/genhomedircon.8
--- a/policycoreutils/scripts/genhomedircon.8 Wed Nov 15 15:49:31
2006 -0500
+++ b/policycoreutils/scripts/genhomedircon.8 Thu Nov 16 17:03:40
2006 -0500policycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +0
-1@@ -45,35 +45,30 @@ Indicates the selinux type of this insta .SH DESCRIPTION .PP This utility is used to generate file context configuration entries for -user home directories based on their default roles and is run whenbuilding
policycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +13
-9-the policy. It can also be run when ever the -.I /etc/selinux/<<SELINUXTYPE>>/users/local.users -file is changed +user home directories based on their +.B prefix +entry in the the +.B semanage user record. +genhomedircon is run when building +the policy. It is also run automaticaly when ever the +.B semanage +utility modifies +.B user +or +.B login +records. Specifically, we replace HOME_ROOT, HOME_DIR, and ROLE macros in the .I /etc/selinux/<<SELINUXTYPE>>/contexts/files/homedir_template -file with generic and user-specific values. -.I local.users -file. If a user has more than one role in -.I local.users, -.B genhomedircon -uses the first role in the list. +file with generic and user-specific values. HOME_ROOT and HOME_DIRis replaced with each distinct location where login users homedirectories are located. Defaults to /home. ROLE is replaced based on the prefix entry in the +.B user
policycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +2
-9+record. .PP -If a user is not listed in -.I local.users, -.B genhomedircon -assumes that the user's home dir will be found in one of the -HOME_ROOTs. -When looking for these users, -.B genhomedircon -only considers real users. "Real" users (as opposed -to system users) are those whose UID is greater than or equal +genhomedircon searches through all password entires for all "login"user home directories, (as opposed
+to system users). Login users are those whose UID is greater than or equal
.ISTARTING_UID
(default 500) and whose login shell is not "/sbin/nologin", or "/bin/false".
.PPpolicycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +0
-3-Users who are explicitly defined in -.I local.users, -are always "real" (including root, in the default configuration). .SH AUTHOR This manual page was originally written by .I Manoj Srivastava <[email protected]>,diff -r
fdaf7172a43epolicycoreutils/semanage/semanage.8
--- a/policycoreutils/semanage/semanage.8 Wed Nov 15 15:49:31 2006
-0500
+++ b/policycoreutils/semanage/semanage.8 Thu Nov 16 17:03:40 2006
-0500policycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +1
-1@@ -7,7 +7,7 @@ semanage \- SELinux Policy Management to .br .B semanage login \-{a|d|m} [\-sr] login_name .br -.B semanage user \-{a|d|m} [\-LrR] selinux_name +.B semanage user \-{a|d|m} [\-LrRP] selinux_name .br .B semanage port \-{a|d|m} [\-tr] [\-p protocol] port | port_range .br@@ -71,6 +71,9 @@ MLS/MCS Security Range (MLS/MCS Systems .I \-R, \-\-role SELinux Roles. You must enclose multiple roles within quotes,separate by spaces. Or specify \-R multiple times.
.TP
+.I \-P, \-\-prefix
+SELinux Prefix. Prefix added tohome_dir_tandhome_tfor labeling users home directories.
+.TP
.I \-s, \-\-seuser
SELinux user name
.TP
diff -rfdaf7172a43epolicycoreutils/semodule_expand/semodule_expand.8
--- a/policycoreutils/semodule_expand/semodule_expand.8 Wed Nov 15
15:49:31 2006 -0500
+++ b/policycoreutils/semodule_expand/semodule_expand.8 Thu Nov 16
17:03:40 2006 -0500policycoreutils/newrole/newrole.c Thu Nov 16 17:03:40 2006 -0500 renamed from policycoreutils/newrole/newrole.c Wed Nov 15 15:49:31 2006 -0500 +1
-1@@ -18,7 +18,7 @@ together a set of packages into a single .SH "OPTIONS" .TP .B \-V -verbose mode +show version .TP .B \-c [version] policy version to create
Quoted 3 lines
Signed-off by: Karl MacMillan <[email protected]>
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 21 lines · Daniel J Walsh
Quoted 20 lines · Karl MacMillan
Quoted 19 lines · Joshua Brindle
Quoted 18 lines
From: Karl MacMillan [mailto:[email protected]]
Quoted 2 lines · Daniel J Walsh
Quoted 1 line · Joshua Brindle
Karl MacMillan wrote:
<snip>
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
What about a top-level
USE_PIEmakefile variable that directs all sub-Makefiles to set PIE flags if appropriate for that module? By default it would be off. This gets the behavior you want without having to carry a patch and keeps the current behavior.No patch necessary, like Chris said make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie"
done and done.
No, because then all compiled apps become -pie. We only
want this on
Quoted 2 lines
the daemons.
What about this instead?
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Why doesn't make CFLAGS="-fPIE -02 -Werror -Wall" LDFLAGS="-pie" work? Why does itmatter if everything is built pie?
There are performance costs associated with pie, particularly at startup. Talking to Dan though, he doesn't think it is enough to not just build everything as pie.
Resend below that I will apply unless there are other objections.
Committed as policycoreutils 1.33.2.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
More small fixes to policycoreutils
audit2allow was not generating reference policy correctly. This patches fixes this and uses /usr/share/sleinux/devel/Makefile to create policy packages.
newrole has Amy Griffiths patch to make newrole return the status code of the shell it execs.
run_init needs to call pam_acct_mgmt, so that pam_tally will work correctly.
semanage does not have -v option, so man page should be fixed.
There is a bug in the translation code in seobject.py Which ended up blowing up semanage, the strip command was being used in correctly.
Also after modifying translations the mcstrans needs to be signaled.
(I think it is time we break the mcstrans code out into a separate script, maybe executed by semanage, which would allow us to write tighter policy around this object and semanage.)
Lastly are you going to merge the translations?
http://people.redhat.com/dwalsh/SELinux/pocicycoreutils-po.patch
audit2allow/audit2allow +17 -13
@@ -184,22 +184,26 @@ output.write(serules.out(requires, module)) output.flush() if buildPP: - cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) - print _("Compiling policy") - print cmd - rc = commands.getstatusoutput(cmd) - if rc[0] == 0: - cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) - if fc_file != "": - cmd = "%s -f %s" % (cmd, fc_file) - + if ref_ind: + cmd = "make -f /usr/share/selinux/devel/Makefile %s.pp" % module + print _("Compiling policy") + print cmd + rc = commands.getstatusoutput(cmd) + else: + cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) + print _("Compiling policy") print cmd rc = commands.getstatusoutput(cmd) if rc[0] == 0: - print _("\n******************** IMPORTANT ***********************\n") - print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) - else: - errorExit(rc[1]) + cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) + if fc_file != "": + cmd = "%s -f %s" % (cmd, fc_file) + + print cmd + rc = commands.getstatusoutput(cmd) + if rc[0] == 0: + print _("\n******************** IMPORTANT ***********************\n") + print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) else: errorExit(rc[1])
newrole/newrole.c +6 -1
@@ -1068,11 +1068,16 @@*/ int rc;int exit_code =0 ; +int status;do { - rc =wait (NULL ); + rc =wait (&status); }while (rc <0 && errno ==EINTR ); +/* Preserve child exit status, unless there is another error. */ +if (WIFEXITED (status)) + exit_code =WEXITSTATUS (status); +if (restore_tty_label (fd, ttyn, tty_context, new_tty_context)) {fprintf (stderr,_ ("Unable to restore tty label...\n" )); exit_code =-1 ;
run_init/run_init.c +8 -0
@@ -132,6 +132,14 @@ result =1 ;/* user authenticated OK! */ } +/* If we were successful, call pam_acct_mgmt() to reset the +* pam_tally failcount. +*/ +if (result && (PAM_SUCCESS !=pam_acct_mgmt (pam_handle,0 )) ) { +fprintf (stderr,_ ("failed to get account information\n" )); +exit (-1 ); + } +/* We're done with PAM. Free `pam_handle'. */ pam_end (pam_handle,PAM_SUCCESS );
semanage/semanage.8 +0 -3
@@ -82,9 +82,6 @@ .TP .I \-T, \-\-trans SELinux Translation -.TP -.I \-v, \-\-verbose -verbose output .SH EXAMPLE .nf
semanage/seobject.py +11 -8
@@ -94,23 +94,25 @@ return re.search("^" + reg +"$",raw) def translate(raw, prepend = 1): - if prepend == 1: - context = "a:b:c:%s" % raw + filler="a:b:c:" + if prepend == 1: + context = "%s%s" % (filler,raw) else: context = raw - (rc, trans) = selinux.selinux_raw_to_trans_context(context) + (rc, trans) = selinux.selinux_raw_to_trans_context(context) if rc != 0: return raw if prepend: - trans = trans.strip("a:b:c") + trans = trans[len(filler):] if trans == "": return raw else: return trans def untranslate(trans, prepend = 1): + filler="a:b:c:" if prepend == 1: - context = "a:b:c:%s" % trans + context = "%s%s" % (filler,trans) else: context = trans
@@ -118,7 +120,7 @@ if rc != 0: return trans if prepend: - raw = raw.strip("a:b:c") + raw = raw[len(filler):] if raw == "": return trans else:
@@ -157,7 +159,7 @@ def out(self): rec = "" for c in self.comments: - rec += c +"\n" + rec += c keys = self.ddict.keys() keys.sort() for k in keys:
@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") + class semanageRecords: def __init__(self): self.sh = semanage_handle_create()
Re: More small fixes to policycoreutils
Quoted 2 lines · Daniel J Walsh
audit2allow was not generating reference policy correctly. This patches fixes this and uses
/usr/share/sleinux/devel/Makefileto create policy packages.
This is distro specific, audit2allow should be using /etc/selinux/config to find the interface directory to use. Further, why is this needed at all?
Quoted 3 lines
run_initneeds to callpam_acct_mgmt, so thatpam_tallywill work correctly.
What is pam_tally and what does the call to pam_acct_mgmt do, and how does it affect run_init?
Quoted 5 lines
Also after modifying translations the mcstrans needs to be signaled.
(I think it is time we break the mcstrans code out into a separate script, maybe executed by semanage, which would allow us to write tighter policy around this object and semanage.)
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Quoted 4 lines
Lastly are you going to merge the translations?
http://people.redhat.com/dwalsh/SELinux/pocicycoreutils-po.patch
It can be merged when a revised patchset does.
p.s. please please inline patches and make them apply from the top of the tree with -p1 or -p0 :)
semanage/seobject.py line 210
Quoted 7 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +
This is very distro specific and totally inappropriate IMO.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 6 lines · Joshua Brindle
Quoted 2 lines · Daniel J Walsh
audit2allow was not generating reference policy correctly. This patches fixes this and uses
/usr/share/sleinux/devel/Makefileto create policy packages.This is distro specific, audit2allow should be using
/etc/selinux/configto find the interface directory to use. Further, why is this needed at all?
Not certain that /usr/share/selinux/targeted/include is any more general in reality. There is nothing stopping a distro from installing headers in different locations.
Quoted 6 lines
Quoted 3 lines
run_initneeds to callpam_acct_mgmt, so thatpam_tallywill work correctly.What is
pam_tallyand what does the call topam_acct_mgmtdo, and how does it affectrun_init?
Quoted 8 lines
Quoted 5 lines
Also after modifying translations the mcstrans needs to be signaled.
(I think it is time we break the mcstrans code out into a separate script, maybe executed by semanage, which would allow us to write tighter policy around this object and semanage.)
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Why isn't setrans upstream?
Quoted 9 lines
Quoted 4 lines
Lastly are you going to merge the translations?
http://people.redhat.com/dwalsh/SELinux/pocicycoreutils-po.patchIt can be merged when a revised patchset does.
p.s. please please inline patches and make them apply from the top of the tree with -p1 or -p0 :)
Quoted 10 lines
semanage/seobject.py line 210
Quoted 7 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +This is very distro specific and totally inappropriate IMO.
Agreed - what is the solution, though?
Karl
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 9 lines · Karl MacMillan
Quoted 6 lines · Joshua Brindle
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Why isn't setrans upstream?
It wasn't clear that there was any demand for it outside of Fedora / RHEL, and it was always optional. If other distros are going to use it (e.g. Debian?), then I agree it should likely be added (after code review and cleanup, of course).
Quoted 11 lines
Quoted 10 lines
semanage/seobject.py line 210
Quoted 7 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +This is very distro specific and totally inappropriate IMO.
Quoted 1 line
Agreed - what is the solution, though?
Configurable pre and post scriptlets, defined externally and optional?
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Karl MacMillan
Quoted 2 lines · Joshua Brindle
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Why isn't setrans upstream?
It wasn't clear that there was any demand for it outside of Fedora / RHEL, and it was always optional. If other distros are going to use it (e.g. Debian?), then I agree it should likely be added (after code review and cleanup, of course).
Also, is this server only for mcs? Does MLS/LSPP config use a different server? It seems like this needs to be more general that mcs, since that doesn't really mean anything anyway.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
semanage/seobject.py line 210
Quoted 7 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +This is very distro specific and totally inappropriate IMO.
Quoted 4 lines
Quoted 1 line
Agreed - what is the solution, though?
Configurable pre and post scriptlets, defined externally and optional?
Same question as above, does semanage management of translations break down on MLS configs? If so I'd vote for all this code to be ripped out of semanage altogether and put into another tool that is specific to the
mcstrans server, since the translation file is server specific anyway.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 7 lines · Joshua Brindle
Quoted 6 lines · Stephen Smalley
Quoted 4 lines · Karl MacMillan
Quoted 2 lines · Joshua Brindle
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Why isn't setrans upstream?
Quoted 7 lines
Quoted 5 lines
It wasn't clear that there was any demand for it outside of Fedora / RHEL, and it was always optional. If other distros are going to use it (e.g. Debian?), then I agree it should likely be added (after code review and cleanup, of course).
Also, is this server only for mcs? Does MLS/LSPP config use a different server?
No - this will work for MLS, though real MLS deployments may replace it with a more complex translation server.
It seems like this needs to be more general that mcs, since that
Quoted 2 lines
doesn't really mean anything anyway.
No idea what you mean here, but it seems worth having a component upstream even if it is only optionally used. Any distro that wants to use MLS/MCS will likely want a translation server.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
semanage/seobject.py line 211
Quoted 8 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +This is very distro specific and totally inappropriate IMO.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Agreed - what is the solution, though?
Configurable pre and post scriptlets, defined externally and optional?
Same question as above, does semanage management of translations break down on MLS configs?
I don't think so.
If so I'd vote for all this code to be ripped out
Quoted 3 lines
of semanage altogether and put into another tool that is specific to the
mcstrans server, since the translation file is server specific anyway.
We are having a lot of success by pointing people towards semanage when they need to configure SELinux. Adding separate tools at this point seems counterproductive to me.
Karl
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Stephen SmalleyQuoted 20 lines · Stephen Smalley
Quoted 4 lines · Karl MacMillan
Quoted 2 lines · Joshua Brindle
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Why isn't setrans upstream?
It wasn't clear that there was any demand for it outside of Fedora / RHEL, and it was always optional. If other distros are going to use it (e.g. Debian?), then I agree it should likely be added (after code review and cleanup, of course).
Quoted 9 lines
Quoted 9 lines
semanage/seobject.py line 210
Quoted 7 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +This is very distro specific and totally inappropriate IMO.
Quoted 4 lines
Quoted 1 line
Agreed - what is the solution, though?
Configurable pre and post scriptlets, defined externally and optional?
Maybe - though I am already concerned about the amount of work that semanage does that is unnecessarily (e.g., changing a user results in a full link / expand). So I would want to allow these scripts to only run when something they are interested in changes.
Would these scripts be run by libsemanage or only semanage? I assume the former.
Karl
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Joshua BrindleQuoted 6 lines · Joshua Brindle
Quoted 2 lines · Daniel J Walsh
audit2allow was not generating reference policy correctly. This patches fixes this and uses
/usr/share/sleinux/devel/Makefileto create policy packages.This is distro specific, audit2allow should be using
/etc/selinux/configto find the interface directory to use. Further, why is this needed at all?
audit2allow -R -M local -i /var/log/audit/audit.log
Attempts to match interfaces against devel package, and build potential policies. Without this change audit2allow blows up.
Not sure what you want to extrace out of /etc/selinux/config? The type of the policy? And then go to /usr/share/selinux/TYPE/include/Makefile?
Quoted 6 lines
Quoted 3 lines
run_initneeds to callpam_acct_mgmt, so thatpam_tallywill work correctly.What is
pam_tallyand what does the call topam_acct_mgmtdo, and how does it affectrun_init?
I believe pam_tally increments a counter for failed logins in pam_authenticate and decrements it when it gets to pam_account management. If it never gets there, the counter continues to increment.
Quoted 8 lines
Quoted 5 lines
Also after modifying translations the mcstrans needs to be signaled.
(I think it is time we break the mcstrans code out into a separate script, maybe executed by semanage, which would allow us to write tighter policy around this object and semanage.)
Its interesting that semanage manages something that is redhat specific and not part of the upstream utilities at all.. IMO this should never have been merged in the first place, semanage manages libsemanage abstractions, if translations were a part of libsemanage it'd be a different story.
Agreed, I think we should break it out and maybe allow semanage to have a plugin type interface, so the administrator still uses the same command to manage other parts of "SELinux" that do not come from upstream.
Quoted 9 lines
Quoted 4 lines
Lastly are you going to merge the translations?
http://people.redhat.com/dwalsh/SELinux/pocicycoreutils-po.patchIt can be merged when a revised patchset does.
p.s. please please inline patches and make them apply from the top of the tree with -p1 or -p0 :)
We are applying these patches with a -p1?
Quoted 12 lines
semanage/seobject.py line 210
Quoted 7 lines
semanage/seobject.py +2
-1@@ -204,7 +206,8 @@ os.write(fd, self.out()) os.close(fd) os.rename(newfilename, self.filename) - + os.system("/sbin/service mcstrans reload > /dev/null") +This is very distro specific and totally inappropriate IMO.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 6 lines · Daniel J Walsh
Quoted 3 lines
What is
pam_tallyand what does the call topam_acct_mgmtdo, and how does it affectrun_init?I believe
pam_tallyincrements a counter for failed logins inpam_authenticateand decrements it when it gets topam_accountmanagement. If it never gets there, the counter continues to increment.
I thought I saw that pam_tally was being moved from the generic system auth config to specific program configs, and was thus no longer an issue for run_init. No?
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 5 lines · Stephen Smalley
Quoted 3 lines · Daniel J Walsh
Quoted 3 lines
What is
pam_tallyand what does the call topam_acct_mgmtdo, and how does it affectrun_init?
Quoted 8 lines
Quoted 2 lines
I believe
pam_tallyincrements a counter for failed logins inpam_authenticateand decrements it when it gets topam_accountmanagement. If it never gets there, the counter continues to increment.I thought I saw that
pam_tallywas being moved from the generic system auth config to specific program configs, and was thus no longer an issue forrun_init. No?
That might be, but after talking to Nalin, he heavily recommends that we use pam_acct_mgmt with a pam_permit. He says that is the recommended way, and would admins to add customizations on when and how you can run the command.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RE: More small fixes to policycoreutils
Quoted 17 lines
From: Daniel J Walsh [mailto:[email protected]]
Quoted 9 lines · Stephen Smalley
Quoted 7 lines · Daniel J Walsh
Quoted 4 lines
What is
pam_tallyand what does the call topam_acct_mgmtdo, and how does it affectrun_init?I believe
pam_tallyincrements a counter for failed logins inpam_authenticateand decrements it when it gets topam_accountmanagement. If it never gets there, the counter continuesto increment.
Quoted 3 lines
Quoted 1 line
I thought I saw that
pam_tallywas being moved from thegeneric system
Quoted 9 lines
Quoted 4 lines
auth config to specific program configs, and was thus no longer an issue for
run_init. No?That might be, but after talking to Nalin, he heavily recommends that we use
pam_acct_mgmtwith apam_permit. He says that is the recommended way, and would admins to add customizations on when and how you can run the command.
So what does this mean as far as the patch that you sent goes? Will you be sending out a revised one soon?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Fixes to make sure module name is all alphabet charaters.
Fixes to generate Reference Policy modules correctly.
audit2allow/audit2allow +25 -13
@@ -25,6 +25,7 @@ # # from avc import * +import re if __name__ == '__main__': import commands, sys, os, getopt, selinux
@@ -59,6 +60,11 @@ print msg sys.exit(1) + def verify_module(module): + m = re.findall("[^a-zA-Z]", module) + if len(m) != 0: + usage(_("Alphabetic Charaters Only")) + def errorExit(error): sys.stderr.write("%s: " % sys.argv[0]) sys.stderr.write("%s\n" % error)
@@ -125,10 +131,12 @@ if module != "" or a[0] == "-": usage() module = a + verify_module(module) if o == "-M": if module != "" or output_ind or a[0] == "-": usage() module = a + verify_module(module) outfile = a+".te" buildPP = 1 if not os.path.exists("/usr/bin/checkmodule"):
@@ -184,22 +192,26 @@ output.write(serules.out(requires, module)) output.flush() if buildPP: - cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) - print _("Compiling policy") - print cmd - rc = commands.getstatusoutput(cmd) - if rc[0] == 0: - cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) - if fc_file != "": - cmd = "%s -f %s" % (cmd, fc_file) - + if ref_ind: + cmd = "make -f /usr/share/selinux/devel/Makefile %s.pp" % module + print _("Compiling policy") + print cmd + rc = commands.getstatusoutput(cmd) + else: + cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) + print _("Compiling policy") print cmd rc = commands.getstatusoutput(cmd) if rc[0] == 0: - print _("\n******************** IMPORTANT ***********************\n") - print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) - else: - errorExit(rc[1]) + cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) + if fc_file != "": + cmd = "%s -f %s" % (cmd, fc_file) + + print cmd + rc = commands.getstatusoutput(cmd) + if rc[0] == 0: + print _("\n******************** IMPORTANT ***********************\n") + print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) else: errorExit(rc[1])
Re: More small fixes to policycoreutils
Quoted 20 lines · Daniel J Walsh
Fixes to make sure module name is all alphabet charaters.
Fixes to generate Reference Policy modules correctly.
------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/audit2allow/audit2allow policycoreutils-1.33.4/audit2allow/audit2allow
audit2allow/audit2allow +1
-0@@ -25,6 +25,7 @@ # # from avc import * +import re if __name__ == '__main__': import commands, sys, os, getopt, selinux
audit2allow/audit2allow line 67
Quoted 8 lines
audit2allow/audit2allow +5
-0@@ -59,6 +60,11 @@ print msg sys.exit(1) + def verify_module(module): + m = re.findall("[^a-zA-Z]", module) + if len(m) != 0: + usage(_("Alphabetic Charaters Only")) +
numbers are valid in module names, I use them all the time in fact.
Quoted 21 lines
audit2allow/audit2allow +2
-1def errorExit(error): sys.stderr.write("%s: " % sys.argv[0]) sys.stderr.write("%s\n" % error)@@ -125,10 +131,12 @@ if module != "" or a[0] == "-": usage() module = a + verify_module(module) if o == "-M": if module != "" or output_ind or a[0] == "-": usage() module = a + verify_module(module) outfile = a+".te" buildPP = 1 if not os.path.exists("/usr/bin/checkmodule"):@@ -184,22 +192,26 @@ output.write(serules.out(requires, module)) output.flush() if buildPP: - cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module)
audit2allow/audit2allow line 196
Quoted 10 lines
audit2allow/audit2allow +2
-8- print _("Compiling policy") - print cmd - rc = commands.getstatusoutput(cmd) - if rc[0] == 0: - cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) - if fc_file != "": - cmd = "%s -f %s" % (cmd, fc_file) - + if ref_ind: + cmd = "make -f /usr/share/selinux/devel/Makefile %s.pp" % module
Still non-standard
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 3 lines · Joshua Brindle
Quoted 2 lines · Daniel J Walsh
Fixes to make sure module name is all alphabet charaters.
Added
Quoted 3 lines
Still non-standard
Fine, I will go with your standard.
audit2allow/audit2allow +26 -13
@@ -29,6 +29,7 @@ if __name__ == '__main__': import commands, sys, os, getopt, selinux import gettext + import re try: gettext.install('policycoreutils') except:
@@ -59,6 +60,11 @@ print msg sys.exit(1) + def verify_module(module): + m = re.findall("[^a-zA-Z0-9]", module) + if len(m) != 0: + usage(_("Alphanumeric Charaters Only")) + def errorExit(error): sys.stderr.write("%s: " % sys.argv[0]) sys.stderr.write("%s\n" % error)
@@ -125,10 +131,12 @@ if module != "" or a[0] == "-": usage() module = a + verify_module(module) if o == "-M": if module != "" or output_ind or a[0] == "-": usage() module = a + verify_module(module) outfile = a+".te" buildPP = 1 if not os.path.exists("/usr/bin/checkmodule"):
@@ -184,22 +192,27 @@ output.write(serules.out(requires, module)) output.flush() if buildPP: - cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) - print _("Compiling policy") - print cmd - rc = commands.getstatusoutput(cmd) - if rc[0] == 0: - cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) - if fc_file != "": - cmd = "%s -f %s" % (cmd, fc_file) - + if ref_ind: + rc, type = selinux.selinux_getpolicytype() + cmd = "make -f /usr/share/selinux/%s/include/Makefile %s.pp" % (type, module) + print _("Compiling policy") + print cmd + rc = commands.getstatusoutput(cmd) + else: + cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) + print _("Compiling policy") print cmd rc = commands.getstatusoutput(cmd) if rc[0] == 0: - print _("\n******************** IMPORTANT ***********************\n") - print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) - else: - errorExit(rc[1]) + cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) + if fc_file != "": + cmd = "%s -f %s" % (cmd, fc_file) + + print cmd + rc = commands.getstatusoutput(cmd) + if rc[0] == 0: + print _("\n******************** IMPORTANT ***********************\n") + print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) else: errorExit(rc[1])
Joshua Brindle
Acked-byRe: More small fixes to policycoreutils
Quoted 80 lines · Daniel J Walsh
Quoted 3 lines · Joshua Brindle
Quoted 2 lines · Daniel J Walsh
Fixes to make sure module name is all alphabet charaters.
Added
Quoted 3 lines
Still non-standard
Fine, I will go with your standard.
------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/audit2allow/audit2allow policycoreutils-1.33.4/audit2allow/audit2allow
audit2allow/audit2allow +19
-13@@ -29,6 +29,7 @@ if __name__ == '__main__': import commands, sys, os, getopt, selinux import gettext + import re try: gettext.install('policycoreutils') except:@@ -59,6 +60,11 @@ print msg sys.exit(1) + def verify_module(module): + m = re.findall("[^a-zA-Z0-9]", module) + if len(m) != 0: + usage(_("Alphanumeric Charaters Only")) + def errorExit(error): sys.stderr.write("%s: " % sys.argv[0]) sys.stderr.write("%s\n" % error)@@ -125,10 +131,12 @@ if module != "" or a[0] == "-": usage() module = a + verify_module(module) if o == "-M": if module != "" or output_ind or a[0] == "-": usage() module = a + verify_module(module) outfile = a+".te" buildPP = 1 if not os.path.exists("/usr/bin/checkmodule"):@@ -184,22 +192,27 @@ output.write(serules.out(requires, module)) output.flush() if buildPP: - cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) - print _("Compiling policy") - print cmd - rc = commands.getstatusoutput(cmd) - if rc[0] == 0: - cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) - if fc_file != "": - cmd = "%s -f %s" % (cmd, fc_file) - + if ref_ind: + rc, type = selinux.selinux_getpolicytype() + cmd = "make -f /usr/share/selinux/%s/include/Makefile %s.pp" % (type, module) + print _("Compiling policy") + print cmd + rc = commands.getstatusoutput(cmd) + else: + cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) + print _("Compiling policy") print cmd rc = commands.getstatusoutput(cmd) if rc[0] == 0: - print _("\n******************** IMPORTANT ***********************\n") - print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) - else: - errorExit(rc[1]) + cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) + if fc_file != "":
audit2allow/audit2allow line 218
Quoted 10 lines
audit2allow/audit2allow +7
-0+ cmd = "%s -f %s" % (cmd, fc_file) + + print cmd + rc = commands.getstatusoutput(cmd) + if rc[0] == 0: + print _("\n******************** IMPORTANT ***********************\n") + print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) else: errorExit(rc[1])
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RE: More small fixes to policycoreutils
In reply to Daniel J WalshQuoted 12 lines
From: Daniel J Walsh [mailto:[email protected]]
Quoted 3 lines · Joshua Brindle
Quoted 2 lines · Daniel J Walsh
Fixes to make sure module name is all alphabet charaters.
Added
Quoted 3 lines
Still non-standard
Fine, I will go with your standard.
Merged this, the error status patch, the verbose man page fix and pam_acct_mgmt patches as of policycoreutils 1.33.6
Thanks.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Joshua BrindleFix handling of translations in python correctly.
Fix rewrite of the translations library not to insert extra lines.
semanage/seobject.py +9 -7
@@ -94,23 +94,25 @@ return re.search("^" + reg +"$",raw) def translate(raw, prepend = 1): - if prepend == 1: - context = "a:b:c:%s" % raw + filler="a:b:c:" + if prepend == 1: + context = "%s%s" % (filler,raw) else: context = raw - (rc, trans) = selinux.selinux_raw_to_trans_context(context) + (rc, trans) = selinux.selinux_raw_to_trans_context(context) if rc != 0: return raw if prepend: - trans = trans.strip("a:b:c") + trans = trans[len(filler):] if trans == "": return raw else: return trans def untranslate(trans, prepend = 1): + filler="a:b:c:" if prepend == 1: - context = "a:b:c:%s" % trans + context = "%s%s" % (filler,trans) else: context = trans
@@ -118,7 +120,7 @@ if rc != 0: return trans if prepend: - raw = raw.strip("a:b:c") + raw = raw[len(filler):] if raw == "": return trans else:
@@ -157,7 +159,7 @@ def out(self): rec = "" for c in self.comments: - rec += c +"\n" + rec += c keys = self.ddict.keys() keys.sort() for k in keys:
Re: More small fixes to policycoreutils
Quoted 11 lines · Daniel J Walsh
Fix handling of translations in python correctly.
Fix rewrite of the translations library not to insert extra lines.
------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/semanage/seobject.pypolicycoreutils-1.33.4/semanage/seobject.py
semanage/seobject.py line 99
Quoted 8 lines
semanage/seobject.py +3
-2@@ -94,23 +94,25 @@ return re.search("^" + reg +"$",raw) def translate(raw, prepend = 1): - if prepend == 1: - context = "a:b:c:%s" % raw + filler="a:b:c:" + if prepend == 1: + context = "%s%s" % (filler,raw)
This is not good, why doesn't this python script use libsepol calls to get the MLS part of the context without manipulating the (opaque) context directly?
semanage/seobject.py line 102
Quoted 4 lines
semanage/seobject.py +1
-1else: context = raw - (rc, trans) = selinux.selinux_raw_to_trans_context(context) + (rc, trans) = selinux.selinux_raw_to_trans_context(context)
?
Quoted 28 lines
semanage/seobject.py +4
-3if rc != 0: return raw if prepend: - trans = trans.strip("a:b:c") + trans = trans[len(filler):] if trans == "": return raw else: return trans def untranslate(trans, prepend = 1): + filler="a:b:c:" if prepend == 1: - context = "a:b:c:%s" % trans + context = "%s%s" % (filler,trans) else: context = trans@@ -118,7 +120,7 @@ if rc != 0: return trans if prepend: - raw = raw.strip("a:b:c") + raw = raw[len(filler):] if raw == "": return trans else:
semanage/seobject.py line 165
Quoted 8 lines
semanage/seobject.py +1
-1@@ -157,7 +159,7 @@ def out(self): rec = "" for c in self.comments: - rec += c +"\n" + rec += c keys = self.ddict.keys() keys.sort() for k in keys:
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 18 lines · Joshua Brindle
Quoted 17 lines · Daniel J Walsh
Fix handling of translations in python correctly.
Fix rewrite of the translations library not to insert extra lines.
------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/semanage/seobject.pypolicycoreutils-1.33.4/semanage/seobject.py
---nsapolicycoreutils/semanage/seobject.py2006-11-16
17:14:26.000000000 -0500
+++policycoreutils-1.33.4/semanage/seobject.py2006-11-22
14:11:25.000000000 -0500semanage/seobject.py +0
-0@@ -94,23 +94,25 @@ return re.search("^" + reg +"$",raw)
Quoted 9 lines
semanage/seobject.py line 99
Quoted 6 lines
semanage/seobject.py +3
-2def translate(raw, prepend = 1): - if prepend == 1: - context = "a:b:c:%s" % raw + filler="a:b:c:" + if prepend == 1: + context = "%s%s" % (filler,raw)This is not good, why doesn't this python script use libsepol calls to get the MLS part of the context without manipulating the (opaque) context directly?
Huh? This is used to verify MLS Componants being added to users and levels by semanage. There is no TYPE componant. so all we have is the MLS s0:15 or so-PatientRecord.
Quoted 6 lines
semanage/seobject.py line 102
Quoted 4 lines
semanage/seobject.py +1
-1else: context = raw - (rc, trans) = selinux.selinux_raw_to_trans_context(context) + (rc, trans) = selinux.selinux_raw_to_trans_context(context)?
Ignore.
Quoted 29 lines
Quoted 29 lines
semanage/seobject.py +4
-3if rc != 0: return raw if prepend: - trans = trans.strip("a:b:c") + trans = trans[len(filler):] if trans == "": return raw else: return trans def untranslate(trans, prepend = 1): + filler="a:b:c:" if prepend == 1: - context = "a:b:c:%s" % trans + context = "%s%s" % (filler,trans) else: context = trans@@ -118,7 +120,7 @@ if rc != 0: return trans if prepend: - raw = raw.strip("a:b:c") + raw = raw[len(filler):] if raw == "": return trans else:@@ -157,7 +159,7 @@
Quoted 10 lines
semanage/seobject.py line 165
Quoted 8 lines
semanage/seobject.py +1
-1def out(self): rec = "" for c in self.comments: - rec += c +"\n" + rec += c keys = self.ddict.keys() keys.sort() for k in keys:
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Joshua BrindleNo verbose flag for semanage, fix man page.
semanage/semanage.8 +0 -3
@@ -82,10 +82,7 @@ .TP .I \-T, \-\-trans SELinux Translation -.TP -.I \-v, \-\-verbose -verbose output .SH EXAMPLE .nf
Joshua Brindle
Acked-byRe: More small fixes to policycoreutils
Quoted 9 lines · Daniel J Walsh
No verbose flag for semanage, fix man page.
------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/semanage/semanage.8 policycoreutils-1.33.4/semanage/semanage.8
semanage/semanage.8 line 88
Quoted 10 lines
semanage/semanage.8 +0
-3@@ -82,10 +82,7 @@ .TP .I \-T, \-\-trans SELinux Translation -.TP -.I \-v, \-\-verbose -verbose output .SH EXAMPLE .nf
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Joshua BrindleAmy's patch for handling exit codes in newrole.
newrole/newrole.c +6 -1
@@ -1068,11 +1068,16 @@*/ int rc;int exit_code =0 ; +int status;do { - rc =wait (NULL ); + rc =wait (&status); }while (rc <0 && errno ==EINTR ); +/* Preserve child exit status, unless there is another error. */ +if (WIFEXITED (status)) + exit_code =WEXITSTATUS (status); +if (restore_tty_label (fd, ttyn, tty_context, new_tty_context)) {fprintf (stderr,_ ("Unable to restore tty label...\n" )); exit_code =-1 ;
Joshua Brindle
Acked-byRe: More small fixes to policycoreutils
Quoted 16 lines · Daniel J Walsh
Amy's patch for handling exit codes in newrole.
------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/newrole/newrole.cpolicycoreutils-1.33.4/newrole/newrole.cnewrole/newrole.c +1
-1@@ -1068,11 +1068,16 @@*/ int rc;int exit_code =0 ; +int status; do { - rc = wait(NULL);
newrole/newrole.c line 1083
Quoted 10 lines
newrole/newrole.c +5
-0+ rc =wait (&status); }while (rc <0 && errno ==EINTR ); +/* Preserve child exit status, unless there is another error. */ +if (WIFEXITED (status)) + exit_code =WEXITSTATUS (status); +if (restore_tty_label (fd, ttyn, tty_context, new_tty_context)) {fprintf (stderr,_ ("Unable to restore tty label...\n" )); exit_code =-1 ;
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Joshua Brindlerun_init patch for call pam_acct_mgmt
run_init/run_init.c +8 -0
@@ -132,6 +132,14 @@ result =1 ;/* user authenticated OK! */ } +/* If we were successful, call pam_acct_mgmt() to reset the +* pam_tally failcount. +*/ +if (result && (PAM_SUCCESS !=pam_acct_mgmt (pam_handle,0 )) ) { +fprintf (stderr,_ ("failed to get account information\n" )); +exit (-1 ); + } +/* We're done with PAM. Free `pam_handle'. */ pam_end (pam_handle,PAM_SUCCESS );
Re: More small fixes to policycoreutils
Quoted 13 lines · Daniel J Walsh
run_initpatch for callpam_acct_mgmt------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/run_init/run_init.cpolicycoreutils-1.33.4/run_init/run_init.crun_init/run_init.c +1
-0@@ -132,6 +132,14 @@ result =1 ;/* user authenticated OK! */ } +/* If we were successful, call pam_acct_mgmt() to reset the
run_init/run_init.c line 145
Quoted 10 lines
run_init/run_init.c +7
-0+* pam_tally failcount. +*/ +if (result && (PAM_SUCCESS !=pam_acct_mgmt (pam_handle,0 )) ) { +fprintf (stderr,_ ("failed to get account information\n" )); +exit (-1 ); + } +/* We're done with PAM. Free `pam_handle'. */ pam_end (pam_handle,PAM_SUCCESS );
I thought the previous thread noted that this was unnecessary, or am I confused?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
Quoted 17 lines · Joshua Brindle
Quoted 16 lines · Daniel J Walsh
run_initpatch for callpam_acct_mgmt------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/run_init/run_init.cpolicycoreutils-1.33.4/run_init/run_init.c
---nsapolicycoreutils/run_init/run_init.c2006-11-16
17:14:27.000000000 -0500
+++policycoreutils-1.33.4/run_init/run_init.c2006-11-22
14:11:25.000000000 -0500run_init/run_init.c +0
-0@@ -132,6 +132,14 @@ result =1 ;/* user authenticated OK! */ }
Quoted 14 lines
run_init/run_init.c line 145
Quoted 11 lines
run_init/run_init.c +8
-0+/* If we were successful, call pam_acct_mgmt() to reset the +* pam_tally failcount. +*/ +if (result && (PAM_SUCCESS !=pam_acct_mgmt (pam_handle,0 )) ) { +fprintf (stderr,_ ("failed to get account information\n" )); +exit (-1 ); + } +/* We're done with PAM. Free `pam_handle'. */ pam_end (pam_handle,PAM_SUCCESS );I thought the previous thread noted that this was unnecessary, or am I confused?
The pam_tally might not be required anymore. But best practices says put it in there.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Joshua Brindle
Acked-byRe: More small fixes to policycoreutils
Quoted 31 lines · Daniel J Walsh
Quoted 17 lines · Joshua Brindle
Quoted 16 lines · Daniel J Walsh
run_initpatch for callpam_acct_mgmt------------------------------------------------------------------------
diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/run_init/run_init.cpolicycoreutils-1.33.4/run_init/run_init.c
---nsapolicycoreutils/run_init/run_init.c2006-11-16
17:14:27.000000000 -0500
+++policycoreutils-1.33.4/run_init/run_init.c2006-11-22
14:11:25.000000000 -0500run_init/run_init.c +0
-0@@ -132,6 +132,14 @@ result =1 ;/* user authenticated OK! */ }Quoted 13 lines
run_init/run_init.c line 145
Quoted 10 lines
run_init/run_init.c +7
-0+/* If we were successful, call pam_acct_mgmt() to reset the +* pam_tally failcount. +*/ +if (result && (PAM_SUCCESS !=pam_acct_mgmt (pam_handle,0 )) ) { +fprintf (stderr,_ ("failed to get account information\n" )); +exit (-1 ); + } +/* We're done with PAM. Free `pam_handle'. */ pam_end (pam_handle,PAM_SUCCESS );I thought the previous thread noted that this was unnecessary, or am I confused?
Quoted 2 lines
The
pam_tallymight not be required anymore. But best practices says put it in there.
Ok,
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: More small fixes to policycoreutils
In reply to Daniel J WalshQuoted 3 lines · Daniel J Walsh
Lastly are you going to merge the translations?
http://people.redhat.com/dwalsh/SELinux/pocicycoreutils-po.patch
I merged this set of po file updates, but I'm hoping that there is some better way to deal with them. For example, after applying this patch and merging it, running make in policycoreutils immediately regenerates the files yet again with another round of changes (POT-Creation-Date headers and line numbers in the comment annotations). So should I commit that as well? I don't know how the po files are typically maintained in other projects.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Joshua Brindle
Acked-byQuoted 128 lines · Daniel J Walsh
Add newrole audit message on login failure.
Add -fPIE and -pie to build of restorecond.
Add
/var/log/wtmpto restorecond.conf watch listFix genhomedircon, semanage,
semodule_expandman pages.
------------------------------------------------------------------------diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/newrole/newrole.cpolicycoreutils-1.33.1/newrole/newrole.cnewrole/newrole.c +1
-0@@ -1028,6 +1028,7 @@ {fprintf (stderr,_ ("newrole: incorrect password for %s\n" ), pw.pw_name); +send_audit_message (0 , old_context, new_context, ttyn); goto err_close_pam; }diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/restorecond/Makefile policycoreutils-1.33.1/restorecond/Makefile
restorecond/Makefile +3
-2@@ -5,8 +5,9 @@ INITDIR = $(DESTDIR)/etc/rc.d/init.d SELINUXDIR = $(DESTDIR)/etc/selinux -CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 +LDFLAGS ?= -pie +CFLAGS ?= -g -Werror -Wall -W +override CFLAGS += -I$(PREFIX)/include -D_FILE_OFFSET_BITS=64 -fPIE LDLIBS += -lselinux -lsepol -L$(PREFIX)/lib all: restoreconddiff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r
nsapolicycoreutils/restorecond/restorecond.confpolicycoreutils-1.33.1/restorecond/restorecond.confrestorecond/restorecond.conf +1
-0@@ -2,5 +2,6 @@ /etc/samba/secrets.tdb /etc/mtab /var/run/utmp +/var/log/wtmp ~/public_html ~/.mozilla/plugins/libflashplayer.sodiff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/scripts/genhomedircon.8 policycoreutils-1.33.1/scripts/genhomedircon.8
scripts/genhomedircon.8 +17
-22@@ -45,35 +45,30 @@ .SH DESCRIPTION .PP This utility is used to generate file context configuration entries for -user home directories based on their default roles and is run when building -the policy. It can also be run when ever the -.I /etc/selinux/<<SELINUXTYPE>>/users/local.users -file is changed +user home directories based on their +.B prefix +entry in the the +.B semanage user record. +genhomedircon is run when building +the policy. It is also run automaticaly when ever the +.B semanage +utility modifies +.B user +or +.B login +records. Specifically, we replace HOME_ROOT, HOME_DIR, and ROLE macros in the .I /etc/selinux/<<SELINUXTYPE>>/contexts/files/homedir_template -file with generic and user-specific values. -.I local.users -file. If a user has more than one role in -.I local.users, -.B genhomedircon -uses the first role in the list. +file with generic and user-specific values. HOME_ROOT and HOME_DIR is replaced with each distinct location where login users homedirectories are located. Defaults to /home. ROLE is replaced based on the prefix entry in the +.B user +record. .PP -If a user is not listed in -.I local.users, -.B genhomedircon -assumes that the user's home dir will be found in one of the -HOME_ROOTs. -When looking for these users, -.B genhomedircon -only considers real users. "Real" users (as opposed -to system users) are those whose UID is greater than or equal +genhomedircon searches through all password entires for all "login" user home directories, (as opposed +to system users). Login users are those whose UID is greater than or equal .I STARTING_UID (default 500) and whose login shell is not "/sbin/nologin", or "/bin/false". .PP -Users who are explicitly defined in -.I local.users, -are always "real" (including root, in the default configuration). .SH AUTHOR This manual page was originally written by .I Manoj Srivastava <[email protected]>,diff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/semanage/semanage.8 policycoreutils-1.33.1/semanage/semanage.8
semanage/semanage.8 +4
-1@@ -7,7 +7,7 @@ .br .B semanage login \-{a|d|m} [\-sr] login_name .br -.B semanage user \-{a|d|m} [\-LrR] selinux_name +.B semanage user \-{a|d|m} [\-LrRP] selinux_name .br .B semanage port \-{a|d|m} [\-tr] [\-p protocol] port | port_range .br@@ -71,6 +71,9 @@ .I \-R, \-\-role SELinux Roles. You must enclose multiple roles within quotes, separate by spaces. Or specify \-R multiple times. .TP +.I \-P, \-\-prefix +SELinux Prefix. Prefix added to home_dir_t and home_t for labeling users home directories. +.TP .I \-s, \-\-seuser SELinux user name .TPdiff --exclude-from=exclude --exclude='*.po' --exclude='*.pot' -N -u -r nsapolicycoreutils/semodule_expand/semodule_expand.8 policycoreutils-1.33.1/semodule_expand/semodule_expand.8
semodule_expand/semodule_expand.8 line 24
Quoted 8 lines
semodule_expand/semodule_expand.8 +1
-1@@ -18,7 +18,7 @@ .SH "OPTIONS" .TP .B \-V -verbose mode +show version .TP .B \-c [version] policy version to create
Everything acked except the Makefile changes
I think our CFLAGS are inappropriate as is, the default (non-debug) build should not add -g and should likely have -O2, whether not to build with PIE is a distro choice I think.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.