ericpaulbishop / redmine_git_hosting

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

SmartHTTP 401 Unauthorized #141

Open sduensin opened 12 years ago

sduensin commented 12 years ago

I'm sure this is something I've done wrong, but I can't figure it out. I performed a fresh Redmine 1.3.0 install on Ubuntu Server 11.10 with Apache 2 and Passenger.

My Apache configuration:

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so                        
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.11                                                                   
PassengerRuby /usr/bin/ruby                                                                                             

<VirtualHost *:80>                                                                                                      

   DocumentRoot /opt/redmine/public                                                                                     

   PassengerDefaultUser www-data                                                                                        
   RailsEnv production                                                                                                  
   RailsBaseURI /                                                                                                       

   <Directory /opt/redmine/public>                                                                                      
      AllowOverride all                                                                                                 
      Options -MultiViews                                                                                               
   </Directory>                                                                                                         

   LogLevel info                                                                                                        
   ErrorLog ${APACHE_LOG_DIR}/redmine-error.log                                                                         
   CustomLog ${APACHE_LOG_DIR}/redmine.log combined                                                                     

</VirtualHost>

When attempting a push to a newly created project, I see:

$ git push asgard master
Counting objects: 137, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (99/99), done.
Writing objects: 100% (137/137), 16.14 MiB | 243 KiB/s, done.
Total 137 (delta 17), reused 0 (delta 0)
error: RPC failed; result=22, HTTP code = 500
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

My Apache error log contains:

[ pid=47775 thr=139747320157952 file=ext/apache2/Hooks.cpp:860 time=2012-01-20 10:46:13.636 ]: Unexpected error in mod_p
assenger: An error occured while sending the request body to the request handler: Broken pipe (32)                      
  Backtrace:                                                                                                            
     (empty) 

And the Redmine log:

Processing GitHttpController#index (for 63.252.192.10 at 2012-01-20 10:46:13) [POST]
  Parameters: {"p1"=>"git-receive-pack", "p2"=>"", "p3"=>"", "action"=>"index", "id"=>"asgard", "path"=>"asgard.git", "controller"=>"git_http"}
  SQL (0.1ms)   SELECT max(`settings`.updated_on) AS max_updated_on FROM `settings` 
  AnonymousUser Load (0.0ms)   SELECT * FROM `users` WHERE ( (`users`.`type` = 'AnonymousUser' ) ) LIMIT 1
  Project Load (0.1ms)   SELECT * FROM `projects` WHERE (`projects`.`identifier` = 'asgard') LIMIT 1
  Repository Load (0.0ms)   SELECT * FROM `repositories` WHERE (`repositories`.project_id = 1) LIMIT 1
  GitRepositoryExtra Load (0.1ms)   SELECT * FROM `git_repository_extras` WHERE (`git_repository_extras`.repository_id = 1) LIMIT 1
  Repository Load (0.1ms)   SELECT * FROM `repositories` WHERE (`repositories`.`id` = 1)
Filter chain halted as [:authenticate] rendered_or_redirected.
Completed in 10ms (View: 0, DB: 0) | 401 Unauthorized [http://www.asgard-platform.org/asgard.git/git-receive-pack]

My basic installation procedure for all this was:

I'm sure I've missed something with SmartHTTP. Looks like it's an authorization problem, but I can't find where.

Help? Please? Thanks!

kubitron commented 12 years ago

You probably need to make sure that password info is properly forwarded to the plugin. I don't use passenger, but for fcgid (an apache plugin), I needed to have something like the following in my conf file (in particular, the whole E=X-HTTP... piece is what is needed. I don't know how that translates to passenger, but I bet you can google it..:

<Location /redmine>
    RewriteEngine On
    # Let apache handle purely static files like images by itself.
    RewriteCond %{REQUEST_FILENAME} !-f

    # Send Everything else to Typo
    RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
</Location>
sduensin commented 12 years ago

@kubitron Thanks for the tip. I'll begin Googling and report back.

sduensin commented 12 years ago

Well, if that's the answer, I sure can't figure it out. Anyone else manage to make this work?

Jehreg commented 12 years ago

+1 Having the same damn problem.

iarspider commented 12 years ago

+1 - same problem here, and no information about passing auth hreaders