Rspamd – disable greylist for mail recipient

So, I had a request from user to disable greylisting for he’s mail account only. Greylisting on server otherwise should be enabled. Rspamd offers few different filters to disable greylist: for IP, for sender domain, but I didn’t see any options for recipient.

Here is a simple lua script which disables greylisting for a specific recipient on your mail server. To do exactly like described here, you should upgrade your Rspamd to at least 3.11.

First, create file “/etc/rspamd/lua.local.d/disable_gl.lua” and add code bellow. Also, create “/etc/rspamd/maps.d/disable_grey.map” map file which will contain with recipient addresses with greylist disabled.

local rspamd_logger = require "rspamd_logger"
local rspamd_util = require "rspamd_util"

local disable_grey_map = rspamd_config:add_map({
    type = "regexp",
    url = "/etc/rspamd/maps.d/disable_grey.map",
    description = "Disable greylisting map"
})


local function disable_greylisting(task)
    local rcpt = task:get_recipients("smtp")
    if not rcpt then return end

    for _, r in ipairs(rcpt) do
	if disable_grey_map and disable_grey_map:get_key(r['addr']) then
            rspamd_logger.infox(task, "Disabling greylisting for recipient: %s", r['addr'])
            task:disable_action('greylist')
            return
        end
    end
end

rspamd_config:register_symbol({
    name = "DISABLE_GREYLIST",
    type = "callback",
    callback = disable_greylisting
})

Disable OPcache for specific PHP script. Exclude from OPcache.

Sometimes accelerating with opcache can cause some problems with your application scripts. In those cases, when your script shouldn’t be accelerated, you can specify those scripts with opcache’s blacklist which will exclude this files from acceleration. Example bellow is done on CentOS 7.

First, find configuration file for your opcache php extension. You can do something like this:

[root@meow php.d]# php -i | grep opcache | grep ini
Additional .ini files parsed => /etc/php.d/10-opcache.ini,

Open 10-opcache.ini and you should see something like bellow. Path to opcache’s blacklist file.

; The location of the OPcache blacklist file (wildcards allowed).
; Each OPcache blacklist file is a text file that holds the names of files
; that should not be accelerated.
opcache.blacklist_filename=/etc/php.d/opcache*.blacklist

Close 10-opcache.ini and open file named opcache-default.blacklist which should be in same directory. If not, create one. This file will contain a list of php scripts which should be ignored by opcache. 

[root@meow php.d]# cat opcache-default.blacklist
; The blacklist file is a text file that holds the names of files
; that should not be accelerated. The file format is to add each filename
/path/to/ignored/script/ignoreThis.php
/path/to/another/ignored/script/ignoreThisToo.php
...

© 2025 geegkytuts.net
Hosted by SIEL


About author