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-clamd

v1.0.1

Published

Haraka plugin that scans emails with clamd

Downloads

2,215

Readme

CI Test Status Code Climate

NPM

haraka-plugin-clamd

This plug-in implements Anti-Virus scanning with ClamAV using the clamd daemon.

The plug-in will reject any message that ClamAV considers to be a virus. If an error occurs (e.g. clamd not running or a timeout), the message will be deferred with a temporary failure.

Configuration

Copy the default clamd.ini into the Haraka config directory:

cp node_modules/haraka-plugin-clamd/config/clamd.ini config/clamd.ini
$EDITOR config/clamd.ini

The following options can be defined in clamd.ini;

clamd_socket (default: localhost:3310)

N.N.N.N:port, [ipv6::literal]:port, host:port or /path/to/socket of the clamd daemon.

Multiple hosts can be listed separated by comma, semi-colon or spaces.

If :port is omitted it defaults to 3310.

On connection error or timeout the next host in the list will be tried. When the host list is exhausted, the message will be deferred with a temporary failure.

randomize_host_order (default: false)

If this is set then the list of hosts with be randomized before a connection is attempted.

only_with_attachments (default: false)

Set this option to only scan messages that contain non-textual attachments. This is a performance optimization, however it will prevent ClamAV from detecting threats such as Phishing in plain-text or HTML messages.

connect_timeout (default: 10)

Timeout connection to host after this many seconds. A timeout will cause the next host in the list to be tried. Once all hosts have been tried then a temporary failure will be returned.

timeout (default: 30)

Post-connection timeout if there is no activity on the socket after this many seconds. A timeout will cause the message to be rejected with a tempoary failure.

max_size (default: 26214400)

The maximum size of message that should be sent to clamd in bytes. This option should not be larger than the StreamMaxLength value in clamd.conf as clamd will stop scanning once this limit is reached. If the clamd limit is reached the plug-in will log a notice that this has happened and will allow the message though.

[reject]

An optional reject section can offer control over when to reject connections. The default settings are shown. ClamAV recommends that hits coming from SafeBrowsing / Phishing / Heuristics, Potentially Unwanted Applications, and UNOFFICIAL be used only for scoring.

* virus=true
* error=true

The following reject options are disabled by default in clamd.conf. With a default ClamAV install, these will have no effect. When an admin enables in clamd.conf, Haraka with then, by default, reject such messages. Adjust these settings to suit.

* Broken.Executable=true
* Structured=true
* Encrypted=true
* PUA=true
* OLE2=true
* Safebrowsing=true
* UNOFFICIAL=true

The following options are enabled by default in clamd but ClamAV suggests using them only for scoring.

* Phishing=false

[check]

The optional check section can allow skipping ClamAV check for remote connection meeting following criteria.

  • authenticated

    Default: true

    If true, messages from authenticated users will be scanned.

  • private_ip

    Default: true

    If true, messages from private IPs will be scanned.

  • local_ip

    Default: true

    If true, messages from localhost will be scanned.

  • relay

    Default: true

    If true, messages that are to be relayed will be scanned.

clamd.excludes

This file can contain a list of virus name patterns that when matched, are not rejected by this plugin. An X-Haraka-Virus: header will be inserted containing the virus name. This header can then be used for scoring in other plugins.

The format of the file is one pattern per line. Comments are prefixed with #. Matches are case-insensitive.

Patterns are expressed using wildcards (e.g. * and ?) or via regexp by enclosing the pattern in //.

To negate a match (e.g. reject if it matches), prefix the match with !. Negative matches are always tested first.

Example:

# Always reject test signatures
!*.TestSig_*
# Skip all unofficial signatures
*.UNOFFICIAL
# Phishing
Heuristics.Phishing.*