Skip to content

netfilter integration

Christopher J. PeBenito selinux 1 version In review

Get series with b4
b4 am 1153168349.10090.45.camel@sgc

Versions newest first

  1. v1 Latest6 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6netfilter integration: add netfilter_contexts path to libselinuxlibselinux/include/selinux/selinux.h libselinux/src/file_path_suffixes.h libselinux/src/selinux_config.c +1 more+12 -11 reply
2/6netfilter integration: add netfilter contexts package sectionlibsepol/include/sepol/module.h libsepol/include/sepol/policydb/module.h libsepol/src/module.c+131 -03 replies
3/6netfilter integration: module store supportlibsemanage/src/direct_api.c libsemanage/src/semanage_store.c libsemanage/src/semanage_store.h+30 -73 replies
4/6netfilter integration: add netfilter contexts sortinglibsemanage/src/direct_api.c libsemanage/src/semanage_store.c libsemanage/src/semanage_store.h+198 -65 replies
5/6netfilter integration: add support to semodule_packagepolicycoreutils/semodule_package/semodule_package.c+26 -20 replies
6/6netfilter integration: add netfilter contexts sorting test caselibsemanage/tests/Makefile libsemanage/tests/nc_sort_malformed libsemanage/tests/nc_sort_sorted +3 more+155 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] netfilter integration

This patchset adds support for netfilter secmark rules in all policy packages. Each line of the file has a priority (1-9) at the beginning of the line, and the remainder is treated as the rule. Sorting is by priority (1-9), and is stable within a module. The current design is for the resultant netfilter_contexts file be suitable for use with iptables-restore.

This example would be the netfilter_contexts of the base module since it has the extra portions required for iptables-restore use:

1 *mangle
1 :PREROUTING ACCEPT [0:0]
1 :INPUT ACCEPT [0:0]
1 :FORWARD ACCEPT [0:0]
1 :OUTPUT ACCEPT [0:0]
1 :POSTROUTING ACCEPT [0:0]
1 :selinux_input - [0:0]
1 :selinux_output - [0:0]
1 :selinux_new_input - [0:0]
1 :selinux_new_output - [0:0]
1 -A INPUT -j selinux_input
1 -A OUTPUT -j selinux_output
1 -A selinux_input -m state --state NEW -j selinux_new_input
1 -A selinux_input -m state --state RELATED,ESTABLISHED -j CONNSECMARK --restore
1 -A selinux_output -m state --state NEW -j selinux_new_output
1 -A selinux_output -m state --state RELATED,ESTABLISHED -j CONNSECMARK --restore
1 -A selinux_new_input -j SECMARK --selctx system_u:object_r:server_packet_t
5 -A selinux_new_input -p tcp --dport 80 -j SECMARK --selctx system_u:object_r:http_server_packet_t 9 -A selinux_new_input -j CONNSECMARK --save
9 -A selinux_new_input -j RETURN
1 -A selinux_new_output -j SECMARK --selctx system_u:object_r:client_packet_t
5 -A selinux_new_output -p tcp --dport 80 -j SECMARK --selctx system_u:object_r:http_client_packet_t 9 -A selinux_new_output -j CONNSECMARK --save
9 -A selinux_new_output -j RETURN
9 COMMIT

While individual loadable modules's netfilter_contexts would look like:

5 -A selinux_new_input -p tcp --dport 443 -j SECMARK --selctx system_u:object_r:http_server_packet_t 5 -A selinux_new_output -p tcp --dport 443 -j SECMARK --selctx system_u:object_r:http_client_packet_t

The below patch to refpolicy will create a file appropriate for testing. The resultant linked and sorted file will be written out
to /etc/selinux/NAME/contexts/netfilter_contexts.

Rules.modular +2 -2
Index: Rules.modular
===================================================================
@@ -89,10 +89,10 @@
 #
 # Create a base module package
 #
-$(BASE_PKG): $(BASE_MOD) $(BASE_FC) $(USERS_EXTRA) $(SEUSERS)
+$(BASE_PKG): $(BASE_MOD) $(BASE_FC) $(USERS_EXTRA) $(SEUSERS) $(net_contexts)
 	@echo "Creating $(NAME) base module package"
 	@test -d $(BUILDDIR) || mkdir -p $(BUILDDIR)
-	$(verbose) $(SEMOD_PKG) -o $@ -m $(BASE_MOD) -f $(BASE_FC) -u $(USERS_EXTRA) -s $(SEUSERS)
+	$(verbose) $(SEMOD_PKG) -o $@ -m $(BASE_MOD) -f $(BASE_FC) -u $(USERS_EXTRA) -s $(SEUSERS) -n $(net_contexts)
 
 $(BASE_MOD): $(BASE_CONF)
 	@echo "Compiling $(NAME) base module"
gennetfilter.py +25 -25

90 lines not on this page · raw message

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.