The 'Bastion' Host

Total Page:16

File Type:pdf, Size:1020Kb

The 'Bastion' Host The ‘Bastion’ Host Author Andy Millett Version 1.0 – initial release (Aug 06) Version 1.1 - (Oct 06) sbl-xbl.spamhaus.org has now changed to zen.spamhaus.org to include Non-MTA sending IP blocks. SuSE Setup procedure errors, thanks to Damien Parker at IP Performance for finding these. Version 1.2 – (Nov 06) ClamAV version change to 0.88.6 Version 1.3 – (Nov 06) Added Greylisting section Preamble Hi there. I created this document to bring together all of the components of what I consider to be a fairly effective mail gateway which has the ability to block spam and viruses. I’ve used Linux because it is stable, adaptable and above all free to the net community at large to use (for personal use of course). I use this server to protect my own domains and find it very effective. The components of the system are based on Open Source programs for which I would like to thank the authors of for themselves releasing to us all to use. One final thing I’d like to mention is this document isn’t for the faint hearted user. It assumes you have knowledge of using the programs mentioned or at least are able to figure out what is going on when something doesn’t work. If you aren’t, please feel free to google your issue, error or whatever, I’ve found that the best place to find the answers to the questions I’ve had. You can post a question on my forum if you wish and I’ll attempt to answer it or help you along – http://andymillett.co.uk/andym/forum . 1. Overview 6.6. Recipients 1.1. Before Queue Content Filter 6.7. MX_Access 1.2. After Queue Content Filter 6.8. getadsmtp.pl 2. Hardware Requirements 7. ClamAV Setup 7.1. freshclam.conf 3. Software Requirements 7.2. clamd.conf 3.1. Operating System 3.2. Postfix 8. AmavisD Setup 3.3. SpamAssassin 8.1. amavis.conf 3.4. ClamAV 3.5. Getadsmtp.pl 9. PolicyD-Weight Setup 3.6. AmavisD 9.1. Whitelisting 3.7. PolicyD-Weight 3.8. Pflogsumm 10. SpamAssassin Setup 3.9. Mailgraph 10.1 Whitelisting/Blacklisting 4. Topology 11. Grey-Listing. 11.1 Whitelisting. 5. OS Installation 12. Starting the Daemons 6. Postfix Setup 6.1. Main.cf 13. Reporting 6.2. Master.cf 13.1 Pflogsumm 6.3. Transport 13.2 Mailgraph 6.4. Virtual 6.5. Helo_checks 14. Links - 1 - 1. Overview Whilst commercial Anti-Spam products are extremely adept at blocking spam and catching viruses sometimes you just wonder if it can be done without the expense. Here’s how, with a little time and a spare computer you can build your own ‘Bastion’ host. Using Postfix, Spam-Assassin and ClamAV on a Linux distribution you can successfully deploy a string-budget anti-spam/anti-virus host by utilizing two areas of the SMTP protocol as it is applied by Postfix (the MTA). 1.1 Before Queue Content Filter By tightening up on rules applied it is possible to block 60-70% of all spam attempts at the initial connection stage. Strict (but fair) application of the SMTP Protocol is used here via Postfix rules and the PolicyD-Weight script. 1.2 After Queue Content Filter Any rules that pass successfully through the Before Queue content-filter pass through Spam- Assassin and ClamAV (After Queue Filter(s)) and are scored against both local rules and SURBL’s and checked for viruses. 2. Hardware requirements 1 x PC or 1U Rack server with a minimum 700mhz P3 CPU, 512mb RAM, 1 IDE disk (preferably two to setup RAID), 1 NIC. A graphics card is recommended but not necessary after the initial setup of the OS. The above hardware will quite happily handle both inbound and outbound email for a small to medium site (50 users / up to 500 messages per hour). For higher volume sites (50-1000+ users / 10000+ messages per hour) a faster processor (preferably dual), more memory (a minimum 2GB) and a dual disk SCSI RAID0 should be considered. 3. Software requirements 3.1 Operating System – pick a distro, any distro you like, Slackware, SuSE, Red-Hat, Debian. All can be downloaded for free but for ease of install and setup use SuSE (9.3 or later). 3.2 Postfix – a secure, highly configurable MTA (Mail Transfer Agent) which accepts email and either delivers it to a local mailbox (local delivery) or forwards it on to a local/remote server (network delivery). 3.3 SpamAssassin – A Perl based Anti-Spam filter with many features. 3.4 ClamAV – An Open Source Anti-Virus server 3.5 Getadsmtp.pl – A free Perl script which contacts you AD/LDAP server for a valid list of recipients. 3.6 AmavisD – A perl based script that integrates a Virus Scanner and Anti-virus program for use within an MTA. 3.7 PolicyD-Weight – A ‘scoring’ perl script which runs prior to the mail being queued and scores based on HELO, MX, and DNSBL inclusion. 3.8 Pflogsumm – A perl script which when run generates a report of mail activities in human readable form. - 2 - 4. Topology The following diagram shows how the Before and After Queue content filters work. Greylist PolicyD- DB Mailbox or Weight Network Transport Process REJECT Before Sending Postfix Greylist Queue Accept NO SMTP Server Master Filter Queue YES Virus Found Postfix After Master Queue Postfix Queue Filter Master Queue AmavisD ClamAV SpamD Process Process Process 5. OS Installation Installing SuSE is fairly straight forward with a couple of exceptions. The default minimum install (Text-Mode) will suffice (we don’t’ need XWindows). Start the installation by booting from the disk and choosing ‘Installation’ from the Menu that appears. - 3 - Choose English (UK) as the selected language. The installation will then continue (if you see a message similar to below, simply click OK). - 4 - Now under the Installation Settings menu, choose ‘Change’ then select ‘Software’ Select ‘Minimum system’ from the choice menu then click on ‘Detailed Selection’ - 5 - Now from the ‘Filter’ option on the top left, drop the list down and choose ‘Search’ Aside from the ‘Minimum system’ you selected the following packages should be installed (you can search for them as written below). pico unzip DB zoo DB-Devel glibc-devel spamassassin perl-Convert-TNEF perl-spamassassin perl-Convert-UUlib amavisd-new perl-Net-Server zlib-devel perl-Net-DNS freetype perl-Archive-Tar freetype2 Perl-Archive-Zip freetype2-devel perl-BerkeleyDB rrdtool perl-Bit-Vector gd perl-Compress-Zlib libpng perl-Date-Calc libpng-devel perl-Inline apache2 perl-IO-stringy apache2-prefork perl-IO-Socket-SSL jpeg perl-ldap libjpeg perl-MailTools apache2 perl-MIME-tools apache2-prefork perl-Net-SSLeay gcc perl-OPENSSL wget perl-Unix-Syslog lha perl-URI unrar perl-TimeDate Once you have finished selecting the programs above, click ‘Accept’ on the bottom right of the screen. A list of required dependencies (if any) will appear. Simply click OK to accept this. - 6 - Once back on the ‘Installation Settings’ menu, click ‘Accept’ again. A message will appear asking you to confirm you wish to create new partitions (and that you will over-write any existing ones). Agree to this. The installation will then continue displaying a progress bar (below). If you wish to see the progress in a more detailed manner you can click on the ‘Details’ tab. When the first stage of the installation is complete the system will automatically reboot itself (this is completely normal). After the reboot the installation will continue. - 7 - Next, choose a root password then choose Next Agree to messages about detecting hardware. As you can see from the picture above, each option (Back, Abort, Next, Change, etc) has a different color on a specific character, you can use this letter in conjunction with the ‘ALT’ key to choose that option. Click Alt-C to change the configuration and choose ‘Firewall’. Set the Firewall configuration to ‘Start Firewall Manually’. Follow with Alt-N to continue. - 8 - Next select Alt-C to change the configuration again, this time select ‘Network Interfaces’. Click on Alt-I to select the presently configured interface (assigned DHCP). On the Network Address Setup screen, select Alt-t to choose a Static Address and enter the settings you require. - 9 - Once this is done, select Alt-H to set the ‘Host Name and Name Server’ settings. Under the ‘Host Name and Name Server’ settings, set your chosen hostname, and DNS domain name (this will be the Primary domain the server is accepting email for). Select OK when you are done. - 10 - Back at the Network Address Setup screen, choose Alt-o to change the routing information of the server. Enter the Default Gateway as required then finish with OK Click Next to finalize the Network Configuration if you are happy you have everything correct. - 11 - The network configuration will then be written. - 12 - Choose ‘Local’ as the authentication method Setup a new user on the system that isn’t root. - 13 - The installation will then ask you if you want to test your internet connection. Agree to this. If the result is ‘Success’ click Next - 14 - You will then be asked if you wish to run Online Update, agree to this. You will be given a choice of update servers with which to download available updates. You can agree to the first selected or choose another. Click Next when ready. - 15 - A list of available updates will then be downloaded finishing at the screen below, simply click OK and the update will continue.
Recommended publications
  • Comodo Antispam Gateway Software Version 1.5
    Comodo Antispam Gateway Software Version 1.5 Administrator Guide Guide Version 1.5.082412 Comodo Security Solutions 525 Washington Blvd. Jersey City, NJ 07310 Comodo Antispam Gateway - Administrator Guide Table of Contents 1 Introduction to Comodo Antispam Gateway........................................................................................................................... 4 1.1 Release Notes............................................................................................................................................................. 5 1.2 Purchasing License .................................................................................................................................................... 6 1.3 Adding more Users, Domains or Time to your Account .................................................................................................6 1.4 License Information................................................................................................................................................... 10 2 Getting Started................................................................................................................................................................... 13 2.1 Incoming Filtering Configuration ................................................................................................................................ 13 2.1.1 Configuring Your Mail Server..................................................................................................................................
    [Show full text]
  • DNS Manager User Guide VF
    Vodafone Hosted Services: DNS Manager User Guide DNS Manager User Guide 1 Vodafone Hosted Services: DNS Manager User Guide DNS Manager What is DNS Manager ? DNS Manager allows the end-user to edit their domain’s zone file, including A (address) records, CNAME (canonical name) records and MX (mail exchange) records. What is the Default Zone File ? If the end-user selects “Edit Zone File” and clicks “Next”, their current zone file will be displayed at the top of the screen. By default, their zone file will contain several important records. Any changes to these records may cause serious problems with their website and email performance. What is DNS ? DNS (Domain Name System or Domain Name Service) catalogs and updates information in regards to domain names. DNS converts domain names into IP addresses. DNS usually contains a set of zone files that lists the types of redirection that will be done. 2 Vodafone Hosted Services: DNS Manager User Guide What are Zone Files ? Four types of records are important in a zone file: • A records • CNAME records • MX records • Start of Authority (SOA) domain.com points to 216.251.43.17 mail.domain.com points to 69.49.123.241 mail will be delivered to 10 mx1c1.megamailservers.com first mail will be delivered to 100 mx2c1.megamailservers.com second mail will be delivered to 110 Resource Record Abbreviations The end-users domain name is called their “origin”. The origin is appended to all names in the zone file that do not end in a dot. For example, if their domain is yourname.com, the entry “www” in the zone file is equal to www.yourname.com.
    [Show full text]
  • Master Thesis Characterizing Sender Policy Framework Configurations At
    Master Thesis Characterizing Sender Policy Framework Configurations at Scale Gabri¨elMathay Kahraman Monday 7th September, 2020 A thesis presented for the degree of Master of Science Computer Science Design and Analysis of Communication Systems (DACS) Chair: prof. dr. ir. Aiko Pras Supervisor: dr. ir. Mattijs Jonker Co-supervisors: ir. Olivier van der Toorn and dr. Doina Bucur Abstract Phishing involves disguising oneself as a trustworthy entity in electronic communication, for example, by pretending to send e-mail on behalf of a company. Phishing e-mails can be prevented if domains implement e-mail security techniques. One of the techniques to improve e-mail security is the Sender Policy Framework (SPF). To enable SPF, the administrator of a domain can specify an SPF policy in the DNS zone of the domain. The SPF policy determines which IP addresses are authorised to send e-mail from the administrator's domain. When an e-mail server receives an e-mail, the e-mail server retrieves the SPF policy of the sender's domain. Next, the IP address of the sender will be queried against the SPF record, and the response of this query determines how to handle the incoming e-mail. The SPF standard was released over six years ago. Even though six years have passed, the research community does not yet have a thorough understanding of the characteristics of SPF use. What we miss is an understanding of how SPF policies are configured, how SPF policies have changed over time, and what the problematic trends are of SPF use. In this Thesis, we address the missing of a large scale analysis on SPF policies over time.
    [Show full text]
  • Email Services Deployment Administrator Guide Email Services Deployment Administrator Guide
    Email Services Deployment Administrator Guide Email Services Deployment Administrator Guide Documentation version: 1.0 Legal Notice Copyright 2016 Symantec Corporation. All rights reserved. Symantec, the Symantec Logo, and the Checkmark Logo are trademarks or registered trademarks of Symantec Corporation or its affiliates in the U.S. and other countries. Other names may be trademarks of their respective owners. The product described in this document is distributed under licenses restricting its use, copying, distribution, and decompilation/reverse engineering. No part of this document may be reproduced in any form by any means without prior written authorization of Symantec Corporation and its licensors, if any. THE DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. SYMANTEC CORPORATION SHALL NOT BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH THE FURNISHING, PERFORMANCE, OR USE OF THIS DOCUMENTATION. THE INFORMATION CONTAINED IN THIS DOCUMENTATION IS SUBJECT TO CHANGE WITHOUT NOTICE. The Licensed Software and Documentation are deemed to be commercial computer software as defined in FAR 12.212 and subject to restricted rights as defined in FAR Section 52.227-19 "Commercial Computer Software - Restricted Rights" and DFARS 227.7202, et seq. "Commercial Computer Software and Commercial Computer Software Documentation," as applicable, and any successor regulations, whether delivered by Symantec as on premises or hosted services. Any use, modification, reproduction release, performance, display or disclosure of the Licensed Software and Documentation by the U.S.
    [Show full text]
  • System Administrator's Guide
    ePrism Email Security System Administrator’s Guide - V11.0 4225 Executive Sq, Ste 1600 Give us a call: Send us an email: For more info, visit us at: La Jolla, CA 92037-1487 1-800-782-3762 [email protected] www.edgewave.com © 2001—2017 EdgeWave. All rights reserved. The EdgeWave logo is a trademark of EdgeWave Inc. All other trademarks and registered trademarks are hereby acknowledged. Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. The Email Security software and its documentation are copyrighted materials. Law prohibits making unauthorized copies. No part of this software or documentation may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into another language without prior permission of EdgeWave. 11.0 Contents Chapter 1 Overview 1 Overview of Services 1 Email Filtering (EMF) 2 Archive 3 Continuity 3 Encryption 4 Data Loss Protection (DLP) 4 Personal Health Information 4 Personal Financial Information 5 ThreatCheck 6 Vx Service 6 Document Conventions 7 Supported Browsers 7 Reporting Spam to EdgeWave 7 Contacting Us 8 Additional Resources 8 Chapter 2 ePrism Appliance 9 Planning for the ePrism Appliance 9 About MX Records 9 Configuration Examples 10 Email Security Outside Corporate Firewall 10 Email Security Behind Corporate Firewall 10 Mandatory 11 Optional 12 Accessing the ePrism Appliance 12 ePrism Appliance
    [Show full text]
  • Migration Technical Guide
    OneNet | Hosted Exchange Migration Technical Guide Migration Technical Guide Documentation OneNet Hosted Exchange Page 1 of 21 OneNet | Hosted Exchange Migration Technical Guide Contents Introduction ....................................................................................................................... 3 Target Audience ........................................................................................................... 3 Section Overview ......................................................................................................... 3 Migration Planning .............................................................................................................. 4 Pre-Migration Planning Form .......................................................................................... 5 Client Site Preparation ......................................................................................................... 6 Mail Data Export .......................................................................................................... 6 Download Outlook 2010/2013 or Microsoft Outlook 2011 (for Mac OS X) ............................. 7 Software Disclaimer ...................................................................................................... 7 Email Client Configuration ............................................................................................. 7 Client System Requirements .......................................................................................... 8 Outlook
    [Show full text]
  • The Qmail Handbook by Dave Sill ISBN:1893115402 Apress 2002 (492 Pages)
    < Free Open Study > The qmail Handbook by Dave Sill ISBN:1893115402 Apress 2002 (492 pages) This guide begins with a discussion of qmail s history, architecture and features, and then goes into a thorough investigation of the installation and configuration process. Table of Contents The qmail Handbook Introduction Ch apt - Introducing qmail er 1 Ch apt - Installing qmail er 2 Ch apt - Configuring qmail: The Basics er 3 Ch apt - Using qmail er 4 Ch apt - Managing qmail er 5 Ch apt - Troubleshooting qmail er 6 Ch apt - Configuring qmail: Advanced Options er 7 Ch apt - Controlling Junk Mail er 8 Ch apt - Managing Mailing Lists er 9 Ch apt - Serving Mailboxes er 10 Ch apt - Hosting Virtual Domain and Users er 11 Ch apt - Understanding Advanced Topics er 12 Ap pe ndi - How qmail Works x A Ap pe ndi - Related Packages x B Ap pe ndi - How Internet Mail Works x C Ap pe ndi - qmail Features x D Ap pe - Error Messages ndi x E Ap pe - Gotchas ndi x F Index List of Figures List of Tables List of Listings < Free Open Study > < Free Open Study > Back Cover • Provides thorough instruction for installing, configuring, and optimizing qmail • Includes coverage of secure networking, troubleshooting issues, and mailing list administration • Covers what system administrators want to know by concentrating on qmail issues relevant to daily operation • Includes instructions on how to filter spam before it reaches the client The qmail Handbook will guide system and mail administrators of all skill levels through installing, configuring, and maintaining the qmail server.
    [Show full text]
  • Auditing an Email Server Patrick Mattson May 2019
    Auditing an Email server Patrick Mattson May 2019 [email protected] Page 1 of 34 Table of Contents Proposal notes ........................................................................................................................................ 4 Learning objective 1 ................................................................................................................................ 6 Learning objective 2 ................................................................................................................................ 6 Learning objective 3 ................................................................................................................................ 6 Learning objective 4 ................................................................................................................................ 6 What are the components of an email server. ......................................................................................... 6 Microsoft Exchange Components ........................................................................................................ 7 Edge Transport - Mail Transfer Agent (MTA) ................................................................................... 7 Other components: ............................................................................................................................. 7 DNS Settings .................................................................................................................................... 7
    [Show full text]
  • Lesson 9: Configuring DNS Records
    Lesson 9: Configuring DNS Records MOAC 70-411: Administering Windows Server 2012 Overview • Exam Objective 3.2: Configure DNS Records • Configuring DNS Record Types • Using the DNSCMD Command to Manage Resource Records • Troubleshooting DNS Problems © 2013 John Wiley & Sons, Inc. 2 Configuring DNS Record Types Lesson 9: Configuring DNS Records © 2013 John Wiley & Sons, Inc. 3 DNS Records • A DNS zone database is made up of a collection of resource records, which are used to answer DNS queries. • Each resource record (RR) specifies information about a particular object. • Each record has a type, an expiration time limit, and some type-specific data. © 2013 John Wiley & Sons, Inc. 4 DNS Records Many of the resource records are automatically created: • Clients or the DHCP servers create the host and Pointer (PTR) records. • When you install a DNS server, NS records are usually created. • When you install domain controllers, Service Location (SRV) records are created. © 2013 John Wiley & Sons, Inc. 5 Creating and Configuring DNS Resource Records Different properties define different accounts: • First name, last name, and login name for a user account • Name of the printer and location for a printer in Active Directory Just as you have different types of objects in Active Directory, you also have different types of resource records in DNS, with different fields. © 2013 John Wiley & Sons, Inc. 6 Creating and Configuring DNS Resource Records When you create a new zone, two types of records are automatically created: • Specifies authoritative SOA information about a DNS zone • Specifies an authoritative NS name server for the host © 2013 John Wiley & Sons, Inc.
    [Show full text]
  • Mdaemon Messaging Server
    MDaemon Email Server | How-To Best Practices Guide Deploying a Mail System When deploying an email system, there are certain things that must be considered, including domain registration & hosting, DNS records, security/encryption requirements, and more. This document will help guide you through the pre-deployment topics that must be considered before installing MDaemon. Purchase and Register a Domain You will need to have a domain name. There are several services from which you can purchase a domain name. One of the most popular is GoDaddy. You will also need to register your domain name with ICANN through a domain name registrar. Registration fees are typically between $10 and $40 per year. Registration gives you legal rights to the domain name for one year, and must be renewed annually. Registration allows you to be certain that you are the legal, registered owner of the domain. The world’s largest domain name registrar is GoDaddy (www.godaddy.com). SSL Certificates SSL (Secure Sockets Layer) certificates are required for encrypted communications. You can purchase SSL certificates from GoDaddy, GlobalSign, or several other organizations. You an also generate your own self-signed SSL certificates in MDaemon via the Security | Security Manager | SSL & TLS configuration screen. DNS DNS (Domain Name System) is a system that translates domain names (such as example.com) into IP addresses that computers use to identify each other on the internet. DNS providers provide DNS servers, which are used to host DNS records that map domain names to IP addresses. DNS servers are normally managed by your Internet service provider (ISP), however, you can also host your own DNS server.
    [Show full text]
  • Linux Network Administrators Guide Remote Systems
    Chapter 16. ManagingTaylor UUCP UUCP was designed in the late seventies by Mike Lesk at AT&T Bell Laboratories to provide a simple dialup network over public telephone lines. Despite the popularity of dialup PPP and SLIP connections to the Internet, many people who want to have email and Usenet News on their home machine still use UUCP because it is often cheaper, especially in countries where Internet users have to pay by the minute for local telephone calls, or where they do not have a local ISP and must pay long distance toll rates to connect. Although there are many implementations of UUCP running on a wide variety of hardware platforms and operating systems, overall, they are highly compatible. However, as with most software that has somehow become standard over the years, there is no UUCP that one would call the UUCP. It has undergone a steady evolution since the first version was implemented in 1976. Currently, there are two major species that differ mainly in their hardware support and configuration. Of these two, various implementations exist, each varying slightly from its siblings. One species is known as Version 2 UUCP, which dates back to a 1977 implementation by Mike Lesk, David A. Novitz, and Greg Chesson. Although it is fairly old, it is still frequently used. Recent implementations of Version 2 provide much of the comfort that the newer UUCP species do. The second species was developed in 1983 and is commonly referred to as BNU (Basic Networking Utilities) or HoneyDanBer UUCP. The latter name is derived from the authors' names (P.
    [Show full text]
  • Network Working Group M. Nakamura Request for Comments: 3974 Kyoto University Category: Informational J
    Network Working Group M. Nakamura Request for Comments: 3974 Kyoto University Category: Informational J. Hagino IIJ Research Laboratory January 2005 SMTP Operational Experience in Mixed IPv4/v6 Environments Status of This Memo This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited. Copyright Notice Copyright (C) The Internet Society (2005). IESG Note: The content of this RFC was at one time considered by the IETF, and therefore it may resemble a current IETF work in progress or a published IETF work. This RFC is not a candidate for any level of Internet Standard. The IETF disclaims any knowledge of the fitness of this RFC for any purpose, and in particular notes that the decision to publish is not based on IETF review for such things as security, congestion control, or inappropriate interaction with deployed protocols. The RFC Editor has chosen to publish this document at its discretion. Readers of this RFC should exercise caution in evaluating its value for implementation and deployment. This document contains a specific interpretation of the applicability of the MX processing algorithm in RFC 2821, Section 5, to dual-stack environments. Implementors are cautioned that they must reference RFC 2821 for the full algorithm; this document is not to be considered a full restatement of RFC 2821, and, in case of ambiguity, RFC 2821 is authoritative. Abstract This document discusses SMTP operational experiences in IPv4/v6 dual stack environments. As IPv6-capable SMTP servers are deployed, it has become apparent that certain configurations of MX records are necessary for stable dual-stack (IPv4 and IPv6) SMTP operation.
    [Show full text]