2005-04-19 13:53:51 +00:00
|
|
|
#
|
|
|
|
# Makefile for the security policy.
|
|
|
|
#
|
|
|
|
# Targets:
|
|
|
|
#
|
|
|
|
# install - compile and install the policy configuration, and context files.
|
|
|
|
# load - compile, install, and load the policy configuration.
|
|
|
|
# reload - compile, install, and load/reload the policy configuration.
|
|
|
|
# relabel - relabel filesystems based on the file contexts configuration.
|
|
|
|
# checklabels - check filesystems against the file context configuration
|
|
|
|
# restorelabels - check filesystems against the file context configuration
|
|
|
|
# and restore the label of files with incorrect labels
|
|
|
|
# policy - compile the policy configuration locally for testing/development.
|
|
|
|
#
|
|
|
|
# The default target is 'policy'.
|
|
|
|
#
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Configurable portions of the Makefile
|
|
|
|
#
|
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
# Override default policy version
|
|
|
|
OUTPUT_POLICY = 18
|
2005-06-01 15:40:37 +00:00
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
# Policy Type
|
|
|
|
# strict, targeted, strict-mls, targeted-mls
|
|
|
|
# strict and strict-mls are currently supported.
|
|
|
|
TYPE = strict
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
# If set, this will be used as the policy
|
|
|
|
# name. Otherwise the policy type will be
|
|
|
|
# used for the name.
|
|
|
|
NAME =
|
|
|
|
|
|
|
|
# Build monolithic policy. Putting n here
|
|
|
|
# will build a loadable module policy.
|
|
|
|
# Only monolithic policies are currently supported.
|
|
|
|
MONOLITHIC=y
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
# Uncomment this to disable command echoing
|
|
|
|
#QUIET:=@
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
2005-06-06 18:13:38 +00:00
|
|
|
# NO OPTIONS BELOW HERE
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# executable paths
|
|
|
|
PREFIX := /usr
|
|
|
|
BINDIR := $(PREFIX)/bin
|
|
|
|
SBINDIR := $(PREFIX)/sbin
|
|
|
|
CHECKPOLICY := $(BINDIR)/checkpolicy
|
2005-05-24 20:44:31 +00:00
|
|
|
LOADPOLICY := $(SBINDIR)/load_policy
|
2005-04-14 20:18:17 +00:00
|
|
|
SETFILES := $(SBINDIR)/setfiles
|
2005-06-14 18:13:55 +00:00
|
|
|
GENHOMEDIRCON := $(SBINDIR)/genhomedircon
|
2005-06-01 19:01:00 +00:00
|
|
|
|
2005-06-15 14:08:18 +00:00
|
|
|
CFLAGS := -Wall
|
|
|
|
|
2005-06-07 18:35:18 +00:00
|
|
|
SUPPORT := support
|
|
|
|
GENDOC := $(SUPPORT)/sedoctool.py
|
2005-06-07 18:45:47 +00:00
|
|
|
FCSORT := $(SUPPORT)/fc_sort
|
2005-06-08 13:44:23 +00:00
|
|
|
SETTUN := $(SUPPORT)/set_tunables
|
2005-06-07 18:35:18 +00:00
|
|
|
|
2005-06-01 18:34:34 +00:00
|
|
|
XMLLINT := $(BINDIR)/xmllint
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-01 15:40:37 +00:00
|
|
|
# enable MLS if requested.
|
2005-06-06 18:13:38 +00:00
|
|
|
ifneq ($(findstring mls,$(TYPE)),)
|
2005-06-01 15:40:37 +00:00
|
|
|
override M4PARAM += -D enable_mls
|
|
|
|
CHECKPOLICY += -M
|
|
|
|
endif
|
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
# compile targeted policy if requested.
|
|
|
|
ifneq ($(findstring targeted,$(TYPE)),)
|
|
|
|
override M4PARAM += -D targeted_policy
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(MONOLITHIC),y)
|
|
|
|
override M4PARAM += -D monolithic_policy
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(OUTPUT_POLICY),)
|
|
|
|
CHECKPOLICY += -c $(OUTPUT_POLICY)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(NAME),)
|
|
|
|
NAME := $(TYPE)
|
2005-06-01 15:40:37 +00:00
|
|
|
endif
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# determine the policy version and current kernel version if possible
|
2005-06-01 15:40:37 +00:00
|
|
|
PV := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
|
2005-04-14 20:18:17 +00:00
|
|
|
KV := $(shell cat /selinux/policyvers)
|
|
|
|
|
|
|
|
# dont print version warnings if we are unable to determine
|
|
|
|
# the currently running kernel's policy version
|
|
|
|
ifeq ($(KV),)
|
2005-06-01 15:40:37 +00:00
|
|
|
KV := $(PV)
|
2005-04-14 20:18:17 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
FC := file_contexts
|
|
|
|
POLVER := policy.$(PV)
|
|
|
|
|
|
|
|
# install paths
|
|
|
|
TOPDIR = $(DESTDIR)/etc/selinux
|
2005-06-06 18:13:38 +00:00
|
|
|
INSTALLDIR = $(TOPDIR)/$(NAME)
|
2005-04-14 20:18:17 +00:00
|
|
|
POLICYPATH = $(INSTALLDIR)/policy
|
|
|
|
SRCPATH = $(INSTALLDIR)/src
|
|
|
|
USERPATH = $(INSTALLDIR)/users
|
|
|
|
CONTEXTPATH = $(INSTALLDIR)/contexts
|
|
|
|
LOADPATH = $(POLICYPATH)/$(POLVER)
|
|
|
|
FCPATH = $(CONTEXTPATH)/files/file_contexts
|
|
|
|
HOMEDIRPATH = $(CONTEXTPATH)/files/homedir_template
|
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
POLDIR = policy
|
|
|
|
MODDIR = $(POLDIR)/modules
|
|
|
|
|
|
|
|
BASE_MODULE = $(MODDIR)/kernel
|
|
|
|
FLASKDIR = $(POLDIR)/flask
|
2005-06-06 18:16:41 +00:00
|
|
|
APPCONF = config/appconfig
|
2005-06-08 21:03:00 +00:00
|
|
|
M4SUPPORT = $(wildcard $(POLDIR)/support/*.spt)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-08 13:44:23 +00:00
|
|
|
GLOBALTUN := $(POLDIR)/global_tunables
|
2005-06-08 21:03:00 +00:00
|
|
|
MOD_DISABLE := $(POLDIR)/modules.conf
|
2005-06-08 13:44:23 +00:00
|
|
|
TUNABLES := $(POLDIR)/tunables.conf
|
2005-06-07 15:11:47 +00:00
|
|
|
|
2005-05-25 20:58:09 +00:00
|
|
|
APPDIR := $(CONTEXTPATH)
|
2005-06-14 18:13:55 +00:00
|
|
|
APPFILES := $(addprefix $(APPDIR)/,default_contexts default_type initrc_context failsafe_context userhelper_context removable_context dbus_contexts customizable_types) $(CONTEXTPATH)/files/media $(INSTALLDIR)/booleans
|
2005-06-01 17:27:56 +00:00
|
|
|
CONTEXTFILES += $(wildcard $(APPCONF)/*_context*) $(APPCONF)/media
|
2005-06-06 18:13:38 +00:00
|
|
|
USER_FILES := $(POLDIR)/users
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-08 22:14:26 +00:00
|
|
|
DISABLEMOD := $(foreach mod,$(shell egrep -v '^[[:blank:]]*\#' $(MOD_DISABLE)),$(subst ./,,$(shell find -iname $(mod).te)))
|
|
|
|
ALL_LAYERS := $(shell find $(wildcard policy/modules/*) -maxdepth 0 -type d)
|
|
|
|
|
|
|
|
GENERATED_TE := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.te.in)))
|
|
|
|
GENERATED_IF := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.if.in)))
|
|
|
|
GENERATED_FC := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.fc.in)))
|
|
|
|
|
2005-06-14 18:39:55 +00:00
|
|
|
# sort here since it removes duplicates, which can happen
|
|
|
|
# when a generated file is already generated
|
|
|
|
DETECTED_MODS := $(sort $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.te)) $(GENERATED_TE))
|
2005-06-07 15:11:47 +00:00
|
|
|
ALL_MODULES := $(filter-out $(DISABLEMOD),$(DETECTED_MODS))
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
PRE_TE_FILES := $(addprefix $(FLASKDIR)/,security_classes initial_sids access_vectors) $(M4SUPPORT) $(POLDIR)/mls
|
2005-06-07 15:11:47 +00:00
|
|
|
ALL_INTERFACES := $(ALL_MODULES:.te=.if)
|
|
|
|
ALL_TE_FILES := $(ALL_MODULES)
|
2005-06-06 18:13:38 +00:00
|
|
|
POST_TE_FILES := $(POLDIR)/users $(POLDIR)/constraints
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-07 15:11:47 +00:00
|
|
|
ALL_FC_FILES := $(ALL_MODULES:.te=.fc)
|
2005-06-13 21:16:05 +00:00
|
|
|
HOMEDIR_TEMPLATE = tmp/homedir_template
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-08 13:44:23 +00:00
|
|
|
POLICY_SECTIONS := tmp/pre_te_files.conf tmp/generated_definitions.conf tmp/all_interfaces.conf tmp/all_attrs_types.conf $(GLOBALTUN) tmp/only_te_rules.conf tmp/all_post.conf
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-09 19:02:52 +00:00
|
|
|
DOCS = doc
|
2005-06-13 12:55:56 +00:00
|
|
|
POLXML = $(DOCS)/policy.xml
|
2005-06-09 19:02:52 +00:00
|
|
|
XMLDTD = $(DOCS)/policy.dtd
|
|
|
|
HTMLDIR = $(DOCS)/html
|
|
|
|
DOCTEMPLATE = $(DOCS)/templates
|
2005-06-02 20:39:32 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# default action: build policy locally
|
|
|
|
#
|
|
|
|
default: policy
|
|
|
|
|
|
|
|
policy: $(POLVER)
|
|
|
|
|
2005-06-01 20:17:47 +00:00
|
|
|
install: $(LOADPATH) $(FCPATH) $(APPFILES) $(USERPATH)/local.users
|
2005-05-25 20:58:09 +00:00
|
|
|
|
|
|
|
load: tmp/load
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Build a binary policy locally
|
|
|
|
#
|
|
|
|
$(POLVER): policy.conf
|
2005-06-06 18:13:38 +00:00
|
|
|
@echo "Compiling $(NAME) $(POLVER)"
|
2005-04-14 20:18:17 +00:00
|
|
|
ifneq ($(PV),$(KV))
|
|
|
|
@echo
|
2005-06-06 18:13:38 +00:00
|
|
|
@echo "WARNING: Policy version mismatch! Is your OUTPUT_POLICY set correctly?"
|
2005-04-14 20:18:17 +00:00
|
|
|
@echo
|
|
|
|
endif
|
2005-06-01 15:40:37 +00:00
|
|
|
$(QUIET) $(CHECKPOLICY) $^ -o $@
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install a binary policy
|
|
|
|
#
|
|
|
|
$(LOADPATH): policy.conf
|
|
|
|
@mkdir -p $(POLICYPATH)
|
2005-06-06 18:13:38 +00:00
|
|
|
@echo "Compiling and installing $(NAME) $(LOADPATH)"
|
2005-04-14 20:18:17 +00:00
|
|
|
ifneq ($(PV),$(KV))
|
|
|
|
@echo
|
2005-06-06 18:13:38 +00:00
|
|
|
@echo "WARNING: Policy version mismatch! Is your OUTPUT_POLICY set correctly?"
|
2005-04-14 20:18:17 +00:00
|
|
|
@echo
|
|
|
|
endif
|
2005-06-01 15:40:37 +00:00
|
|
|
$(QUIET) $(CHECKPOLICY) $^ -o $@
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-04-19 13:53:51 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Load the binary policy
|
|
|
|
#
|
|
|
|
reload tmp/load: $(LOADPATH) $(FCPATH)
|
2005-06-06 18:13:38 +00:00
|
|
|
@echo "Loading $(NAME) $(LOADPATH)"
|
2005-04-19 13:53:51 +00:00
|
|
|
$(QUIET) $(LOADPOLICY) -q $(LOADPATH)
|
|
|
|
@touch tmp/load
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Construct a monolithic policy.conf
|
|
|
|
#
|
|
|
|
policy.conf: $(POLICY_SECTIONS)
|
2005-06-06 18:13:38 +00:00
|
|
|
@echo "Creating $(NAME) policy.conf"
|
2005-06-14 15:54:55 +00:00
|
|
|
# checkpolicy can use the #line directives provided by -s for error reporting:
|
2005-06-06 18:13:38 +00:00
|
|
|
$(QUIET) m4 $(M4PARAM) -s $^ > tmp/$@.tmp
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) sed -e /^portcon/d -e /^nodecon/d -e /^netifcon/d < tmp/$@.tmp > $@
|
2005-06-14 15:54:55 +00:00
|
|
|
# the ordering of these ocontexts matters:
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) grep ^portcon tmp/$@.tmp >> $@ || true
|
|
|
|
$(QUIET) grep ^netifcon tmp/$@.tmp >> $@ || true
|
|
|
|
$(QUIET) grep ^nodecon tmp/$@.tmp >> $@ || true
|
|
|
|
|
|
|
|
tmp/pre_te_files.conf: $(PRE_TE_FILES)
|
|
|
|
@test -d tmp || mkdir -p tmp
|
|
|
|
$(QUIET) cat $^ > $@
|
|
|
|
|
2005-06-14 15:54:55 +00:00
|
|
|
tmp/generated_definitions.conf: $(ALL_LAYERS) $(ALL_TE_FILES)
|
|
|
|
# per-userdomain templates:
|
2005-04-14 20:18:17 +00:00
|
|
|
@test -d tmp || mkdir -p tmp
|
|
|
|
$(QUIET) echo "define(\`per_userdomain_templates',\`" > $@
|
2005-06-07 15:11:47 +00:00
|
|
|
$(QUIET) for i in $(patsubst %.te,%,$(notdir $(ALL_MODULES))); do \
|
2005-04-14 20:18:17 +00:00
|
|
|
echo "ifdef(\`""$$i""_per_userdomain_template',\`""$$i""_per_userdomain_template("'$$1'")')" \
|
|
|
|
>> $@ ;\
|
|
|
|
done
|
|
|
|
$(QUIET) echo "')" >> $@
|
2005-06-14 15:54:55 +00:00
|
|
|
# define foo.te
|
2005-06-07 15:11:47 +00:00
|
|
|
$(QUIET) for i in $(notdir $(ALL_MODULES)); do \
|
2005-04-14 20:18:17 +00:00
|
|
|
echo "define(\`$$i')" >> $@ ;\
|
|
|
|
done
|
2005-06-08 13:44:23 +00:00
|
|
|
$(QUIET) $(SETTUN) $(TUNABLES) >> $@
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-07 18:35:18 +00:00
|
|
|
tmp/all_interfaces.conf: $(ALL_INTERFACES)
|
2005-04-14 20:18:17 +00:00
|
|
|
@test -d tmp || mkdir -p tmp
|
2005-06-07 18:35:18 +00:00
|
|
|
$(QUIET) cat $^ > $@
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-07 18:35:18 +00:00
|
|
|
tmp/all_te_files.conf: $(ALL_TE_FILES)
|
2005-04-14 20:18:17 +00:00
|
|
|
@test -d tmp || mkdir -p tmp
|
2005-06-07 18:35:18 +00:00
|
|
|
$(QUIET) cat $^ > $@
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
tmp/post_te_files.conf: $(POST_TE_FILES)
|
|
|
|
@test -d tmp || mkdir -p tmp
|
|
|
|
$(QUIET) cat $^ > $@
|
|
|
|
|
|
|
|
# extract attributes and put them first. extract post te stuff
|
|
|
|
# like genfscon and put last. portcon, nodecon, and netifcon
|
|
|
|
# is delayed since they are generated by m4
|
2005-05-05 14:08:26 +00:00
|
|
|
tmp/all_attrs_types.conf tmp/only_te_rules.conf tmp/all_post.conf: tmp/all_te_files.conf tmp/post_te_files.conf
|
|
|
|
$(QUIET) grep ^attribute tmp/all_te_files.conf > tmp/all_attrs_types.conf || true
|
|
|
|
$(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf
|
2005-06-02 15:39:10 +00:00
|
|
|
$(QUIET) grep '^sid ' tmp/all_te_files.conf >> tmp/all_post.conf || true
|
|
|
|
$(QUIET) egrep '^fs_use_(xattr|task|trans)' tmp/all_te_files.conf >> tmp/all_post.conf || true
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) grep ^genfscon tmp/all_te_files.conf >> tmp/all_post.conf || true
|
2005-06-02 15:39:10 +00:00
|
|
|
$(QUIET) sed -r -e /^attribute/d -e '/^type /d' -e /^genfscon/d \
|
|
|
|
-e '/^sid /d' -e '/^fs_use_(xattr|task|trans)/d' \
|
|
|
|
< tmp/all_te_files.conf > tmp/only_te_rules.conf
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-08 21:46:39 +00:00
|
|
|
$(MODDIR)/kernel/corenetwork.if: $(MODDIR)/kernel/corenetwork.if.m4 $(MODDIR)/kernel/corenetwork.if.in
|
2005-06-13 18:40:08 +00:00
|
|
|
@echo "#" > $@
|
|
|
|
@echo "# This is a generated file! Instead of modifying this file, the" >> $@
|
|
|
|
@echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@
|
|
|
|
@echo "#" >> $@
|
|
|
|
$(QUIET) cat $(MODDIR)/kernel/corenetwork.if.in >> $@
|
2005-06-08 21:46:39 +00:00
|
|
|
$(QUIET) egrep "^[[:blank:]]*network_(interface|node|port)\(.*\)" $(@:.if=.te).in \
|
2005-06-14 15:54:55 +00:00
|
|
|
| m4 $(M4PARAM) $(M4SUPPORT) $(MODDIR)/kernel/corenetwork.if.m4 - \
|
2005-06-08 21:46:39 +00:00
|
|
|
| sed -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@
|
|
|
|
$(QUIET) echo "## </module>" >> $@
|
|
|
|
|
|
|
|
$(MODDIR)/kernel/corenetwork.te: $(MODDIR)/kernel/corenetwork.te.m4 $(MODDIR)/kernel/corenetwork.te.in
|
2005-06-13 18:40:08 +00:00
|
|
|
@echo "#" > $@
|
|
|
|
@echo "# This is a generated file! Instead of modifying this file, the" >> $@
|
|
|
|
@echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@
|
|
|
|
@echo "#" >> $@
|
2005-06-14 15:54:55 +00:00
|
|
|
$(QUIET) m4 $(M4PARAM) $(M4SUPPORT) $^ \
|
2005-06-13 18:40:08 +00:00
|
|
|
| sed -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@
|
2005-06-08 21:46:39 +00:00
|
|
|
|
2005-04-19 13:53:51 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Remove the dontaudit rules from the policy.conf
|
|
|
|
#
|
|
|
|
enableaudit: policy.conf
|
|
|
|
@test -d tmp || mkdir -p tmp
|
|
|
|
@echo "Removing dontaudit rules from policy.conf"
|
|
|
|
$(QUIET) grep -v dontaudit policy.conf > tmp/policy.audit
|
|
|
|
$(QUIET) mv tmp/policy.audit policy.conf
|
|
|
|
|
2005-05-18 20:58:13 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Construct file_contexts
|
|
|
|
#
|
2005-06-13 21:16:05 +00:00
|
|
|
$(FC): $(M4SUPPORT) tmp/generated_definitions.conf $(ALL_FC_FILES) $(FCSORT)
|
2005-05-18 20:58:13 +00:00
|
|
|
@test -d tmp || mkdir -p tmp
|
2005-06-13 21:16:05 +00:00
|
|
|
$(QUIET) m4 $(M4PARAM) $(M4SUPPORT) tmp/generated_definitions.conf $(ALL_FC_FILES) > tmp/$@.tmp
|
|
|
|
$(QUIET) grep -e HOME -e ROLE tmp/$@.tmp > $(HOMEDIR_TEMPLATE)
|
|
|
|
$(QUIET) sed -i -e /HOME/d -e /ROLE/d tmp/$@.tmp
|
|
|
|
$(QUIET) $(FCSORT) tmp/$@.tmp $@
|
2005-05-18 20:58:13 +00:00
|
|
|
|
2005-05-24 20:44:31 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install file_contexts
|
|
|
|
#
|
2005-06-07 18:35:18 +00:00
|
|
|
$(FCPATH): $(FC) $(USERPATH)/system.users
|
2005-05-24 20:44:31 +00:00
|
|
|
@mkdir -p $(CONTEXTPATH)/files
|
|
|
|
$(QUIET) install -m 644 $(FC) $(FCPATH)
|
2005-06-13 21:16:05 +00:00
|
|
|
$(QUIET) install -m 644 $(HOMEDIR_TEMPLATE) $(HOMEDIRPATH)
|
|
|
|
$(QUIET) $(GENHOMEDIRCON) -d $(TOPDIR) -t $(NAME) $(USEPWD)
|
2005-05-24 20:44:31 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Filesystem labeling
|
|
|
|
#
|
2005-04-19 13:53:51 +00:00
|
|
|
FILESYSTEMS := `mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs| jfs).*rw/{print $$3}';`
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-04-19 13:53:51 +00:00
|
|
|
checklabels: $(FC) $(SETFILES)
|
|
|
|
@if test -z "$(FILESYSTEMS)"; then \
|
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) $(SETFILES) -v -n $(FC) $(FILESYSTEMS)
|
|
|
|
|
2005-04-19 13:53:51 +00:00
|
|
|
restorelabels: $(FC) $(SETFILES)
|
|
|
|
@if test -z "$(FILESYSTEMS)"; then \
|
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) $(SETFILES) -v $(FC) $(FILESYSTEMS)
|
|
|
|
|
|
|
|
relabel: $(FC) $(SETFILES)
|
2005-04-19 13:53:51 +00:00
|
|
|
@if test -z "$(FILESYSTEMS)"; then \
|
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2005-04-14 20:18:17 +00:00
|
|
|
$(QUIET) $(SETFILES) $(FC) $(FILESYSTEMS)
|
|
|
|
|
2005-06-08 13:44:23 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Create config files
|
|
|
|
#
|
2005-06-14 15:54:55 +00:00
|
|
|
conf: $(MOD_DISABLE) $(TUNABLES) $(GENERATED_TE) $(GENERATED_IF) $(GENERATED_FC)
|
|
|
|
|
|
|
|
$(MOD_DISABLE) $(TUNABLES): $(POLXML)
|
2005-06-08 13:44:23 +00:00
|
|
|
@echo "Creating $(MOD_DISABLE) and $(TUNABLES)"
|
2005-06-13 12:55:56 +00:00
|
|
|
$(QUIET) cd $(DOCS) && ../$(GENDOC) -t ../$(TUNABLES) -m ../$(MOD_DISABLE) -x ../$(POLXML)
|
2005-06-08 13:44:23 +00:00
|
|
|
|
2005-05-18 20:58:13 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Documentation generation
|
|
|
|
#
|
|
|
|
|
2005-06-14 15:54:55 +00:00
|
|
|
# minimal dependencies here, because we don't want to rebuild
|
2005-06-08 13:44:23 +00:00
|
|
|
# this and its dependents every time the dependencies
|
|
|
|
# change
|
2005-06-14 15:54:55 +00:00
|
|
|
$(POLXML): $(ALL_INTERFACES)
|
2005-05-24 17:31:39 +00:00
|
|
|
@echo "Creating $@"
|
2005-06-08 13:44:23 +00:00
|
|
|
@mkdir -p tmp
|
2005-06-01 18:34:34 +00:00
|
|
|
$(QUIET) echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' > $@
|
|
|
|
$(QUIET) echo '<!DOCTYPE policy SYSTEM "policy.dtd">' >> $@
|
|
|
|
$(QUIET) echo "<policy>" >> $@
|
2005-06-01 20:17:47 +00:00
|
|
|
# process this through m4 to eliminate the generated definitions templates.
|
2005-06-01 17:45:06 +00:00
|
|
|
# currently these are only in corenetwork.if
|
2005-06-08 13:44:23 +00:00
|
|
|
$(QUIET) m4 $(ALL_INTERFACES) $(GLOBALTUN) | egrep -h "^##[[:blank:]]" | sed -e 's/^##[[:blank:]]//g' >> $@
|
2005-05-24 17:31:39 +00:00
|
|
|
$(QUIET) echo "</policy>" >> $@
|
2005-06-01 19:01:00 +00:00
|
|
|
$(QUIET) if test -x $(XMLLINT) && test -f $(XMLDTD); then \
|
|
|
|
$(XMLLINT) --noout --dtdvalid $(XMLDTD) $@ ;\
|
2005-06-01 18:34:34 +00:00
|
|
|
fi
|
2005-05-18 20:58:13 +00:00
|
|
|
|
2005-06-13 12:55:56 +00:00
|
|
|
html: $(POLXML)
|
2005-06-09 19:02:52 +00:00
|
|
|
@mkdir -p $(HTMLDIR)
|
2005-06-13 12:55:56 +00:00
|
|
|
$(QUIET) cd $(DOCS) && ../$(GENDOC) -d ../$(HTMLDIR) -T ../$(DOCTEMPLATE) -x ../$(POLXML)
|
2005-06-09 19:02:52 +00:00
|
|
|
$(QUIET) cp $(DOCTEMPLATE)/*.css $(HTMLDIR)
|
|
|
|
|
2005-05-25 20:58:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Runtime binary policy patching of users
|
|
|
|
#
|
|
|
|
$(USERPATH)/system.users: $(USER_FILES) tmp/generated_definitions.conf
|
|
|
|
@mkdir -p $(USERPATH)
|
|
|
|
@echo "Installing system.users"
|
|
|
|
@echo "# " > tmp/system.users
|
|
|
|
@echo "# Do not edit this file. " >> tmp/system.users
|
|
|
|
@echo "# This file is replaced on reinstalls of this policy." >> tmp/system.users
|
|
|
|
@echo "# Please edit local.users to make local changes." >> tmp/system.users
|
|
|
|
@echo "#" >> tmp/system.users
|
|
|
|
$(QUIET) m4 $(M4PARAM) tmp/generated_definitions.conf $(USER_FILES) | \
|
|
|
|
egrep -v "^[[:space:]]*($$|#)" >> tmp/system.users
|
|
|
|
$(QUIET) install -m 644 tmp/system.users $@
|
|
|
|
|
2005-06-14 18:13:55 +00:00
|
|
|
$(USERPATH)/local.users: config/local.users
|
2005-05-25 20:58:09 +00:00
|
|
|
@mkdir -p $(USERPATH)
|
|
|
|
@echo "Installing local.users"
|
2005-06-15 14:08:18 +00:00
|
|
|
$(QUIET) install -b -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Appconfig files
|
|
|
|
#
|
|
|
|
install-appconfig: $(APPFILES)
|
|
|
|
|
2005-06-14 18:13:55 +00:00
|
|
|
$(INSTALLDIR)/booleans: $(TUNABLES)
|
|
|
|
@mkdir -p $(INSTALLDIR)
|
|
|
|
$(QUIET) egrep '^[[:blank:]]*[[:alpha:]]' $(TUNABLES) \
|
|
|
|
| sed -e 's/false/0/g' -e 's/true/1/g' > tmp/booleans
|
|
|
|
$(QUIET) install -m 644 tmp/booleans $@
|
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(CONTEXTPATH)/files/media: $(APPCONF)/media
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(CONTEXTPATH)/files/
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/default_contexts: $(APPCONF)/default_contexts
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/removable_context: $(APPCONF)/removable_context
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
|
|
|
$(APPDIR)/customizable_types: policy.conf
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) grep "^type .*customizable" $< | cut -d',' -f1 | cut -d' ' -f2 > tmp/customizable_types
|
|
|
|
$(QUIET) install -m 644 tmp/customizable_types $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/default_type: $(APPCONF)/default_type
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/userhelper_context: $(APPCONF)/userhelper_context
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/initrc_context: $(APPCONF)/initrc_context
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/failsafe_context: $(APPCONF)/failsafe_context
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/dbus_contexts: $(APPCONF)/dbus_contexts
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-01 17:27:56 +00:00
|
|
|
$(APPDIR)/users/root: $(APPCONF)/root_default_contexts
|
2005-06-14 18:13:55 +00:00
|
|
|
@mkdir -p $(APPDIR)/users
|
|
|
|
$(QUIET) install -m 644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2005-06-15 14:14:20 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install policy sources
|
|
|
|
#
|
|
|
|
install-src:
|
|
|
|
rm -rf $(SRCPATH)/policy.old
|
|
|
|
-mv $(SRCPATH)/policy $(SRCPATH)/policy.old
|
|
|
|
mkdir -p $(SRCPATH)/policy
|
|
|
|
cp -R . $(SRCPATH)/policy
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
clean:
|
|
|
|
rm -fR tmp
|
|
|
|
rm -f policy.conf
|
|
|
|
rm -f policy.$(PV)
|
|
|
|
rm -f $(FC)
|
|
|
|
|
2005-06-07 15:11:47 +00:00
|
|
|
bare: clean
|
2005-06-13 12:55:56 +00:00
|
|
|
rm -f $(POLXML)
|
2005-06-07 18:45:47 +00:00
|
|
|
rm -f $(SUPPORT)/*.pyc
|
|
|
|
rm -f $(FCSORT)
|
2005-06-07 15:11:47 +00:00
|
|
|
rm -f $(MOD_DISABLE)
|
|
|
|
rm -f $(TUNABLES)
|
2005-06-09 19:02:52 +00:00
|
|
|
rm -fR $(HTMLDIR)
|
2005-06-08 22:14:26 +00:00
|
|
|
ifneq ($(GENERATED_TE),)
|
|
|
|
rm -f $(GENERATED_TE)
|
|
|
|
endif
|
|
|
|
ifneq ($(GENERATED_IF),)
|
|
|
|
rm -f $(GENERATED_IF)
|
|
|
|
endif
|
|
|
|
ifneq ($(GENERATED_FC),)
|
|
|
|
rm -f $(GENERATED_FC)
|
|
|
|
endif
|
2005-06-07 15:11:47 +00:00
|
|
|
|
|
|
|
.PHONY: default policy install reload enableaudit checklabels restorelabels relabel conf clean bare
|