From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R0I8y-0001FG-Vt for garchives@archives.gentoo.org; Sun, 04 Sep 2011 19:14:13 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2846421C043; Sun, 4 Sep 2011 19:14:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DF2B621C043 for ; Sun, 4 Sep 2011 19:14:03 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D058D1B403B for ; Sun, 4 Sep 2011 19:14:00 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AE0E980042 for ; Sun, 4 Sep 2011 19:13:59 +0000 (UTC) From: "Sven Vermeulen" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Vermeulen" Message-ID: <11b1fe0702047eb939047f1f441b45c2e474485f.SwifT@gentoo> Subject: [gentoo-commits] proj/hardened-docs:master commit in: xml/ X-VCS-Repository: proj/hardened-docs X-VCS-Files: xml/selinux-faq.xml X-VCS-Directories: xml/ X-VCS-Committer: SwifT X-VCS-Committer-Name: Sven Vermeulen X-VCS-Revision: 11b1fe0702047eb939047f1f441b45c2e474485f Date: Sun, 4 Sep 2011 19:13:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 64409b8ed0b98801fb3b0cce21a99826 commit: 11b1fe0702047eb939047f1f441b45c2e474485f Author: Sven Vermeulen siphos be> AuthorDate: Sun Sep 4 19:12:29 2011 +0000 Commit: Sven Vermeulen siphos be> CommitDate: Sun Sep 4 19:12:29 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/hardened-docs= .git;a=3Dcommit;h=3D11b1fe07 Update FAQ, add entry regarding local policy (id=3Dlocalpolicy) --- xml/selinux-faq.xml | 121 +++++++++++++++++++++++++++++++++++++++++++++= +++--- 1 files changed, 114 insertions(+), 7 deletions(-) diff --git a/xml/selinux-faq.xml b/xml/selinux-faq.xml index 1427d89..9a3fc95 100644 --- a/xml/selinux-faq.xml +++ b/xml/selinux-faq.xml @@ -17,8 +17,8 @@ The FAQ is a collection of solutions found on IRC, mail= inglist, forums or elsewhere =20 -13 -2011-09-03 +14 +2011-09-04 =20 Questions @@ -148,11 +148,11 @@ like we will eventually support these file systems = on SELinux fully as well. Can I use SELinux with AMD64 no-multilib? =20 + +

-Yes. However, for the time being, it is only supported through developer -profiles, meaning that the profiles should not be seen as very stable (t= heir -content can still change swiftly). Try out -hardened/linux/amd64/no-multilib/selinux and tell us what you get= . +Yes, just use the hardened/linux/amd64/no-multilib/selinux = profile +and you're all set.

=20 @@ -303,7 +303,114 @@ The most specific means, in order of tests:

However, when you add your own file contexts (using semanage), th= is does not apply. Instead, tools like restorecon will take the last hit -within the locally added file contexts! +within the locally added file contexts! You can check the content of the +locally added rules in /etc/selinux/strict/contexts/files/file_con= texts.local +(substitute strict with your SELinux type). +

+ + + +
+How do I make small changes (additions) to the policy? + + +

+If you are interested in the Gentoo Hardened SELinux development itself,= please +have a look at the SELinux +Development Guide and other documentation linked from the SELinux project page. +

+ +

+However, you will eventually need to keep some changes on your policy, d= ue to +how you have configured your system or when you need to allow something = that is +not going to be accepted as a distribution-wide policy change. In that c= ase, +read on. +

+ +

+Updates on the policy are only possible as long as you need to allow<= /e> +additional privileges. It is not possible to remove rules from the polic= y, only +enhance it. To maintain your own set of additional rules, create a file = in which +you will keep your changes. In the next example, I will use the term +fixlocal, substitute with whatever name you like - but keep= it +consistent. In the file (fixlocal.te) put in the following = text +(again, substitute fixlocal with your chosen name): +

+ +
+policy_module(fixlocal, 1.0)
+
+require {
+# Declarations of types, classes and permissions used
+
+}
+
+# Declaration of policy rules
+
+ +

+In this file, you can add rules as you like. In the next example, we add= three +rules: +

+ +
    +
  1. + Allow mozilla_t the execmem privilege (based on a deni= al that + occurs when mozilla fails to start) +
  2. +
  3. + Allow ssh_t to connect to any port rather than just the SSH p= ort +
  4. +
  5. + Allows the user_t domain to send messages directly to the sys= tem + logger +
  6. +
+ +
+policy_module(fixlocal, 1.0)
+
+require {
+  type mozilla_t;
+  type ssh_t;
+  type user_t;
+
+  class process { execmem };
+}
+
+# Grant mozilla the execmem privilege
+allow mozilla_t self:process { execmem };
+
+# Allow SSH client to connect to any port (as provided by the u=
ser through the=20
+# "ssh -p <portnum> ..." command)
+corenet_tcp_connect_all_ports(ssh_t)
+
+# Allow the user_t domain to send messages to the system logger=

+logging_send_syslog_msg(user_t)
+
+ +

+If you need to provide raw allow statements (like the one above for the +mozilla_t domain), make sure that the type (mozilla_t),=20 +class (process) and privilege (execmem) are mentioned in +the require { ... } paragraph. +

+ +

+When using interface names, make sure that the type (ssh_t and +user_t) is mentioned in the require { ... } paragraph. +

+ +

+To find the proper interface name (like corenet_tcp_connect_all_ports= +above), you can either look for it in the SELinux Reference Pol= icy +API online or, if sec-policy/selinux-base-policy is built w= ith the +doc USE flag, in /usr/share/doc/selinux-base-policy-.*/html= . +Of course, you can also ask for help in #gentoo-hardened on +irc.freenode.net, the mailinglist, forums, etc. to find the proper rules= and +statements for your case.

=20