Drop hashcash support from Gnus and Message mode

* lisp/gnus/gnus.el (gnus-install-group-spam-parameters): Remove
'spam-use-hashcash' option.
* lisp/gnus/message.el (message-generate-hashcash): Mark as
obsolete, default to nil unconditionally.
(message-send-mail, message-setup-1, message-resend): Don't
generate hashcash headers.
* lisp/gnus/spam.el (hashcash): Don't require.
(spam-use-hashcash):
(spam-check-hashcash): Mark as obsolete.
(spam-install-hooks): Don't install 'spam-use-hashcash' hook.
* doc/misc/message.texi (Mail Headers): Don't document above
obsoleted variable 'message-generate-hashcash'.
* doc/misc/gnus.texi (Hashcash): Delete section.
(Anti-spam Hashcash Payments): Delete subsection.
(Extending the Spam package): Don't mention Hashcash.  (Bug#76195)
This commit is contained in:
Stefan Kangas 2025-02-11 18:47:27 +01:00
parent 7d5fe06e79
commit 250f421475
6 changed files with 19 additions and 134 deletions

View file

@ -874,7 +874,6 @@ Thwarting Email Spam
* The problem of spam:: Some background, and some solutions
* Anti-Spam Basics:: Simple steps to reduce the amount of spam.
* SpamAssassin:: How to use external anti-spam tools.
* Hashcash:: Reduce spam by burning CPU time.
Spam Package
@ -892,7 +891,6 @@ Spam Back Ends
* Blacklists and Whitelists::
* BBDB Whitelists::
* Gmane Spam Reporting::
* Anti-spam Hashcash Payments::
* Blackholes::
* Regular Expressions Header Matching::
* Bogofilter::
@ -24318,7 +24316,6 @@ This is annoying. Here's what you can do about it.
* The problem of spam:: Some background, and some solutions
* Anti-Spam Basics:: Simple steps to reduce the amount of spam.
* SpamAssassin:: How to use external anti-spam tools.
* Hashcash:: Reduce spam by burning CPU time.
@end menu
@node The problem of spam
@ -24540,81 +24537,6 @@ spam. And here is the nifty function:
(gnus-summary-mark-as-expirable 1))
@end lisp
@node Hashcash
@subsection Hashcash
@cindex hashcash
One technique to fight spam is to require senders to do something
costly and demonstrably unique for each message they send. This has
the obvious drawback that you cannot rely on everyone in the world
using this technique, since it is not part of the Internet standards,
but it may be useful in smaller communities.
While the tools in the previous section work well in practice, they
work only because the tools are constantly maintained and updated as
new form of spam appears. This means that a small percentage of spam
will always get through. It also means that somewhere, someone needs
to read lots of spam to update these tools. Hashcash avoids that, but
instead prefers that everyone you contact through e-mail supports the
scheme. You can view the two approaches as pragmatic vs dogmatic.
The approaches have their own advantages and disadvantages, but as
often in the real world, a combination of them is stronger than either
one of them separately.
@cindex X-Hashcash
The ``something costly'' is to burn CPU time, more specifically to
compute a hash collision up to a certain number of bits. The
resulting hashcash cookie is inserted in a @samp{X-Hashcash:} header.
For more details, and for the external application @code{hashcash} you
need to install to use this feature, see
@uref{http://www.hashcash.org/}.
If you wish to generate hashcash for each message you send, you can
customize @code{message-generate-hashcash} (@pxref{Mail Headers, ,Mail
Headers,message, The Message Manual}), as in:
@lisp
(setq message-generate-hashcash t)
@end lisp
You will need to set up some additional variables as well:
@table @code
@item hashcash-default-payment
@vindex hashcash-default-payment
This variable indicates the default number of bits the hash collision
should consist of. By default this is 20. Suggested useful values
include 17 to 29.
@item hashcash-payment-alist
@vindex hashcash-payment-alist
Some receivers may require you to spend burn more CPU time than the
default. This variable contains a list of @samp{(@var{addr}
@var{amount})} cells, where @var{addr} is the receiver (email address
or newsgroup) and @var{amount} is the number of bits in the collision
that is needed. It can also contain @samp{(@var{addr} @var{string}
@var{amount})} cells, where the @var{string} is the string to use
(normally the email address or newsgroup name is used).
@item hashcash-program
@vindex hashcash-program
Where the @code{hashcash} binary is installed. This variable should
be automatically set by @code{executable-find}, but if it's @code{nil}
(usually because the @code{hashcash} binary is not in your path)
you'll get a warning when you check hashcash payments and an error
when you generate hashcash payments.
@end table
Gnus can verify hashcash cookies, although this can also be done by
hand customized mail filtering scripts. To verify a hashcash cookie
in a message, use the @code{mail-check-payment} function in the
@code{hashcash.el} library. You can also use the @code{spam.el}
package with the @code{spam-use-hashcash} back end to validate hashcash
cookies in incoming mail and filter mail accordingly (@pxref{Anti-spam
Hashcash Payments}).
@node Spam Package
@section Spam Package
@cindex spam filtering
@ -25245,7 +25167,6 @@ Processors}).
* Blacklists and Whitelists::
* BBDB Whitelists::
* Gmane Spam Reporting::
* Anti-spam Hashcash Payments::
* Blackholes::
* Regular Expressions Header Matching::
* Bogofilter::
@ -25441,23 +25362,6 @@ default is @code{user-mail-address}.
@end defvar
@node Anti-spam Hashcash Payments
@subsubsection Anti-spam Hashcash Payments
@cindex spam filtering
@cindex hashcash, spam filtering
@cindex spam
@defvar spam-use-hashcash
Similar to @code{spam-use-whitelist} (@pxref{Blacklists and
Whitelists}), but uses hashcash tokens for whitelisting messages
instead of the sender address. Messages without a hashcash payment
token will be sent to the next spam-split rule. This is an explicit
filter, meaning that unless a hashcash token is found, the messages
are not assumed to be spam or ham.
@end defvar
@node Blackholes
@subsubsection Blackholes
@cindex spam filtering
@ -26008,8 +25912,7 @@ such a back end.
This function will install a back end that can only check incoming mail
for spam contents. It can't register or unregister messages.
@code{spam-use-blackholes} and @code{spam-use-hashcash} are such
back ends.
@code{spam-use-blackholes} is such a back end.
@item
@code{spam-install-statistical-checkonly-backend}
@ -29060,8 +28963,6 @@ that are accessible from the article buffer.
nnfolder archives.
@item Gnus now supports the ``hashcash'' client puzzle anti-spam mechanism.
Use @code{(setq message-generate-hashcash t)} to enable.
@xref{Hashcash}.
@item You can now drag and drop attachments to the Message buffer.
See @code{mml-dnd-protocol-alist} and @code{mml-dnd-attach-options}.

