The Bugzilla Guide - 2.18 Release
Prev | Chapter 2. Installing Bugzilla | Next

# 2.2. Configuration

| Poorly-configured MySQL and Bugzilla installations have given attackers full access to systems in the past. Please take the security parts of these guidelines seriously, even for Bugzilla machines hidden away behind your firewall. Be certain to read Chapter 4 for some important security tips.

## 2.2.1. localconfig

Once you run `checksetup.pl` with all the correct modules installed, it displays a message about, and write out a file called, `localconfig`. This file contains the default settings for a number of Bugzilla parameters.

Load this file in your editor. The only value you need to change is $db_pass, the password for the user you will create for your database. Pick a strong password (for simplicity, it should not contain single quote characters) and put it here.

The other options in the `localconfig` file are documented by their accompanying comments. If you have a slightly non-standard MySQL setup, you may wish to change one or more of the other "$db_*" parameters.

You may also wish to change the names of the priorities, severities, operating systems and platforms for your installation. However, you can always change these after installation has finished; if you then re-run `checksetup.pl`, the changes will get picked up.

## 2.2.2. MySQL

| MySQL's default configuration is very insecure. Section 4.2 has some good information for improving your installation's security.

### 2.2.2.1. Allow large attachments

By default, MySQL will only accept packets up to 64Kb in size. If you want to have attachments larger than this, you will need to modify your `/etc/my.cnf` as below.

If you are using MySQL 4.0 or newer, enter:

      [mysqld]
      # Allow packets up to 1M
      max_allowed_packet=1M

If you are using an older version of MySQL, enter:

      [mysqld]
      # Allow packets up to 1M
      set-variable = max_allowed_packet=1M

There is also a parameter in Bugzilla called 'maxattachmentsize' (default = 1000 Kb) that controls the maximum allowable attachment size. Attachments larger than either the 'max_allowed_packet' or 'maxattachmentsize' value will not be accepted by Bugzilla.

### 2.2.2.2. Allow small words in full-text indexes

By default, words must be at least four characters in length in order to be indexed by MySQL's full-text indexes. This causes a lot of Bugzilla specific words to be missed, including "cc", "ftp" and "uri".

MySQL can be configured to index those words by setting the ft_min_word_len param to the minimum size of the words to index. This can be done by modifying the `/etc/my.cnf` according to the example below:

      [mysqld]
      # Allow small words in full-text indexes
      ft_min_word_len=2

Rebuilding the indexes can be done based on documentation found at http://www.mysql.com/doc/en/Fulltext_Fine-tuning.html.

| The ft_min_word_len parameter is only suported in MySQL v4 or higher.

### 2.2.2.3. Permit attachments table to grow beyond 4GB

By default, MySQL will limit the size of a table to 4GB. This limit is present even if the underlying filesystem has no such limit. To set a higher limit, follow these instructions.

Run the `MySQL` command-line client and enter:

      mysql> ALTER TABLE attachments
              AVG_ROW_LENGTH=1000000, MAX_ROWS=20000;

The above command will change the limit to 20GB. Mysql will have to make a temporary copy of your entire table to do this. Ideally, you should do this when your attachments table is still small.

### 2.2.2.4. Add a user to MySQL

