{"action":"reopened","issue":{"number":112,"created_at":"2011-10-26T19:59:39Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"I realize that we got off on the wrong foot.  You have a great plugin.\r\n\r\nAttached is a patch for the 0.4.2 release that allows selinux support. I've given some pretty complete documentation, as well as a rakefile for setup. The bulk of the support is in a selinux subdirectory and in the tasks/selinux.rake file.  The only substantive changes are that I've moved binaries to a bin directory in the plugin root and prevented modification of gitUser and ssh key directories in the settings page (but only when selinux operational).  The lock file and other tmp file functionality is still in /tmp as before (although I've put them in /tmp/redmine_git_hosting/git_user subdirectory to handle case in which there are multiple redmine distributions with multiple gitolite repositories on the same machine, which is my use case). \r\n\r\nI've updated the README.mkd file with a new selinux section.  I don't know if I got the formatting right on this file.  Don't have a way to test it.\r\n\r\nNote that there is one new local string added to warn users that they cannot change those settings.  It appears that all of the locals are in English except for the Portugese ones?  At any rate, you might check my translation in pt.yml and pt-BR.yml, since I don't really know Portugese.\r\n\r\nI hope that you will take this.  It seems to work fine and might help users who are working in a selinux environment. Note that the rakefile will actually handle multiple, complete redmine + redmine_git_hosting installations simply by typing something like:\r\n\r\nrake RAILS_ENV=production ROOT_PATTERN=\"/source/.*/redmine\" selinux:install\r\n\r\np.s. I believe that I have all of the selinux use-cases covered, but just in case I left the redmine_git_hosting binaries running in a permissive environment for now (can be fixed by commenting out line near top of selinux/redmine_git.te.\r\n\r\nPatch follows.  Let me know if you want this in a different way:\r\n\r\n    diff --git a/vendor/plugins/redmine_git_hosting/.gitignore b/vendor/plugins/redmine_git_hosting/.gitignore\r\n    new file mode 100755\r\n    index 0000000..5412c5a\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/.gitignore\r\n    @@ -0,0 +1,3 @@\r\n    +.*.swp\r\n    +bin/\r\n    +selinux/tmp/\r\n    diff --git a/vendor/plugins/redmine_git_hosting/README.mkd b/vendor/plugins/redmine_git_hosting/README.mkd\r\n    index 945b9cf..dfae035 100755\r\n    --- a/vendor/plugins/redmine_git_hosting/README.mkd\r\n    +++ b/vendor/plugins/redmine_git_hosting/README.mkd\r\n    @@ -246,6 +246,44 @@ This library allows you to quickly deploy ChiliProject, with this plugin to an u\r\n     chili\\_test.sh script, modifying the variables in those scripts as desired.  This library is still under development,\r\n     so these instructions may need to be updated in the near future.\r\n     \r\n    +## Selinux Configuration for redmine\r\n    +\r\n    +This plugin can be configured to run with selinux.  We have included a rakefile in tasks/selinux.rake to assist\r\n    +with installing with selinux.  You should start by editing init.rb and migrating as described above.  Then, you \r\n    +can execute one of the selinux rake tasks (from the redmine root).  For instance, the simplest option installs \r\n    +a selinux configuration for both redmine and the redmine_git_hosting plugin:   \r\n    +\r\n    +    rake selinux:install RAILS_ENV=production \r\n    +\r\n    +This will generate the redmine_git_hosting binaries in ./bin, install a selinux policy for these binaries (called\r\n    +redmine_git.pp), then install a complete context for redmine as follows:\r\n    +\r\n    +**(1)** Most of redmine will be marked with \"public_content_rw_t\". \r\n    +\r\n    +**(2)** The dispatch files in Rails.root/public/dispatch.* will be marked with \"httpd_sys_script_exec_t\"\r\n    +\r\n    +**(3)** The redmine_git_hosting binaries in Rails.root/vendor/plugins/redmine_git_hosting/bin will be labeled\r\n    +with \"httpd_redmine_git_script_exec_t\", which has been crafted to allow the sudo behavior required by these\r\n    +binaries.\r\n    +\r\n    +Note that this rake file has additional options.  For instance, you can specify redmine roots with regular \r\n    +expressions (not globbed expessions!) as follows (notice the use of double quotes):\r\n    +\r\n    +    rake selinux:install RAILS_ENV=production ROOT_PATTERN=\"/source/.*/redmine\"\r\n    +\r\n    +These additional options are documented in the selinux.rake file.\r\n    +\r\n    +Once this plugin is placed under selinux control, three of the redmine_git_hosting settings can \r\n    +no longer be modified from the settings page.  They are: 'gitUser', 'gitoliteIdentityFile', and \r\n    +'gitoliteIdentityPublicKeyFile'.  The plugin settings page will make this clear.  The simplest way to \r\n    +modify these options is to temporarily place your system into permissive mode, refresh the setting page, \r\n    +change options, then place your system back into enforcing mode.  Alternatively, you can alter the init.rb \r\n    +file and reinstall the plugin.  Under normal operation, you will get one selinux complaint about /bin/touch \r\n    +in your log each time that you visit the plugin settings page.\r\n    +\r\n    +This rakefile and selinux configuration has been primarily tested on Redhat Enterprise Linux version 6.x \r\n    +with apache and fcgi. Other configurations may require slight tweaking.\r\n    +\r\n     ## Tested Configurations\r\n     \r\n     This plugin has been primarily tested on Ubuntu Server 10.10 and 11.04 (32 and 64 bit) with ChiliProject v1.x,\r\n    diff --git a/vendor/plugins/redmine_git_hosting/app/models/git_hosting_settings_observer.rb b/vendor/plugins/redmine_git_hosting/app/models/git_hosting_settings_observer.rb\r\n    index fee8d8a..fcd16e9 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/app/models/git_hosting_settings_observer.rb\r\n    +++ b/vendor/plugins/redmine_git_hosting/app/models/git_hosting_settings_observer.rb\r\n    @@ -5,6 +5,8 @@ class GitHostingSettingsObserver < ActiveRecord::Observer\r\n     \t@@old_hook_asynch  = Setting.plugin_redmine_git_hosting['gitHooksAreAsynchronous']\r\n     \t@@old_http_server  = Setting.plugin_redmine_git_hosting['httpServer']\r\n     \t@@old_git_user     = Setting.plugin_redmine_git_hosting['gitUser']\r\n    +        @@old_gitolite_identity = Setting.plugin_redmine_git_hosting['gitoliteIdentityFile']\r\n    +\t@@old_gitolite_publickey = Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']\r\n     \t@@old_repo_base    = Setting.plugin_redmine_git_hosting['gitRepositoryBasePath']\r\n     \r\n     \r\n    @@ -14,12 +16,25 @@ class GitHostingSettingsObserver < ActiveRecord::Observer\r\n     \t\tend\r\n     \tend\r\n     \r\n    -\r\n    -\r\n    +        def before_save(object)\r\n    +        \tif object.name == \"plugin_redmine_git_hosting\" && !GitHosting.bin_dir_writeable?\r\n    +                \t# If bin directory not alterable, don't alow changes to\r\n    +          \t\t# Git Username, or Gitolite public or private keys\r\n    +                \tvaluehash = object.value\r\n    +\t                valuehash['gitUser'] = @@old_git_user\r\n    +                  \tvaluehash['gitoliteIdentityFile'] = @@old_gitolite_identity\r\n    +                  \tvaluehash['gitoliteIdentityPublicKeyFile'] = @@old_gitolite_publickey\r\n    +\t\t\tobject.value = valuehash\r\n    +                end\r\n    +        end\r\n    +                \t\r\n     \tdef after_save(object)\r\n     \t\tif object.name == \"plugin_redmine_git_hosting\"\r\n     \r\n    -\t\t\t%x[ rm -rf '#{ GitHosting.get_tmp_dir }' ]\r\n    +                \tif GitHosting.bin_dir_writeable?\r\n    +\t\t\t\t%x[ rm -rf '#{ GitHosting.get_tmp_dir }' ]\r\n    +\t\t\t\t%x[ rm -rf '#{ GitHosting.get_bin_dir }' ] \r\n    +                        end\r\n     \r\n     \t\t\tif @@old_repo_base != object.value['gitRepositoryBasePath']\r\n     \t\t\t\tGitHostingObserver.set_update_active(false)\r\n    @@ -49,6 +64,8 @@ class GitHostingSettingsObserver < ActiveRecord::Observer\r\n     \t\t\t@@old_hook_asynch  = object.value['gitHooksAreAsynchronous']\r\n     \t\t\t@@old_http_server  = object.value['httpServer']\r\n     \t\t\t@@old_git_user     = object.value['gitUser']\r\n    +                        @@old_gitolite_identity = object.value['gitoliteIdentityFile']\r\n    +                        @@old_gitolite_publickey = object.value['gitoliteIdentityPublicKeyFile']\r\n     \t\t\t@@old_repo_base    = object.value['gitRepositoryBasePath']\r\n     \r\n     \t\tend\r\n    diff --git a/vendor/plugins/redmine_git_hosting/app/views/settings/_redmine_git_hosting.html.erb b/vendor/plugins/redmine_git_hosting/app/views/settings/_redmine_git_hosting.html.erb\r\n    index c6b1e77..3e226fa 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/app/views/settings/_redmine_git_hosting.html.erb\r\n    +++ b/vendor/plugins/redmine_git_hosting/app/views/settings/_redmine_git_hosting.html.erb\r\n    @@ -26,19 +26,19 @@\r\n     \t\t<br />\r\n     \t</p>\r\n     \t<p>\r\n    -\t\t<label><%= l(:label_git_user)%></label>\r\n    +\t\t<label><%= l(:label_git_user) %><%= \"<em><br /> [ #{l(:label_cannot_change_selinux)} ]</br>\" if !GitHosting.bin_dir_writeable? :reset %></label>\r\n     \t\t<%= text_field_tag(\"settings[gitUser]\", @settings['gitUser'].split(/[\\r\\n\\t ,;]+/).join(\"\\n\"), :size => 60) %>\r\n     \t\t<br />\r\n     \t</p>\r\n     \r\n     \t<p>\r\n    -\t\t<label><%= l(:label_gitolite_identity_file)%></label>\r\n    +\t\t<label><%= l(:label_gitolite_identity_file) %><%= \"<em><br /> [ #{l(:label_cannot_change_selinux)} ]</br>\" if !GitHosting.bin_dir_writeable? %></label>\r\n     \t\t<%= text_field_tag(\"settings[gitoliteIdentityFile]\", @settings['gitoliteIdentityFile'], :size => 60) %>\r\n     \t\t<br />\r\n     \t</p>\r\n     \r\n     \t<p>\r\n    -\t\t<label><%= l(:label_gitolite_identity_public_key_file)%></label>\r\n    +\t\t<label><%= l(:label_gitolite_identity_public_key_file) %><%= \"<em><br /> [ #{l(:label_cannot_change_selinux)} ]</br>\" if !GitHosting.bin_dir_writeable? %></label>\r\n     \t\t<%= text_field_tag(\"settings[gitoliteIdentityPublicKeyFile]\", @settings['gitoliteIdentityPublicKeyFile'], :size => 60) %>\r\n     \t\t<br />\r\n     \t</p>\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/bg.yml b/vendor/plugins/redmine_git_hosting/config/locales/bg.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/bg.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/bg.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/bs.yml b/vendor/plugins/redmine_git_hosting/config/locales/bs.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/bs.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/bs.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/ca.yml b/vendor/plugins/redmine_git_hosting/config/locales/ca.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/ca.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/ca.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/cs.yml b/vendor/plugins/redmine_git_hosting/config/locales/cs.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/cs.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/cs.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/da.yml b/vendor/plugins/redmine_git_hosting/config/locales/da.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/da.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/da.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/de.yml b/vendor/plugins/redmine_git_hosting/config/locales/de.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/de.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/de.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/el.yml b/vendor/plugins/redmine_git_hosting/config/locales/el.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/el.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/el.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/en.yml b/vendor/plugins/redmine_git_hosting/config/locales/en.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/en.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/en.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/es.yml b/vendor/plugins/redmine_git_hosting/config/locales/es.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/es.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/es.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/fi.yml b/vendor/plugins/redmine_git_hosting/config/locales/fi.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/fi.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/fi.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/fr.yml b/vendor/plugins/redmine_git_hosting/config/locales/fr.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/fr.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/fr.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/gl.yml b/vendor/plugins/redmine_git_hosting/config/locales/gl.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/gl.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/gl.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/he.yml b/vendor/plugins/redmine_git_hosting/config/locales/he.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/he.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/he.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/hu.yml b/vendor/plugins/redmine_git_hosting/config/locales/hu.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/hu.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/hu.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/id.yml b/vendor/plugins/redmine_git_hosting/config/locales/id.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/id.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/id.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/it.yml b/vendor/plugins/redmine_git_hosting/config/locales/it.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/it.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/it.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/ja.yml b/vendor/plugins/redmine_git_hosting/config/locales/ja.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/ja.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/ja.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/ko.yml b/vendor/plugins/redmine_git_hosting/config/locales/ko.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/ko.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/ko.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/lt.yml b/vendor/plugins/redmine_git_hosting/config/locales/lt.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/lt.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/lt.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/nl.yml b/vendor/plugins/redmine_git_hosting/config/locales/nl.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/nl.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/nl.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/no.yml b/vendor/plugins/redmine_git_hosting/config/locales/no.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/no.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/no.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/pl.yml b/vendor/plugins/redmine_git_hosting/config/locales/pl.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/pl.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/pl.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/pt-BR.yml b/vendor/plugins/redmine_git_hosting/config/locales/pt-BR.yml\r\n    index 90c31bf..e9989cd 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/pt-BR.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/pt-BR.yml\r\n    @@ -7,6 +7,7 @@ pt-BR:\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)\r\n       label_git_repository_base_path: 'DirectÃ³rio Git base (Relativo Ã  \"home\" do utilizador git)'\r\n    +  label_cannot_change_selinux: 'nÃ£o pode ser mudada (selinux)'\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/pt.yml b/vendor/plugins/redmine_git_hosting/config/locales/pt.yml\r\n    index dc5f5f1..f6db9e3 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/pt.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/pt.yml\r\n    @@ -7,6 +7,7 @@ pt:\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)\r\n       label_git_repository_base_path: 'DirectÃ³rio Git base (Relativo Ã  \"home\" do utilizador git)'\r\n    +  label_cannot_change_selinux: 'nÃ£o pode ser mudada (selinux)'\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/ro.yml b/vendor/plugins/redmine_git_hosting/config/locales/ro.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/ro.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/ro.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/ru.yml b/vendor/plugins/redmine_git_hosting/config/locales/ru.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/ru.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/ru.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/sk.yml b/vendor/plugins/redmine_git_hosting/config/locales/sk.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/sk.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/sk.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/sl.yml b/vendor/plugins/redmine_git_hosting/config/locales/sl.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/sl.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/sl.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/sr.yml b/vendor/plugins/redmine_git_hosting/config/locales/sr.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/sr.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/sr.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/sv.yml b/vendor/plugins/redmine_git_hosting/config/locales/sv.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/sv.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/sv.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/th.yml b/vendor/plugins/redmine_git_hosting/config/locales/th.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/th.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/th.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/tr.yml b/vendor/plugins/redmine_git_hosting/config/locales/tr.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/tr.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/tr.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/uk.yml b/vendor/plugins/redmine_git_hosting/config/locales/uk.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/uk.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/uk.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/vi.yml b/vendor/plugins/redmine_git_hosting/config/locales/vi.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/vi.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/vi.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/zh-TW.yml b/vendor/plugins/redmine_git_hosting/config/locales/zh-TW.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/zh-TW.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/zh-TW.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/config/locales/zh.yml b/vendor/plugins/redmine_git_hosting/config/locales/zh.yml\r\n    index 2ce8a46..723401c 100644\r\n    --- a/vendor/plugins/redmine_git_hosting/config/locales/zh.yml\r\n    +++ b/vendor/plugins/redmine_git_hosting/config/locales/zh.yml\r\n    @@ -7,6 +7,7 @@\r\n       label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)\r\n       label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)\r\n       label_git_repository_base_path: Git Repository Base Path (Relative to git user home)\r\n    +  label_cannot_change_selinux: Cannot be changed under selinux\r\n     \r\n       field_git_daemon: Git Daemon\r\n       field_git_http: Git Smart HTTP\r\n    diff --git a/vendor/plugins/redmine_git_hosting/lib/git_hosting.rb b/vendor/plugins/redmine_git_hosting/lib/git_hosting.rb\r\n    index 8bcea34..07aa7e0 100755\r\n    --- a/vendor/plugins/redmine_git_hosting/lib/git_hosting.rb\r\n    +++ b/vendor/plugins/redmine_git_hosting/lib/git_hosting.rb\r\n    @@ -23,6 +23,10 @@ module GitHosting\r\n     \t\treturn @@web_user\r\n     \tend\r\n     \r\n    +        def self.web_user=(setuser)\r\n    +        \t@@web_user = setuser\r\n    +        end\r\n    +\r\n     \tdef self.git_user\r\n     \t\tSetting.plugin_redmine_git_hosting['gitUser']\r\n     \tend\r\n    @@ -92,7 +96,7 @@ module GitHosting\r\n     \t\t\t@@sudo_web_to_git_user_stamp = Time.new\r\n     \t\t\treturn @@sudo_web_to_git_user_cached\r\n     \t\tend\r\n    -\t\ttest = %x[sudo -nu #{git_user} echo \"yes\"]\r\n    + \t\ttest = %x[#{GitHosting.git_user_runner} echo \"yes\"]\r\n     \t\tif test.match(/yes/)\r\n     \t\t\t@@sudo_web_to_git_user_cached = true\r\n     \t\t\t@@sudo_web_to_git_user_stamp = Time.new\r\n    @@ -146,7 +150,7 @@ module GitHosting\r\n     \t\tend\r\n     \tend\r\n     \tdef self.get_tmp_dir\r\n    -\t\t@@git_hosting_tmp_dir ||= File.join(Dir.tmpdir, \"redmine_git_hosting\")\r\n    +                @@git_hosting_tmp_dir ||= File.join(Dir.tmpdir, \"redmine_git_hosting\", \"#{git_user}\")\r\n     \t\tif !File.directory?(@@git_hosting_tmp_dir)\r\n     \t\t\t%x[mkdir -p \"#{@@git_hosting_tmp_dir}\"]\r\n     \t\t\t%x[chmod 700 \"#{@@git_hosting_tmp_dir}\"]\r\n    @@ -154,17 +158,51 @@ module GitHosting\r\n     \t\tend\r\n     \t\treturn @@git_hosting_tmp_dir\r\n     \tend\r\n    +\tdef self.get_bin_dir\r\n    +        \t@@git_hosting_bin_dir ||= \r\n    +                \tRails.root.join(\"vendor/plugins/redmine_git_hosting/bin\")\r\n    +\t\tif !File.directory?(@@git_hosting_bin_dir)\r\n    +                  \tlogger.error \"Creating bin directory: #{@@git_hosting_bin_dir}, Owner #{web_user}\"\r\n    +\t\t\t%x[mkdir -p \"#{@@git_hosting_bin_dir}\"]\r\n    +\t\t\t%x[chmod 750 \"#{@@git_hosting_bin_dir}\"]\r\n    +\t\t\t%x[chown #{web_user} \"#{@@git_hosting_bin_dir}\"]\r\n    +\t\tend\r\n    +                if !File.directory?(@@git_hosting_bin_dir)\r\n    +                \tlogger.error \"Cannot create bin directory: #{@@git_hosting_bin_dir}\"\r\n    +                end\r\n    +\t\treturn @@git_hosting_bin_dir\r\n    +\tend\r\n     \r\n    -\r\n    +\t@@git_bin_dir_writeable = nil\r\n    +        def self.bin_dir_writeable?(*option)\r\n    +        \t@@git_bin_dir_writeable = nil if option.length > 0 && option[0] == :reset\r\n    +\t\tif @@git_bin_dir_writeable == nil\r\n    +                \tmybindir = get_bin_dir\r\n    +\t                mytestfile = \"#{mybindir}/writecheck\"\r\n    +        \t\tif (!File.directory?(mybindir))\r\n    +\t                \t@@git_bin_dir_writeable = false\r\n    +        \t        else\r\n    +\t        \t        %x[touch \"#{mytestfile}\"]\r\n    +                \t\tif (!File.exists?(\"#{mytestfile}\"))\r\n    +                                \t@@git_bin_dir_writeable = false\r\n    +                        \telse\r\n    +                                \t%x[rm \"#{mytestfile}\"]\r\n    +                        \t\t@@git_bin_dir_writeable = true\r\n    +                        \tend\r\n    +\t\t\tend\r\n    +        \tend\r\n    +\t\t@@git_bin_dir_writeable\r\n    +        end\r\n     \r\n     \tdef self.git_exec_path\r\n    -\t\treturn File.join(get_tmp_dir(), \"run_git_as_git_user\")\r\n    +\t\treturn File.join(get_bin_dir(), \"run_git_as_git_user\")\r\n     \tend\r\n    +\r\n     \tdef self.gitolite_ssh_path\r\n    -\t\treturn File.join(get_tmp_dir(), \"gitolite_admin_ssh\")\r\n    +\t\treturn File.join(get_bin_dir(), \"gitolite_admin_ssh\")\r\n     \tend\r\n     \tdef self.git_user_runner_path\r\n    -\t\treturn File.join(get_tmp_dir(), \"run_as_git_user\")\r\n    +\t\treturn File.join(get_bin_dir(), \"run_as_git_user\")\r\n     \tend\r\n     \r\n     \r\n    @@ -189,7 +227,7 @@ module GitHosting\r\n     \r\n     \r\n     \tdef self.update_git_exec\r\n    -\t\tlogger.info \"Setting up #{get_tmp_dir()}\"\r\n    +\t\tlogger.info \"Setting up #{get_bin_dir()}\"\r\n     \t\tgitolite_key=Setting.plugin_redmine_git_hosting['gitoliteIdentityFile']\r\n     \r\n     \t\tFile.open(gitolite_ssh_path(), \"w\") do |f|\r\n    @@ -211,8 +249,6 @@ module GitHosting\r\n     \t\tsudo_version = 100*100*(split_version[0].to_i) + 100*(split_version[1].to_i) + split_version[2].to_i\r\n     \t\tsudo_version_switch = (100*100*1) + (100 * 7) + 3\r\n     \r\n    -\r\n    -\r\n     \t\tFile.open(git_exec_path(), \"w\") do |f|\r\n     \t\t\tf.puts '#!/bin/sh'\r\n     \t\t\tf.puts \"if [ \\\"\\$(whoami)\\\" = \\\"#{git_user}\\\" ] ; then\"\r\n    @@ -251,14 +287,10 @@ module GitHosting\r\n     \t\t\tf.puts '}'\r\n     \t\tend if !File.exists?(git_user_runner_path())\r\n     \r\n    -\r\n    -\r\n     \t\tFile.chmod(0550, git_exec_path())\r\n     \t\tFile.chmod(0550, gitolite_ssh_path())\r\n     \t\tFile.chmod(0550, git_user_runner_path())\r\n    -\r\n    -\r\n    -\r\n    +\t\t%x[chown #{web_user} -R \"#{@@git_hosting_bin_dir}\"]\r\n     \tend\r\n     \r\n     \t\r\n    @@ -291,7 +323,7 @@ module GitHosting\r\n     \t\t# clone/pull from admin repo\r\n     \t\tlocal_dir = get_tmp_dir()\r\n     \t\tif File.exists? \"#{local_dir}/gitolite-admin\"\r\n    -\t\t\tlogger.info \"Fethcing changes for #{local_dir}/gitolite-admin\"\r\n    +\t\t\tlogger.info \"Fetching changes for #{local_dir}/gitolite-admin\"\r\n     \t\t\t%x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' fetch]\r\n     \t\t\t%x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' merge FETCH_HEAD]\r\n     \t\telse\r\n    diff --git a/vendor/plugins/redmine_git_hosting/selinux/README b/vendor/plugins/redmine_git_hosting/selinux/README\r\n    new file mode 100644\r\n    index 0000000..a877fb2\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/selinux/README\r\n    @@ -0,0 +1,67 @@\r\n    +This directory contains a selinux policy crafted to cover the sudo and\r\n    +ssh scripts for the redmine_git_hosting plugin. In it, we define a new\r\n    +httpd-compatible type, \"httpd_redmine_git_script_exec_t\" which can be\r\n    +placed on the redmine_git_hosting/bin directory to allow sudo access\r\n    +from redmine code.  The basic assumption is that scripts placed into\r\n    +this directory will be called from context \"httpd_script_t\" (i.e\r\n    +redmine). \r\n    +\r\n    +Once this plugin is placed under selinux control, three of the\r\n    +redmine_git_hosting settings can no longer be modified from the\r\n    +settings page.  They are: 'gitUser', 'gitoliteIdentityFile', and\r\n    +'gitoliteIdentityPublicKeyFile'.  The plugin settings page will make\r\n    +this clear.  The simplest way to modify these options is to\r\n    +temporarily place your system into permissive mode, refresh the\r\n    +setting page, change options, then place your system back into\r\n    +enforcing mode.  Alternatively, you can alter the init.rb file and\r\n    +reinstall the plugin.  Under normal operation, you will get one\r\n    +selinux complaint about /bin/touch in your log each time that you\r\n    +visit the plugin settings page.\r\n    +\r\n    +******************* INSTALLATION AND SETUP *************************\r\n    +Note that the redmine_git_hosting/bin directory must be constructed\r\n    +statically so that it can be labeled.  You can do this with a series\r\n    +of rake tasks at the top-level of the redmine directory (after fixing\r\n    +up the defaults in the redmine_git_hosting init.rb file):\r\n    +\r\n    +    # Build bin directory with customized scripts for redmine_git_hosting, \r\n    +    # install new selinux policy, and install complete selinux context for \r\n    +    # redmine+this plugin:\r\n    +\r\n    +    rake selinux:install RAILS_ENV=production\r\n    +\r\n    +Since redmine doesn't currently have a selinux install option, this\r\n    +installation command is only available for this plugin.  What this\r\n    +will do is label the whole redmine site with \"public_content_rw_t\",\r\n    +with the exception of the \"dispatch*\" files in public (set to\r\n    +\"httpd_script_exec_t\") and the scripts in redmine_git_hosting/bin (set\r\n    +to \"httpd_redmine_git_script_exec_t\").\r\n    +\r\n    +If you happen to have multiple redmine installations, you can use a\r\n    +regular expression to describe the redmine root directories (this will\r\n    +translate into file context descriptions).  For instance, if you have\r\n    +multiple redmine installations in directories whose paths start with\r\n    +\"/source\" and end with \"redmine\" you can use (notice the use of\r\n    +double-quotes!):\r\n    +\r\n    +    rake selinux:install RAILS_ENV=production ROOT_PATTERN=\"/source/.*/redmine\"\r\n    +\r\n    +Somewhat less far-reaching options include:\r\n    +\r\n    +    # Build bin directory with customized scripts for redmine_git_hosting,\r\n    +    # install new selinux policy, and install selinux context for \r\n    +    # the redmine_git_hosting plugin\r\n    +   \r\n    +    rake selinux:redmine_git_hosting:install\r\n    +\r\n    +Finally, for those who are hand-crafting their own file context:\r\n    +\r\n    +    # Build bin directory with customized scripts for redmine_git_hosting\r\n    +    # and install new selinux policy.  No file contexts will be\r\n    +    # installed (so that you must do customization afterwards).\r\n    +\r\n    +    rake selinux:redmine_git_hosting:install_scripts_and_policy\r\n    +\r\n    +\r\n    +\r\n    +\t  \r\n    diff --git a/vendor/plugins/redmine_git_hosting/selinux/redmine_git.fc b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.fc\r\n    new file mode 100644\r\n    index 0000000..7924d24\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.fc\r\n    @@ -0,0 +1,9 @@\r\n    +# We do not install contexts as part of the policy, since it is likely\r\n    +# to be overridden by the local policy for parent directories.  The rakefile\r\n    +# ( ../tasks/selinux.rake) will install file contexts \"manually\".\r\n    +# \r\n    +# If you really want to install a file context, uncomment the following\r\n    +# and rerun the install script or rake task\r\n    +#\r\n    +# /.*/redmine/vendor/plugins/redmine_git_hosting/bin(/.*)?  httpd_redmine_git_script_exec_t\r\n    +\r\n    diff --git a/vendor/plugins/redmine_git_hosting/selinux/redmine_git.if b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.if\r\n    new file mode 100644\r\n    index 0000000..f5e66e4\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.if\r\n    @@ -0,0 +1,131 @@\r\n    +\r\n    +## <summary>policy for httpd_redmine_git_script</summary>\r\n    +\r\n    +\r\n    +########################################\r\n    +## <summary>\r\n    +##\tExecute a domain transition to run httpd_redmine_git_script.\r\n    +## </summary>\r\n    +## <param name=\"domain\">\r\n    +## <summary>\r\n    +##\tDomain allowed access.\r\n    +## </summary>\r\n    +## </param>\r\n    +#\r\n    +interface(`httpd_redmine_git_script_domtrans',`\r\n    +\tgen_require(`\r\n    +\t\ttype httpd_redmine_git_script_t, httpd_redmine_git_script_exec_t;\r\n    +\t')\r\n    +\r\n    +\tdomtrans_pattern($1, httpd_redmine_git_script_exec_t, httpd_redmine_git_script_t)\r\n    +')\r\n    +\r\n    +\r\n    +########################################\r\n    +## <summary>\r\n    +##\tSearch httpd_redmine_git_script rw directories.\r\n    +## </summary>\r\n    +## <param name=\"domain\">\r\n    +##\t<summary>\r\n    +##\tDomain allowed access.\r\n    +##\t</summary>\r\n    +## </param>\r\n    +#\r\n    +interface(`httpd_redmine_git_script_search_rw_dir',`\r\n    +\tgen_require(`\r\n    +\t\ttype httpd_redmine_git_script_rw_t;\r\n    +\t')\r\n    +\r\n    +\tallow $1 httpd_redmine_git_script_rw_t:dir search_dir_perms;\r\n    +\tfiles_search_rw($1)\r\n    +')\r\n    +\r\n    +########################################\r\n    +## <summary>\r\n    +##\tRead httpd_redmine_git_script rw files.\r\n    +## </summary>\r\n    +## <param name=\"domain\">\r\n    +##\t<summary>\r\n    +##\tDomain allowed access.\r\n    +##\t</summary>\r\n    +## </param>\r\n    +#\r\n    +interface(`httpd_redmine_git_script_read_rw_files',`\r\n    +\tgen_require(`\r\n    +\t\ttype httpd_redmine_git_script_rw_t;\r\n    +\t')\r\n    +\r\n    +\tallow $1 httpd_redmine_git_script_rw_t:file r_file_perms;\r\n    +\tallow $1 httpd_redmine_git_script_rw_t:dir list_dir_perms;\r\n    +\tfiles_search_rw($1)\r\n    +')\r\n    +\r\n    +########################################\r\n    +## <summary>\r\n    +##\tCreate, read, write, and delete\r\n    +##\thttpd_redmine_git_script rw files.\r\n    +## </summary>\r\n    +## <param name=\"domain\">\r\n    +##\t<summary>\r\n    +##\tDomain allowed access.\r\n    +##\t</summary>\r\n    +## </param>\r\n    +#\r\n    +interface(`httpd_redmine_git_script_manage_rw_files',`\r\n    +\tgen_require(`\r\n    +\t\ttype httpd_redmine_git_script_rw_t;\r\n    +\t')\r\n    +\r\n    +         manage_files_pattern($1, httpd_redmine_git_script_rw_t, httpd_redmine_git_script_rw_t)\r\n    +')\r\n    +\r\n    +########################################\r\n    +## <summary>\r\n    +##\tCreate, read, write, and delete\r\n    +##\thttpd_redmine_git_script rw dirs.\r\n    +## </summary>\r\n    +## <param name=\"domain\">\r\n    +##\t<summary>\r\n    +##\tDomain allowed access.\r\n    +##\t</summary>\r\n    +## </param>\r\n    +#\r\n    +interface(`httpd_redmine_git_script_manage_rw_dirs',`\r\n    +\tgen_require(`\r\n    +\t\ttype httpd_redmine_git_script_rw_t;\r\n    +\t')\r\n    +\r\n    +         manage_dirs_pattern($1, httpd_redmine_git_script_rw_t, httpd_redmine_git_script_rw_t)\r\n    +')\r\n    +\r\n    +\r\n    +########################################\r\n    +## <summary>\r\n    +##\tAll of the rules required to administrate\r\n    +##\tan httpd_redmine_git_script environment\r\n    +## </summary>\r\n    +## <param name=\"domain\">\r\n    +##\t<summary>\r\n    +##\tDomain allowed access.\r\n    +##\t</summary>\r\n    +## </param>\r\n    +## <param name=\"role\">\r\n    +##\t<summary>\r\n    +##\tRole allowed access.\r\n    +##\t</summary>\r\n    +## </param>\r\n    +## <rolecap/>\r\n    +#\r\n    +interface(`httpd_redmine_git_script_admin',`\r\n    +\tgen_require(`\r\n    +\t\ttype httpd_redmine_git_script_t;\r\n    +                type httpd_redmine_git_script_rw_t;\r\n    +\t')\r\n    +\r\n    +\tallow $1 httpd_redmine_git_script_t:process { ptrace signal_perms };\r\n    +\tps_process_pattern($1, httpd_redmine_git_script_t)\r\n    +\r\n    +\tfiles_search_etc($1)\r\n    +\tadmin_pattern($1, httpd_redmine_git_script_rw_t)\r\n    +\r\n    +')\r\n    diff --git a/vendor/plugins/redmine_git_hosting/selinux/redmine_git.pp b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.pp\r\n    new file mode 100644\r\n    index 0000000..bfe21e6\r\n    Binary files /dev/null and b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.pp differ\r\n    diff --git a/vendor/plugins/redmine_git_hosting/selinux/redmine_git.sh b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.sh\r\n    new file mode 100755\r\n    index 0000000..0a6beae\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.sh\r\n    @@ -0,0 +1,44 @@\r\n    +#!/bin/sh -e\r\n    +\r\n    +DIRNAME=`dirname $0`\r\n    +cd $DIRNAME\r\n    +USAGE=\"$0 [ --update ]\"\r\n    +if [ `id -u` != 0 ]; then\r\n    +echo 'You must be root to run this script'\r\n    +exit 1\r\n    +fi\r\n    +\r\n    +if [ $# -eq 1 ]; then\r\n    +\tif [ \"$1\" = \"--update\" ] ; then\r\n    +\t\ttime=`ls -l --time-style=\"+%x %X\" redmine_git.te | awk '{ printf \"%s %s\", $6, $7 }'`\r\n    +\t\trules=`ausearch --start $time -m avc --raw -se redmine_git`\r\n    +\t\tif [ x\"$rules\" != \"x\" ] ; then\r\n    +\t\t\techo \"Found avc's to update policy with\"\r\n    +\t\t\techo -e \"$rules\" | audit2allow -R\r\n    +\t\t\techo \"Do you want these changes added to policy [y/n]?\"\r\n    +\t\t\tread ANS\r\n    +\t\t\tif [ \"$ANS\" = \"y\" -o \"$ANS\" = \"Y\" ] ; then\r\n    +\t\t\t\techo \"Updating policy\"\r\n    +\t\t\t\techo -e \"$rules\" | audit2allow -R >> redmine_git.te\r\n    +\t\t\t\t# Fall though and rebuild policy\r\n    +\t\t\telse\r\n    +\t\t\t\texit 0\r\n    +\t\t\tfi\r\n    +\t\telse\r\n    +\t\t\techo \"No new avcs found\"\r\n    +\t\t\texit 0\r\n    +\t\tfi\r\n    +\telse\r\n    +\t\techo -e $USAGE\r\n    +\t\texit 1\r\n    +\tfi\r\n    +elif [ $# -ge 2 ] ; then\r\n    +\techo -e $USAGE\r\n    +\texit 1\r\n    +fi\r\n    +\r\n    +echo \"Building and Loading Policy\"\r\n    +set -x\r\n    +make -f /usr/share/selinux/devel/Makefile\r\n    +/usr/sbin/semodule -i redmine_git.pp\r\n    +\r\n    diff --git a/vendor/plugins/redmine_git_hosting/selinux/redmine_git.te b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.te\r\n    new file mode 100644\r\n    index 0000000..54b0a7a\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/selinux/redmine_git.te\r\n    @@ -0,0 +1,69 @@\r\n    +policy_module(redmine_git,1.0.0)\r\n    +\r\n    +########################################\r\n    +#\r\n    +# Declarations\r\n    +#\r\n    +require {\r\n    +       type httpd_t, httpd_sys_script_t, httpd_sys_script_exec_t;\r\n    +       type sudo_db_t;\r\n    +       type httpd_redmine_git_script_t;\r\n    +       class process { setrlimit setfscreate };\r\n    +       class netlink_route_socket { write getattr read bind create nlmsg_read };\r\n    +       class capability { setuid sys_resource setgid };\r\n    +       class dir { getattr search write};\r\n    +}\r\n    +\r\n    +apache_content_template(redmine_git)\r\n    +\r\n    +permissive httpd_redmine_git_script_t;\r\n    +\r\n    +########################################\r\n    +#\r\n    +# httpd_redmine_git_script local policy\r\n    +#\r\n    +########################################\r\n    +\r\n    +manage_dirs_pattern(httpd_redmine_git_script_t, httpd_redmine_git_script_rw_t, httpd_redmine_git_script_rw_t)\r\n    +manage_files_pattern(httpd_redmine_git_script_t, httpd_redmine_git_script_rw_t, httpd_redmine_git_script_rw_t)\r\n    +\r\n    +domain_use_interactive_fds(httpd_redmine_git_script_t)\r\n    +\r\n    +files_read_etc_files(httpd_redmine_git_script_t)\r\n    +\r\n    +miscfiles_read_localization(httpd_redmine_git_script_t)\r\n    +\r\n    +# Allow our scripts to be called by redmine/apache\r\n    +httpd_redmine_git_script_domtrans(httpd_sys_script_t)\r\n    +\r\n    +# Allow us to access to rest of redmine site\r\n    +miscfiles_read_public_files(httpd_redmine_git_script_t)\r\n    +miscfiles_manage_public_files(httpd_redmine_git_script_t)\r\n    +\r\n    +#============= httpd_redmine_git_script_t ==============\r\n    +#Specific capabilities identified by audit2allow\r\n    +\r\n    +allow httpd_redmine_git_script_t self:capability audit_write;\r\n    +allow httpd_redmine_git_script_t self:capability { setuid sys_resource setgid };\r\n    +allow httpd_redmine_git_script_t self:key write;\r\n    +allow httpd_redmine_git_script_t self:netlink_audit_socket { write nlmsg_relay create read };\r\n    +allow httpd_redmine_git_script_t self:netlink_route_socket { write getattr read bind create nlmsg_read };\r\n    +allow httpd_redmine_git_script_t self:process setrlimit;\r\n    +allow httpd_redmine_git_script_t sudo_db_t:dir { getattr search };\r\n    +\r\n    +gitosis_read_lib_files(httpd_redmine_git_script_t)\r\n    +gitosis_manage_lib_files(httpd_redmine_git_script_t)\r\n    +\r\n    +httpd_rw_stream_sockets(httpd_redmine_git_script_t)\r\n    +kernel_read_kernel_sysctls(httpd_redmine_git_script_t)\r\n    +logging_send_syslog_msg(httpd_redmine_git_script_t)\r\n    +\r\n    +# These seem to be needed for ssh....  Not sure why ssh needs\r\n    +# to read and/or validate contexts...\r\n    +allow httpd_redmine_git_script_t self:process setfscreate;\r\n    +miscfiles_manage_cert_dirs(httpd_redmine_git_script_t)\r\n    +miscfiles_manage_cert_files(httpd_redmine_git_script_t)\r\n    +selinux_load_policy(httpd_redmine_git_script_t)\r\n    +selinux_validate_context(httpd_redmine_git_script_t)\r\n    +seutil_read_file_contexts(httpd_redmine_git_script_t)\r\n    +seutil_search_default_contexts(httpd_redmine_git_script_t)\r\n    diff --git a/vendor/plugins/redmine_git_hosting/tasks/selinux.rake b/vendor/plugins/redmine_git_hosting/tasks/selinux.rake\r\n    new file mode 100644\r\n    index 0000000..92e1e4c\r\n    --- /dev/null\r\n    +++ b/vendor/plugins/redmine_git_hosting/tasks/selinux.rake\r\n    @@ -0,0 +1,273 @@\r\n    +################################################################################\r\n    +# Rakefile for selinux installation for Redmine+Redmine_Git_Hosting Plugin     #\r\n    +#                                                                              #\r\n    +# This rakefile provides a variety of options for configuring the selinux      #\r\n    +# context for Redmine + Redmine_Git_Hosting Plugin.  In addition to the usual  #\r\n    +# environment variables (such as RAIL_ENV), this rakefile has one additional   #\r\n    +# variable, ROOT_PATTERN.  ROOT_PATTERN holds an optional regular expression   #\r\n    +# (not globbed filename) which describes the possible root locations for       #\r\n    +# redmine installations; note that such patterns must be quoted to avoid       #\r\n    +# attempts by the shell to expand them.  If undefined, the rakefile will use   #\r\n    +# the Rails.root for the local installation.                                   #\r\n    +#                                                                              #\r\n    +# TOP-LEVEL TARGETS:                                                           #\r\n    +#                                                                              #\r\n    +# These commands should be executed after altering the init.rb file as         #\r\n    +# described in the README.mkb file.  Each target type comes in both \"install\"  #\r\n    +# and \"remove\" versions. In the following, the environment variables are       #\r\n    +# optional (of course). Default for ROOT_PATTERN is Rails.root                 #\r\n    +#                                                                              #\r\n    +# 1) Build bin directory with customized scripts for redmine_git_hosting,      #\r\n    +#    install new selinux policy, and install complete selinux context for      #\r\n    +#    redmine+redmine_git_hosting plugin                                        #\r\n    +#                                                                              #\r\n    +# rake selinux:install RAILS_ENV=xxx ROOT_PATTERN=\"yyy\"                        #\r\n    +# rake selinux:remove RAILS_ENV=xxx ROOT_PATTERN=\"yyy\"                         #\r\n    +#                                                                              #\r\n    +# 2) Build bin directory with customized scripts for redmine_git_hosting,      #\r\n    +#    install new selinux policy, and install selinux context for               #\r\n    +#    redmine_git_hosting plugin (not for complete redmine installation). This  #\r\n    +#    option assumes that the redmine installation (and plugin) code are        #\r\n    +#    already labeled as \"public_content_rw_t\" except for dispatch.* files      #\r\n    +#    which should be labeled as \"httpd_sys_script_exec_t\".                     #\r\n    +#                                                                              #\r\n    +# rake selinux:redmine_git_hosting:install RAILS_ENV=xxx ROOT_PATTERN=\"yyy\"    #\r\n    +# rake selinux:redmine_git_hosting:remove RAILS_ENV=xxx ROOT_PATTERN=\"yyy\"     #\r\n    +#                                                                              #\r\n    +# 3) Build bin directory with customized scripts for redmine_git_hosting and   #\r\n    +#    install new selinux policy. Do not install file contexts of any sort.     #\r\n    +#    Proper labeling (done in some other way) should have all of redmine       #\r\n    +#    (including plugins) labeled as \"public_content_rw_t\", with the exception  #\r\n    +#    of public/dispatch.* (which should be labeled \"httpd_sys_script_exec_t\")  #\r\n    +#    and vendor/plugins/redmine_git_hosting/bin(/.*) which should be labeled   #\r\n    +#    with the new label \"httpd_redmine_git_script_exec_t\".                     #\r\n    +#                                                                              #\r\n    +# rake selinux:redmine_git_hosting:install_scripts_and_policy RAILS_ENV=xxx ROOT_PATTERN=\"yyy\" \r\n    +# rake selinux:redmine_git_hosting:remove_scripts_and_policy RAILS_ENV=xxx ROOT_PATTERN=\"yyy\"  \r\n    +#                                                                              #\r\n    +################################################################################\r\n    +\r\n    +namespace :selinux do\r\n    +    desc \"Configure selinux for Redmine and Redmine_Git_Hosting plugin\"\r\n    +    task :install => [:environment,:install_contexts,\"selinux:redmine_git_hosting:install\"] do\r\n    +    end\r\n    +\r\n    +    desc \"Unconfigure selinux for Redmine and Redmine_Git_Hosting plugin\"\r\n    +    task :remove => [:environment,\"selinux:redmine_git_hosting:remove\",:remove_contexts] do\r\n    +    end\r\n    +\r\n    +    desc \"Install selinux file contexts for redmine (without plugins)\"\r\n    +    task :install_contexts => [:environment] do\r\n    +        roots = redmine_roots\r\n    +        root_pattern = redmine_root_pattern\r\n    +        puts \"[Installing file contexts for redmine:\"\r\n    +\r\n    +        sh \"semanage fcontext -a -t public_content_rw_t \\\"#{root_pattern}(/.*)?\\\"\"\r\n    +        sh \"semanage fcontext -a -t httpd_sys_script_exec_t \\\"#{root_pattern}/public/dispatch.*\\\"\"\r\n    +\r\n    +        roots.each do |path|\r\n    +            puts \"Setting new context for redmine root instance at #{path}.\"\r\n    +            sh \"restorecon -R -p #{path}\"\r\n    +        end\r\n    +        puts \"DONE.]\"\r\n    +    end\r\n    +\r\n    +    desc \"Remove selinux file contexts for redmine (without plugins)\"\r\n    +    task :remove_contexts => [:environment] do\r\n    +        roots = redmine_roots\r\n    +        root_pattern = redmine_root_pattern\r\n    +        puts \"[Removing file contexts for redmine (ignoring errors):\"\r\n    +\r\n    +        sh \"semanage fcontext -d \\\"#{root_pattern}(/.*)?\\\"\"\r\n    +        sh \"semanage fcontext -d \\\"#{root_pattern}/public/dispatch.*\\\"\"\r\n    +\r\n    +        roots.each do |path|\r\n    +            puts \"Setting new context for redmine root instance at #{path}.\"\r\n    +            sh \"restorecon -R -p #{path}\"\r\n    +        end\r\n    +        puts \"DONE.]\"\r\n    +    end\r\n    +\r\n    +    namespace :redmine_git_hosting do\r\n    +\tdesc \"Install scripts, policy, and file context for redmine_git_hosting plugin.\"\r\n    +\ttask :install => [:environment,:install_scripts,:install_policy,:install_contexts] do\r\n    +\tend\r\n    +\t    \r\n    +\tdesc \"Remove scripts, policy, and file context for redmine_git_hosting plugin.\"\r\n    +        task :remove => [:environment,:remove_contexts,:remove_policy,:remove_scripts] do\r\n    +\tend\r\n    +\t \r\n    +\tdesc \"Install scripts and policy for redmine_git_hosting plugin.\"\r\n    +\ttask :install_scripts_and_policy => [:environment,:install_scripts,:install_policy] do\r\n    +\tend\r\n    +\t    \r\n    +\tdesc \"Remove scripts and policy for redmine_git_hosting plugin.\"\r\n    +        task :remove_scripts_and_policy => [:environment,:remove_policy,:remove_scripts] do\r\n    +\tend\r\n    +\t \r\n    +        desc \"Generate and install redmine_git_hosting shell scripts.\"\r\n    +        task :install_scripts => [:environment] do\r\n    +            puts \"[Generating and installing redmine_git_hosting shell scripts:\"\r\n    +\r\n    +            plugin_roots = redmine_roots(\"vendor/plugins/redmine_git_hosting\")\r\n    +            plugin_roots.each do |path|\r\n    +\t\tif path != \"#{Rails.root}/vendor/plugins/redmine_git_hosting\"\r\n    +\t\t    # Have to call another rails environment.  Keep default root in that environment\r\n    +\t\t    chdir File.expand_path(\"#{path}/../../..\") do\r\n    +\t\t        print %x[rake selinux:redmine_git_hosting:install_scripts_helper]\r\n    +\t\t    end\r\n    +\t\telse\r\n    +\t\t    Rake::Task[\"selinux:redmine_git_hosting:install_scripts_helper\"].invoke\r\n    +\t\tend\r\n    +            end\r\n    +            puts \"DONE.]\"\r\n    +\tend\r\n    +\r\n    +        desc \"Helper function for generating and installing redmine_git_hosting shell scripts.\"\r\n    +        task :install_scripts_helper => [:environment] do \r\n    +            web_program = ENV['HTTPD'] || 'httpd'\r\n    +            web_user = ENV['WEB_USER'] || %x[ps aux | grep #{web_program} | sed \"s/ .*$//\" | sort -u | grep -v `whoami`].split(\"\\n\")[0]\r\n    +            GitHosting.web_user = web_user\r\n    +\r\n    +\t    # Helper only executed in local environment\t\r\n    +\t    path = \"#{Rails.root}/vendor/plugins/redmine_git_hosting\"\r\n    +\t    print \"Clearing out #{path}/bin directory...\"\r\n    +\t    %x[rm -rf \"#{path}/bin\"]\r\n    +\t    puts \"Success!\"\r\n    +\t    print \"Writing customized scripts to #{path}/bin directory...\"\r\n    +\t    GitHosting.update_git_exec\r\n    +\t    puts \"Success!\"\r\n    +        end\r\n    +\r\n    +\tdesc \"Remove redmine_git_hosting shell scripts.\"\r\n    +\ttask :remove_scripts => [:environment] do\r\n    +            puts \"[Deleting redmine_git_hosting shell scripts:\"\r\n    +            plugin_roots = redmine_roots(\"vendor/plugins/redmine_git_hosting\")\r\n    +            plugin_roots.each do |path|\r\n    +        \tsh \"rm -rf #{path}/bin\"\r\n    +        \tputs \"Success!\"\r\n    +            end\r\n    +            puts \"DONE.]\"\r\n    +\tend\r\n    +\r\n    + \tdesc \"Install selinux tags and policy for redmine_git_hosting.\"\r\n    +\ttask :install_policy => [:environment] do\r\n    +\t    puts \"[Installing selinux tags and policy for redmine_git_hosting:\"\r\n    +            plugin_roots = redmine_roots(\"vendor/plugins/redmine_git_hosting\")\r\n    +            sh \"#{plugin_roots[0]}/selinux/redmine_git.sh\"\r\n    +            puts \"DONE.]\"\r\n    +\tend\r\n","comments":1,"title":"Here is a patch to allow this plugin to work with selinux","updated_at":"2011-10-27T01:49:03Z","url":"https://api.github.com/repos/ericpaulbishop/redmine_git_hosting/issues/112","id":2060957,"assignee":null,"milestone":null,"closed_at":null,"user":{"gravatar_id":"55e5a9314b16473f85a420bd6a468ed1","avatar_url":"https://secure.gravatar.com/avatar/55e5a9314b16473f85a420bd6a468ed1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/kubitron","id":1109217,"login":"kubitron"},"html_url":"https://github.com/ericpaulbishop/redmine_git_hosting/issues/112","labels":[],"state":"open"},"legacy":{"number":112,"action":"reopened","issue":2060957}}