kubitron / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
78 stars 15 forks source link

Testing if Gitolite user 'git' can sudo to Redmine user 'apache' #111

Open chobong opened 10 years ago

chobong commented 10 years ago

Hi,

Sorry if this is duplicate issue. I searched both this site and Google but still cannot fix the problem.

I have finished installing gitolite3 and Redmine 2.4 on my server. After installing redmine_git_hosting plugin 0.7, my Redmine cannot connect to Git (Administration --> Setting--> Repositories --> Git shows (!) /home/redmine/plugins/redmine_git_hosting/bin/run_git_cmd_as_gitolite_user )

And in git_hosting log, I get this error: 2014-03-05 15:49:04 +0900 ERROR [GitHosting] ["Problems to retrieve Gitolite hook parameters in Gitolite config"] 2014-03-05 15:49:04 +0900 INFO [GitHosting] ["Testing if Gitolite user 'git' can sudo to Redmine user 'apache'..."] 2014-03-05 15:49:04 +0900 ERROR [GitHosting] ["Error while testing sudo_git_to_redmine_user"] 2014-03-05 15:49:04 +0900 INFO [GitHosting] ["Testing if Redmine user 'apache' can sudo to Gitolite user 'git'..."] 2014-03-05 15:49:04 +0900 ERROR [GitHosting] ["Error while testing sudo_web_to_gitolite_user"]

I tried to test sudo for gitolite by running sudo -nu git/apache echo "Yes" and they are working. I updated visudo at below

%admin ALL=(ALL) ALL %sudo ALL=(ALL) ALL root ALL=(ALL) ALL apache ALL=(git) NOPASSWD:ALL git ALL=(apache) NOPASSWD:ALL Defaults:apache !requiretty Defaults:git !requiretty

But I doesn't work... How can I check why this error "Testing if Gitolite user 'git' can sudo to Redmine user 'apache'" happen?

Could you please help?

Thank you.

chobong commented 10 years ago

Hi,

I tried to follow this https://github.com/ericpaulbishop/redmine_git_hosting/issues/79 and https://github.com/jbox-web/redmine_git_hosting/wiki/Troubleshooting, but the error still the same.

I tested running sudo from passenger by adding these line in /redmine_git_hosting/lib/redmine_gitolite/config.rb sudo_test= %x[ sudo -nu git echo "yes"] logger.warn "Test: #{test}" --> It's working

Maybe the problem comes from my Passenger? I installed ruby and passenger via rvm and here is the passenger configuration in apache:

/etc/httpd/conf.d/redmine.conf PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.37 PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.0.0-p451/wrappers/ruby PassengerLoadShellEnvvars off PassengerDefaultUser apache

Path /usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/usr/local/mysql/bin:/root/bin

Could you please help?

Thank you so much.

chobong commented 10 years ago

Hi,

I have fixed this problem. This is my OS cannot run this command with sudo sudo -u git -i eval " something here " Then I edited all shell scripts in redmine_git_hosting/bin/* to sudo -u git -s eval " something here " and it's working.

Now i have problem that though everything in ConfigTest Menu is passed, but when I create a new git repository on redmine, it cannot be created on the server. I cannot see any error log in log/git_hosting.log

2014-03-18 19:23:29 +0900 INFO [GitHosting] User 'admin' created a new repository 'mhau11' 2014-03-18 19:23:29 +0900 DEBUG [GitWorker] add_repository : get lock ! 2014-03-18 19:23:29 +0900 INFO [GitWorker] Using Gitolite configuration file : 'gitolite.conf' 2014-03-18 19:23:29 +0900 INFO [GitWorker] add_repository : repository 'mhau11' does not exist in Gitolite, create it ... 2014-03-18 19:23:29 +0900 DEBUG [GitWorker] add_repository : repository path 'repositories/mhau11.git' 2014-03-18 19:23:29 +0900 DEBUG [GitHosting] /home/redmine/plugins/redmine_git_hosting/bin/run_shell_cmd_as_gitolite_user find 'recycle_bin/' -type d -regex 'recycle_bin/[0-9]+__mhau11.git' -prune || true 2>&1 2014-03-18 19:23:29 +0900 INFO [GitWorker] add_repository : let Gitolite create empty repository 'repositories/mhau11.git' 2014-03-18 19:23:29 +0900 INFO [GitWorker] add_repository : pushing to Gitolite... 2014-03-18 19:23:30 +0900 INFO [GitWorker] add_repository : done ! 2014-03-18 19:23:30 +0900 DEBUG [GitWorker] add_repository : lock released !

Could you pls check and have an advice?

Thank you.