View file

@ -1908,13 +1908,6 @@ Regexp of headers to be removed before mailing. The default is@*
This string is inserted at the end of the headers in all message
buffers that are initialized as mail.
@item message-generate-hashcash
@vindex message-generate-hashcash
Variable that indicates whether @samp{X-Hashcash} headers
should be computed for the message. @xref{Hashcash, ,Hashcash,gnus,
The Gnus Manual}. If @code{opportunistic}, only generate the headers
when it doesn't lead to the user having to wait.
@end table

View file

@ -606,6 +606,11 @@ behavior included additional information about the originating message.
The new variable 'message-header-use-obsolete-in-reply-to', nil by
default, can be set to a non-nil value to restore the previous behavior.
+++
*** Hashcash support has been removed.
It is believed to no longer be useful as a method to fight spam. The
'message-generate-hashcash' option is now obsolete and has no effect.
** Gnus
---
@ -614,6 +619,11 @@ When called with a prefix argument, accepting, declining, or tentatively
accepting an icalendar event will prompt for a comment to add to the
response.
+++
*** Hashcash support has been removed.
It is believed to no longer be useful as a method to fight spam. The
'spam-use-hashcash' hook is now obsolete and has no effect.
** Sieve
+++

View file

@ -1925,7 +1925,6 @@ spam-autodetect-recheck-messages is set.")
(variable-item spam-use-bsfilter-headers)
(variable-item spam-use-stat)
(variable-item spam-use-blackholes)
(variable-item spam-use-hashcash)
(variable-item spam-use-bogofilter-headers)
(variable-item spam-use-bogofilter)))
:function-document
@ -1958,7 +1957,6 @@ set."
(variable-item spam-use-crm114)
(variable-item spam-use-stat)
(variable-item spam-use-blackholes)
(variable-item spam-use-hashcash)
(variable-item spam-use-spamassassin)
(variable-item spam-use-spamassassin-headers)
(variable-item spam-use-bsfilter)

View file

