Skip to content

philr/srsd

Repository files navigation

srsd - Sender Rewriting Scheme Daemon

A daemon written in Go that accepts and rewrites email addresses according to the Sender Rewriting System.

The daemon listens on a Unix socket for requests to rewrite email addresses either for forwarding or in reverse for bounce handling.

The mileusna/srs package is used perform the rewriting.

Compiling

From the source directory, run go build to produce a srsd executable.

Configuration

srsd uses a JSON configuration file. A sample is provided as srsd.json. A default secret can be provided in addition to secrets for specific target SRS domains.

Secrets in the configuration file must be encoded using base64. 64 random bytes are recommended (used for an SHA-1 HMAC). Suitable secrets can be generated by running:

head -c64 /dev/urandom | base64 -w0

Executing

Start the daemon by running srsd.

By default, srsd will look for a configuration file named srsd.json in the current directory and open a socket named srsd.sock in the current directory. The socket will be created with access permissions set to 0770. To specify different configuration file and socket locations, use the -config-file and -socket-path options respectively. To specify different access permissions use the -socket-access option. For example:

srsd -config-file /etc/srsd.conf -socket-path /run/srsd/srsd.sock -socket-access 0777

The process will remain running in the foreground when started. To terminate send the process an INT or TERM signal.

Protocol

srsd accepts connections made to the Unix socket. Each connection can be used to perform multiple operations (provided a syntax error is not encountered). Rewrite commands are issued one per line (terminated with a line feed \n).

Requesting a forwarding rewrite for the sender address [email protected] using the SRS domain srs.example.com:

Requesting a reverse rewrite for the SRS address SRS0=PmRI=YB=example.org=[email protected]:

Errors will be reported prefixed with "ERROR: ":

> [email protected]
< ERROR: Hash invalid in SRS address
> [email protected]
< ERROR: Time stamp out of date
> [email protected]
< ERROR: Missing SRS domain or email address

The final error in the above example will result in the connection being closed due to the syntax error.

systemd

A systemd service file is provided as srsd.service.

Releases

No releases published

Packages

No packages published

Languages