[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to setup spamasassin blacklist?



Hi,

On Sat, Aug 23, 2025 at 09:24:27AM -0400, Haines Brown wrote:
> I believe I did exactly as suggested. I copied the template to 
> create the file ~/.spanassassin/ user_prefs and did not change 
> the default values. Instead I appended to the user_prefs file a 
> list of addresses I would like to blacklist. These lines are in 
> the form
> 
>   sender@domain.com
> 
> but perhaps used to use the form 
> 
>   blacklist_from sender@domain.com
> 
> and so appended a list in that form as well.
> 
> The ~/.Spamassassin directory is owned by me and has a 755 
> permission. The user_prefs file in that directory is also owned 
> by me and has a 644 permission. 
> 
> All this has no effect. How do I get spamd to use the
> user_prefs file? Years ago I did it without problem.

So much missing information here. You say you are using spamd, but
earlier you quote:

> users can add new rules for their own use in the
> "~/.spamassassin/user_prefs" file, if they like. (spamd disables this
> for security and increased speed.)"

So you should understand that if you are using spamd then you should not
be trying to use your own ~/.spamassassin directory.

Yet there are many ways to call SpamAssassin. Are you even sure that you
*are* using spamd? You need to talk about which MTA you use and how you
have hooked it up to spamd.

Next up you aren't being clear exactly what you have in your config:

> list of addresses I would like to blacklist. These lines are in 
> the form
> 
>   sender@domain.com

…is not valid spamd config so I guess you are not being literal. Not
being literal doesn't help when asking for advice.

> but perhaps used to use the form 
> 
>   blacklist_from sender@domain.com

…should work as long as this config file is actually being used, which
we have not established yet.

Note that:

- In modern (4.x) versions of SpamAssassin such as you find on Debian 12
  and 13 the directive is actually called "blocklist_from", though the
  old name is still accepted.

- Trying to block spam by from addresses is of very limited use and in
  general you should be trying to find more reliable ways of doing
  this, like training bayes and/or adjusting scores of rules that are
  actually hit by the spam mail. Spotting spam is already a life's work
  and doing it by sending address is just infinitely more on top.

Overall I suspect your questions are going to be more about SpamAssassin
than Debian. SpamAssassin has a vibrate user community and their mailing
list receives a lot of support questions so I strongly recommend asking
your questions there.

    https://cwiki.apache.org/confluence/display/spamassassin/MailingLists

The first thing they'll want to know though is which version of
SpamAssassin you're using, which MTA you're using, and how your MTA
calls it.

> I believe I did exactly as suggested. I copied the template to 
> create the file ~/.spanassassin/ user_prefs and did not change 
> the default values.

It didn't actually say though though. It told you to create a new config
file with only the directives you want in it. You don't need to copy a
template; the template just shows you what the defaults *are*. You can
assume they are all there to begin with. You just add your
changes/additions.

> I am in the debian-spamd120 group. A question: is this
> necessary?

Probably not. It depends how your MTA uses spamd (if it does at all).

A lot of setups have the MTA talk to spamd over TCP in which case the
spamd will be running as a single user (debian-spamd) with no access to
user home directories so no access to per-user prefs. It is possible to
have the MTA promise which user it is and have spamd act on that. It is
also possible to have the MTA only call the spamc client after it has
started to do a local delivery, which would be actually as the user
receiving the email by that point. In that case it might be over a local
socket, not TCP, and things can be more interesting. This is part of why
we can't avoid getting into how you have your MTA talking to spamd.

> In case spamassassin needs restarting I restarted spamd.
> A queston: is it necessary to do so?

Yes it's necessary to restart spamd after changing its config. Assuming
you actually are using spamd. Also you would normally want to be using
sa-update on a daily basis to update the stock rules, and that will
restart it anyway every time those change.

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting

b4ffced082478bab86fc9ba02feb0015a662e5b90a13bbcf377a9fe497c95dea


Reply to: