Set GIT_ASKPASS=true when running Git
[girocco.git] / Girocco / Config.pm
blob5f5dfe17d45335b6682b345a3aed6fdf557bcba9
1 package Girocco::Config;
3 use strict;
4 use warnings;
7 ## Basic settings
9 # Name of the service
10 our $name = "GiroccoEx";
12 # Nickname of the service (undef for initial part of $name upto first '.')
13 our $nickname = undef;
15 # Title of the service (as shown in gitweb)
16 our $title = "Example Girocco Hosting";
18 # Path to the Git binary to use (you MUST set this, even if to /usr/bin/git!)
19 our $git_bin = '/usr/bin/git';
21 # Path to the git-http-backend binary to use (undef to use default)
22 # If both $httppullurl and $httpspushurl are undef this will never be used
23 # The default if this is undef is `$git_bin --exec-path`/git-http-backend
24 # Setting this explicitly is slightly more efficient as it avoids calling --exec-path
25 our $git_http_backend_bin = undef;
27 # Name (if in $PATH) or full path to netcat executable that accepts a -U option
28 # to connect to a unix socket. This may simply be 'nc' on many systems.
29 our $nc_openbsd_bin = 'nc.openbsd';
31 # Path to the sendmail instance to use. It should understand the -f <from>, -i and -t
32 # options as well as accepting a list of recipient addresses in order to be used here.
33 # You MUST set this, even if to '/usr/sbin/sendmail'!
34 # Setting this to 'sendmail.pl' is special and will automatically be expanded to
35 # a full path to the ../bin/sendmail.pl executable in this Girocco installation.
36 # sendmail.pl is a sendmail-compatible script that delivers the message directly
37 # using SMTP to a mail relay host. This is the recommended configuration as it
38 # minimizes the information exposed to recipients (no sender account names or uids),
39 # can talk to an SMTP server on another host (eliminating the need for a working
40 # sendmail and/or SMTP server on this host) and avoids any unwanted address rewriting.
41 # By default it expects the mail relay to be listening on localhost port 25.
42 # See the sendmail.pl section below for more information on configuring sendmail.pl.
43 our $sendmail_bin = 'sendmail.pl';
45 # E-mail of the site admin
46 our $admin = 'admin@example.org';
48 # Sender of emails
49 # This is the SMTP 'MAIL FROM:' value
50 # It will be passed to $sendmail_bin with the -f option
51 # Some sites may not allow non-privileged users to pass the -f option to
52 # $sendmail_bin. In that case set this to undef and no -f option will be
53 # passed which means the 'MAIL FROM:' value will be the user the mail is
54 # sent as (either $cgi_user or $mirror_user depending on the activity).
55 # To avoid having bounce emails go to $admin, this may be set to something
56 # else such as 'admin-noreply@example.org' and then the 'admin-noreply' address
57 # may be redirected to /dev/null. Setting this to '' or '<>' is not
58 # recommended because that will likely cause the emails to be marked as SPAM
59 # by the receiver's SPAM filter. If $sendmail_bin is set to 'sendmail.pl' this
60 # value must be acceptable to the receiving SMTP server as a 'MAIL FROM:' value.
61 # If this is set to undef and 'sendmail.pl' is used, the 'MAIL FROM:' value will
62 # be the user the mail is sent as (either $cgi_user or $mirror_user).
63 our $sender = $admin;
65 # Copy $admin on failure/recovery messages?
66 our $admincc = 1;
68 # Girocco branch to use for html.cgi view source links (undef for HEAD)
69 our $giroccobranch = undef;
72 ## Git user agent strings
74 # Git clients (i.e. fetch/clone) always send a user agent string when fetching
75 # over HTTP. Since version 1.7.12.1 an 'agent=' capability string is included
76 # as well which affects git:, smart HTTP and ssh: protocols.
78 # These settings allow the default user agent string to be changed independently
79 # for fetch/clone operations (only matters if $mirror is true) and server
80 # operations (some other Git client fetching from us). Note that it is not
81 # possible to suppress the capability entirely although it can be set to an
82 # empty string. If these values are not set, the default user agent string
83 # will be used. Typically (unless Git was built with non-standard options) the
84 # default is "git/" plus the version. So for example "git/1.8.5.6" or
85 # "git/2.1.4" might be seen.
87 # One might want to change the default user agent strings in order to prevent
88 # an attacker from learning the exact Git version being used to avoid being
89 # able to quickly target any version-specific vulnerabilities. Note that
90 # no matter what's set here, an attacker can easily determine whether a server
91 # is running JGit, libgit2 or Git and for Git whether it's version 1.7.12.1 or
92 # later. A reasonable value to hide the exact Git version number while
93 # remaining compatible with servers that require a "Git/" user agent string
94 # would be something like "git/2" or even just "git/".
96 # The GIT_USER_AGENT value to use when acting as a client (i.e. clone/fetch)
97 # This value is only used if $mirror is true and at least one mirror is set up.
98 # Setting this to the empty string will suppress the HTTP User-Agent header,
99 # but will still include an "agent=" capability in the packet protocol. The
100 # empty string is not recommended because some servers match on "git/".
101 # Leave undef to use the default Git user agent string
102 # IMPORTANT: some server sites will refuse to serve up Git repositories unless
103 # the client user agent string contains "Git/" (matched case insensitively)!
104 our $git_client_ua = undef;
106 # The GIT_USER_AGENT value to use when acting as a server (i.e. some Git client
107 # is fetching/cloning from us).
108 # Leave undef to use the default Git user agent string
109 our $git_server_ua = undef;
112 ## Feature knobs
114 # Enable mirroring mode if true (see "Foreign VCS mirrors" section below)
115 our $mirror = 1;
117 # Enable push mode if true
118 our $push = 1;
120 # If both $mirror and $push are enabled, setting this to 'mirror' pre-selects
121 # mirror mode on the initial regproj display, otherwise 'push' mode will be
122 # pre-selected. When forking the initial mode will be 'push' if $push enabled.
123 our $initial_regproj_mode = 'mirror';
125 # Enable user management if true; this means the interface for registering
126 # user accounts and uploading SSH keys. This implies full chroot.
127 our $manage_users = 1;
129 # Minimum key length (in bits) for uploaded SSH RSA/DSA keys.
130 # If this is not set (i.e. undef) keys as small as 512 bits will be allowed.
131 # Nowadays keys less than 2048 bits in length should probably not be allowed.
132 # Note, however, that versions of OpenSSH starting with 4.3p1 will only generate
133 # DSA keys of exactly 1024 bits in length even though that length is no longer
134 # recommended. (OpenSSL can be used to generate DSA keys with lengths > 1024.)
135 # OpenSSH does not have any problem generating RSA keys longer than 1024 bits.
136 # This setting is only checked when new keys are added so setting it/increasing it
137 # will not affect existing keys. For maximum compatibility a value of 1024 may
138 # be used however 2048 is recommended. Setting it to anything other than 1024,
139 # 2048 or 3072 may have the side effect of making it very difficult to generate
140 # DSA keys that satisfy the restriction (but RSA keys should not be a problem).
141 # Note that no matter what setting is specified here keys smaller than 512 bits
142 # will never be allowed via the reguser.cgi/edituser.cgi interface.
143 # RECOMMENDED VALUE: 2048 (ok) or 3072 (better)
144 our $min_key_length = 1024;
146 # Disable DSA public keys?
147 # If this is set to 1, adding DSA keys at reguser.cgi/edituser.cgi time will be
148 # prohibited. If $pushurl is undef then this is implicitly set to 1 since DSA
149 # keys are not usable with https push.
150 # OpenSSH will only generate 1024 bit DSA keys starting with version 4.3p1.
151 # Even if OpenSSL is used to generate a longer DSA key (which can then be used
152 # with OpenSSH), the SSH protocol itself still forces use of SHA-1 in the DSA
153 # signature blob which tends to defeat the purpose of going to a longer key in
154 # the first place. So it may be better from a security standpoint to simply
155 # disable DSA keys especially if $min_key_length and $rsakeylength have been set
156 # to something higher such as 3072 or 4096. This setting is only checked when
157 # new keys are added so setting it/increasing it will not affect existing keys.
158 # There is no way to disable DSA keys in the OpenSSH server config file itself.
159 # If this is set to 1, no ssh_host_dsa_key will be generated or used with the
160 # sshd running in the jail (but if the sshd_config has already been generated
161 # in the jail, it must be removed and 'sudo make install' run again or otherwise
162 # the sshd_config needs to be edited by hand for the change to take effect).
163 # RECOMMENDED VALUE: 1
164 our $disable_dsa = 0;
166 # Enable the special 'mob' user if set to 'mob'
167 our $mob = "mob";
169 # Let users set admin passwords; if false, all password inputs are assumed empty.
170 # This will make new projects use empty passwords and all operations on them
171 # unrestricted, but you will be able to do no operations on previously created
172 # projects you have set a password on.
173 our $project_passwords = 1;
175 # How to determine project owner; 'email' adds a form item asking for their
176 # email contact, 'source' takes realname of owner of source repository if it
177 # is a local path (and empty string otherwise). 'source' is suitable in case
178 # the site operates only as mirror of purely local-filesystem repositories.
179 our $project_owners = 'email';
181 # Which project fields to make editable, out of 'shortdesc', 'homepage',
182 # 'README', 'notifymail', 'notifyjson', 'notifycia'. (This is currently
183 # soft restriction - form fields aren't used, but manually injected values
184 # *are* used. Submit a patch if that's an issue for you.)
185 our @project_fields = qw(homepage shortdesc README notifymail notifyjson notifycia);
187 # Minimal number of seconds to pass between two updates of a project.
188 our $min_mirror_interval = 3600; # 1 hour
190 # Minimal number of seconds to pass between two garbage collections of a project.
191 our $min_gc_interval = 604800; # 1 week
193 # Whether or not to run the ../bin/update-pwd-db script whenever the etc/passwd
194 # database is changed. This is typically needed (i.e. set to a true value) for
195 # FreeBSD style systems when using an sshd chroot jail for push access. So if
196 # $pushurl is undef or the system Girocco is running on is not like FreeBSD
197 # (e.g. a master.passwd file that must be transformed into pwd.db and spwd.db), then
198 # this setting should normally be left false (i.e. 0). See comments in the
199 # provided ../bin/update-pwd-db script about when and how it's invoked.
200 our $update_pwd_db = 0;
202 # Port the sshd running in the jail should listen on
203 # Be sure to update $pushurl to match
204 # Not used if $pushurl is undef
205 our $sshd_jail_port = 22;
207 # If this is true then host names used in mirror source URLs will be checked
208 # and any that are not DNS names (i.e. IPv4 or IPv6) or match one of the DNS
209 # host names in any of the URL settings below will be rejected.
210 our $restrict_mirror_hosts = 1;
212 # If $restrict_mirror_hosts is enabled this is the minimum number of labels
213 # required in a valid dns name. Normally 2 is the correct value, but if
214 # Girocco is being used internally where a common default or search domain
215 # is set for everyone then this should be changed to 1 to allow a dns name
216 # with a single label in it. No matter what is set here at least 1 label
217 # is always required when $restrict_mirror_hosts is enabled.
218 our $min_dns_labels = 2;
221 ## Foreign VCS mirrors
223 # Note that if any of these settings are changed from true to false, then
224 # any pre-existing mirrors using the now-disabled foreign VCS will stop
225 # updating, new mirrors using the now-disabled foreign VCS will be disallowed
226 # and attempts to update ANY project settings for a pre-existing project that
227 # uses a now-disabled foreign VCS source URL will also be disallowed.
229 # If $mirror is true and $mirror_svn is true then mirrors from svn source
230 # repositories will be allowed (and be converted to Git). These URLs have
231 # the form svn://... or svn+http://... or svn+https://...
232 # Note that for this to work the "svn" command line command must be available
233 # in PATH and the "git svn" commands must work (which generally requires both
234 # Perl and the subversion perl bindings be installed).
235 our $mirror_svn = 1;
237 # If $mirror is true and $mirror_darcs is true then mirrors from darcs source
238 # repositories will be allowed (and be converted to Git). These URLs have
239 # the form darcs://...
240 # Note that for this to work the "darcs" command line command must be available
241 # in PATH and so must python (required to run the darcs-fast-export script).
242 our $mirror_darcs = 1;
244 # If $mirror is true and $mirror_bzr is true then mirrors from bzr source
245 # repositories will be allowed (and be converted to Git). These URLs have
246 # the form bzr://...
247 # Note that for this to work the "bzr" command line command must be available
248 # in PATH (it's a python script so python is required as well).
249 our $mirror_bzr = 1;
251 # If $mirror is true and $mirror_hg is true then mirrors from hg source
252 # repositories will be allowed (and be converted to Git). These URLs have
253 # the form hg+http://... or hg+https://...
254 # Note that for this to work the "hg" command line command must be available
255 # in PATH and so must python (required to run the hg-fast-export.py script).
256 # Note that if the PYTHON environment variable is set that will be used instead
257 # of just plain "python" to run the hg-fast-export.py script (which needs to
258 # be able to import from mercurial).
259 our $mirror_hg = 1;
262 ## Paths
264 # Path where the main chunk of Girocco files will be installed
265 # This will get COMPLETELY OVERWRITTEN by each make install!!!
266 our $basedir = '/home/repo/repomgr';
268 # Path where the automatically generated non-user certificates will be stored
269 # (The per-user certificates are always stored in $chroot/etc/sshcerts/)
270 # This is preserved by each make install and MUST NOT be under $basedir!
271 # Not used unless $httpspushurl is defined
272 our $certsdir = '/home/repo/certs';
274 # The repository collection
275 # "$reporoot-recyclebin" will also be created for use by toolbox/trash-project.pl
276 our $reporoot = "/srv/git";
278 # The repository collection's location within the chroot jail
279 # Normally $reporoot will be bind mounted onto $chroot/$jailreporoot
280 # Should NOT start with '/'
281 our $jailreporoot = "srv/git";
283 # The chroot for ssh pushing; location for project database and other run-time
284 # data even in non-chroot setups
285 our $chroot = "/home/repo/j";
287 # The gitweb files web directory (corresponds to $gitwebfiles)
288 our $webroot = "/home/repo/WWW";
290 # The CGI-enabled web directory (corresponds to $gitweburl and $webadmurl)
291 our $cgiroot = "/home/repo/WWW";
293 # A web-accessible symlink to $reporoot (corresponds to $httppullurl, can be undef)
294 # If using the sample apache.conf (with paths suitably updated) this is not required
295 # to serve either smart or non-smart HTTP repositories to the Git client
296 our $webreporoot = "/home/repo/WWW/r";
299 ## Certificates (only used if $httpspushurl is defined)
301 # path to root certificate (undef to use automatic root cert)
302 # this certificate is made available for easy download and should be whatever
303 # the root certificate is for the https certificate being used by the web server
304 our $rootcert = undef;
306 # The certificate to sign user push client authentication certificates with (undef for auto)
307 # The automatically generated certificate should always be fine
308 our $clientcert = undef;
310 # The private key for $clientcert (undef for auto)
311 # The automatically generated key should always be fine
312 our $clientkey = undef;
314 # The client certificate chain suffix (a pemseq file to append to user client certs) (undef for auto)
315 # The automatically generated chain should always be fine
316 # This suffix will also be appended to the $mobusercert before making it available for download
317 our $clientcertsuffix = undef;
319 # The mob user certificate signed by $clientcert (undef for auto)
320 # The automatically generated certificate should always be fine
321 # Not used unless $mob is set to 'mob'
322 # The $clientcertsuffix will be appended before making $mobusercert available for download
323 our $mobusercert = undef;
325 # The private key for $mobusercert (undef for auto)
326 # The automatically generated key should always be fine
327 # Not used unless $mob is set to 'mob'
328 our $mobuserkey = undef;
330 # The key length for automatically generated RSA private keys (in bits).
331 # These keys are then used to create the automatically generated certificates.
332 # If undef or set to a value less than 2048, then 2048 will be used.
333 # Set to 3072 to generate more secure keys/certificates. Set to 4096 (or higher) for
334 # even greater security. Be warned that setting to a non-multiple of 8 and/or greater
335 # than 4096 could negatively impact compatibility with some clients.
336 # The values 2048, 3072 and 4096 are expected to be compatible with all clients.
337 # Note that OpenSSL has no problem with > 4096 or non-multiple of 8 lengths.
338 # See also the $min_key_length setting above to restrict user key sizes.
339 # This value is also used when generating the ssh_host_rsa_key for the chroot jail sshd.
340 # RECOMMENDED VALUE: 3072
341 our $rsakeylength = undef;
344 ## URL addresses
346 # URL of the gitweb.cgi script (must be in pathinfo mode)
347 # If mod_rewrite is enabled and the sample apache.conf configuration is used
348 # (with paths suitably updated), the trailing "/w" is optional for all browsers
349 # that send a User-Agent string WITHOUT (case insensitively) "git/". Alternatively
350 # a minor change to the sample apache.conf can redirect (301 or 302) URLs without
351 # the "/w" to a URL with it where appropriate.
352 our $gitweburl = "http://repo.or.cz/w";
354 # URL of the extra gitweb files (CSS, .js files, images, ...)
355 our $gitwebfiles = "http://repo.or.cz";
357 # URL of the Girocco CGI web admin interface (Girocco cgi/ subdirectory)
358 our $webadmurl = "http://repo.or.cz";
360 # URL of the Girocco CGI html templater (Girocco cgi/html.cgi)
361 our $htmlurl = "http://repo.or.cz/h";
363 # HTTP URL of the repository collection (undef if N/A)
364 # If mod_rewrite is enabled and the sample apache.conf configuration is used
365 # (with paths suitably updated), the trailing "/r" is optional for Git clients
366 # that send a User-Agent string containing "git/" (case insensitively).
367 our $httppullurl = "http://repo.or.cz/r";
369 # HTTPS push URL of the repository collection (undef if N/A)
370 # If this is defined, the openssl command must be available
371 # The sample apache.conf configuration requires mod_rewrite be enabled to
372 # support https push operations.
373 # Normally this should be set to $httppullurl with http: replaced with https:
374 # If the sample apache.conf configuration is used (with paths suitably updated),
375 # the trailing "/r" is optional for Git clients that send a User-Agent string
376 # containing "git/" (case insensitively).
377 our $httpspushurl = undef;
379 # Git URL of the repository collection (undef if N/A)
380 # (You need to set up git-daemon on your system, and Girocco will not
381 # do this particular thing for you.)
382 our $gitpullurl = "git://repo.or.cz";
384 # Pushy SSH URL of the repository collection (undef if N/A)
385 # Note that the "/$jailreporoot" portion is optional and will be automatically
386 # added if appropriate when omitted by the client so this URL can typically
387 # be made the same as $gitpullurl with git: replaced with ssh:
388 our $pushurl = "ssh://repo.or.cz/$jailreporoot";
390 # URL of gitweb of this Girocco instance (set to undef if you're not nice
391 # to the community)
392 our $giroccourl = "$Girocco::Config::gitweburl/girocco.git";
395 ## Some templating settings
397 # Legal warning (on reguser and regproj pages)
398 our $legalese = <<EOT;
399 <p>By submitting this form, you are confirming that you will mirror or push
400 only what we can store and show to anyone else who can visit this site without
401 breaking any law, and that you will be nice to all small furry animals.
402 <sup><a href="/h/about.html">(more details)</a></sup>
403 </p>
406 # Pre-configured mirror sources (set to undef for none)
407 # Arrayref of name - record pairs, the record has these attributes:
408 # label: The label of this source
409 # url: The template URL; %1, %2, ... will be substituted for inputs
410 # desc: Optional VERY short description
411 # link: Optional URL to make the desc point at
412 # inputs: Arrayref of hashref input records:
413 # label: Label of input record
414 # suffix: Optional suffix
415 # If the inputs arrayref is undef, single URL input is shown,
416 # pre-filled with url (probably empty string).
417 our $mirror_sources = [
419 label => 'Anywhere',
420 url => '',
421 desc => 'Any HTTP/Git/rsync pull URL - bring it on!',
422 inputs => undef
425 label => 'GitHub',
426 url => 'git://github.com/%1/%2.git',
427 desc => 'GitHub Social Code Hosting',
428 link => 'http://github.com/',
429 inputs => [ { label => 'User:' }, { label => 'Project:', suffix => '.git' } ]
432 label => 'Gitorious',
433 url => 'git://gitorious.org/%1/%2.git',
434 desc => 'Green and Orange Boxes',
435 link => 'http://gitorious.org/',
436 inputs => [ { label => 'Project:' }, { label => 'Repository:', suffix => '.git' } ]
440 # You can customize the gitweb interface widely by editing
441 # gitweb/gitweb_config.perl
444 ## Permission settings
446 # Girocco needs some way to manipulate write permissions to various parts of
447 # all repositories; this concerns three entities:
448 # - www-data: the web interface needs to be able to rewrite few files within
449 # the repository
450 # - repo: a user designated for cronjobs; handles mirroring and repacking;
451 # this one is optional if not $mirror
452 # - others: the designated users that are supposed to be able to push; they
453 # may have account either within chroot, or outside of it
455 # There are several ways how to use Girocco based on a combination of the
456 # following settings.
458 # (Non-chroot) UNIX user the CGI scripts run on; note that if some non-related
459 # untrusted CGI scripts run on this account too, that can be a big security
460 # problem and you'll probably need to set up suexec (poor you).
461 # This must always be set.
462 our $cgi_user = 'www-data';
464 # (Non-chroot) UNIX user performing mirroring jobs; this is the user who
465 # should run all the daemons and cronjobs and
466 # the user who should be running make install (if not root).
467 # This must always be set.
468 our $mirror_user = 'repo';
470 # (Non-chroot) UNIX group owning the repositories by default; it owns whole
471 # mirror repositories and at least web-writable metadata of push repositories.
472 # If you undefine this, all the data will become WORLD-WRITABLE.
473 # Both $cgi_user and $mirror_user should be members of this group!
474 our $owning_group = 'repo';
476 # Whether to use chroot jail for pushing; this must be always the same
477 # as $manage_users.
478 # TODO: Gitosis support for $manage_users and not $chrooted?
479 our $chrooted = $manage_users;
481 # How to control permissions of push-writable data in push repositories:
482 # * 'Group' for the traditional model: The $chroot/etc/group project database
483 # file is used as the UNIX group(5) file; the directories have gid appropriate
484 # for the particular repository and are group-writable. This works only if
485 # $chrooted so that users are put in the proper groups on login when using
486 # SSH push. Smart HTTPS push does not require a chroot to work -- simply
487 # run "make install" as the non-root $mirror_user user, but leave
488 # $manage_users and $chrooted enabled.
489 # * 'ACL' for a model based on POSIX ACL: The directories are coupled with ACLs
490 # listing the users with push permissions. This works for both chroot and
491 # non-chroot setups, however it requires ACL support within the filesystem.
492 # This option is BASICALLY UNTESTED, too. And UNIMPLEMENTED. :-)
493 # * 'Hooks' for a relaxed model: The directories are world-writable and push
494 # permission control is purely hook-driven. This is INSECURE and works only
495 # when you trust all your users; on the other hand, the attack vectors are
496 # mostly just DoS or fully-traceable tinkering.
497 our $permission_control = 'Group';
499 # Path to alternate screen multiuser acl file (see screen/README, undef for none)
500 our $screen_acl_file = undef;
503 ## sendmail.pl configuration
505 # Full information on available sendmail.pl settings can be found by running
506 # ../bin/sendmail.pl -v -h
508 # These settings will only used if $sendmail_bin is set to 'sendmail.pl'
510 # sendmail.pl host name
511 #$ENV{'SENDMAIL_PL_HOST'} = 'localhost'; # localhost is the default
513 # sendmail.pl port name
514 #$ENV{'SENDMAIL_PL_PORT'} = '25'; # port 25 is the default
516 # sendmail.pl nc executable
517 #$ENV{'SENDMAIL_PL_NCBIN'} = "$chroot/bin/nc.openbsd"; # default is nc found in $PATH
519 # sendmail.pl nc options
520 # multiple options may be included, e.g. '-4 -X connect -x 192.168.100.10:8080'
521 #$ENV{'SENDMAIL_PL_NCOPT'} = '-4'; # force IPv4, default is to allow IPv4 & IPv6
524 ## Sanity checks & defaults
526 # Couple of sanity checks and default settings (do not change these)
527 use Digest::MD5 qw(md5);
528 use MIME::Base64 qw(encode_base64);
529 $nickname = (split(/[.]/, $name))[0] unless $nickname;
530 our $tmpsuffix = substr(encode_base64(md5($name.':'.$nickname)),0,6);
531 $tmpsuffix =~ tr,+/,=_,;
532 ($mirror_user) or die "Girocco::Config: \$mirror_user must be set even if to current user";
533 ($basedir) or die "Girocco::Config: \$basedir must be set";
534 ($sendmail_bin) or die "Girocco::Config: \$sendmail_bin must be set";
535 $sendmail_bin = "$basedir/bin/sendmail.pl" if $sendmail_bin eq "sendmail.pl";
536 $screen_acl_file = "$basedir/screen/giroccoacl" unless $screen_acl_file;
537 $jailreporoot =~ s,^/+,,;
538 ($reporoot) or die "Girocco::Config \$reporoot must be set";
539 ($jailreporoot) or die "Girocco::Config \$jailreporoot must be set";
540 (not $mob or $mob eq 'mob') or die "Girocco::Config \$mob must be undef (or '') or 'mob'";
541 (not $min_key_length or $min_key_length =~ /^[1-9][0-9]*$/)
542 or die "Girocco::Config \$min_key_length must be undef or numeric";
543 $admincc = $admincc ? 1 : 0;
544 $rootcert = "$certsdir/girocco_root_crt.pem" if $httpspushurl && !$rootcert;
545 $clientcert = "$certsdir/girocco_client_crt.pem" if $httpspushurl && !$clientcert;
546 $clientkey = "$certsdir/girocco_client_key.pem" if $httpspushurl && !$clientkey;
547 $clientcertsuffix = "$certsdir/girocco_client_suffix.pem" if $httpspushurl && !$clientcertsuffix;
548 $mobusercert = "$certsdir/girocco_mob_user_crt.pem" if $httpspushurl && $mob && !$mobusercert;
549 $mobuserkey = "$certsdir/girocco_mob_user_key.pem" if $httpspushurl && $mob && !$mobuserkey;
550 our $mobpushurl = $pushurl;
551 $mobpushurl =~ s,^ssh://,ssh://mob@,i if $mobpushurl;
552 $disable_dsa = 1 unless $pushurl;
553 $disable_dsa = $disable_dsa ? 1 : '';
554 our $httpdnsname = ($gitweburl =~ m,https?://([A-Za-z0-9.-]+),i) ? lc($1) : undef if $gitweburl;
555 our $httpsdnsname = ($httpspushurl =~ m,https://([A-Za-z0-9.-]+),i) ? lc($1) : undef if $httpspushurl;
556 ($mirror or $push) or die "Girocco::Config: neither \$mirror nor \$push is set?!";
557 (not $push or ($pushurl or $httpspushurl or $gitpullurl or $httppullurl)) or die "Girocco::Config: no pull URL is set";
558 (not $push or ($pushurl or $httpspushurl)) or die "Girocco::Config: \$push set but \$pushurl and \$httpspushurl are undef";
559 (not $mirror or $mirror_user) or die "Girocco::Config: \$mirror set but \$mirror_user is undef";
560 ($manage_users == $chrooted) or die "Girocco::Config: \$manage_users and \$chrooted must be set to the same value";
561 (not $chrooted or $permission_control ne 'ACL') or die "Girocco::Config: resolving uids for ACL not supported when using chroot";
562 (grep { $permission_control eq $_ } qw(Group Hooks)) or die "Girocco::Config: \$permission_control must be set to Group or Hooks";
563 ($chrooted or not $mob) or die "Girocco::Config: mob user supported only in the chrooted mode";
564 (not $httpspushurl or $httpsdnsname) or die "Girocco::Config invalid \$httpspushurl does not start with https://domainname";
566 # Make sure Git has a consistent and reproducible environment
568 $ENV{'XDG_CONFIG_HOME'} = $chroot.'/var/empty';
569 $ENV{'HOME'} = $chroot.'/etc/girocco';
570 $ENV{'GIT_CONFIG_NOSYSTEM'} = 1;
571 $ENV{'GIT_ATTR_NOSYSTEM'} = 1;
572 $ENV{'GIT_TERMINAL_PROMPT'} = 0;
573 $ENV{'GIT_ASKPASS'} = 'true';
574 delete $ENV{'GIT_USER_AGENT'};
575 $ENV{'GIT_USER_AGENT'} = $git_client_ua if defined($git_client_ua);