Skip to contentSkip to conversation

domains/local/*.te file_contexts/local/*.fc

PATCH Erich Schubert 2 participants 6 messages Sep 6, 2004 – Sep 9, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,
the patch below adds support for domains/local/*.te and file_contexts/local/*.fc to the Makefile.

I prefer having my local policy modifications in there, instead of cluttering the "programs" part.

Also the modifications will be loaded last, which is especially helpful for the "file_contexts" part, since it allows you to override the file context of files easily.

If there is a nicer way to achieve this, please tell me.

I also havn't tested the behaviour when the wildcard statements don't expand, and i'm not enough a make guru to tell you if they'll just expand to nothing like i'd like them to. ;-)

Greetings,
Erich Schubert

Signature · 3 lines
     erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
      Which is worse: ignorance or apathy? Who knows? Who cares?      //\
 Man kann sich auch in Gesellschaft anderer einsam fühlen. Weizsäcker V_/_
Makefile renamed from usr/share/selinux/policy/default/Makefile +2 -2
@@ -33,7 +33,7 @@
 ALL_PROGRAM_MACROS := $(wildcard macros/program/*.te)
 ALL_MACROS := $(ALL_PROGRAM_MACROS) $(wildcard macros/*.te)
 ALL_TYPES := $(wildcard types/*.te)
-ALL_DOMAINS := $(wildcard domains/*.te domains/misc/*.te domains/program/*.te)
+ALL_DOMAINS := $(wildcard domains/*.te domains/misc/*.te domains/program/*.te domains/local/*.te)
 ALLTEFILES := attrib.te tmp/program_used_flags.te $(ALL_MACROS) $(ALL_TYPES) $(ALL_DOMAINS) assert.te 
 TE_RBAC_FILES := $(ALLTEFILES) rbac
 ALL_TUNABLES := $(wildcard tunables/*.te )
@@ -49,7 +49,7 @@
 UNUSED_TE_FILES := $(wildcard domains/program/unused/*.te)
 
 FC = file_contexts/file_contexts
-FCFILES=file_contexts/types.fc $(wildcard file_contexts/misc/*.fc) $(patsubst domains/program/%.te,file_contexts/program/%.fc, $(wildcard domains/program/*.te))
+FCFILES=file_contexts/types.fc $(wildcard file_contexts/misc/*.fc) $(patsubst domains/program/%.te,file_contexts/program/%.fc, $(wildcard domains/program/*.te)) $(wildcard file_contexts/local/*.fc)
 
 APPDIR=$(CONTEXTPATH)
 APPFILES = $(addprefix $(APPDIR)/,default_contexts default_type initrc_context failsafe_context)
#1 lore raw
Quoted 6 lines · Erich Schubert

Hi,
the patch below adds support for domains/local/*.te and file_contexts/local/*.fc to the Makefile.

I prefer having my local policy modifications in there, instead of cluttering the "programs" part.

Why not use domains/misc and file_contexts/misc? They do everything you seem to want to do.

Signature · 9 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

--
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.
#2 lore raw

Hi,

Quoted 8 lines
Quoted 5 lines

the patch below adds support for domains/local/*.te and file_contexts/local/*.fc to the Makefile.

I prefer having my local policy modifications in there, instead of cluttering the "programs" part.

Why not use domains/misc and file_contexts/misc? They do everything you seem to want to do.

I used to, but they are loaded before the other rules. Which is a problem for file contexts: for example i cannot use a different context for something in /usr/local/sbin when i place the rule in file_contexts/misc/local.fc - it will be overridden by the other file contexts.

Greetings,
Erich Schubert

Signature · 10 lines
    erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
       The best things in life are free: Friendship and Love.        //\
  Wer keine Zeit mehr mit echten Freunden verbringt, der wird bald   V_/_
          sein Gleichgewicht verlieren. --- Michael Levine


--
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.
#3 lore raw
Quoted 8 lines · Erich Schubert
Quoted 2 lines

Why not use domains/misc and file_contexts/misc? They do everything you seem to want to do.

I used to, but they are loaded before the other rules. Which is a problem for file contexts: for example i cannot use a different context for something in /usr/local/sbin when i place the rule in file_contexts/misc/local.fc - it will be overridden by the other file contexts.

OK, maybe we should just change that to have file_contexts/misc/* included last. What do you think?

Signature · 9 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

--
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.
#4 lore raw

Hi,

Quoted 2 lines

OK, maybe we should just change that to have file_contexts/misc/* included last. What do you think?

Basically yes. but be careful: I havn't checked the contents of the misc files, but somewhere default contexts such as /bin, /usr/bin etc. need to be defined. So we need something to be listed first, too. Where is this done currently, i havn't checked.

Maybe we should name them appropriately: first and last, or "defaults" and "overrides"?

Greetings,
Erich Schubert

Signature · 9 lines
    erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C   (o_
   There was never a good war or a bad peace. - Benjamin Franklin   //\
         Humor sollte immmer dabeisein, auch bei Problemen.         V_/_


--
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.
#5 lore raw
Quoted 7 lines · Erich Schubert
Quoted 2 lines

OK, maybe we should just change that to have file_contexts/misc/* included last. What do you think?

Basically yes. but be careful: I havn't checked the contents of the misc files, but somewhere default contexts such as /bin, /usr/bin etc. need to be defined. So we need something to be listed first, too. Where is this done currently, i havn't checked.

Currently file_contexts/misc is empty, it's only used for custom stuff. This may change at some future time, but anything that impacts the misc directory is not going to break anything now.

Quoted 2 lines

Maybe we should name them appropriately: first and last, or "defaults" and "overrides"?

I don't like that idea. If we were going to do that sort of thing then we would have to consider something like the numerical order used for init scripts.

The attached patch (not in unified format) changes the file_contexts/misc directory to have precedence.

Signature · 4 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

52c52
< FCFILES=file_contexts/types.fc $(wildcard file_contexts/misc/*.fc) $(patsubst domains/program/%.te,file_contexts/program/%.fc, $(wildcard domains/program/*.te))
---

Quoted 1 line

FCFILES=file_contexts/types.fc $(patsubst domains/program/%.te,file_contexts/program/%.fc, $(wildcard domains/program/*.te)) $(wildcard file_contexts/misc/*.fc)