[Rspamd-Users] Implemented /etc/hosts files processing - any documentation around yet?

Duncan Bellamy a.16bit.sysop at gmail.com
Thu Apr 30 16:29:44 UTC 2020


Why not?  If you are going to update the host file blocklist it’s hardly much more effort to process into a map file as well?

> On 30 Apr 2020, at 17:21, Stefan Bauer <cubewerk at gmail.com> wrote:
> 
> Thank you for your time. I simply just dont want to mess with the sources
> files :)
> 
> Am Do., 30. Apr. 2020 um 18:17 Uhr schrieb Duncan Bellamy <
> a.16bit.sysop at gmail.com <mailto:a.16bit.sysop at gmail.com>>:
> 
>> The easiest way would be to use sed to process the host files or generate
>> maps eg:
>> 
>> Edit in place:
>> sed 's+^0.0.0.0[[:space:]]*++g' -i hosts
>> 
>> Create map:
>> cat hosts | sed 's+^0.0.0.0[[:space:]]*++g' > hosts.map
>> 
>> It can be done with awk as well.
>> 
>> Both match 0.0.0.0 at beginning of line, if there is space or tab before
>> the 0.0.0.0 it won’t match unless you change the expression.
>> 
>>> On 30 Apr 2020, at 16:28, Stefan Bauer <cubewerk at gmail.com> wrote:
>>> 
>>> I'm aware of the function, but my source files are in hosts file style
>> and
>>> i do not want to modify the source files.
>>> 
>>> 0.0.0.0 badguys.com <http://badguys.com/> <http://badguys.com/ <http://badguys.com/>>
>>> 
>>> multimap requires - in all the ways i'm aware of - the files in the form
>>> badguys.com <http://badguys.com/> <http://badguys.com/ <http://badguys.com/>>
>>> 
>>> Am Do., 30. Apr. 2020 um 17:25 Uhr schrieb Duncan Bellamy <
>>> a.16bit.sysop at gmail.com <mailto:a.16bit.sysop at gmail.com> <mailto:a.16bit.sysop at gmail.com <mailto:a.16bit.sysop at gmail.com>>>:
>>> 
>>>> Here is two whitelist examples:
>>>> 
>>>> domain_whitelist {
>>>> type = "from"
>>>> filter = "email:domain:tld"
>>>> map = "${LOCAL_CONFDIR}/local.d/maps.d/whitelist.map";
>>>> description = "List of domains to whitelist";
>>>> action = "accept";
>>>> }
>>>> 
>>>> ip_whitelist {
>>>> type = "ip";
>>>> prefilter = "true";
>>>> map = "${LOCAL_CONFDIR}/local.d/maps.d/ip_whitelist.map";
>>>> description = "List IP addresses to whitelist";
>>>> action = "accept";
>>>> }
>>>> 
>>>> whitelist, accepts any domain listed and ip_whitelist accepts and ip
>>>> listed.  It’s not 0.0.0.0 badguys.com <http://badguys.com/> <http://badguys.com/ <http://badguys.com/>> <
>> http://badguys.com/ <http://badguys.com/> <http://badguys.com/ <http://badguys.com/>>>,  just
>>>> badguys.com <http://badguys.com/> <http://badguys.com/ <http://badguys.com/>> <http://badguys.com/ <http://badguys.com/> <
>> http://badguys.com/>> (and change to reject!)
>>>> 
>>>>> On 30 Apr 2020, at 16:19, Stefan Bauer <cubewerk at gmail.com> wrote:
>>>>> 
>>>>> Of corse I'm aware of that module. It just does not directly support
>>>>> hosts-file style map source files.
>>>>> 
>>>>> Am Do., 30. Apr. 2020 um 16:53 Uhr schrieb dunc <
>> a.16bit.sysop at gmail.com
>>>>> :
>>>>> 
>>>>>> Have you tried the multimap module?
>>>>>> 
>>>>>> On Thu, 30 Apr 2020, 11:03 Stefan Bauer, <cubewerk at gmail.com> wrote:
>>>>>> 
>>>>>>> Thanks for confirming what i was not hoping ;)
>>>>>>> Then i need to find another way to have hosts-file style files in
>> maps.
>>>>>>> Dont wanted to fiddle with the source files.
>>>>>>> 
>>>>>>> Am Do., 30. Apr. 2020 um 11:39 Uhr schrieb Arno Welzel <
>>>>>>> privat at arnowelzel.de
>>>>>>>> :
>>>>>>> 
>>>>>>>> Stefan Bauer:
>>>>>>>> 
>>>>>>>>> Implemented /etc/hosts files processing according to changelog.
>>>>>>>> 
>>>>>>>> You mean "Implement hosts file processing" here?
>>>>>>>> <https://github.com/rspamd/rspamd/blob/master/ChangeLog>
>>>>>>>> 
>>>>>>>> Also see:
>>>>>>>> <https://rspamd.com/doc/faq.html>
>>>>>>>> 
>>>>>>>> ----------
>>>>>>>> Please bear in mind that Rspamd does NOT use the standard resolver
>>>>>>>> libraries for performace and sanity considerations, so all resolvers
>>>>>>>> configuration must be either static (in the normal /etc/resolv.conf
>> or
>>>>>>>> in local.d/options.inc for Rspamd specific resolvers) or Rspamd
>> should
>>>>>>>> be reloaded (or restarted) on any DNS resolvers change. Rspamd
>>>>>> currently
>>>>>>>> does not read /etc/hosts file as well.
>>>>>>>> ----------
>>>>>>>> 
>>>>>>>> I think, the change only affects that section "does not read
>>>> /etc/hosts
>>>>>>>> file as well" and from version 2.5 nowards, DNS resolving also uses
>>>>>>>> /etc/hosts now.
>>>>>>>> --
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.rspamd.com
>>>>>>>> https://lists.rspamd.com/mailman/listinfo/users
>>>>>>>> 
>>>>>>> --
>>>>>>> Users mailing list
>>>>>>> Users at lists.rspamd.com
>>>>>>> https://lists.rspamd.com/mailman/listinfo/users
>>>>>>> 
>>>>>> --
>>>>>> Users mailing list
>>>>>> Users at lists.rspamd.com
>>>>>> https://lists.rspamd.com/mailman/listinfo/users
>>>>>> 
>>>>> --
>>>>> Users mailing list
>>>>> Users at lists.rspamd.com <mailto:Users at lists.rspamd.com>
>>>>> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users>
>>>> 
>>>> --
>>>> Users mailing list
>>>> Users at lists.rspamd.com <mailto:Users at lists.rspamd.com> <mailto:Users at lists.rspamd.com <mailto:Users at lists.rspamd.com>>
>>>> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users> <
>> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users>>
>>>> 
>>> --
>>> Users mailing list
>>> Users at lists.rspamd.com <mailto:Users at lists.rspamd.com> <mailto:Users at lists.rspamd.com <mailto:Users at lists.rspamd.com>>
>>> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users> <
>> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users>>
>> --
>> Users mailing list
>> Users at lists.rspamd.com <mailto:Users at lists.rspamd.com>
>> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users>
>> 
> -- 
> Users mailing list
> Users at lists.rspamd.com <mailto:Users at lists.rspamd.com>
> https://lists.rspamd.com/mailman/listinfo/users <https://lists.rspamd.com/mailman/listinfo/users>


More information about the Users mailing list