@ -1945,7 +1945,7 @@ no, only reply back to the author."
(const :tag "Never" nil)
(const :tag "Always" t)))
(defcustom message-generate-hashcash (if (executable-find "hashcash") 'opportunistic)
(defcustom message-generate-hashcash nil
"Whether to generate X-Hashcash: headers.
If t, always generate hashcash headers. If `opportunistic',
only generate hashcash headers if it can be done without the user
@ -1959,6 +1959,7 @@ You must have the \"hashcash\" binary installed, see `hashcash-program'."
:type '(choice (const :tag "Always" t)
(const :tag "Never" nil)
(const :tag "Opportunistic" opportunistic)))
(make-obsolete-variable 'message-generate-hashcash "it does nothing." "31.1")
;;; Internal variables.
@ -4834,8 +4835,6 @@ Valid types are `send', `return', `exit', `kill' and `postpone'."
(erase-buffer)))
(kill-buffer tembuf))))
(declare-function hashcash-wait-async "hashcash" (&optional buffer))
(defun message--check-continuation-headers ()
(message-check 'continuation-headers
(goto-char (point-min))
@ -4905,16 +4904,6 @@ If you always want Gnus to send messages in one piece, set
message-posting-charset))
(headers message-required-mail-headers)
options)
(when (and message-generate-hashcash
(not (eq message-generate-hashcash 'opportunistic)))
(message "Generating hashcash...")
(require 'hashcash)
;; Wait for calculations already started to finish...
(hashcash-wait-async)
;; ...and do calculations not already done. mail-add-payment
;; will leave existing X-Hashcash headers alone.
(mail-add-payment)
(message "Generating hashcash...done"))
(save-restriction
(message-narrow-to-headers)
;; Generate the Mail-Followup-To header if the header is not there...
@ -6967,9 +6956,6 @@ are not included."
(message-narrow-to-headers)
(run-hooks 'message-header-setup-hook))
(setq buffer-undo-list nil)
(when message-generate-hashcash
;; Generate hashcash headers for recipients already known
(mail-add-payment-async))
;; Gnus posting styles are applied via buffer-local `message-setup-hook'
;; values.
(run-hooks 'message-setup-hook)
@ -8023,7 +8009,6 @@ is for the internal use."
(let ((inhibit-read-only t))
(erase-buffer)))
(let ((message-this-is-mail t)
message-generate-hashcash
message-setup-hook)
(message-setup `((To . ,address))))
;; Insert our usual headers.
@ -8072,7 +8057,6 @@ is for the internal use."
(sendmail-coding-system 'raw-text)
(select-safe-coding-system-function nil)
message-required-mail-headers
message-generate-hashcash
rfc2047-encode-encoded-words
;; If `message-sendmail-envelope-from' is `header' then
;; the envelope-from will be the original sender's

View file

@ -4,7 +4,7 @@
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
;; Keywords: network, spam, mail, bogofilter, BBDB, dspam, dig, whitelist, blacklist, gmane, hashcash, spamassassin, bsfilter, ifile, stat, crm114, spamoracle
;; Keywords: network, spam, mail, bogofilter, BBDB, dspam, dig, whitelist, blacklist, gmane, spamassassin, bsfilter, ifile, stat, crm114, spamoracle
;; This file is part of GNU Emacs.
@ -46,8 +46,7 @@
(require 'dig)
(eval-when-compile
(require 'cl-lib)
(require 'hashcash))
(require 'cl-lib))
;; autoload spam-report
(autoload 'spam-report-gmane "spam-report")
@ -205,6 +204,7 @@ are considered spam."
"Whether hashcash payments should be detected by `spam-split'."
:type 'boolean
:group 'spam)
(make-obsolete-variable 'spam-use-hashcash "it does nothing." "31.1")
(defcustom spam-use-regex-headers nil
"Whether a header regular expression match should be used by `spam-split'.
@ -294,7 +294,6 @@ them."
spam-use-whitelist
spam-use-whitelist-exclusive
spam-use-blackholes
spam-use-hashcash
spam-use-regex-headers
spam-use-regex-body
spam-use-bogofilter
@ -1014,9 +1013,6 @@ backends)."
(spam-install-checkonly-backend 'spam-use-blackholes
#'spam-check-blackholes)
(spam-install-checkonly-backend 'spam-use-hashcash
#'spam-check-hashcash)
(spam-install-checkonly-backend 'spam-use-spamassassin-headers
#'spam-check-spamassassin-headers)
@ -2022,8 +2018,11 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
;;{{{ Hashcash.
(declare-function mail-check-payment "hashcash")
(defun spam-check-hashcash ()
"Check the headers for hashcash payments."
(declare (obsolete nil "31.1"))
(require 'hashcash)
(ignore-errors (mail-check-payment))) ;mail-check-payment returns a boolean
;;}}}