You need to add a new MySQL user for Bugzilla to use. (It's not safe to have Bugzilla use the MySQL root account.) The following instructions assume the defaults in `localconfig`; if you changed those, you need to modify the SQL command appropriately. You will need the $db_pass password you set in `localconfig` in Section 2.2.1.

We use an SQL GRANT command to create a "bugs" user. This also restricts the "bugs"user to operations within a database called "bugs", and only allows the account to connect from "localhost". Modify it to reflect your setup if you will be connecting from another machine or as a different user.

Run the `mysql` command-line client.

If you are using MySQL 4.0 or newer, enter:

      mysql> GRANT SELECT, INSERT,
             UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
             CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
             TO bugs@localhost IDENTIFIED BY '$db_pass';
      mysql> FLUSH PRIVILEGES;

If you are using an older version of MySQL,the `LOCK TABLES` and `CREATE TEMPORARY TABLES` permissions will be unavailable and should be removed from the permissions list. In this case, the following command line can be used:

      mysql> GRANT SELECT, INSERT,
             UPDATE, DELETE, INDEX, ALTER, CREATE, DROP,
             REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY
             '$db_pass';
      mysql> FLUSH PRIVILEGES;

## 2.2.3. checksetup.pl

Next, rerun `checksetup.pl`. It reconfirms that all the modules are present, and notices the altered localconfig file, which it assumes you have edited to your satisfaction. It compiles the UI templates, connects to the database using the 'bugs' user you created and the password you defined, and creates the 'bugs' database and the tables therein.

After that, it asks for details of an administrator account. Bugzilla can have multiple administrators - you can create more later - but it needs one to start off with. Enter the email address of an administrator, his or her full name, and a suitable Bugzilla password.

`checksetup.pl` will then finish. You may rerun `checksetup.pl` at any time if you wish.

## 2.2.4. Web server

Configure your web server according to the instructions in the appropriate section. The Bugzilla Team recommends Apache. No matter what webserver you choose, make sure that sensitive information is not remotely available by ensuring that the access controls in Section 4.3.1 are properly applied.

### 2.2.4.1. Apache httpd

Load `httpd.conf` in your editor.

Uncomment (or add) the following line. This configures Apache to run .cgi files outside the `cgi-bin` directory.

      AddHandler cgi-script .cgi

Apache uses `<Directory>` directives to permit fine-grained permission setting. Add the following two lines to a `<Directory>` directive that applies either to the Bugzilla directory or one of its parents (e.g. the `<Directory /var/www/html>` directive). This allows Bugzilla's `.htaccess` files to override global permissions, and allows .cgi files to run in the Bugzilla directory.

      Options +ExecCGI +FollowSymLinks
      AllowOverride Limit

Add `index.cgi` to the end of the `DirectoryIndex` line.

`checksetup.pl` can set tighter permissions on Bugzilla's files and directories if it knows what group the webserver runs as. Look for the `Group` line in `httpd.conf`, and place that value in the $webservergroup variable in `localconfig`. Then rerun `checksetup.pl`.

### 2.2.4.2. Microsoft Internet Information Services

If you are running Bugzilla on Windows and choose to use Microsoft's Internet Information Services or Personal Web Server you will need to perform a number of other configuration steps as explained below. You may also want to refer to the following Microsoft Knowledge Base articles: 245225 "HOW TO: Configure and Test a PERL Script with IIS 4.0, 5.0, and 5.1" (for Internet Information Services) and 231998 "HOW TO: FP2000: How to Use Perl with Microsoft Personal Web Server on Windows 95/98" (for Personal Web Server).

You will need to create a virtual directory for the Bugzilla install. Put the Bugzilla files in a directory that is named something other than what you want your end-users accessing. That is, if you want your users to access your Bugzilla installation through "http://<yourdomainname>/Bugzilla", then do not put your Bugzilla files in a directory named "Bugzilla". Instead, place them in a different location, and then use the IIS Administration tool to create a Virtual Directory named "Bugzilla" that acts as an alias for the actual location of the files. When creating that virtual directory, make sure you add the "Execute (such as ISAPI applications or CGI)" access permission.

You will also need to tell IIS how to handle Bugzilla's .cgi files. Using the IIS Administration tool again, open up the properties for the new virtual directory and select the Configuration option to access the Script Mappings. Create an entry mapping .cgi to:

    <full path to perl.exe >\perl.exe -x<full path to Bugzilla> -wT "%s" %s

For example:

    c:\perl\bin\perl.exe -xc:\bugzilla -wT "%s" %s

| The ActiveState install may have already created an entry for .pl files that is limited to "GET,HEAD,POST". If so, this mapping should be removed as Bugzilla's .pl files are not designed to be run via a webserver.

IIS will also need to know that the index.cgi should be treated as a default document. On the Documents tab page of the virtual directory properties, you need to add index.cgi as a default document type. If you wish, you may remove the other default document types for this particular virtual directory, since Bugzilla doesn't use any of them.

Also, and this can't be stressed enough, make sure that files such as `localconfig` and your `data` directory are secured as described in Section 4.3.1.

### 2.2.4.3. AOL Server

Ben FrantzDale reported success using AOL Server with Bugzilla. He reported his experience and what appears below is based on that.

AOL Server will have to be configured to run CGI scripts, please consult the documentation that came with your server for more information on how to do this.

Because AOL Server doesn't support `.htaccess` files, you'll have to create a TCL script. You should create an `aolserver/modules/tcl/filter.tcl` file (the filename shouldn't matter) with the following contents (change `/bugzilla/` to the web-based path to your Bugzilla installation):

      ns_register_filter preauth GET /bugzilla/localconfig filter_deny
      ns_register_filter preauth GET /bugzilla/localconfig~ filter_deny
      ns_register_filter preauth GET /bugzilla/\#localconfig\# filter_deny
      ns_register_filter preauth GET /bugzilla/*.pl filter_deny
      ns_register_filter preauth GET /bugzilla/syncshadowdb filter_deny
      ns_register_filter preauth GET /bugzilla/runtests.sh filter_deny
      ns_register_filter preauth GET /bugzilla/data/* filter_deny
      ns_register_filter preauth GET /bugzilla/template/* filter_deny

      proc filter_deny { why } {
          ns_log Notice "filter_deny"
          return "filter_return"
      }

| This probably doesn't account for all possible editor backup files so you may wish to add some additional variations of `localconfig`. For more information, see bug 186383 or Bugtraq ID 6501.

| If you are using webdot from research.att.com (the default configuration for the webdotbase paramater), you will need to allow access to `data/webdot/*.dot` for the reasearch.att.com machine. If you are using a local installation of GraphViz, you will need to allow everybody to access `*.png`, `*.gif`, `*.jpg`, and `*.map` in the `data/webdot` directory.

## 2.2.5. Bugzilla

Your Bugzilla should now be working. Access `http://<your-bugzilla-server>/` - you should see the Bugzilla front page. If not, consult the Troubleshooting section, Appendix B.

Log in with the administrator account you defined in the last `checksetup.pl` run. You should go through the parameters on the Edit Parameters page (see link in the footer) and see if there are any you wish to change. They key parameters are documented in Section 3.1; you should certainly alter maintainer and urlbase; you may also want to alter cookiepath or requirelogin.

This would also be a good time to revisit the `localconfig` file and make sure that the names of the priorities, severities, platforms and operating systems are those you wish to use when you start creating bugs. Remember to rerun `checksetup.pl` if you change it.

Bugzilla has several optional features which require extra configuration. You can read about those in Section 2.3.

Prev | Home | Next
Installation | Up | Optional Additional Configuration