apache.conf.in: use @@certsdir@@ not @@webroot@@/../certs
[girocco.git] / Girocco / Config.pm
blobe6bbe778832b5fdcd35ad2777ac474ec4ce98366
1 package Girocco::Config;
3 use strict;
4 use warnings;
8 ## --------------
9 ## Basic settings
10 ## --------------
13 # Name of the service (typically a single word or a domain name)
14 # (no spaces allowed)
15 our $name = "repo.or.cz";
17 # Nickname of the service (undef for initial part of $name upto first '.')
18 # (no spaces allowed)
19 our $nickname = "rorcz";
21 # Title of the service (as shown in gitweb)
22 # (may contain spaces)
23 our $title = "Public Git Hosting";
25 # Path to the Git binary to use (you MUST set this, even if to /usr/bin/git!)
26 our $git_bin = '/home/repo/bin/git';
28 # Path to the git-daemon binary to use (undef to use default)
29 # If $gitpullurl is undef this will never be used (assuming no git inetd
30 # service has been set up in that case).
31 # The default if this is undef is `$git_bin --exec-path`/git-daemon
32 our $git_daemon_bin = undef;
34 # Path to the git-http-backend binary to use (undef to use default)
35 # If both $httppullurl and $httpspushurl are undef this will never be used
36 # The default if this is undef is `$git_bin --exec-path`/git-http-backend
37 our $git_http_backend_bin = undef;
39 # Name (if in $PATH) or full path to netcat executable that accepts a -U option
40 # to connect to a unix socket. This may simply be 'nc' on many systems.
41 # See the ../src/dragonfly/README file for a DragonFly BSD nc with -U support.
42 # For a Linux-like system try installing the 'netcat-openbsd' package.
43 our $nc_openbsd_bin = 'nc.openbsd';
45 # Path to POSIX sh executable to use. Set to undef to use /bin/sh
46 our $posix_sh_bin = undef;
48 # Path to Perl executable to use. Set to undef to use Perl found in $PATH
49 our $perl_bin = undef;
51 # Path to gzip executable to use. Set to undef to use gzip found in $PATH
52 our $gzip_bin = undef;
54 # Path to the sendmail instance to use. It should understand the -f <from>, -i and -t
55 # options as well as accepting a list of recipient addresses in order to be used here.
56 # You MUST set this, even if to '/usr/sbin/sendmail'!
57 # Setting this to 'sendmail.pl' is special and will automatically be expanded to
58 # a full path to the ../bin/sendmail.pl executable in this Girocco installation.
59 # sendmail.pl is a sendmail-compatible script that delivers the message directly
60 # using SMTP to a mail relay host. This is the recommended configuration as it
61 # minimizes the information exposed to recipients (no sender account names or uids),
62 # can talk to an SMTP server on another host (eliminating the need for a working
63 # sendmail and/or SMTP server on this host) and avoids any unwanted address rewriting.
64 # By default it expects the mail relay to be listening on localhost port 25.
65 # See the sendmail.pl section below for more information on configuring sendmail.pl.
66 our $sendmail_bin = 'sendmail.pl';
68 # E-mail of the site admin
69 our $admin = 'admin@repo.or.cz';
71 # Sender of emails
72 # This is the SMTP 'MAIL FROM:' value
73 # It will be passed to $sendmail_bin with the -f option
74 # Some sites may not allow non-privileged users to pass the -f option to
75 # $sendmail_bin. In that case set this to undef and no -f option will be
76 # passed which means the 'MAIL FROM:' value will be the user the mail is
77 # sent as (either $cgi_user or $mirror_user depending on the activity).
78 # To avoid having bounce emails go to $admin, this may be set to something
79 # else such as 'admin-noreply@example.org' and then the 'admin-noreply' address
80 # may be redirected to /dev/null. Setting this to '' or '<>' is not
81 # recommended because that will likely cause the emails to be marked as SPAM
82 # by the receiver's SPAM filter. If $sendmail_bin is set to 'sendmail.pl' this
83 # value must be acceptable to the receiving SMTP server as a 'MAIL FROM:' value.
84 # If this is set to undef and 'sendmail.pl' is used, the 'MAIL FROM:' value will
85 # be the user the mail is sent as (either $cgi_user or $mirror_user).
86 our $sender = 'admin-noreply@repo.or.cz';
88 # Copy $admin on failure/recovery messages?
89 our $admincc = 0;
91 # Girocco branch to use for html.cgi view source links (undef for HEAD)
92 our $giroccobranch = 'rorcz';
94 # PATH adjustments
95 # If the PATH needs to be customized to find required executables on
96 # the system, it can be done here.
97 # For example something like this:
98 #$ENV{PATH} = substr(`/usr/bin/getconf PATH`,0,-1).":/usr/local/bin";
102 ## ----------------------
103 ## Git user agent strings
104 ## ----------------------
107 # Git clients (i.e. fetch/clone) always send a user agent string when fetching
108 # over HTTP. Since version 1.7.12.1 an 'agent=' capability string is included
109 # as well which affects git:, smart HTTP and ssh: protocols.
111 # These settings allow the default user agent string to be changed independently
112 # for fetch/clone operations (only matters if $mirror is true) and server
113 # operations (some other Git client fetching from us). Note that it is not
114 # possible to suppress the capability entirely although it can be set to an
115 # empty string. If these values are not set, the default user agent string
116 # will be used. Typically (unless Git was built with non-standard options) the
117 # default is "git/" plus the version. So for example "git/1.8.5.6" or
118 # "git/2.1.4" might be seen.
120 # One might want to change the default user agent strings in order to prevent
121 # an attacker from learning the exact Git version being used to avoid being
122 # able to quickly target any version-specific vulnerabilities. Note that
123 # no matter what's set here, an attacker can easily determine whether a server
124 # is running JGit, libgit2 or Git and for Git whether it's version 1.7.12.1 or
125 # later. A reasonable value to hide the exact Git version number while
126 # remaining compatible with servers that require a "Git/" user agent string
127 # would be something like "git/2" or even just "git/".
129 # The GIT_USER_AGENT value to use when acting as a client (i.e. clone/fetch)
130 # This value is only used if $mirror is true and at least one mirror is set up.
131 # Setting this to the empty string will suppress the HTTP User-Agent header,
132 # but will still include an "agent=" capability in the packet protocol. The
133 # empty string is not recommended because some servers match on "git/".
134 # Leave undef to use the default Git user agent string
135 # IMPORTANT: some server sites will refuse to serve up Git repositories unless
136 # the client user agent string contains "Git/" (matched case insensitively)!
137 our $git_client_ua = undef;
139 # The GIT_USER_AGENT value to use when acting as a server (i.e. some Git client
140 # is fetching/cloning from us).
141 # Leave undef to use the default Git user agent string
142 our $git_server_ua = undef;
146 ## -------------
147 ## Feature knobs
148 ## -------------
151 # Enable mirroring mode if true (see "Foreign VCS mirrors" section below)
152 our $mirror = 1;
154 # Enable push mode if true
155 our $push = 1;
157 # If both $mirror and $push are enabled, setting this to 'mirror' pre-selects
158 # mirror mode on the initial regproj display, otherwise 'push' mode will be
159 # pre-selected. When forking the initial mode will be 'push' if $push enabled.
160 our $initial_regproj_mode = 'mirror';
162 # Enable user management if true; this means the interface for registering
163 # user accounts and uploading SSH keys. This implies full chroot.
164 our $manage_users = 1;
166 # Minimum key length (in bits) for uploaded SSH RSA/DSA keys.
167 # If this is not set (i.e. undef) keys as small as 512 bits will be allowed.
168 # Nowadays keys less than 2048 bits in length should probably not be allowed.
169 # Note, however, that versions of OpenSSH starting with 4.3p1 will only generate
170 # DSA keys of exactly 1024 bits in length even though that length is no longer
171 # recommended. (OpenSSL can be used to generate DSA keys with lengths > 1024.)
172 # OpenSSH does not have any problem generating RSA keys longer than 1024 bits.
173 # This setting is only checked when new keys are added so setting it/increasing it
174 # will not affect existing keys. For maximum compatibility a value of 1024 may
175 # be used however 2048 is recommended. Setting it to anything other than 1024,
176 # 2048 or 3072 may have the side effect of making it very difficult to generate
177 # DSA keys that satisfy the restriction (but RSA keys should not be a problem).
178 # Note that no matter what setting is specified here keys smaller than 512 bits
179 # will never be allowed via the reguser.cgi/edituser.cgi interface.
180 # RECOMMENDED VALUE: 2048 (ok) or 3072 (better)
181 our $min_key_length = 2048;
183 # Disable DSA public keys?
184 # If this is set to 1, adding DSA keys at reguser.cgi/edituser.cgi time will be
185 # prohibited. If $pushurl is undef then this is implicitly set to 1 since DSA
186 # keys are not usable with https push.
187 # OpenSSH will only generate 1024 bit DSA keys starting with version 4.3p1.
188 # Even if OpenSSL is used to generate a longer DSA key (which can then be used
189 # with OpenSSH), the SSH protocol itself still forces use of SHA-1 in the DSA
190 # signature blob which tends to defeat the purpose of going to a longer key in
191 # the first place. So it may be better from a security standpoint to simply
192 # disable DSA keys especially if $min_key_length and $rsakeylength have been set
193 # to something higher such as 3072 or 4096. This setting is only checked when
194 # new keys are added so setting it/increasing it will not affect existing keys.
195 # There is no way to disable DSA keys in the OpenSSH server config file itself.
196 # If this is set to 1, no ssh_host_dsa_key will be generated or used with the
197 # sshd running in the jail (but if the sshd_config has already been generated
198 # in the jail, it must be removed and 'sudo make install' run again or otherwise
199 # the sshd_config needs to be edited by hand for the change to take effect).
200 # RECOMMENDED VALUE: 1
201 our $disable_dsa = 1;
203 # Enable the special 'mob' user if set to 'mob'
204 our $mob = "mob";
206 # Let users set admin passwords; if false, all password inputs are assumed empty.
207 # This will make new projects use empty passwords and all operations on them
208 # unrestricted, but you will be able to do no operations on previously created
209 # projects you have set a password on.
210 our $project_passwords = 1;
212 # How to determine project owner; 'email' adds a form item asking for their
213 # email contact, 'source' takes realname of owner of source repository if it
214 # is a local path (and empty string otherwise). 'source' is suitable in case
215 # the site operates only as mirror of purely local-filesystem repositories.
216 our $project_owners = 'email';
218 # Which project fields to make editable, out of 'shortdesc', 'homepage', 'README',
219 # 'cleanmirror', 'notifymail', 'reverseorder', 'summaryonly', 'notifytag' and 'notifyjson'
220 # 'notifycia' was used by the now defunct CIA service and while allowing it to
221 # be edited does work and the value is saved, the value is totally ignored by Girocco
222 our @project_fields = qw(cleanmirror homepage shortdesc README notifymail reverseorder summaryonly notifytag notifyjson);
224 # Minimal number of seconds to pass between two updates of a project.
225 our $min_mirror_interval = 3600; # 1 hour
227 # Minimal number of seconds to pass between two garbage collections of a project.
228 our $min_gc_interval = 604800; # 1 week
230 # Minimal number of seconds to pass after first failure before sending failure email.
231 # A mirror update failed message will not be sent until mirror updates have been
232 # failing for at least this long. Set to 0 to send a failure message right away
233 # (provided the $min_mirror_failure_message_count condition has been met).
234 our $min_mirror_failure_message_interval = 345600; # 4 days
236 # Minimal number of consecutive failures required before sending failure email.
237 # A mirror update failed message will not be sent until mirror updates have failed
238 # for this many consecutive updates. Set to 0 to send a failure message right away
239 # (provided the $min_mirror_failure_message_interval condition has been met).
240 our $min_mirror_failure_message_count = 10;
242 # Maximum window memory size when repacking. If this is set, it will be used
243 # instead of the automatically computed value if it's less than that value.
244 # May use a 'k', 'm', or 'g' suffix otherwise value is in bytes.
245 our $max_gc_window_memory_size = undef;
247 # Maximum big file threshold size when repacking. If this is set, it will be
248 # used instead of the automatically computed value if it's less than that value.
249 # May use a 'k', 'm', or 'g' suffix otherwise value is in bytes.
250 our $max_gc_big_file_threshold_size = undef;
252 # Whether or not to run the ../bin/update-pwd-db script whenever the etc/passwd
253 # database is changed. This is typically needed (i.e. set to a true value) for
254 # FreeBSD style systems when using an sshd chroot jail for push access. So if
255 # $pushurl is undef or the system Girocco is running on is not like FreeBSD
256 # (e.g. a master.passwd file that must be transformed into pwd.db and spwd.db), then
257 # this setting should normally be left false (i.e. 0). See comments in the
258 # provided ../bin/update-pwd-db script about when and how it's invoked.
259 our $update_pwd_db = 0;
261 # Port the sshd running in the jail should listen on
262 # Be sure to update $pushurl to match
263 # Not used if $pushurl is undef
264 our $sshd_jail_port = 22;
266 # If this is true then host names used in mirror source URLs will be checked
267 # and any that are not DNS names (i.e. IPv4 or IPv6) or match one of the DNS
268 # host names in any of the URL settings below will be rejected.
269 our $restrict_mirror_hosts = 1;
271 # If $restrict_mirror_hosts is enabled this is the minimum number of labels
272 # required in a valid dns name. Normally 2 is the correct value, but if
273 # Girocco is being used internally where a common default or search domain
274 # is set for everyone then this should be changed to 1 to allow a dns name
275 # with a single label in it. No matter what is set here at least 1 label
276 # is always required when $restrict_mirror_hosts is enabled.
277 our $min_dns_labels = 2;
279 # If $xmllint_readme is true then the contents of the README.html section
280 # will be passed through xmllint and any errors must be corrected before
281 # it can be saved. If this is set to true then xmllint must be in the $PATH.
282 # RECOMMENDED VALUE: 1
283 our $xmllint_readme = 1;
285 # If defined, pass this value to format-readme as its `-m` option
286 # When format-readme is formatting an automatic readme, it will skip
287 # anything larger than this. The default is 32768 if unset.
288 # See `bin/format-readme -h` for details.
289 our $max_readme_size = 350000;
291 # Maximum size of any single email sent by mail.sh in K (1024-byte) units
292 # If message is larger it will be truncated with a "...e-mail trimmed" line
293 # RECOMMENDED VALUE: 256 - 5120 (.25M - 5M)
294 our $mailsh_sizelimit = 512;
298 ## -------------------
299 ## Foreign VCS mirrors
300 ## -------------------
303 # Note that if any of these settings are changed from true to false, then
304 # any pre-existing mirrors using the now-disabled foreign VCS will stop
305 # updating, new mirrors using the now-disabled foreign VCS will be disallowed
306 # and attempts to update ANY project settings for a pre-existing project that
307 # uses a now-disabled foreign VCS source URL will also be disallowed.
309 # If $mirror is true and $mirror_svn is true then mirrors from svn source
310 # repositories will be allowed (and be converted to Git). These URLs have
311 # the form svn://... or svn+http://... or svn+https://...
312 # Since this functionality makes use of the "git svn" command and is maintained
313 # with Git, it tends to be kept up-to-date and highly usable.
314 # Note that for this to work the "svn" command line command must be available
315 # in PATH and the "git svn" commands must work (which generally requires both
316 # Perl and the subversion perl bindings be installed).
317 # RECOMMENDED VALUE: 1 (if the necessary prerequisites are installed)
318 our $mirror_svn = 1;
320 # Prior to Git v1.5.1, git-svn always used a log window size of 1000.
321 # Starting with Git v1.5.1, git-svn defaults to using a log window size of 100
322 # and provides a --log-window-size= option to change it. Starting with Git
323 # v2.2.0, git-svn disconnects and reconnects to the server every log window size
324 # interval to attempt to reduce memory use by git-svn. If $svn_log_window_size
325 # is undefined, Girocco will use a log window size of 250 (instead of the
326 # the default 100). If $svn_log_window_size is set, Girocco will use that
327 # value instead. Beware that setting it too low (i.e. < 50) will almost
328 # certainly cause performance issues if not failures. Unless there are concerns
329 # about git-svn memory use on a server with extremely limited memory, the
330 # value of 250 that Girocco uses by default should be fine. Obviously if
331 # $mirror or $mirror_svn is false this setting is irrelevant.
332 our $svn_log_window_size = undef;
334 # If $mirror is true and $mirror_darcs is true then mirrors from darcs source
335 # repositories will be allowed (and be converted to Git). These URLs have
336 # the form darcs+http://... darcs+https://... (and deprecated darcs://...)
337 # Note that for this to work the "darcs" command line command must be available
338 # in PATH and so must python (required to run the darcs-fast-export script).
339 # This support depends on items updated separately from Git and which may easily
340 # become out-of-date or incompatible (e.g. new python version).
341 # NOTE: If this is set to 0, the girocco-darcs-fast-export.git
342 # submodule need not be initialized or checked out.
343 # RECOMMENDED VALUE: 0 (unless you have a need to mirror darcs repos)
344 our $mirror_darcs = 0;
346 # If $mirror is true and $mirror_bzr is true then mirrors from bzr source
347 # repositories will be allowed (and be converted to Git). These URLs have
348 # the form bzr://...
349 # Note that for this to work the "bzr" command line command must be available
350 # in PATH (it's a python script so python is required as well).
351 # This support depends on items updated separately from Git and which may easily
352 # become out-of-date or incompatible (e.g. new python version).
353 # RECOMMENDED VALUE: 0 (unless you have a need to mirror bzr repos)
354 our $mirror_bzr = 0;
356 # If $mirror is true and $mirror_hg is true then mirrors from hg source
357 # repositories will be allowed (and be converted to Git). These URLs have
358 # the form hg+http://... or hg+https://...
359 # Note that for this to work the "hg" command line command must be available
360 # in PATH and so must python (required to run the hg-fast-export.py script).
361 # Note that if the PYTHON environment variable is set that will be used instead
362 # of just plain "python" to run the hg-fast-export.py script (which needs to
363 # be able to import from mercurial). Currently the hg-fast-export.py script
364 # used for this feature is likely incompatible with python 3 or later.
365 # Repositories created via this facility may need to be "reset" if the upstream
366 # hg repository moves the tip revision backwards and creates "unnamed heads".
367 # This support depends on items updated separately from Git and which may easily
368 # become out-of-date or incompatible (e.g. new python version).
369 # NOTE: If this is set to 0, the girocco-hg-fast-export.git
370 # submodule need not be initialized or checked out.
371 # RECOMMENDED VALUE: 0 (unless you have a need to mirror hg repos)
372 our $mirror_hg = 0;
376 ## -----
377 ## Paths
378 ## -----
381 # Path where the main chunk of Girocco files will be installed
382 # This will get COMPLETELY OVERWRITTEN by each make install!!!
383 # MUST be an absolute path
384 our $basedir = '/home/repo/repomgr';
386 # Path where the automatically generated non-user certificates will be stored
387 # (The per-user certificates are always stored in $chroot/etc/sshcerts/)
388 # This is preserved by each make install and MUST NOT be under $basedir!
389 # Not used unless $httpspushurl is defined
390 # MUST be an absolute path
391 our $certsdir = '/home/repo/certs';
393 # The repository collection
394 # "$reporoot/_recyclebin" will also be created for use by toolbox/trash-project.pl
395 # MUST be an absolute path
396 our $reporoot = "/srv/git";
398 # The repository collection's location within the chroot jail
399 # Normally $reporoot will be bind mounted onto $chroot/$jailreporoot
400 # Should NOT start with '/'
401 our $jailreporoot = "srv/git";
403 # The chroot for ssh pushing; location for project database and other run-time
404 # data even in non-chroot setups
405 # MUST be an absolute path
406 our $chroot = "/home/repo/j";
408 # An installation that will never run a chrooted sshd should set this
409 # to a true value (e.g. 1) to guarantee that jailsetup for a chrooted
410 # sshd never takes place no matter what user runs `make install`.
411 # Note that the "jailsetup.sh" script will still run to do the database
412 # setup that's stored in $chroot regardless of this setting, it will just
413 # always run in "dbonly" mode when this setting is true.
414 our $disable_jailsetup = 0;
416 # The gitweb files web directory (corresponds to $gitwebfiles)
417 # Note that it is safe to place this under $basedir since it's set up after
418 # $basedir is completely replaced during install time. Be WARNED, however,
419 # that normally the install process only adds/replaces things in $webroot,
420 # but if $webroot is under $basedir then it will be completely removed and
421 # rebuilt each time "make install" is run. This will make gitweb/git-browser
422 # web services very briefly unavailable while this is happening.
423 # MUST be an absolute path
424 our $webroot = "/home/repo/www";
426 # The CGI-enabled web directory (corresponds to $gitweburl and $webadmurl)
427 # This will not be web-accessible except that if any aliases point to
428 # a *.cgi file in here it will be allowed to run as a cgi-script.
429 # Note that it is safe to place this under $basedir since it's set up after
430 # $basedir is completely replaced during install time. Be WARNED, however,
431 # that normally the install process only adds/replaces things in $cgiroot,
432 # but if $cgiroot is under $basedir then it will be completely removed and
433 # rebuilt each time "make install" is run. This will make gitweb/git-browser
434 # web services very briefly unavailable while this is happening.
435 # MUST be an absolute path
436 our $cgiroot = "/home/repo/cgibin";
438 # A web-accessible symlink to $reporoot (corresponds to $httppullurl, can be undef)
439 # If using the sample apache.conf (with paths suitably updated) this is not required
440 # to serve either smart or non-smart HTTP repositories to the Git client
441 # MUST be an absolute path if not undef
442 our $webreporoot = "/home/repo/www/r";
444 # The location to store the project list cache, gitweb project list and gitweb
445 # cache file. Normally this should not be changed. Note that it must be in
446 # a directory that is writable by $mirror_user and $cgi_user (just in case the
447 # cache file is missing). The directory should have its group set to $owning_group.
448 # Again, this setting should not normally need to be changed.
449 # MUST be an absolute path
450 our $projlist_cache_dir = "$chroot/etc";
454 ## ----------------------------------------------------
455 ## Certificates (only used if $httpspushurl is defined)
456 ## ----------------------------------------------------
459 # path to root certificate (undef to use automatic root cert)
460 # this certificate is made available for easy download and should be whatever
461 # the root certificate is for the https certificate being used by the web server
462 our $rootcert = undef;
464 # The certificate to sign user push client authentication certificates with (undef for auto)
465 # The automatically generated certificate should always be fine
466 our $clientcert = undef;
468 # The private key for $clientcert (undef for auto)
469 # The automatically generated key should always be fine
470 our $clientkey = undef;
472 # The client certificate chain suffix (a pemseq file to append to user client certs) (undef for auto)
473 # The automatically generated chain should always be fine
474 # This suffix will also be appended to the $mobusercert before making it available for download
475 our $clientcertsuffix = undef;
477 # The mob user certificate signed by $clientcert (undef for auto)
478 # The automatically generated certificate should always be fine
479 # Not used unless $mob is set to 'mob'
480 # The $clientcertsuffix will be appended before making $mobusercert available for download
481 our $mobusercert = undef;
483 # The private key for $mobusercert (undef for auto)
484 # The automatically generated key should always be fine
485 # Not used unless $mob is set to 'mob'
486 our $mobuserkey = undef;
488 # Server alt names to embed in the auto-generated girocco_www_crt.pem certificate.
489 # The common name (CN) in the server certificate is the host name from $httpspushurl.
490 # By default no server alt names are embedded (not even the host from $httpspushurl).
491 # If the web server configuration is not using this auto-generated server certificate
492 # then the values set here will have no impact and this setting can be ignored.
493 # To embed server alternative names, list each (separated by spaces). The names
494 # may be DNS names, IPv4 addresses or IPv6 addresses (NO surrounding '[' ']' please).
495 # If ANY DNS names are included here be sure to also include the host name from
496 # the $httpspushurl or else standards-conforming clients will fail with a host name
497 # mismatch error when they attempt to verify the connection.
498 #our $wwwcertaltnames = 'example.com www.example.com git.example.com 127.0.0.1 ::1';
499 our $wwwcertaltnames = undef;
501 # The key length for automatically generated RSA private keys (in bits).
502 # These keys are then used to create the automatically generated certificates.
503 # If undef or set to a value less than 2048, then 2048 will be used.
504 # Set to 3072 to generate more secure keys/certificates. Set to 4096 (or higher) for
505 # even greater security. Be warned that setting to a non-multiple of 8 and/or greater
506 # than 4096 could negatively impact compatibility with some clients.
507 # The values 2048, 3072 and 4096 are expected to be compatible with all clients.
508 # Note that OpenSSL has no problem with > 4096 or non-multiple of 8 lengths.
509 # See also the $min_key_length setting above to restrict user key sizes.
510 # This value is also used when generating the ssh_host_rsa_key for the chroot jail sshd.
511 # RECOMMENDED VALUE: 3072
512 our $rsakeylength = undef;
516 ## -------------
517 ## URL addresses
518 ## -------------
521 # URL of the gitweb.cgi script (must be in pathinfo mode). If the sample
522 # apache.conf configuration is used, the trailing "/w" is optional.
523 our $gitweburl = "https://repo.or.cz";
525 # URL of the extra gitweb files (CSS, .js files, images, ...)
526 our $gitwebfiles = "https://repo.or.cz";
528 # URL of the Girocco CGI web admin interface (Girocco cgi/ subdirectory)
529 # e.g. reguser.cgi, edituser.cgi, regproj.cgi, editproj.cgi etc.
530 our $webadmurl = "https://repo.or.cz";
532 # URL of the Girocco CGI bundles information generator (Girocco cgi/bundles.cgi)
533 # If the sample apache.conf configuration is used, the trailing "/b" is optional.
534 # This is different from $httpbundleurl. This URL lists all available bundles
535 # for a project and returns that as an HTML page.
536 our $bundlesurl = "https://repo.or.cz";
538 # URL of the Girocco CGI html templater (Girocco cgi/html.cgi)
539 # If mod_rewrite is enabled and the sample apache.conf configuration is used,
540 # the trailing "/h" is optional when the template file name ends in ".html"
541 # (which all the provided ones do).
542 our $htmlurl = "https://repo.or.cz";
544 # HTTP URL of the repository collection (undef if N/A)
545 # If the sample apache.conf configuration is used, the trailing "/r" is optional.
546 our $httppullurl = "https://repo.or.cz";
548 # HTTP URL of the repository collection when fetching a bundle (undef if N/A)
549 # Normally this will be the same as $httppullurl, but note that the bundle
550 # fetching logic is located in git-http-backend-verify so whatever URL is
551 # given here MUST end up running the git-http-backend-verify script!
552 # For example, if we're fetching the 'clone.bundle' for the 'girocco.git'
553 # repository, the final URL will be "$httpbundleurl/girocco.git/clone.bundle"
554 # If the sample apache.conf configuration is used, the trailing "/r" is optional.
555 # This is different from $bundlesurl. This URL fetches a single Git-format
556 # .bundle file that is only usable with the 'git bundle' command.
557 our $httpbundleurl = "https://repo.or.cz";
559 # HTTPS push URL of the repository collection (undef if N/A)
560 # If this is defined, the openssl command must be available
561 # The sample apache.conf configuration requires mod_ssl, mod_authn_anon and
562 # mod_rewrite be enabled to support https push operations.
563 # Normally this should be set to $httppullurl with http: replaced with https:
564 # If the sample apache.conf configuration is used, the trailing "/r" is optional.
565 our $httpspushurl = "https://repo.or.cz";
567 # Git URL of the repository collection (undef if N/A)
568 # (You need to set up git-daemon on your system, and Girocco will not
569 # do this particular thing for you.)
570 our $gitpullurl = "git://repo.or.cz";
572 # Pushy SSH URL of the repository collection (undef if N/A)
573 # Note that the "/$jailreporoot" portion is optional and will be automatically
574 # added if appropriate when omitted by the client so this URL can typically
575 # be made the same as $gitpullurl with git: replaced with ssh:
576 our $pushurl = "ssh://repo.or.cz";
578 # URL of gitweb of this Girocco instance (set to undef if you're not nice
579 # to the community)
580 our $giroccourl = "$Girocco::Config::gitweburl/girocco.git";
584 ## -------------------
585 ## Web server controls
586 ## -------------------
589 # If true then non-smart HTTP access will be disabled
590 # There's normally no reason to leave non-smart HTTP access enabled
591 # since downloadable bundles are provided. However, in case the
592 # non-smart HTTP access is needed for some reason, this can be set to undef or 0.
593 # This affects access via http: AND https: and processing of apache.conf.in.
594 # Note that this setting does not affect gitweb, ssh: or git: URL access in any way.
595 # RECOMMENDED VALUE: 1
596 our $SmartHTTPOnly = 1;
598 # If true, the https <VirtualHost ...> section in apache.conf.in will be
599 # automatically enabled when it's converted to apache.conf by the conversion
600 # script. Do NOT enable this unless the required Apache modules are present
601 # and loaded (mod_ssl, mod_rewrite, mod_authn_anon) AND $httpspushurl is
602 # defined above otherwise the server will fail to start (with various errors)
603 # when the resulting apache.conf is used.
604 our $TLSHost = 1;
606 # If true, the information about configuring a Git client to trust
607 # a Girocco-generated TLS root will be suppressed presuming that some other
608 # means (such as LetsEncrypt.org) has been used to generate a TLS web
609 # certificate signed by a pre-trusted root. This does NOT affect the
610 # information on how to configure https push certificates as those are still
611 # required in order to push over https regardless of what web server certificate
612 # may be in use.
613 # RECOMMENDED VALUE: 0 (for girocco-generated root & server certificates)
614 # RECOMMENDED VALUE: 1 (for LetsEncrypt etc. generated server certificates)
615 our $pretrustedroot = 1;
619 ## ------------------------
620 ## Some templating settings
621 ## ------------------------
624 # Legal warning (on reguser and regproj pages)
625 our $legalese = <<EOT;
626 <p>By submitting this form, you are confirming that you will mirror or push
627 only free software and redistributing it will not violate any law
628 of Czech Republic.
629 <sup class="sup"><span><a href="/about.html">(more details)</a></span></sup>
630 </p>
633 # Pre-configured mirror sources (set to undef for none)
634 # Arrayref of name - record pairs, the record has these attributes:
635 # label: The label of this source
636 # url: The template URL; %1, %2, ... will be substituted for inputs
637 # desc: Optional VERY short description
638 # link: Optional URL to make the desc point at
639 # inputs: Arrayref of hashref input records:
640 # label: Label of input record
641 # suffix: Optional suffix
642 # If the inputs arrayref is undef, single URL input is shown,
643 # pre-filled with url (probably empty string).
644 our $mirror_sources = [
646 label => 'Anywhere',
647 url => '',
648 desc => 'Any HTTP/Git/rsync pull URL - bring it on!',
649 inputs => undef
652 label => 'GitHub',
653 url => 'https://github.com/%1/%2.git',
654 desc => 'GitHub Social Code Hosting',
655 link => 'https://github.com/',
656 inputs => [ { label => 'User:' }, { label => 'Project:', suffix => '.git' } ]
659 label => 'GitLab',
660 url => 'https://gitlab.com/%1/%2.git',
661 desc => 'Engulfed the Green and Orange Boxes',
662 link => 'https://gitlab.com/',
663 inputs => [ { label => 'Project:' }, { label => 'Repository:', suffix => '.git' } ]
667 # You can customize the gitweb interface widely by editing
668 # gitweb/gitweb_config.perl
672 ## -------------------
673 ## Permission settings
674 ## -------------------
677 # Girocco needs some way to manipulate write permissions to various parts of
678 # all repositories; this concerns three entities:
679 # - www-data: the web interface needs to be able to rewrite few files within
680 # the repository
681 # - repo: a user designated for cronjobs; handles mirroring and repacking;
682 # this one is optional if not $mirror
683 # - others: the designated users that are supposed to be able to push; they
684 # may have account either within chroot, or outside of it
686 # There are several ways how to use Girocco based on a combination of the
687 # following settings.
689 # (Non-chroot) UNIX user the CGI scripts run on; note that if some non-related
690 # untrusted CGI scripts run on this account too, that can be a big security
691 # problem and you'll probably need to set up suexec (poor you).
692 # This must always be set.
693 our $cgi_user = 'www-data';
695 # (Non-chroot) UNIX user performing mirroring jobs; this is the user who
696 # should run all the daemons and cronjobs and
697 # the user who should be running make install (if not root).
698 # This must always be set.
699 our $mirror_user = 'repo';
701 # (Non-chroot) UNIX group owning the repositories by default; it owns whole
702 # mirror repositories and at least web-writable metadata of push repositories.
703 # If you undefine this, all the data will become WORLD-WRITABLE.
704 # Both $cgi_user and $mirror_user should be members of this group!
705 our $owning_group = 'repo';
707 # Whether to use chroot jail for pushing; this must be always the same
708 # as $manage_users.
709 # TODO: Gitosis support for $manage_users and not $chrooted?
710 our $chrooted = $manage_users;
712 # How to control permissions of push-writable data in push repositories:
713 # * 'Group' for the traditional model: The $chroot/etc/group project database
714 # file is used as the UNIX group(5) file; the directories have gid appropriate
715 # for the particular repository and are group-writable. This works only if
716 # $chrooted so that users are put in the proper groups on login when using
717 # SSH push. Smart HTTPS push does not require a chroot to work -- simply
718 # run "make install" as the non-root $mirror_user user, but leave
719 # $manage_users and $chrooted enabled.
720 # * 'ACL' for a model based on POSIX ACL: The directories are coupled with ACLs
721 # listing the users with push permissions. This works for both chroot and
722 # non-chroot setups, however it requires ACL support within the filesystem.
723 # This option is BASICALLY UNTESTED, too. And UNIMPLEMENTED. :-)
724 # * 'Hooks' for a relaxed model: The directories are world-writable and push
725 # permission control is purely hook-driven. This is INSECURE and works only
726 # when you trust all your users; on the other hand, the attack vectors are
727 # mostly just DoS or fully-traceable tinkering.
728 our $permission_control = 'Group';
730 # Path to alternate screen multiuser acl file (see screen/README, undef for none)
731 our $screen_acl_file = undef;
733 # Reserved project name and user name suffixes.
735 # Note that with personal mob branches enabled, a user name can end up being a
736 # file name after having a 'mob.' prefix added or a directory name after having
737 # a 'mob_' prefix added. If there is ANY possibility that a file with a
738 # .suffix name may need to be served by the web server, lc(suffix) SHOULD be in
739 # this hash! Pre-existing project names or user names with a suffix in this
740 # table can continue to be used, but no new projects or users can be created
741 # that have a suffix (case-insensitive) listed here.
742 our %reserved_suffixes = (
743 # Entries must be lowercase WITHOUT a leading '.'
744 bmp => 1,
745 bz2 => 1,
746 cer => 1,
747 cgi => 1,
748 crt => 1,
749 css => 1,
750 dmg => 1,
751 fcgi => 1,
752 gif => 1,
753 gz => 1,
754 htm => 1,
755 html => 1,
756 ico => 1,
757 jp2 => 1,
758 jpeg => 1,
759 jpg => 1,
760 jpg2 => 1,
761 js => 1,
762 pdf => 1,
763 pem => 1,
764 php => 1,
765 png => 1,
766 sig => 1,
767 shtml => 1,
768 svg => 1,
769 svgz => 1,
770 tar => 1,
771 text => 1,
772 tgz => 1,
773 tif => 1,
774 tiff => 1,
775 txt => 1,
776 xbm => 1,
777 xht => 1,
778 xhtml => 1,
779 xz => 1,
780 zip => 1,
785 ## -------------------------
786 ## sendmail.pl configuration
787 ## -------------------------
790 # Full information on available sendmail.pl settings can be found by running
791 # ../bin/sendmail.pl -v -h
793 # These settings will only be used if $sendmail_bin is set to 'sendmail.pl'
795 # sendmail.pl host name
796 #$ENV{'SENDMAIL_PL_HOST'} = 'localhost'; # localhost is the default
798 # sendmail.pl port name
799 #$ENV{'SENDMAIL_PL_PORT'} = '25'; # port 25 is the default
801 # sendmail.pl nc executable
802 #$ENV{'SENDMAIL_PL_NCBIN'} = "$chroot/bin/nc.openbsd"; # default is nc found in $PATH
804 # sendmail.pl nc options
805 # multiple options may be included, e.g. '-4 -X connect -x 192.168.100.10:8080'
806 #$ENV{'SENDMAIL_PL_NCOPT'} = '-4'; # force IPv4, default is to allow IPv4 & IPv6
810 ## -------------------------
811 ## Obscure Tuneable Features
812 ## -------------------------
815 # Throttle classes configured here override the defaults for them that
816 # are located in taskd/taskd.pl. See comments in that file for more info.
817 our @throttle_classes = ();
819 # Any tag names listed here will be allowed even if they would otherwise not be.
820 # Note that @allowed_tags takes precedence over @blocked_tags.
821 our @allowed_tags = (qw( ));
823 # Any tag names listed here will be disallowed in addition to the standard
824 # list of nonsense words etc. that are blocked as tags.
825 our @blocked_tags = (qw( ));
827 # Case folding tags
828 # If this setting is true, then tags that differ only in case will always use
829 # the same-cased version. If this setting is enabled and the tag is present in
830 # @allowed_tags (or the embedded white list in Util.pm) then the case of the
831 # tag will match the white list entry otherwise it will be all lowercased.
832 # If this setting is disabled (false) tags are used with their case left as-is.
833 # RECOMMENDED VALUE: 1 (true)
834 our $foldtags = 1;
836 # If there are no more than this many objects, then all deltas will be
837 # recomputed when gc takes place. Note that this does not affect any
838 # fast-import created packs as they ALWAYS have their deltas recomputed.
839 # Also when combining small packs, if the total object count in the packs
840 # to be combined is no more than this then the new, combined pack will have
841 # its deltas recomputed during the combine operation.
842 # Leave undef to use the default (which should generally be fine).
843 # Lowering this from the default can increase disk use.
844 # Values less than 1000 * number of CPU cores will be silently ignored.
845 # The "girocco.redelta" config item can be used to modify this behavior on
846 # a per-repository basis. See the description of it in gc.sh.
847 our $new_delta_threshold = undef;
849 # This setting is irrelevant unless foreign vcs mirrors that use git fast-import
850 # are enabled (e.g. $mirror_darcs, $mirror_bzr or $mirror_hg -- $mirror_svn does
851 # NOT use git fast-import and is not affected by this setting).
852 # The packs generated by git fast-import are very poor quality. For this reason
853 # they ALWAYS have their deltas recomputed at some point. Normally this is
854 # delayed until the next full (or mini) gc takes place. For this reason a full
855 # gc is always scheduled immediately after a fresh mirror clone completes.
856 # However, in the case of normal mirror updates, several git fast-import created
857 # packs may exist as a result of changes fetched during the normal mirror update
858 # process. These packs will persist (with their git fast-import poor quality)
859 # until the next full (or mini) gc triggers. The bad deltas in these update
860 # packs could be sent down to clients who fetch updates before the next gc
861 # triggers. To reduce (i.e. practically eliminate) the likelihood of this
862 # occurring, this setting can be changed to a false (0 or undef) value in which
863 # case after each mirror update of a git fast-import mirror, any newly created
864 # git fast-import packs (as a result of the mirror update running) will have
865 # their deltas recomputed shortly thereafter instead of waiting for the next gc.
866 # Recomputing deltas immediately (almost immediately) will result in an extra
867 # redeltification step (with associated CPU cost) that would otherwise not
868 # occur and, in some cases (mainly large repositories), could ultimately result
869 # in slightly less efficient deltas being retained.
870 # RECOMMENDED VALUE: 1
871 our $delay_gfi_redelta = 1;
873 # If this is set to a true value, then core.packedGitWindowSize will be set
874 # to 1 MiB (the same as if Git was compiled with NO_MMAP set). If this is NOT
875 # set, core.packedGitWindowSize will be set to 32 MiB (even on 64-bit) to avoid
876 # memory blowout. If your Git was built with NO_MMAP set and will not work
877 # without NO_MMAP set, you MUST set this to a true value!
878 our $git_no_mmap = undef;
880 # If set to a true value, the "X-Girocco: $gitweburl" header included in all
881 # Girocco-generated emails will be suppressed.
882 our $suppress_x_girocco = undef;
884 # Number of days to keep reflogs around
885 # May be set to a value between 1 and 30 (inclusive)
886 # The default of one day should normally suffice unless there's a need to
887 # support a "Where's the undo? WHERE IS THE UNDO?!!!" option ;)
888 our $reflogs_lifetime = 7;
890 # The pack.window size to use with git upload-pack
891 # When Git is creating a pack to send down to a client, if it needs to send
892 # down objects that are deltas against objects it is not sending and that it
893 # does not know the client already has, it must undelta and recompute deltas
894 # for those objects. This is the remote's "Compressing objects" phase the
895 # client sees during a fetch or clone. If this value is unset, the normal
896 # Git default of 10 will be used for the window size during these operations.
897 # This value may be set to a number between 2 and 50 inclusive to change the
898 # window size during upload pack operations. A window size of 2 provides the
899 # fastest response at the expense of less efficient deltas for the objects
900 # being recompressed (meaning more data to send to the client). A window
901 # size of 5 typically reduces the compression time by almost half and is
902 # usually nearly as fast as a window size of 2 while providing better deltas.
903 # A window size of 50 will increase the time spent in the "Compressing objects"
904 # phase by as much as 5 times but will produce deltas similar to those that
905 # Girocco generates when it performs garbage collection.
906 # RECOMMENDED VALUE: undef or 5
907 our $upload_pack_window = 5;
909 # If this is true then remote fetching of refs/stash and refs/tgstash will
910 # be allowed. Git does not allow single-level ref names to be pushed so the
911 # only way they could get in there is if a linked working tree (or, gasp, a
912 # non-bare Girocco repository) created them or they arrived via a non-clean
913 # mirror fetch. The client almost certainly does not want to see them.
914 # Unless this config item is true they will also be left out of the bundle too.
915 # Since both stash and tgstash are used with their ref logs and there's no way
916 # for a remote to fetch ref logs, the "log --walk-reflogs" feature could not be
917 # used with them by a remote that fetched them anyway.
919 # NOTE: The reason this doesn't just control all single-level refs is that the
920 # "hideRefs" configuration mechanism isn't flexible enough to hide all
921 # single-level refs without knowing their names. In addition, it hides the
922 # entire refs hierarchy so refs/stash/foo will also be hidden along with
923 # refs/stash, but Git doesn't actually support ref names that introduce a
924 # directory/file confict (aka D/F conflict) and "refs/stash" represents an
925 # official Git ref name therefore any refs/stash/... names really aren't
926 # allowed in the first place so it's no problem if they're incidentally hidden
927 # along with refs/stash itself.
929 # NOTE: Git 1.8.2 or later is required to actually hide the refs from fetchers
930 # over the "git:" protocol and Git 2.3.5 or later is required to properly hide
931 # them over the smart "http:" protocol (Girocco will not attempt to "hide" them
932 # on a smart HTTP fetch if Git is < 2.3.5 to avoid Git bugs.) They will never
933 # be hidden via the non-smart HTTP fetch or any other non-smart protocols that
934 # also make use of the $gitdir/info/refs file as they are not excluded from it.
935 # Nor will they be hidden when accessed via any non-Girocco mechanism.
936 # They will, however, always be excluded from the primary (aka .bitmap) pack
937 # and bundle no matter what version of Git is used unless this is set to a
938 # true value. It's only the server's Git version that matters when hiding refs.
940 # RECOMMENDED VALUE: undef or 0
941 our $fetch_stash_refs = undef;
943 # When set to a true value, Girocco will attempt to pick up ref changes made
944 # outside of Girocco itself and process them using the usual Girocco
945 # notification mechanism. Git lacks any "post-ref-change" hook capability that
946 # could facilitate this. This feature is primarily intended to detect running
947 # of "git fetch" in linked working trees of a Girocco repository. In many
948 # cases after running a command Git runs "git gc --auto". With the correct
949 # encouragement we can always induce Git to run our pre-auto-gc hook at that
950 # time. "git fetch" invokes "git gc --auto" after the fetch. Girocco needs
951 # to do additional maintenance to make this work properly so do not enable this
952 # unless it's really needed. Additionally, there are a number of commands
953 # (such as "git commit") that do not invoke "git gc --auto". Even with this
954 # enabled, additional hooks for post-rewrite and post-checkout
955 # would really be needed to catch more things and even then there are some
956 # Git commands that would never be caught ("git filter-branch",
957 # "git update-ref", "git reset", etc.) so this is hardly a complete solution.
958 # But it WILL catch "git fetch" changes although the hashes it uses for the
959 # "old" ref values may not be all that recent, the new ref values will be.
960 # When this is false, the hack is completely disabled.
961 # When this is true, the hack is enabled by default for all repositories,
962 # but can be controlled on an individual repository basis by setting the
963 # girocco.autogchack value explicitly to true (enable) or false (disable).
964 # If this is set to the special value "mirror" then it will behave as true
965 # for mirrors and false for non-mirrors thereby completely eliminating any
966 # overhead for push projects but detecting external "git fetch"s for mirrors.
967 # If this is enabled for a project, any third party script/tool can trigger
968 # the Girocco ref notification mechanism simply by making a ref change and
969 # then running "git gc --auto --quiet" on the project. In a capitulation to
970 # use of linked working trees, Girocco installs a post-commit hook that will
971 # trigger these notifications as well when this is enabled.
972 our $autogchack = 0;
974 # When set to a true value the initial setting for core.hooksPath will point
975 # to the repository's own hooks directory instead of $reporoot/_global/hooks.
976 # Due to the unfortunate implementation of core.hooksPath, Girocco must always
977 # ensure the value gets set in each repository's config file. Normally it
978 # just sets it to $reporoot/_global/hooks and that's that. However, the
979 # update-all-config script will also tolerate it pointing at the repository's
980 # own hooks directory -- Girocco maintains symbolic links in there to the
981 # global hooks to make sure they get run when using older versions of Git;
982 # therefore that setting is basically equivalent. The difference is that
983 # repository-specific hooks can be added when hooksPath is pointing at the
984 # repository's hooks directory but not when it's pointing at _global/hooks.
985 # A repository's setting can be changed manually (and it will stick), but
986 # sometimes it may be desirable to always just default to pointing at the
987 # repository's own hooks directory from the start. Perhaps linked working
988 # trees will be in use and software that needs to set repository-specific hooks
989 # will be in use. If $autogchack has been set to true this may very likely be
990 # the case.
991 our $localhooks = 0;
993 # If this is set to a true value changes to single-level refs (e.g. refs/stash)
994 # will be passed through to the notification machinery.
995 # Usually this is NOT wanted, especially when linked working trees are being
996 # used with the repository.
997 # However, in the unlikely event that changes to such ref names should NOT be
998 # ignored, this value may be set to any true value.
999 # RECOMMENDED VALUE: 0
1000 our $notify_single_level = 0;
1002 # If this is set to a non-empty value it will become the default value for
1003 # all repositories' girocco.notifyHook value.
1004 # Whenever taskd.pl receives a batch of ref changes for processing, it first
1005 # sends them off to any configured "girocco.notifyHook" (same semantics as
1006 # a post-receive hook except it also gets four command-line arguments like
1007 # so: cat ref-changes | notifyhook $projname $user $linecount $contextlinecount
1008 # There is no default notify hook, but each repository may set its own by
1009 # setting the `girocco.notifyHook` config value which will be eval'd by the
1010 # shell (like $GIT_EDITOR is) with the current directory set to the
1011 # repository's git-dir and the changes on standard input.
1012 # Note that normal notification processing does not take place until after
1013 # this command (if it's not null) gets run (regardless of its result code).
1014 our $default_notifyhook = undef;
1016 # UNIX group owning the repositories' htmlcache subdirectory
1017 # If not defined defaults to $owning_group
1018 # If gitweb access is provided but only on a read-only basis, then setting
1019 # this to a group to which Both $cgi_user and $mirror_user belong will still
1020 # allow summary page caching.
1021 # $mirror_user should always belong to this group
1022 our $htmlcache_owning_group = undef;
1024 # UNIX group owning the repositories' ctags subdirectory
1025 # If not defined defaults to $owning_group
1026 # If gitweb access is provided but only on a read-only basis, then setting
1027 # this to a group to which Both $cgi_user and $mirror_user belong will still
1028 # allow tags to be added to the repository in gitweb (provided that feature
1029 # is enabled in gitweb/gitweb_config.perl).
1030 # $mirror_user should always belong to this group
1031 our $ctags_owning_group = undef;
1033 # When using pack bitmaps and computing data to send to clients over a fetch,
1034 # having pack.writeBitmapHashCache set to true produces better deltas (thereby
1035 # potentially reducing the amount of data that needs to be sent). However,
1036 # JGit does not understand this extra data, so if JGit needs to use the bitmaps
1037 # generated when Girocco runs Git, this setting needs to be set to a true value
1038 # so that the hash cache is excluded when Git generates the bitmaps thereby
1039 # making them compatible with JGit.
1040 # Note that changes to this setting will not take effect until the next time
1041 # gc is scheduled to run on a project and then only if gc actually takes place.
1042 # Use the $basedir/toolbox/make-all-gc-eligible.sh script to force all projects
1043 # to actually do a gc the next time they are scheduled for one.
1044 # RECOMMENDED VALUE: undef or 0
1045 our $jgit_compatible_bitmaps = 0;
1047 # Set the default value of receive.maxInputSize
1048 # This is only effective for receives (aka an incoming push) and causes the
1049 # push to abort if the incoming pack (which is generally thin and does not
1050 # have any index) exceeds this many bytes in size (a 'k', 'm' or 'g' suffix
1051 # may be used on the value). If undef or set to 0 there is no limit. This
1052 # limit is only effective when Girocco is running Git v2.11.0 or later.
1053 our $max_receive_size = undef;
1055 # Suppress git: and ssh: log messages
1056 # Access via http: and/or https: provides logging of the project being
1057 # cloned/fetched/pushed to. There is normally no such logging for access
1058 # via ssh: and/or git: protocols. However, Girocco intercepts those
1059 # accesses to perform sanity and permision checks and also logs the request
1060 # to the system log at that time. By setting this value to any true
1061 # value, that logging of git: and ssh: git activity will be suppressed.
1062 # RECOMMENDED VALUE: 0
1063 our $suppress_git_ssh_logging = 0;
1065 # Select the sshd to be installed into the chroot
1066 # If set this MUST be an absolute path
1067 # Ignored unless a chroot is actually being created
1068 # Leaving this undef will find sshd in "standard" system locations and
1069 # is the recommended value. Only set this if you need to override the
1070 # "standard" sshd for some reason.
1071 # RECOMMENDED VALUE: undef
1072 our $sshd_bin = undef;
1076 ## ------------------------
1077 ## Sanity checks & defaults
1078 ## ------------------------
1080 # Changing anything in this section can result in unexpected breakage
1082 # Couple of sanity checks and default settings (do not change these)
1083 use Digest::MD5 qw(md5);
1084 use MIME::Base64 qw(encode_base64);
1085 $name =~ s/\s+/_/gs;
1086 $nickname = lc((split(/[.]/, $name))[0]) unless $nickname;
1087 $nickname =~ s/\s+/_/gs;
1088 our $tmpsuffix = substr(encode_base64(md5($name.':'.$nickname)),0,6);
1089 $tmpsuffix =~ tr,+/,=_,;
1090 ($mirror_user) or die "Girocco::Config: \$mirror_user must be set even if to current user";
1091 ($basedir) or die "Girocco::Config: \$basedir must be set";
1092 ($sendmail_bin) or die "Girocco::Config: \$sendmail_bin must be set";
1093 $sendmail_bin = "$basedir/bin/sendmail.pl" if $sendmail_bin eq "sendmail.pl";
1094 $screen_acl_file = "$basedir/screen/giroccoacl" unless $screen_acl_file;
1095 $jailreporoot =~ s,^/+,,;
1096 ($reporoot) or die "Girocco::Config \$reporoot must be set";
1097 ($jailreporoot) or die "Girocco::Config \$jailreporoot must be set";
1098 $disable_jailsetup = $disable_jailsetup ? 1 : '';
1099 $notify_single_level = $notify_single_level ? 1 : '';
1100 $fetch_stash_refs = $fetch_stash_refs ? 1 : '';
1101 (not $mob or $mob eq 'mob') or die "Girocco::Config \$mob must be undef (or '') or 'mob'";
1102 (not $min_key_length or $min_key_length =~ /^[1-9][0-9]*$/)
1103 or die "Girocco::Config \$min_key_length must be undef or numeric";
1104 (! defined $max_readme_size || $max_readme_size =~ /^[0-9]+$/)
1105 or die "Girocco::Config \$max_readme_size must be a whole number";
1106 (defined $mailsh_sizelimit and $mailsh_sizelimit =~ /^[1-9][0-9]*$/)
1107 or die "Girocco::Config \$mailsh_sizelimit must be a positive number";
1108 $admincc = $admincc ? 1 : 0;
1109 $rootcert = "$certsdir/girocco_root_crt.pem" if $httpspushurl && !$rootcert;
1110 $clientcert = "$certsdir/girocco_client_crt.pem" if $httpspushurl && !$clientcert;
1111 $clientkey = "$certsdir/girocco_client_key.pem" if $httpspushurl && !$clientkey;
1112 $clientcertsuffix = "$certsdir/girocco_client_suffix.pem" if $httpspushurl && !$clientcertsuffix;
1113 $mobusercert = "$certsdir/girocco_mob_user_crt.pem" if $httpspushurl && $mob && !$mobusercert;
1114 $mobuserkey = "$certsdir/girocco_mob_user_key.pem" if $httpspushurl && $mob && !$mobuserkey;
1115 our $mobpushurl = $pushurl;
1116 $mobpushurl =~ s,^ssh://,ssh://mob@,i if $mobpushurl;
1117 $disable_dsa = 1 unless $pushurl;
1118 $disable_dsa = $disable_dsa ? 1 : '';
1119 our $httpdnsname = ($gitweburl =~ m,https?://([A-Za-z0-9.-]+),i) ? lc($1) : undef if $gitweburl;
1120 our $httpsdnsname = ($httpspushurl =~ m,https://([A-Za-z0-9.-]+),i) ? lc($1) : undef if $httpspushurl;
1121 $SmartHTTPOnly = $SmartHTTPOnly ? 1 : '';
1122 $TLSHost = $TLSHost ? 1 : '';
1123 $pretrustedroot = $pretrustedroot ? 1 : '';
1124 $suppress_git_ssh_logging = $suppress_git_ssh_logging ? 1 : '';
1125 ($mirror or $push) or die "Girocco::Config: neither \$mirror nor \$push is set?!";
1126 (not $push or ($pushurl or $httpspushurl or $gitpullurl or $httppullurl)) or die "Girocco::Config: no pull URL is set";
1127 (not $push or ($pushurl or $httpspushurl)) or die "Girocco::Config: \$push set but \$pushurl and \$httpspushurl are undef";
1128 (not $mirror or $mirror_user) or die "Girocco::Config: \$mirror set but \$mirror_user is undef";
1129 ($manage_users == $chrooted) or die "Girocco::Config: \$manage_users and \$chrooted must be set to the same value";
1130 (not $chrooted or $permission_control ne 'ACL') or die "Girocco::Config: resolving uids for ACL not supported when using chroot";
1131 (grep { $permission_control eq $_ } qw(Group Hooks)) or die "Girocco::Config: \$permission_control must be set to Group or Hooks";
1132 ($chrooted or not $mob) or die "Girocco::Config: mob user supported only in the chrooted mode";
1133 (not $httpspushurl or $httpsdnsname) or die "Girocco::Config invalid \$httpspushurl does not start with https://domainname";
1134 (not $svn_log_window_size or $svn_log_window_size =~ /^[1-9][0-9]*$/)
1135 or die "Girocco::Config \$svn_log_window_size must be undef or numeric";
1136 (not $posix_sh_bin or $posix_sh_bin !~ /\s/) or die "Girocco::Config: \$posix_sh_bin must not contain any whitespace";
1137 (not $perl_bin or $perl_bin !~ /\s/) or die "Girocco::Config: \$perl_bin must not contain any whitespace";
1138 !$delay_gfi_redelta and $delay_gfi_redelta = undef;
1139 !$git_no_mmap and $git_no_mmap = undef;
1140 !$suppress_x_girocco and $suppress_x_girocco = undef;
1141 !$jgit_compatible_bitmaps and $jgit_compatible_bitmaps = undef;
1142 !$autogchack and $autogchack = undef;
1143 (not $reflogs_lifetime or $reflogs_lifetime !~ /^[1-9][0-9]*$/) and $reflogs_lifetime = 1;
1144 $reflogs_lifetime = 0 + $reflogs_lifetime;
1145 $reflogs_lifetime >= 0 or $reflogs_lifetime = 1;
1146 $reflogs_lifetime <= 30 or $reflogs_lifetime = 30;
1147 (not defined $upload_pack_window or $upload_pack_window =~ /^[1-9][0-9]*$/)
1148 or die "Girocco::Config \$upload_pack_window must be undef or numeric";
1149 (not defined $upload_pack_window or $upload_pack_window >= 2 && $upload_pack_window <= 50)
1150 or die "Girocco::Config \$upload_pack_window must be in range 2..50";
1151 (not defined $max_receive_size or $max_receive_size =~ /^\d+[kKmMgG]?$/)
1152 or die "Girocco::Config \$max_receive_size setting is invalid";
1153 defined($ENV{'SENDMAIL_PL_HOST'}) and our $sendmail_pl_host = $ENV{'SENDMAIL_PL_HOST'};
1154 defined($ENV{'SENDMAIL_PL_PORT'}) and our $sendmail_pl_port = $ENV{'SENDMAIL_PL_PORT'};
1155 defined($ENV{'SENDMAIL_PL_NCBIN'}) and our $sendmail_pl_ncbin = $ENV{'SENDMAIL_PL_NCBIN'};
1156 defined($ENV{'SENDMAIL_PL_NCOPT'}) and our $sendmail_pl_ncopt = $ENV{'SENDMAIL_PL_NCOPT'};
1157 defined($ENV{'PYTHON'}) and our $python = $ENV{'PYTHON'};
1158 my $op; BEGIN {$op = $ENV{'PATH'}}
1159 defined($op) && defined($ENV{'PATH'}) && $op ne $ENV{'PATH'} and our $path=$ENV{'PATH'};
1161 # jailreporoot MUST NOT be absolute
1162 defined($jailreporoot) && substr($jailreporoot, 0, 1) ne "/" or
1163 die "\$jailreporoot MUST NOT be an absolute path\n";
1165 # webreporoot can be undef
1166 !defined($webreporoot) || substr($webreporoot, 0, 1) eq "/" or
1167 die "\$webreporoot MUST be an absolute path if not undef\n";
1169 # All these MUST be absolute paths
1171 no strict 'refs';
1172 defined(${$_}) && substr(${$_}, 0, 1) eq "/" or
1173 die "\$$_ MUST be an absolute path\n"
1174 foreach qw(basedir certsdir reporoot chroot webroot cgiroot projlist_cache_dir);
1177 # Make sure Git has a consistent and reproducible environment
1179 $ENV{'XDG_CONFIG_HOME'} = $chroot.'/var/empty';
1180 $ENV{'HOME'} = $chroot.'/etc/girocco';
1181 $ENV{'TMPDIR'} = '/tmp';
1182 $ENV{'GIT_CONFIG_NOSYSTEM'} = 1;
1183 $ENV{'GIT_ATTR_NOSYSTEM'} = 1;
1184 $ENV{'GIT_NO_REPLACE_OBJECTS'} = 1;
1185 $ENV{'GIT_TERMINAL_PROMPT'} = 0;
1186 $ENV{'GIT_ASKPASS'} = $basedir.'/bin/git-askpass-password';
1187 delete $ENV{'GIT_USER_AGENT'};
1188 $ENV{'GIT_USER_AGENT'} = $git_client_ua if defined($git_client_ua);
1189 delete $ENV{'GIT_HTTP_USER_AGENT'};
1190 delete $ENV{'GIT_CONFIG_PARAMETERS'};
1191 delete $ENV{'GIT_ALTERNATE_OBJECT_DIRECTORIES'};
1192 delete $ENV{'GIT_CONFIG'};
1193 delete $ENV{'GIT_DIR'};
1194 delete $ENV{'GIT_GRAFT_FILE'};
1195 delete $ENV{'GIT_INDEX_FILE'};
1196 delete $ENV{'GIT_OBJECT_DIRECTORY'};
1197 delete $ENV{'GIT_NAMESPACE'};
1199 # Guarantee a sane umask for Girocco
1201 umask(umask() & ~0770);