You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Timo Röhling 859796b126 Workaround for Solaris libc hace 10 años
.gitignore Ignore Eclipse project files hace 11 años
.travis.yml Fix Travis CI script hace 11 años
CMakeLists.txt Check for headers which may or may not be available hace 10 años
LICENSE Initial commit hace 12 años
README.md Update README hace 10 años
main.cf.ex Update main.cf.ex hace 11 años
makefile Initial commit hace 12 años
postinstall.cmake.in Use PERMISSIONS keyword instead of FILE_PERMISSIONS hace 10 años
postsrsd.apparmor.in Add AppArmor support hace 12 años
postsrsd.c Workaround for Solaris libc hace 10 años
postsrsd.default Optionally exclude domains from address rewriting hace 11 años
postsrsd.lsb_init.in add status check to LSB init script hace 10 años
postsrsd.rh_init.in Make sysconfig directory configurable hace 10 años
postsrsd.upstart.in Make sysconfig directory configurable hace 10 años
sha1.c Fix pointer conversion warnings hace 10 años
srs2.c Fix pointer conversion warnings hace 10 años
srs2.h Add preliminary Mac OS X support hace 10 años

README.md

PostSRSd

About

PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix. SRS is needed if your mail server acts as forwarder.

Sender Rewriting Scheme Crash Course

Imagine your server receives a mail from alice@example.com that is to be forwarded. If example.com uses the Sender Policy Framework to indicate that all legit mails originate from their server, your forwarded mail might be bounced, because you have no permission to send on behalf of example.com. The solution is that you map the address to your own domain, e.g. SRS0+xxxx=yy=example.com=alice@yourdomain.org (forward SRS). If the mail is bounced later and a notification arrives, you can extract the original address from the rewritten one (reverse SRS) and return the notification to the sender. You might notice that the reverse SRS can be abused to turn your server into an open relay. For this reason, xxxx and yy are a cryptographic signature and a time stamp. If the signature does not match, the address is forged and the mail can be discarded.

Building

PostSRSd requires a POSIX compatible system and CMake to build. Optionally, help2man is used to create a manual page.

For convenience, a Makefile fragment is provided which calls CMake with the recommended command line options. Just run make.

Alternatively, you can control many aspects of the build manually:

mkdir build
cd build
cmake .. <options>
make
make install

The CMake script defines a number of options in addition to the standard CMake flags. Use -D<option>=<value> to override the defaults.

  • GENERATE_SRS_SECRET (default: ON). Generate a random secret on install.
  • USE_APPARMOR (default: OFF): Install an AppArmor profile for the daemon.
  • INIT_FLAVOR (default: auto-detect). Select the appriopriate startup script type. Must be one of (upstart,sysv-lsb,sysv-redhat) or none.
  • CHROOT_DIR (default: ${CMAKE_INSTALL_PREFIX}/lib/postsrsd). Chroot jail for the daemon.
  • SYSCONF_DIR (default: /etc). Location of system configuration files.
  • CONFIG_DIR (default: ${SYSCONF_DIR}/default). Install destination for the postsrsd settings.
  • DOC_DIR (default: ${CMAKE_INSTALL_PREFIX}/share/doc/postsrsd). Install destination for documentation files.

Installing

Run make install as root to install the daemon and the configuration files.

Configuration

The configuration is located in /etc/default/postsrsd by default. You must store at least one secret key in /etc/postsrsd.secret. The installer tries to generate one from /dev/urandom. Be careful that no one can guess your secret, because anyone who knows it can use your mail server as open relay! Each line of /etc/postsrsd.secret is used as secret. The first secret is used for signing and verification, the others for verification only.

PostSRSd exposes its functionality via two TCP lookup tables. The recommended Postfix configuration is to add the following fragment to your main.cf:

sender_canonical_maps = tcp:127.0.0.1:10001
sender_canonical_classes = envelope_sender
recipient_canonical_maps = tcp:127.0.0.1:10002
recipient_canonical_classes= envelope_recipient

This will transparently rewrite incoming and outgoing envelope addresses. Run service postsrsd start and postfix reload as root, or reboot.