Commit graph

10 commits

Author SHA1 Message Date
joerg
82bdfe81ee Fix typo. Thanks schmonz@ 2007-07-03 14:42:33 +00:00
joerg
e24209d145 Add common handling for libresolv similiar to dlopen(3) wrapping.
For now, DragonFly and FreeBSD use the libc version, it is not reentrant,
but thread-safe. NetBSD 3.0+ and Darwin 8.0+ use libresolv from base
(the BIND9 resolver), all other fall back to net/bind9. Feel free to add
your favorite platform if it has a thread-safe resolver in base.

Modify mail/libspf-alf, mail/milter-greylist, mail/spamdyke and
net/nocol accordingly. Testing on !DragonFly and feedback from tron@
2007-07-03 13:54:45 +00:00
schmonz
e399928025 Update to 2.6.3. From the changelog:
Fixed a serious bug where spamdyke was closing the connection to qmail and
    exiting as soon as the remote host exited.  When the remote host sends its
    SMTP data in one burst and closes the connection without waiting for the
    response code from the DATA segment, qmail doesn't accept the message and
    nothing gets delivered.
  Added some code to log_writeln() to translate bare carriage returns into
    carriage return/linefeed combinations.  This allows poorly written remote
    servers to send mail, most notably Microsoft web servers.  Dogmatically
    refusing to accept mail by refusing to be more flexible than RFC 822
    will never change the world; let's be reasonable instead of bouncing
    messages back to our friends who can't change their mail servers anyway.
  Fixed smtp_filter() to accept parameters to AUTH LOGIN when the MUA sends the
    authentication information with the command instead of waiting for the
    prompts.  Thanks to Carlo Blohm for reporting this one.
2007-06-21 19:08:45 +00:00
schmonz
5e34cbf654 Update to 2.6.2. From the changelog:
Fixed smtp_filter() to accept parameters to AUTH PLAIN when the MUA sends the
    authentication information with the command instead of waiting for another
    prompt.
  Changed find_address() to strip BATV tags from addresses so whitelist/
    blacklist matching can still take place.  Reported by Walter Russo.
  Added utils/passwordcheck to help troubleshoot SMTP AUTH problems.
  Added more logging to exec_checkpassword() to aid troubleshooting.
2007-06-08 01:08:29 +00:00
schmonz
88398b2bc2 Update to 2.6.1. From the changelog:
* Changed calls to tolower() and isalnum() to eliminate warnings
    from gcc 3.3.3 on NetBSD 3.1.  Thanks to David Frese for reporting
    this one.

* Fixed a very small typo in the new mask/flag system that was
    preventing spamdyke from advertising SMTP AUTH on unpatched
    qmail servers -- FILTER_FLAG_AUTH_ADD had the same value as
    FILTER_FLAG_AUTH_NONE.  Oops.  Thanks to Renato Franzin for
    reporting this one.

* Fixed an oversight in the use of gethostbyname() to perform DNS
    lookups for A records.  If the server is configured to search
    a domain for matching names ("search" in /etc/resolv.conf) and
    the domain has a wildcard DNS entry, the DNS RBL code was always
    matching because an A record was always found.  Adding a dot
    to the end of the queried name prevents the domain searching
    and returns correct results.  Thanks to "Paolo", Alexander
    Fordyce and Jens Mickerts for reporting and helping me troubleshoot
    this one.
2007-06-04 21:54:05 +00:00
schmonz
50d9979579 Update to 2.6.0. From the changelog:
Added support for STARTTLS, similar to the way SMTP AUTH is implemented -- if
    a server certificate is available, spamdyke takes care of the TLS.  If not
    but qmail supports TLS, spamdyke passes it through.
  Changed the read() and write() calls to the network to use macros named
    NETWORK_READ() and NETWORK_WRITE() that are replaced by TLS routines when
    TLS support has been compiled in.
  Changed the smtp_filter() return codes to use a mask/flag system because the
    possible permutations of PASS/INTERCEPT/QUIT with ADD/REMOVE/CAPTURE AUTH
    and ADD/REMOVE/CAPTURE TLS and CHILD QUIT/CONTINUE were getting too complex.
  Fixed search_file() to match a file entry where the search text matches the
    entry completely but the entry has wildcard markers at the start and/or end.
  Added TLS support to tests/sendrecv so TLS can be tested from scripts.
  Fixed numerous small bugs in tests/sendrecv that were causing inaccurate test
    results (false positives and false negatives).
  Updated all of the test scripts to make renumbering them easier.
  Added a new test script to exercise a small whitelist wildcard bug I found.
  Added 10 new test scripts to exercise the new TLS features.
  Changed process_command_line() and usage() to print a brief usage message if
    no parameters are given.
  Changed process_command_line() and usage() to print a brief error message if
    a bad parameter is given.
  Changed process_command_line() and usage() to print the full usage message if
    -h or --help is given.
  Changed process_command_line() and usage() to print the version header if -v
    or --version is given.
  Renamed test_smtpauth_crammd5, test_smtpauth_login and test_smtpauth_plain to
    smtpauth_crammd5, smtpauth_login and smtpauth_plain, respectively.
  Moved smtpauth_crammd5, smtpauth_login and smtpauth_plain from the utils
    folder to tests/smtpauth, since they're only used by the test scripts
    anyway.
  Added alternate command line options for people who spell "gray" with an "e".
    They do the same thing.
  Updated the documentation.
