Mailing List Archive

symlinking config files
Hi gang,

my first post here.

I'm running version 4.0.0-8 on debian testing. This is for
Mailman. I have a script that creates a welcomelist for all my
Mailman members. I include it via a symlink.

# ls -l /etc/spamassassin/88_mailman_members.cf
lrwxrwxrwx 1 root root 57 Jan 5 15:52 /etc/spamassassin/88_mailman_members.cf -> ../../home/mailman/opt/spamassassin/88_mailman_members.cf

Clearly spamassassin follows the symlink and reads the file. I can
see by just making a mistake in it, mistyping welcomelist as
wlcomelist

root@tagol~# spamassassin --lint
Jan 5 17:58:51.081 [783424] warn: config: failed to parse line in /etc/spamassassin/88_mailman_members.cf (line 1248): wlcomelist_from krichel@openlib.org
root@tagol~#

But

# spamc -R < /tmp/test.mail

does not see the welcomelisted user. It's only when I remove the
syslink, and replace it with the file

rm /etc/spamassassin/88_mailman_members.cf
cp /home/mailman/opt/spamassassin/88_mailman_members.cf /etc/spamassassin/88_mailman_members.cf

and restart

# systemctl restart spamd

that

# spamc -R < /tmp/test.mail

sees the welcomelisted user. I am puzzled by this.


--
Written by Thomas Krichel http://openlib.org/home/krichel on his 21399th day.
Re: symlinking config files [ In reply to ]
On Friday 05 January 2024 at 19:53:00, Thomas Krichel wrote:

> I'm running version 4.0.0-8 on debian testing. This is for
> Mailman. I have a script that creates a welcomelist for all my
> Mailman members. I include it via a symlink.

> Clearly spamassassin follows the symlink and reads the file.

> But
>
> # spamc -R < /tmp/test.mail
>
> does not see the welcomelisted user. It's only when I remove the
> syslink, and replace it with the file

> and restart that
>
> # spamc -R < /tmp/test.mail
>
> sees the welcomelisted user. I am puzzled by this.

I would look at the ownership / permissions of the file, and the directories it
is under, in both cases.

Check the user which spamc runs as and ensure that this user can read the file
which is symlinked to.

Testing stuff as root can be misleading.


Antony.

--
Pavlov is in the pub enjoying a pint.
The barman rings for last orders, and Pavlov jumps up exclaiming "Damn! I
forgot to feed the dog!"

Please reply to the list;
please *don't* CC me.
Re: symlinking config files [ In reply to ]
Antony Stone writes

> Check the user which spamc runs

Thank you for this!

root@tagol~# ps axf | grep spam
789246 ? S 0:00 \_ spamd child
root@tagol~# ps axf | grep spam
662102 ? Ss 0:00 gpg-agent --homedir /etc/spamassassin/sa-update-keys --use-standard-socket --daemon
778204 pts/20 T 0:00 \_ emacs -nw /etc/spamassassin/local.cf
790063 pts/20 S+ 0:00 \_ grep --color=auto spam
789238 ? Ss 0:01 /usr/bin/perl -T -w /usr/sbin/spamd --pidfile=/run/spamd.pid --create-prefs --max-children 5 --helper-home-dir
789245 ? S 0:00 \_ spamd child
789246 ? S 0:00 \_ spamd child

for better or worse it seems it's running as root.

> as and ensure that this user can read the file
> which is symlinked to.
>
> Testing stuff as root can be misleading.

Sure. I also tested spamasssin from a completely plain vanilla user

$ spamassassin --lint
Jan 5 19:15:42.326 [792794] warn: config: failed to parse line in /etc/spamassassin/88_mailman_members.cf (line 1248): wlcomelist_from krichel@openlib.org


--
Written by Thomas Krichel http://openlib.org/home/krichel on his 21399th day.
Re: symlinking config files [ In reply to ]
On 2024-01-05 at 13:53:00 UTC-0500 (Fri, 5 Jan 2024 18:53:00 +0000)
Thomas Krichel <krichel@openlib.org>
is rumored to have said:

> Hi gang,
>
> my first post here.
>
> I'm running version 4.0.0-8 on debian testing. This is for
> Mailman. I have a script that creates a welcomelist for all my
> Mailman members. I include it via a symlink.
>
> # ls -l /etc/spamassassin/88_mailman_members.cf
> lrwxrwxrwx 1 root root 57 Jan 5 15:52
> /etc/spamassassin/88_mailman_members.cf ->
> ../../home/mailman/opt/spamassassin/88_mailman_members.cf
>
> Clearly spamassassin follows the symlink and reads the file. I can
> see by just making a mistake in it, mistyping welcomelist as
> wlcomelist
>
> root@tagol~# spamassassin --lint
> Jan 5 17:58:51.081 [783424] warn: config: failed to parse line in
> /etc/spamassassin/88_mailman_members.cf (line 1248): wlcomelist_from
> krichel@openlib.org
> root@tagol~#
>
> But
>
> # spamc -R < /tmp/test.mail
>
> does not see the welcomelisted user. It's only when I remove the
> syslink, and replace it with the file

Why would you think spamc ever sees any SA rules file? That would pretty
much destroy any excuse for using spamc/spamd.

You probably only needed to restart spamd.


> rm /etc/spamassassin/88_mailman_members.cf
> cp /home/mailman/opt/spamassassin/88_mailman_members.cf
> /etc/spamassassin/88_mailman_members.cf
>
> and restart
>
> # systemctl restart spamd

Should have tried that first...

>
> that
>
> # spamc -R < /tmp/test.mail
>
> sees the welcomelisted user. I am puzzled by this.
>
>
> --
> Written by Thomas Krichel http://openlib.org/home/krichel on his
> 21399th day.


--
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire
Re: symlinking config files [ In reply to ]
Bill Cole writes

> You probably only needed to restart spamd.

I think I did this every time I tested, and I tested many times
over.

--
Written by Thomas Krichel http://openlib.org/home/krichel on his 21399th day.
Re: symlinking config files [ In reply to ]
Thomas Krichel wrote:
>
> Hi gang,
>
> my first post here.
>
> I'm running version 4.0.0-8 on debian testing. This is for
> Mailman. I have a script that creates a welcomelist for all my
> Mailman members. I include it via a symlink.
>
> # ls -l /etc/spamassassin/88_mailman_members.cf
> lrwxrwxrwx 1 root root 57 Jan 5 15:52 /etc/spamassassin/88_mailman_members.cf -> ../../home/mailman/opt/spamassassin/88_mailman_members.cf
>
> Clearly spamassassin follows the symlink and reads the file. I can
> see by just making a mistake in it, mistyping welcomelist as
> wlcomelist
>
> root@tagol~# spamassassin --lint
> Jan 5 17:58:51.081 [783424] warn: config: failed to parse line in /etc/spamassassin/88_mailman_members.cf (line 1248): wlcomelist_from krichel@openlib.org
> root@tagol~#
>
> But
>
> # spamc -R < /tmp/test.mail

Did you restart spamd after adding the symlink but before this call?
Can you find the startup log entries for the last spamd start before
this call, and see if there were any errors logged that might be relevant?

The only slightly suspect item from above is the relative symlink
starting with ../ - I would suggest remaking that symlink with an
absolute path instead. Another thing to check is if there is some
security component (Apparmor/SELinux usually, IME) active - it may
object to spamd following the symlink where it allows the "spamassassin"
script.

I don't recall ever having any issues symlinking SA configuration like
this myself.

-kgd