From cc07de58baccb0331a78489113ad54c509ea8cfe Mon Sep 17 00:00:00 2001
From: Hans Ulrich Niedermann
Date: Sat, 11 Jul 2009 16:25:24 +0200
Subject: Add SE policy sources for gpsd
---
.gitignore | 1 +
gpsd-devices.fc | 6 ++++++
gpsd-devices.if | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
gpsd-devices.te | 28 ++++++++++++++++++++++++++++
4 files changed, 89 insertions(+)
create mode 100644 .gitignore
create mode 100644 gpsd-devices.fc
create mode 100644 gpsd-devices.if
create mode 100644 gpsd-devices.te
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b8cdaf8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pp
diff --git a/gpsd-devices.fc b/gpsd-devices.fc
new file mode 100644
index 0000000..9cf7c4c
--- /dev/null
+++ b/gpsd-devices.fc
@@ -0,0 +1,6 @@
+# myapp executable will have:
+# label: system_u:object_r:myapp_exec_t
+# MLS sensitivity: s0
+# MCS categories:
+
+/usr/sbin/myapp -- gen_context(system_u:object_r:myapp_exec_t,s0)
diff --git a/gpsd-devices.if b/gpsd-devices.if
new file mode 100644
index 0000000..54d42ae
--- /dev/null
+++ b/gpsd-devices.if
@@ -0,0 +1,54 @@
+## Myapp example policy
+##
+##
+## More descriptive text about myapp. The desc
+## tag can also use p, ul, and ol
+## html tags for formatting.
+##
+##
+## This policy supports the following myapp features:
+##
+## - Feature A
+## - Feature B
+## - Feature C
+##
+##
+##
+#
+
+########################################
+##
+## Execute a domain transition to run myapp.
+##
+##
+##
+## Domain allowed to transition.
+##
+##
+#
+interface(`myapp_domtrans',`
+ gen_require(`
+ type myapp_t, myapp_exec_t;
+ ')
+
+ domtrans_pattern($1,myapp_exec_t,myapp_t)
+')
+
+########################################
+##
+## Read myapp log files.
+##
+##
+##
+## Domain allowed to read the log files.
+##
+##
+#
+interface(`myapp_read_log',`
+ gen_require(`
+ type myapp_log_t;
+ ')
+
+ logging_search_logs($1)
+ allow $1 myapp_log_t:file read_file_perms;
+')
diff --git a/gpsd-devices.te b/gpsd-devices.te
new file mode 100644
index 0000000..8238355
--- /dev/null
+++ b/gpsd-devices.te
@@ -0,0 +1,28 @@
+
+policy_module(myapp,1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type myapp_t;
+type myapp_exec_t;
+domain_type(myapp_t)
+domain_entry_file(myapp_t, myapp_exec_t)
+
+type myapp_log_t;
+logging_log_file(myapp_log_t)
+
+type myapp_tmp_t;
+files_tmp_file(myapp_tmp_t)
+
+########################################
+#
+# Myapp local policy
+#
+
+allow myapp_t myapp_log_t:file { read_file_perms append_file_perms };
+
+allow myapp_t myapp_tmp_t:file manage_file_perms;
+files_tmp_filetrans(myapp_t,myapp_tmp_t,file)
--
cgit