Archive for January, 2010

SBDavid

Creating the postfix aliases database

Creating the postfix aliases database

Postfix uses a Sendmail-compatible aliases(5) table to redirect mail for local(8) recipients. Typically, this information is kept in two files: in a text file /etc/aliases and in an indexed file /etc/aliases.db. The command “postconf alias_maps” will tell you the exact location of the text file.

root@dell:~# postconf alias_maps
alias_maps = hash:/etc/aliases
root@dell:~#

First, be sure to update the text file with aliases for root, postmaster and “postfix” that forward mail to a real person. Postfix has a sample aliases file /etc/postfix/aliases that you can adapt to local conditions.

/etc/aliases:
root: you
postmaster: root

Note: there should be no whitespace before the “:”.

Finally, build the indexed aliases file with one of the following commands:

# newaliases
# sendmail -bi

Checking Postfix file permission/ownership discrepancies

# postfix check

The first line (postfix check) causes Postfix to report file permission/ownership discrepancies.

# egrep ‘(reject|warning|error|fatal|panic):’ /var/log/maillog

The second line looks for problem reports from the mail software, and reports how effective the relay and junk mail access blocks are. This may produce a lot of output. You will want to apply some postprocessing to eliminate uninteresting information.

Postfix uses database files for access control

Postfix uses database files for access control, address rewriting and other purposes.

Here is a common example of how Postfix invokes a database:

/etc/postfix/main.cf:
virtual_alias_maps = hash:/etc/postfix/virtual

Whenever you make a change to the main.cf or master.cf file, execute the following command as root in order to refresh a running mail system:

# postfix reload
SBDavid

Postfix configuration files

Postfix configuration files

By default, Postfix configuration files are in /etc/postfix. The two most important files are main.cf and master.cf; these files must be owned by root. Giving someone else write permission to main.cf or master.cf (or to their parent directories) means giving root privileges to that person.

In /etc/postfix/main.cf you will have to set up a minimal number of configuration parameters. Postfix configuration parameters resemble shell variables, with two important differences: the first one is that Postfix does not know about quotes like the UNIX shell does.

You specify a configuration parameter as:

/etc/postfix/main.cf:
parameter = value

and you use it by putting a “$” character in front of its name:

/etc/postfix/main.cf:
other_parameter = $parameter

You can use $parameter before it is given a value (that is the second main difference with UNIX shell variables). The Postfix configuration language uses lazy evaluation, and does not look at a parameter value until it is needed at runtime.

SBDavid

Running CGI script from any directory

Running CGI script from any directory

In order to force apache to allow cgi script to run, simply create a file called .htaccess inside the directory in which you wish to run the scripts. Inser this text into the file:

AddHandler cgi-script .cgi .pl

AddHandler maps the filename extensions extension to the handler handler-name. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. For example, to activate CGI scripts with the file extension “.cgi”, you might use:

AddHandler cgi-script .cgi

Once that has been put into your srm.conf or httpd.conf file, any file containing the “.cgi” extension will be treated as a CGI program.

The extension argument is case-insensitive, and can be specified with or without a leading dot.

« Prev - Next »