npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

haraka-plugin-aliases

v1.0.2

Published

Haraka plugin that add aliases

Downloads

2,964

Readme

Build Status Code Climate NPM

haraka-plugin-aliases

This plugin allows the configuration of aliases that perform an action or change the RCPT address. Aliases are specified in a JSON formatted config file, and must have an action. Syntax errors found in the JSON config will stop the server.

IMPORTANT: this plugin must appear in config/plugins before other plugins that run on hook_rcpt

WARNING: DO NOT USE THIS PLUGIN WITH queue/smtp_proxy.

Configuration

aliases

JSON formatted config file that contains keys to match against RCPT addresses, and values that are objects with an "action" : "" property. Example:

{ "test1": { "action": "drop" } }

In the above example the "test1" alias will drop any message that matches test1, test1-, or test1+ (wildcard '-' or '+', see below). Actions may have 0 or more options listed like so:

{ "test3": { "action": "alias", "to": "test3-works" } }

In the above example the "test3" alias has an action of "alias" and a mandatory "to" field. If "to" were missing the alias would fail and an error would be emitted.

Aliases of 'user', '@host' and 'user@host' possible:

{ "demo" : { "action" : "drop" } }
    or
{ "@example.com" : { "action" : "drop" } }
    or
{ "[email protected]" : { "action" : "drop" } }

Aliases may be expanded to multiple recipients:

{
  "[email protected]": {
    "action": "alias",
    "to": ["[email protected]", "[email protected]"]
  }
}

wildcard notation

This plugin supports wildcard matching of aliases against the right most string of a RCPT address. The characters '-' and '+' are commonly used for subaddressing and this plugin can alias the "user" part of the address.

If the address were [email protected] (or [email protected]), the below alias would match:

{ "test2": { "action": "drop" } }

Larger and more specific aliases match first when using wildcard '-' notation. If the above RCPT was evaluated with this alias config, it would alias:

{
  "test2": { "action": "drop" },
  "test2-testing": { "action": "alias", "to": "[email protected]" }
}

It also allows you to route all emails to a certain domain:

{
  "*": { "action": "alias", "to": "[email protected]" }
}

chaining and circuits

Alias chaining is not supported. As a side-effect, we enjoy protections against alias circuits.

  • optional one line formatting

Any valid JSON will due. Please consider keeping each alias on its own line so that others that wish to grep the aliases file have an easier time finding the full configuration for an alias.

  • nondeterministic duplicate matches

This plugin was written with speed in mind. That means every lookup hashes into the alias file for its match. While the act of doing so is fast, it does mean that any duplicate alias entries will match nondeterministically. That is, we cannot predict what will happen here:

{
  "coinflip": { "action": "alias", "to": "[email protected]" },
  "coinflip": { "action": "alias", "to": "[email protected]" }
}

Due to node.js implementation, one result will likely always be chosen over the other, so this is not exactly a coinflip. We simply cannot say what the language implementation will do and it could change.

action (required)

The following is a list of supported actions and their options.

  • drop

    Drops a message while pretending everything was okay to the sender. This acts like an alias to /dev/null.

  • alias

    Maps the alias key to the address specified in the "to" option. A note about matching in addition to the note about wildcard '-' above. When we match an alias, we store the hostname of the match for a shortcut substitution syntax later.

    • to (required)

    This option is the full address, or local part at matched hostname that the RCPT address will be re-written to. For an example of an alias to a full address consider the following:

    { "test5": { "action": "alias", "to": "[email protected]" } }

    This maps RCPT matches for "test5" to "[email protected]". This would map "[email protected]" to "[email protected]" every time. Compare this notation with its shortcut counterpart, best used when the "to" address is at the same domain as the match:

    { "test4": { "action": "alias", "to": "test4" } }

    This notation is more compact. Mail to "[email protected]" will map to "[email protected]". This notation enables lots of aliases on a single domain to map to other local parts at the same domain.

Example Configuration

{
  "test1": { "action": "drop" },
  "test2": { "action": "drop" },
  "test3": { "action": "alias", "to": "test3-works" },
  "test4": { "action": "alias", "to": "test4" },
  "test5": { "action": "alias", "to": "[email protected]" },
  "test6": { "action": "alias", "to": "[email protected]" }
}