The build & install is automated by autoconf and automake. Basic steps:

./configure
make
make install

By default, the binary 'renattach' is put in '/usr/local/bin' and the 
example conf file 'renattach.conf.ex' is put in '/usr/local/etc'. Please 
run "./configure --help" to see all the options. For instance, to install 
under your home directory: "./configure --prefix=$HOME"

To customize your installation, modify the options in renattach.conf. Use 
the command "renattach --settings" to see the active configuration.

Since renattach is a standard UNIX filter, it can be installed into a wide
variety of mailing systems. The filter reads a single email message as
input at stdin, then writes the filtered output either to stdout or to a 
pipe (external command) if the --pipe option is used.

There are many ways to install renattach in both the user and site-wide
contexts. The cases below are by no means exhaustive.


=============================
procmail for individual users
=============================

Most mail servers use procmail for local mail delivery. This is the 
default configuration for Sendmail. In Postfix, main.cf has to include:
mailbox_command = /usr/bin/procmail

If your site uses procmail, then you can create the ".procmailrc" file in 
your home directory to instruct procmail to run certain scripts. The 
following basic ".procmailrc" will filter all incoming mail through 
renattach. Please see "man procmailrc" to learn more about the format:

# Filter mail through renattach, and wait for success exit code
:0 wf
| /path/to/renattach


=================================
procmail for entire site (global)
=================================

If your site uses procmail, then you can take advantage of procmail's 
site-wide filtering capabilities via the /etc/procmailrc configuration 
file. You can use the same filtering 'rule' as in the above example for 
individual users. Please see "man procmail" for more information.

Please check to make sure that procmail does not run procmailrc 
with root privileges. renattach SHOULD NOT run as 'root'.


===================
Postfix integration
===================

The Postfix MTA has a flexible modular design that makes it relatively
easy to add content filters such as renattach. There are several
advantages to installing renattach at the MTA level:

+	Tighter integration into the mail system, ensuring that all mail
	is filtered (instead of relying on procmail operating correctly)

+	Possibility for both inbound and outbound SMTP filtering

+	Superior security, since the filter can run under dedicated UID

+	Superior feedback on filtering errors (mail bounces or temporary
	failures) due to strict interpretation of filter exit codes. In
	other words, if renattach encounters a temporary error such as
	resource shortage or dead external pipe, mail will remain queued
	and delivery will be attempted later. If renattach encounters a
	fatal error (bad command usage) then mail will bounce.

To install renattach, you only need to modify /etc/postfix/master.cf
The following instructions are based on Postfix's FILTER_README file and 
describe how to install renattach as a content filter for SMTP.

1) Create a new user 'filter' with a disabled password, unique group, no 
home directory and no login shell. /etc/passwd would have something like:
filter:*:952:952:filter:/dev/null:/dev/null

2) Insert the following into /etc/postfix/master.cf to define the 'filter'
service that uses the Postfix pipe program. Note the long second line;  
this instructs Postfix to pipe mail into renattach using privileges of
the dedicated filter user. You can specify any renattach options you wish.
Here, we MUST use renattach's -p (or --pipe) to send the filtered output
to the Postfix 'sendmail' command. This re-injects the filtered message
back into the mail system. Note the quotes around the entire sendmail 
command; YOU MUST INCLUDE the space between ${recipient} and the closing 
quote exactly as shown. Otherwise, a UUCP-compatibility feature in Postfix
causes the quotes to be improperly balanced. Also, this quoted sendmail
command line must be the final option specified.

filter    unix  -       n       n       -       -       pipe
  user=filter argv=/usr/local/bin/renattach -p "/usr/sbin/sendmail -i -f ${sender} -- ${recipient} "

3) Now that you have defined a new 'filter' module, you can instruct the 
smtp module to use 'filter' as a content filter. This is done simply by 
editing /etc/postfix/master.cf and adding the -o content_filter=filter 
option to smtpd. This means that the smtp service should appear like this:

smtp      inet  n       -       n       -       -       smtpd
	-o content_filter=filter

4) Save master.cf and run 'postfix reload'. Now test your configuration.  
Any mail coming into your system via SMTP should now leave with the
additional renattach headers. The system mail logs should indicate mail
being passed with relay=filter. There should also be log entries from the
postfix/pipe program. Make sure use_syslog is enabled so that your mail
logs show filtered attachments and message-id's. Send some dangerous
attachments to confirm that they are filtered and logged.

It's important to understand how mail now flows through your system. The 
following illustrates step-by-step how mail is processed with the above 
configuration:

a. Client connects to server:25 (smtpd) and uploads an email
b. smtpd relays the mail to the content filter, the 'filter' service
c. The 'filter' service pipes the mail to renattach
d. renattach pipes its output to the Postfix sendmail command,
   specifying as command line options the original sender and recipient(s)
e. The sendmail command locally re-injects the mail into the system
f. Delivery continues as normal