2007-05-30 05:58:10 +00:00
schmonz
6c9c63a232 Update to 2.5.0. From the changelog:
Moved portions of spamdyke's code from spamdyke.c into new .c and .h files to
    make it a little easier to understand and maintain.
  Added base64_encode() and base64_decode() to transfer data to/from base64
    format.
  Added md5() to produce an MD5 digest of a data block.  Turns out this wasn't
    necessary for spamdyke, only for test_smtpauth_crammd5.  Oops.
  Renamed the "make openbsd" command to "make bsd" since apparently all *BSD
    distributions don't need -lresolv.
  Renamed search_ip_file() to search_tcprules_file() and extended it to support
    IP ranges, rDNS names and remote info like tcprules does (according to
    http://cr.yp.to/ucspi-tcp/tcprules.html).  This makes the IP black/
    whitelist files much more flexible.  This will be much handier in the next
    version (AKA The Great Configuration Overhaul).
  Modified middleman() and smtp_filter(), added exec_checkpassword() so spamdyke
    can do SMTP AUTH, either by offering it itself or observing the qmail
    traffic.  LOGIN, PLAIN and CRAM-MD5 are supported.
  Changed the STRLEN_ macros in spamdyke.h to use a single STRLEN() macro so the
    preprocessor will count characters instead of doing it by hand.  Much safer
    this way.
  Removed "-a"'s (max number of recipients per message) dependence on "-d"
    (local domains file).  With SMTP AUTH, the local access file and whitelists,
    this shouldn't be necessary.
  Added process_access() to process local access files (e.g. /etc/tcp.smtp) and
    export environment variables based on the source of the incoming connection.
  Added relay prevention based on the content of the local access file(s) and
    the list(s) of local domains.  Connections from remote sources that are
    granted relay permission in the access file(s) are allowed to relay.  Users
    who authenticate with SMTP AUTH are allowed to relay.  All others must send
    to local addresses only.
  Added a series of test scripts to exercise all of spamdyke's filters and
    options.  This should make it easier to regression test new versions.
  Changed search_file() and search_tcprules_file() to compare domain names in a
    case insensitive manner.
  Changed canonicalize_path() to reduce all file paths to lowercase.  This was
    causing graylisting to be inconsistant.  Reported by bcarr@purgatoire.org.
2007-05-07 19:43:43 +00:00
joerg
01186e9166 Use OpenBSD case for DragonFly. 2007-04-18 15:36:18 +00:00
schmonz
c84d21987b Update to 2.4.0. From the changelog:
Added search_ip_file() to search files for IP addresses and allow wildcards,
    network sizes (numbers of bits, e.g. 11.22.33.44/16) and netmasks (e.g.
    11.22.33.0/255.255.255.0).
  Added new options to allow graylisting exclusions by IP address and rDNS
    name.
  Added new options to activate graylisting for only certain IP addresses and
    rDNS names.
  Updated the documentation.

  Added some explicit casting to printf("%.*s") arguments to make them ints
    instead of longs.  gcc 3.3 on OpenBSD was complaining.
  Changed a datatype in log_write() from long to time_t.  gcc 3.3 on OpenBSD
    was complaining.
  Changed all uses of sprintf() to snprintf(), even though they were already
    safe from buffer overruns.  gcc 3.3 on OpenBSD was complaining.
  Added a new target to the Makefile in the spamdyke and utils folders named
    "openbsd" that compiles without the "-lresolv" flag.  gcc 3.3 on OpenBSD
    includes the resolver library automatically and throws an error when it
    is explicitly specified.
  Added some additional #include directives in dnsmx.c, dnsptr.c and dnstxt.c
    because they're not included by resolv.h on OpenBSD.

  Gained a broader understanding of the resolver library and DNS packet
    structure, then rewrote most of dns_txt() and dns_ptr_lookup() to (more)
    correctly process DNS data.
  Added dns_mx() to perform MX record lookups.
  Changed process_command_line() to use getopt_long() and added long option
    equivalents to the existing command line flags.
  Added the option "reject-missing-sender-mx" to reject email from senders
    whose domains aren't local and don't have MX records and/or A records.
    AOL does this.
  Updated the usage statement to show the new (long) command line options.
  Updated the README.txt to show the new (long) command line options.
  Moved domain2path and domainsplit into a new folder named "utils".
  Created dnsmx, dnsptr and dnstxt in the utils folder by copying the dns_mx(),
    dns_ptr() and dns_txt() functions from spamdyke.  They are simple command
    line utilities that no one will ever use except as examples of how to make
    MX, PTR and TXT DNS queries using libc.  As far as Google knows, there are
    no such examples anywhere else on the internet.
  Changed the DNS RBL code to check for A records in addition to TXT records.
    Some RBLs are using A records, I don't know why.
  Fixed the DNS RBL code not to check 127.0.0.1 for RBL entries.
2007-04-11 14:50:37 +00:00
schmonz
8a570f2200 Initial import of spamdyke 2.2.1.
spamdyke monitors incoming traffic, acting as a middleman between
qmail and the remote server. It catches the sender and recipient
addresses as they go by and logs them to syslog. If it sees something
it doesn't like (e.g. a blacklisted sender), it cuts the connection,
closes qmail and fakes the rest of the SMTP transaction with the
remote server. qmail thinks the remote server disconnected normally.
The remote server thinks qmail is rejecting the message. It's the
best of both worlds.

spamdyke can optionally reject the connection if the remote server's
reverse DNS entry does not exist, does not resolve, contains its
IP address and either contains a prohibited keyword (like "dynamic")
or ends in a country code; if the IP address, reverse DNS entry,
or envelope sender is listed in a blacklist; or if data is sent
before the SMTP greeting banner is displayed. spamdyke can also
limit recipients per connection, greylist for some or all domains,
and close connections that go idle or take too long.
2007-03-24 07:39:25 +00:00