System notice: In light of the Debian OpenSSL security issue we've regenerated the server keys. See this thread for instructions and the new key fingerprints.

Commit d9a4e805f7f080a37e9c1ef0d2bb304769b75fb7

only allow git-upload-pack the the command

Commit diff

script/git-daemon

 
1010require File.dirname(__FILE__)+'/../config/environment'
1111
1212Rails.configuration.log_level = :info # Disable debug
13ActiveRecord::Base.logger = nil
1413ActiveRecord::Base.allow_concurrency = true
15ActiveRecord::Base.clear_active_connections!
1614
1715BASE_PATH = File.expand_path(GitoriousConfig['repository_base_path'])
1816
17TIMEOUT = 30
1918MAX_CHILDREN = 30
2019$children_reaped = 0
2120$children_active = 0
2323 class Daemon
2424 include Daemonize
2525
26 SERVICE_REGEXP = /(\w{4})(git-[\w-]+)\s(.+)\x0host=([\w\.\-]+)/.freeze
26 SERVICE_REGEXP = /(\w{4})(git\-upload\-pack)\s(.+)\x0host=([\w\.\-]+)/.freeze
2727
2828 def initialize(options)
2929 @options = options
5656 $children_active += 1
5757
5858 line = session.recv(1000)
59 timeout = 30
59
6060 if line =~ SERVICE_REGEXP
6161 code = $1
6262 service = $2
7878 end
7979
8080 Dir.chdir(path) do
81 cmd = "git-upload-pack --strict --timeout=#{timeout} ."
81 cmd = "git-upload-pack --strict --timeout=#{TIMEOUT} ."
8282
8383 fork do
8484 repository = nil
107107 else
108108 log(pid, "Cannot find repository: #{path}")
109109 end
110
110
111111 exec(cmd)
112 # FIXME; we don't ever get here since we exec(), so reaped count may be incorrect
112113 $children_reaped += 1
113114 exit!
114115 end
toggle raw diff