aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-27 12:44:18 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-27 12:44:18 +0300
commit749503560ef72d7b20f935487a77ee4fbc8a9e3f (patch)
treee5d76effbcffaa834efaaf2f0c83db3e32d31c12
parent7551c7a9483ea4821dc76bd72fe5441d99a63ed3 (diff)
downloadrspamd-749503560ef72d7b20f935487a77ee4fbc8a9e3f.tar.gz
rspamd-749503560ef72d7b20f935487a77ee4fbc8a9e3f.zip
* Fix dependencies on perlxs target (do not rebuild it constantly)
* Fix rspamc to understand lmtp and delivery sections in config * Fix parser's states when reading module options * Add sample config for surbl module with comments --HG-- rename : rspamc.pl => rspamc.pl.in
-rw-r--r--CMakeLists.txt7
-rwxr-xr-xrspamc.pl.in (renamed from rspamc.pl)4
-rw-r--r--rspamd.conf.sample31
-rw-r--r--src/cfg_file.l8
4 files changed, 44 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9928c1757..275562b63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -270,14 +270,18 @@ ADD_CUSTOM_COMMAND(OUTPUT src/modules.c
COMMAND ../utils/gen-modules.sh ${PLUGINSSRC}
WORKING_DIRECTORY src)
-ADD_CUSTOM_TARGET(perlxs ALL
+ADD_CUSTOM_COMMAND(OUTPUT perl/Makefile
COMMAND ${PERL_EXECUTABLE} ./Makefile.PL
+ WORKING_DIRECTORY perl)
+ADD_CUSTOM_TARGET(perlxs
COMMAND make
+ DEPENDS perl/Makefile
WORKING_DIRECTORY perl
VERBATIM)
CONFIGURE_FILE(config.h.in src/config.h)
CONFIGURE_FILE(perl/Makefile.PL.in perl/Makefile.PL)
+CONFIGURE_FILE(rspamc.pl.in rspamc.pl @ONLY)
ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CONTRIBSRC} ${TOKENIZERSSRC}
${CLASSIFIERSSRC} ${PLUGINSSRC} ${YACC_OUTPUT}
@@ -292,6 +296,7 @@ IF(PERL_DYNALOADER)
TARGET_LINK_LIBRARIES(rspamd dynaloader)
ENDIF(PERL_DYNALOADER)
TARGET_LINK_LIBRARIES(rspamd ${GMIME2_LIBRARIES})
+ADD_DEPENDENCIES(rspamd perlxs)
ADD_EXECUTABLE(test/rspamd-test ${TESTDEPENDS} ${CONTRIBSRC} ${TESTSRC})
SET_TARGET_PROPERTIES(test/rspamd-test PROPERTIES LINKER_LANGUAGE C)
diff --git a/rspamc.pl b/rspamc.pl.in
index e04a5bfce..8caeb28a3 100755
--- a/rspamc.pl
+++ b/rspamc.pl.in
@@ -10,7 +10,7 @@
use Socket qw(:DEFAULT :crlf);
my %cfg = (
- 'conf_file' => './rspamd.conf',
+ 'conf_file' => '@CMAKE_INSTALL_PREFIX@/etc/rspamd.conf',
'command' => 'SYMBOLS',
'host' => 'localhost',
'port' => '11333',
@@ -33,7 +33,7 @@ sub parse_config {
my $ctrl = 0;
while (<CONF>) {
- if ($_ =~ /control\s*{/i) {
+ if ($_ =~ /control\s*{/i || $_ =~ /lmtp\s*{/i || $_ =~ /delivery\s*{/i) {
$ctrl = 1;
}
if ($ctrl && $_ =~ /}/) {
diff --git a/rspamd.conf.sample b/rspamd.conf.sample
index 41b44ccdd..b440a3325 100644
--- a/rspamd.conf.sample
+++ b/rspamd.conf.sample
@@ -76,14 +76,45 @@ factors {
"winnow" = 5.5;
};
+# Options for lmtp worker
lmtp {
enabled = yes;
+ # Bind socket for lmtp interface
bind_socket = localhost:11335;
+ # Metric that is considered as main. If we have spam result on
+ # this metric, lmtp delivery would be failed
+ metric = "default";
};
delivery {
enabled = yes;
+ # Path to delivery agent, %f is expanded as mail from address and %r
+ # is expanded as recipient address
+ # Expample: agent = "/usr/local/bin/procmail -f %f -d %r"
agent = "/dev/null";
+ # Bind socket for lmtp interface
+ # Example: bind_socket = localhost:25
+
+ # Whether we should use lmtp for MTA delivery
+ lmtp = no;
+};
+
+# SURBL module params, note that single quotes are mandatory here
+.module 'surbl' {
+ # Address to redirector in host:port format
+ redirector = "localhost:8080";
+ # Connect timeout for redirector
+ redirector_connect_timeout = "1s";
+ # IO timeout for redirector (may be usefull to set this value rather big)
+ redirector_read_timeout = "10s";
+ # This is suffix for surbl dns requests
+ suffix = "multi.surbl.org";
+ # Metric for surbl module
+ metric = "default";
+ # List of public known hostings (for which we should use 3 components of domain name instead of 2)
+ hostings = "narod.ru,pp.ru,org.ru,net.ru";
+ # Whitelisted urls
+ whitelist = "highsecure.ru,freebsd.org";
};
url_filters = "surbl";
diff --git a/src/cfg_file.l b/src/cfg_file.l
index d2810c5bb..b28bbd263 100644
--- a/src/cfg_file.l
+++ b/src/cfg_file.l
@@ -133,11 +133,13 @@ yes|YES|no|NO|[yY]|[nN] yylval.flag=parse_flag(yytext); return FLAG;
<module>\n /* ignore EOL */;
<module>[ \t]+ /* ignore whitespace */;
-<module>\'[a-zA-Z0-9_-]\' yylval.string=strdup(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return MODULE_OPT;
+<module>^[ \t]*#.* /* ignore comments */;
+<module>\'[a-zA-Z0-9_-]+\' yylval.string=strdup(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return MODULE_OPT;
<module>\{ return OBRACE;
-<module>\} return EBRACE;
+<module>\} BEGIN(INITIAL); return EBRACE;
<module>\; return SEMICOLON;
-<module>[a-zA-Z0-9_-] yylval.string=strdup(yytext); return PARAM;
+<module>= return EQSIGN;
+<module>[a-zA-Z0-9_-]+ yylval.string=strdup(yytext); return PARAM;
<module>\$[a-zA-Z_][a-zA-Z0-9_]+ yylval.string=strdup(yytext + 1); return VARIABLE;
<module>\"[^"]+\" yylval.string=strdup(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return QUOTEDSTRING;