Skip to contentSkip to conversation

Git shell users

PATCH New Dominick Grift 1 participant 1 message Aug 24, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 3/8 Git shell users

Did you know that there is a Git shell in /usr/bin/git-shell, and did you know that you can use that together with OpenSSH to commit to shared repositories? Heck you can even commit to shared repositories using OpenSSH with a plain bash shell, but the Git shell is much cooler. A user domain solely for the purpose of commiting to shared repositories needs much less privileges that the least privilege userdom_base_user_template provides.

Git shell users do not need pty's, execmem or many other privileges provided by the base_user_template. Therefore we implement a template just for Git shell users, and we create a Git shell role, so that administrators can easily map their Unix logins to the Git shell SELinux user.

This Git shell user domain is allowed to manage and execute (primary) shared repositories.

FIXED: the default context in config/appconfig-mls for git_shell_u was wrong. git_shell.te: userdom_git_user_template was called by git_user but should be called by git_shell

---
:000000 100644 0000000... 2d9c6bc... A config/appconfig-mcs/git_shell_u_default_contexts
:000000 100644 0000000... 2d9c6bc... A config/appconfig-mls/git_shell_u_default_contexts
:000000 100644 0000000... bfbd788... A config/appconfig-standard/git_shell_u_default_contexts
:000000 100644 0000000... 601a7b0... A policy/modules/roles/git_shell.fc
:000000 100644 0000000... c6d9896... A policy/modules/roles/git_shell.if
:000000 100644 0000000... f5aa6cb... A policy/modules/roles/git_shell.te
:100644 100644 4da6875... aba9c7b... M policy/modules/services/git.if
:100644 100644 2dc8697... 5c30b4b... M policy/modules/system/userdomain.if

 config/appconfig-mcs/git_shell_u_default_contexts  |    2 +
 config/appconfig-mls/git_shell_u_default_contexts  |    2 +
 .../git_shell_u_default_contexts                   |    2 +
 policy/modules/roles/git_shell.fc                  |    1 +
 policy/modules/roles/git_shell.if                  |   50 +++++++++++++++
 policy/modules/roles/git_shell.te                  |   15 +++++
 policy/modules/services/git.if                     |   67 ++++++++++++++++++++
 policy/modules/system/userdomain.if                |   63 ++++++++++++++++++
 8 files changed, 202 insertions(+), 0 deletions(-)
config/appconfig-mcs/git_shell_u_default_contexts new file +2 -0
new file mode 100644
index 0000000..2d9c6bc
@@ -0,0 +1,2 @@
+git_shell_r:git_shell_t:s0		git_shell_r:git_shell_t:s0
+system_r:sshd_t:s0		git_shell_r:git_shell_t:s0
config/appconfig-mls/git_shell_u_default_contexts new file +2 -0
new file mode 100644
index 0000000..2d9c6bc
@@ -0,0 +1,2 @@
+git_shell_r:git_shell_t:s0		git_shell_r:git_shell_t:s0
+system_r:sshd_t:s0		git_shell_r:git_shell_t:s0
config/appconfig-standard/git_shell_u_default_contexts new file +2 -0
new file mode 100644
index 0000000..bfbd788
@@ -0,0 +1,2 @@
+git_shell_r:git_shell_t			git_shell_r:git_shell_t
+system_r:sshd_t			git_shell_r:git_shell_t
policy/modules/roles/git_shell.fc new file +1 -0
new file mode 100644
index 0000000..601a7b0
@@ -0,0 +1 @@
+# file contexts handled by userdomain and genhomedircon
policy/modules/roles/git_shell.if new file +50 -0

50 lines not on this page · raw message

policy/modules/roles/git_shell.te new file +15 -0
new file mode 100644
index 0000000..f5aa6cb
@@ -0,0 +1,15 @@
+policy_module(git_shell, 1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+userdom_git_user_template(git_shell)
+
+########################################
+#
+# Local policy
+#
+
+#gen_user(git_shell_u,, git_shell_r, s0, s0)
policy/modules/services/git.if +67 -0

73 lines not on this page · raw message

policy/modules/system/userdomain.if +63 -0

69 lines not on this page · raw message

Signature · 9 lines
1.7.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20110824/ded93978/attachment-0001.bin