Update of ACM tools
PATCH 1/1 Update of ACM tools
Hello!
The attached patch makes a couple of changes to the ACM security tools
and installation. Particularly it does the following:
- the Makefile installs the ACM security-related tools
into /etc/xen/acm-security
- improves and cleans up some of the tools
- updates the documentation
xen-unstable.hg/tools/security/Makefile +59 -33
@@ -1,16 +1,19 @@ XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SRCS = secpol_tool.c CFLAGS += -Wall CFLAGS += -Werror CFLAGS += -O3 CFLAGS += -fno-strict-aliasing -CFLAGS += -I. -I/usr/include/libxml2 -CFLAGS_XML2BIN += $(shell xml2-config --cflags --libs ) -#if above does not work, try -L/usr/lib -lxml2 -lz -lpthread -lm +CFLAGS += -I. + +CPPFLAGS += -MMD -MF .$*.d +PROG_DEPS = .*.d + XML2VERSION = $(shell xml2-config --version ) -VALIDATE_SCHEMA=$(shell if [[ $(XML2VERSION) < 2.6.20 ]]; then echo ""; else echo "-DVALIDATE_SCHEMA"; fi; ) +CFLAGS += $(shell xml2-config --cflags ) +CFLAGS += $(shell if [[ $(XML2VERSION) < 2.6.20 ]]; then echo ""; else echo "-DVALIDATE_SCHEMA"; fi ) +LDFLAGS += $(shell xml2-config --libs ) # if this does not work, try -L/usr/lib -lxml2 -lz -lpthread -lm ifeq ($(ACM_DEFAULT_SECURITY_POLICY),ACM_NULL_POLICY) POLICY=null
@@ -24,48 +27,71 @@ endif ifeq ($(ACM_DEFAULT_SECURITY_POLICY),ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY) POLICY=chwall_ste endif -POLICYFILE=./policies/$(POLICY)/$(POLICY).bin + +SRCS_TOOL = secpol_tool.c +OBJS_TOOL := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_TOOL))) +SRCS_XML2BIN = secpol_xml2bin.c secpol_xml2bin.h +OBJS_XML2BIN := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_XML2BIN))) +SRCS_GETD = get_decision.c +OBJS_GETD := $(patsubst %.c,%.o,$(filter %.c,$(SRCS_GETD))) + +ACM_INST_TOOLS = xensec_tool xensec_xml2bin +ACM_NOINST_TOOLS = get_decision +ACM_OBJS = $(OBJS_TOOL) $(OBJS_XML2BIN) $(OBJS_GETD) +ACM_SCRIPTS = getlabel.sh setlabel.sh updategrub.sh labelfuncs.sh + +ACM_CONFIG_DIR = /etc/xen/acm-security +ACM_POLICY_DIR = $(ACM_CONFIG_DIR)/policies +ACM_SCRIPT_DIR = $(ACM_CONFIG_DIR)/scripts + +ACM_SCHEMA = security_policy.xsd +ACM_EXAMPLES = null chwall ste chwall_ste +ACM_POLICY_SUFFIX = security_policy.xml +ACM_LABEL_SUFFIX = security_label_template.xml ifeq ($(ACM_SECURITY),y) all: build -install:all - -default:all +install: all $(ACM_CONFIG_FILE) + $(INSTALL_DIR) -p $(DESTDIR)/usr/sbin + $(INSTALL_PROG) -p $(ACM_INST_TOOLS) $(DESTDIR)/usr/sbin + $(INSTALL_DIR) -p $(DESTDIR)$(ACM_CONFIG_DIR) + $(INSTALL_DIR) -p $(DESTDIR)$(ACM_POLICY_DIR) + $(INSTALL_DATA) -p policies/$(ACM_SCHEMA) $(DESTDIR)$(ACM_POLICY_DIR) + for i in $(ACM_EXAMPLES); do \ + $(INSTALL_DIR) -p $(DESTDIR)$(ACM_POLICY_DIR)/$$i; \ + $(INSTALL_DATA) -p policies/$$i/$$i-$(ACM_POLICY_SUFFIX) $(DESTDIR)$(ACM_POLICY_DIR)/$$i; \ + $(INSTALL_DATA) -p policies/$$i/$$i-$(ACM_LABEL_SUFFIX) $(DESTDIR)$(ACM_POLICY_DIR)/$$i; \ + done + $(INSTALL_DIR) -p $(DESTDIR)$(ACM_SCRIPT_DIR) + $(INSTALL_PROG) -p $(ACM_SCRIPTS) $(DESTDIR)$(ACM_SCRIPT_DIR) else all: install: - -default: endif -build: mk-symlinks - $(MAKE) secpol_tool - $(MAKE) secpol_xml2bin - $(MAKE) get_decision - chmod 700 ./setlabel.sh - chmod 700 ./updategrub.sh - chmod 700 ./getlabel.sh - -secpol_tool : secpol_tool.c - $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< +build: mk-symlinks $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS) + chmod 700 $(ACM_SCRIPTS) -secpol_xml2bin : secpol_xml2bin.c secpol_xml2bin.h - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_XML2BIN) $(VALIDATE_SCHEMA) -o $@ $< +xensec_tool: $(OBJS_TOOL) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -clean: - rm -rf secpol_tool secpol_xml2bin xen get_decision +xensec_xml2bin: $(OBJS_XML2BIN) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -policy_clean: - rm -rf policies/*/*.bin policies/*/*.map +get_decision: $(OBJS_GETD) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -mrproper: clean policy_clean +clean: + $(RM) $(ACM_INST_TOOLS) $(ACM_NOINST_TOOLS) + $(RM) $(ACM_OBJS) + $(RM) $(PROG_DEPS) + $(RM) -r xen +mrproper: clean -$(POLICYFILE) : build - @./secpol_xml2bin $(POLICY) > /dev/null +boot_install: install + $(ACM_SCRIPT_DIR)/updategrub.sh $(POLICY) $(KERNEL_VERSION) -boot_install: $(POLICYFILE) - @cp $(POLICYFILE) /boot - @./updategrub.sh $(POLICY) $(PWD)/$(XEN_ROOT) +-include $(PROG_DEPS)
xen-unstable.hg/tools/security/example.txt +46 -42
168 lines not on this page · raw message
xen-unstable.hg/tools/security/getlabel.sh +27 -66
126 lines not on this page · raw message
xen-unstable.hg/tools/security/install.txt +6 -6
@@ -41,11 +41,11 @@ exclusively (chwall_ste --> {chwall, ste # make manual steps (alternative to make boot_install): - #./secpol_xml2bin chwall_ste - #cp policies/chwall_ste/chwall_ste.bin /boot - #edit /boot/grub/grub.conf + # ./xensec_xml2bin -d policies/ chwall_ste + # cp policies/chwall_ste/chwall_ste.bin /boot + # edit /boot/grub/grub.conf add the follwoing line to your xen boot entry: - "module chwall_ste.bin" + "module /boot/chwall_ste.bin" alternatively, you can try our automatic translation and installation of the policy:
@@ -61,9 +61,9 @@ exclusively (chwall_ste --> {chwall, ste 3. reboot into the newly compiled hypervisor after boot - #xm dmesg should show an entry about the policy being loaded + # xm dmesg should show an entry about the policy being loaded during the boot process - #tools/security/secpol_tool getpolicy + # xensec_tool getpolicy should print the new chwall_ste binary policy representation
xen-unstable.hg/tools/security/labelfuncs.sh +158 -34
306 lines not on this page · raw message
xen-unstable.hg/tools/security/secpol_tool.c +4 -2
@@ -44,12 +44,13 @@ fprintf(stderr, "ERROR: " _m " (%d = %s)void usage (char *progname) { -printf ("Use: %s \n" +printf ("Usage: %s ACTION\n" +"ACTION is one of:\n" "\t getpolicy\n" "\t dumpstats\n" "\t loadpolicy <binary policy file>\n" "\t getssid -d <domainid> [-f]\n" -"\t getssid -s <ssidref> [-f]\n" , progname); +"\t getssid -s <ssidref> [-f]\n" , progname);exit (-1 ); }
@@ -85,6 +86,7 @@ static inline int do_acm_op(int xc_handlif ((ret =do_xen_hypercall (xc_handle, &hypercall)) <0 ) { +printf ("ACM operation failed: errno=%d\n" , errno );if (errno ==EACCES )fprintf (stderr,"ACM operation failed -- need to" " rebuild the user-space tool set?\n" );
xen-unstable.hg/tools/security/secpol_xml2bin.c +52 -17
145 lines not on this page · raw message
xen-unstable.hg/tools/security/secpol_xml2bin.h +2 -2
@@ -12,7 +12,7 @@* License. * */ -#define POLICY_SUBDIR "policies/" +#define POLICY_DIR "/etc/xen/acm-security/policies/"#define POLICY_EXTENSION "-security_policy.xml"#define LABEL_EXTENSION "-security_label_template.xml"#define BINARY_EXTENSION ".bin"
@@ -20,7 +20,7 @@#define PRIMARY_COMPONENT_ATTR_NAME "order"#define BOOTSTRAP_LABEL_ATTR_NAME "bootstrap"#define PRIMARY_COMPONENT "PrimaryPolicyComponent" -#define SCHEMA_FILENAME "policies/security_policy.xsd" +#define SCHEMA_FILENAME "security_policy.xsd"/* basic states (used as 1 << X) */ #define XML2BIN_SECPOL 0/* policy tokens */
xen-unstable.hg/tools/security/setlabel.sh +33 -63
135 lines not on this page · raw message
xen-unstable.hg/tools/security/updategrub.sh +35 -143
211 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Ewan Mellor
AppliedQuoted 11 lines · Stefan Berger
Hello!
The attached patch makes a couple of changes to the ACM security tools
and installation. Particularly it does the following:
- theMakefileinstalls the ACM security-related tools
into/etc/xen/acm-security
- improves and cleans up some of the tools
- updates the documentationSigned-off-by Tom Lendacky <[email protected]>Signed-off-by Stefan Berger <[email protected]>
Applied, thank you.
Ewan.