GithubHelp home page GithubHelp logo

zuazo / spamassassin-cookbook Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 100 KB

Chef cookbook to install and configure SpamAssassin.

Home Page: https://supermarket.chef.io/cookbooks/onddo-spamassassin

License: Apache License 2.0

Ruby 84.80% HTML 15.20%
chef cookbook devops antispam mta spamassassin bayes-classifier bayesian-filter mail-server

spamassassin-cookbook's Introduction

SpamAssassin Cookbook

Documentation GitHub License

Cookbook Version Dependency Status Code Climate Build Status Coverage Status Inline docs

Chef cookbook to install and configure SpamAssassin, a mail filter software to identify spam.

Requirements

Supported Platforms

This cookbook has been tested on the following platforms:

  • Amazon Linux
  • CentOS
  • Debian
  • Fedora
  • openSUSE
  • Oracle Linux
  • RedHat
  • SUSE
  • Ubuntu

Please, let us know if you use it successfully on any other platform.

Required Applications

  • Chef 12 or higher.
  • Ruby 2.2 or higher.

Attributes

Attribute Default Description
node['spamassassin']['spamc']['path'] calculated SpamAssassin client binary path.
node['spamassassin']['spamd']['path'] calculated SpamAssassin daemon binary path.
node['spamassassin']['spamd']['user'] 'spamd' SpamAssassin user.
node['spamassassin']['spamd']['group'] 'spamd' SpamAssassin group.
node['spamassassin']['spamd']['lib_path'] calculated SpamAssassin library path.
node['spamassassin']['spamd']['enabled'] true SpamAssassin daemon enabler flag.
node['spamassassin']['spamd']['options'] calculated SpamAssassin daemon option arguments.
node['spamassassin']['spamd']['pidfile'] '/var/run/spamd.pid' SpamAssassin daemon pid file.
node['spamassassin']['spamd']['nice'] nil SpamAssassin daemon nice scheduling priority.
node['spamassassin']['conf']['rewrite_headers'] calculated An array of rewrite headers.
node['spamassassin']['conf']['report_safe'] true SpamAssassin report_safe enabler flag.
node['spamassassin']['conf']['trusted_networks'] nil Network or hosts that are considered trusted.
node['spamassassin']['conf']['lock_method'] 'flock' File-locking method used to protect database files on-disk.
node['spamassassin']['conf']['required_score'] 5 Score required before a mail is considered spam.
node['spamassassin']['conf']['use_bayes'] true Whether to use the naive-Bayesian-style classifier.
node['spamassassin']['conf']['bayes_auto_learn'] true Whether SpamAssassin should automatically feed high-scoring mail.
node['spamassassin']['conf']['bayes_ignore_headers'] [] Headers ignored by the naive-Bayesian-style classifier.
node['spamassassin']['conf']['plugins'] [] A hash to configure SpamAssassin plugins (see the example below).
node['spamassassin']['conf']['localrules'] [] An array to configure local rules at the end of local.conf.

Plugin Example

node.default['spamassassin']['conf']['plugins']['shortcircuit'] = [
  {
    'USER_IN_WHITELIST' => 'on',
    'USER_IN_DEF_WHITELIST' => 'on',
    'USER_IN_ALL_SPAM_TO' => 'on',
    'SUBJECT_IN_WHITELIST' => 'on',

    'USER_IN_BLACKLIST' => 'on',
    'USER_IN_BLACKLIST_TO' => 'on',
    'SUBJECT_IN_BLACKLIST' => 'on',

    'ALL_TRUSTED' => 'on',

    'BAYES_99' => 'spam',
    'BAYES_00' => 'ham'
  }
]

Local Rules Example

Say you want to add the following rules to local.cf to blacklist some senders

blacklist_from [email protected]
blacklist_from [email protected]
node.default['spamassassin']['conf']['localrules'] = [
  'blacklist_from [email protected]',
  'blacklist_from [email protected]'
]

Recipes

onddo-spamassassin::default

Installs SpamAssassin client and Daemon.

Usage Examples

Including in a Cookbook Recipe

Running it from a recipe:

# Required_score is set to 5 by default, change it:
node.default['spamassassin']['conf']['required_score'] = 4
include_recipe 'onddo-spamassassin::default' # or include it in your run-list

Don't forget to include the onddo-spamassassin cookbook as a dependency in the metadata.

# metadata.rb
# [...]

depends 'onddo-spamassassin'

Including in the Run List

Another alternative is to include the default recipe in your Run List.

{
  "name": "mail.example.com",
  "[...]": "[...]",
  "run_list": [
    "recipe[onddo-spamassassin]"
  ]
}

Testing

See TESTING.md.

Contributing

Please do not hesitate to open an issue with any questions or problems.

See CONTRIBUTING.md.

TODO

See TODO.md.

License and Author

Author: Xabier de Zuazo ([email protected])
Copyright: Copyright (c) 2015, Xabier de Zuazo
Copyright: Copyright (c) 2013-2015 Onddo Labs, SL.
License: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

spamassassin-cookbook's People

Contributors

mrseccubus avatar zuazo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

spamassassin-cookbook's Issues

spamassassin is restarting after each modification even if spamd is disabled

Cookbook Version

2.1.0

Chef Client Version

Chef: 14.10.9

Platform Details

CentOS 7

If node['spamassassin']['spamd']['enabled'] = false, the spamassassin is still restarting after any modification.

Can you fix it by adding something like this each time service[#{service_name}] is notified?

notifies :restart, "service[#{service_name}]" if node['spamassassin']['spamd']['enabled']

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.