Sa-compile must be run in advance, in order to compile the ruleset using re2c and the C compiler.
This plugin will use native-code object files representing the ruleset, in order to provide significant speedups in rule evaluation.
// RHEL/Centos/AlmaLinux
yum install gcc re2c make perl-ExtUtils-MakeMaker
// Debian/Ubuntu
apt-get install gcc re2c make sa-compile
Navigate to Warden -> Settings -> Plugin Settings -> Enable the Rule2XSBody plugin. You can test to see if the rules compile sucessfully by running the command:
// compile the rules
/usr/bin/sa-compile
// If using SELinux apply the proper lables to the compuled rules
restorecon -R -v "/var/lib/spamassassin/compiled/"
You should see it compile the rules and copy them to your spamassassin compiled rules directory.
With Rule2XSBody enabled when restarting Spamassassin you might see this if SELinux is enabled:
Oct 29 10:28:25 web spamd[19433]: logger: removing stderr method
Oct 29 10:28:27 web spamd[19477]: Can't load '/var/lib/spamassassin/compiled/5.016/3.004002/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so' for module Mail::SpamAssassin::CompiledRegexps::body_0: /var/lib/spamassassin/compiled/5.016/3.004002/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so: failed to map segment from shared object: Permission denied at /usr/share/perl5/XSLoader.pm line 68.
Oct 29 10:28:27 web spamd[19477]: at /var/lib/spamassassin/compiled/5.016/3.004002/Mail/SpamAssassin/CompiledRegexps/body_0.pm line 364.
Oct 29 10:28:27 web spamd[19477]: Can't load '/var/lib/spamassassin/compiled/5.016/3.004002/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so' for module Mail::SpamAssassin::CompiledRegexps::body_0: /var/lib/spamassassin/compiled/5.016/3.004002/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so: failed to map segment from shared object: Permission denied at /usr/share/perl5/XSLoader.pm line 68.
Oct 29 10:28:27 web spamd[19477]: at /var/lib/spamassassin/compiled/5.016/3.004002/Mail/SpamAssassin/CompiledRegexps/body_0.pm line 364.
Oct 29 10:28:27 web spamd[19477]: BEGIN failed--compilation aborted at /var/lib/spamassassin/compiled/5.016/3.004002/Mail/SpamAssassin/CompiledRegexps/body_0.pm line 365.
Oct 29 10:28:27 web spamd[19477]: Compilation failed in require at (eval 1591) line 1.
The fix is to re-apply the SELinux labels on the /var/lib/spamassassin/compiled/
directory:
restorecon -R -v "/var/lib/spamassassin/compiled/"