0.1.14 fixes

This commit is contained in:
SJ 2012-02-11 23:12:30 +01:00
parent 2629329b74
commit fa843306de
15 changed files with 99 additions and 117 deletions

View File

@ -67,13 +67,15 @@ $(RECURSIVE_TARGETS):
installdirs: mkinstalldirs installdirs: mkinstalldirs
$(srcdir)/mkinstalldirs \ $(srcdir)/mkinstalldirs \
$(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)/piler $(DESTDIR)$(sysconfdir) \ $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)/piler $(DESTDIR)$(sysconfdir) \
$(DESTDIR)$(datarootdir)/piler $(DESTDIR)$(includedir)/piler $(DESTDIR)$(localstatedir)/piler/store \ $(DESTDIR)$(localstatedir)/piler/store \
$(DESTDIR)$(localstatedir)/piler/stat $(DESTDIR)$(localstatedir)/piler/tmp $(DESTDIR)$(localstatedir)/piler/stat $(DESTDIR)$(localstatedir)/piler/tmp \
$(DESTDIR)$(localstatedir)/piler/sphinx
$(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/run/piler $(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/run/piler
$(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/store $(INSTALL) -d -m 0700 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/store
$(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/stat $(INSTALL) -d -m 0755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/stat
$(INSTALL) -d -m 0711 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/tmp $(INSTALL) -d -m 0711 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/tmp
$(INSTALL) -d -m 0700 -o $(RUNNING_USER) -g $(RUNNING_GROUP) $(DESTDIR)$(localstatedir)/piler/sphinx
install-am: install-am:

9
configure vendored
View File

@ -604,6 +604,7 @@ LIBOBJS
DATADIR DATADIR
CFGDIR CFGDIR
MYSQL_CONFIG MYSQL_CONFIG
iv
id_bin id_bin
libclamav_extra_libs libclamav_extra_libs
mysql_obj mysql_obj
@ -3400,6 +3401,7 @@ done
have_libclamav="no" have_libclamav="no"
have_libtool="no" have_libtool="no"
have_clamd="no" have_clamd="no"
@ -3421,7 +3423,7 @@ os=`uname -s`
id_bin="id" id_bin="id"
SUBDIRS="src" SUBDIRS="src etc util"
@ -4143,13 +4145,15 @@ fi
echo "piler data directory: $data_dir/piler" echo "piler data directory: $data_dir/piler"
iv=`util/gen-iv.pl`
echo; echo echo; echo
CFLAGS="$static -O2 -Wall -g" CFLAGS="$static -O2 -Wall -g"
LIBS="$antispam_libs $sunos_libs " LIBS="$antispam_libs $sunos_libs "
OBJS="dirs.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o $objs" OBJS="dirs.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o $objs"
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile" ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
@ -4857,6 +4861,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
"util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac esac

View File

@ -27,6 +27,7 @@ AC_SUBST(mysql_libs)
AC_SUBST(mysql_obj) AC_SUBST(mysql_obj)
AC_SUBST(libclamav_extra_libs) AC_SUBST(libclamav_extra_libs)
AC_SUBST(id_bin) AC_SUBST(id_bin)
AC_SUBST(iv)
have_libclamav="no" have_libclamav="no"
have_libtool="no" have_libtool="no"
@ -50,7 +51,7 @@ os=`uname -s`
id_bin="id" id_bin="id"
dnl SUBDIRS="src etc util perl init.d templates history contrib/stat" dnl SUBDIRS="src etc util perl init.d templates history contrib/stat"
SUBDIRS="src" SUBDIRS="src etc util"
dnl static build dnl static build
@ -267,12 +268,14 @@ fi
echo "piler data directory: $data_dir/piler" echo "piler data directory: $data_dir/piler"
iv=`util/gen-iv.pl`
echo; echo echo; echo
CFLAGS="$static -O2 -Wall -g" CFLAGS="$static -O2 -Wall -g"
LIBS="$antispam_libs $sunos_libs " LIBS="$antispam_libs $sunos_libs "
OBJS="dirs.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o $objs" OBJS="dirs.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o $objs"
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile]) AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile])
AC_OUTPUT AC_OUTPUT

View File

@ -26,11 +26,11 @@ INSTALL = @INSTALL@
all: all:
sed -e 's%pidfile=.*%pidfile=$(localstatedir)/run/piler/piler.pid%g' \ sed -e 's%pidfile=.*%pidfile=$(localstatedir)/run/piler/piler.pid%g' \
-e 's%workdir=.*%workdir=$(localstatedir)/spool/piler/tmp%g' \ -e 's%iv=.*%iv=@iv@%g' \
-e 's%queuedir=.*%queuedir=$(localstatedir)/piler/queue%g' < $(srcdir)/example.conf > $(srcdir)/piler.conf -e 's%workdir=.*%workdir=$(localstatedir)/piler/tmp%g' < $(srcdir)/example.conf > $(srcdir)/piler.conf
install: install:
if [ ! -f "$(DESTDIR)$(sysconfdir)/piler.conf" ]; then $(INSTALL) -m 0640 $(srcdir)/piler.conf $(DESTDIR)$(sysconfdir)/piler.conf; chgrp $(CLAPF_GROUP) $(DESTDIR)$(sysconfdir)/piler.conf; fi if [ ! -f "$(DESTDIR)$(sysconfdir)/piler.conf" ]; then $(INSTALL) -m 0640 -g $(RUNNING_GROUP) $(srcdir)/piler.conf $(DESTDIR)$(sysconfdir)/piler.conf; fi
clean: clean:
rm -f piler.conf cron.jobs rm -f piler.conf cron.jobs

View File

@ -25,5 +25,5 @@ piler's crontab:
sphinx's cronjob: sphinx's cronjob:
*/5 * * * * /usr/local/bin/indexer --quiet delta1 --rotate && sleep 2 && /usr/local/bin/indexer --quiet --merge main1 delta1 --merge-dst-range deleted 0 0 --rotate */5 * * * * /usr/local/bin/indexer --quiet delta1 --rotate && sleep 2 && /usr/local/bin/indexer --quiet --merge main1 delta1 --merge-dst-range deleted 0 0 --rotate
*/5 * * * * /usr/local/bin/indexer --quiet tag1 --rotate */15 * * * * /usr/local/bin/indexer --quiet tag1 --rotate

View File

@ -11,6 +11,9 @@ verbosity=1
; it it was started by root ; it it was started by root
username=piler username=piler
; this is a 16 character long vector
iv=****************
; number of worker processes, ie. the number of simultaneous smtp connections to piler. ; number of worker processes, ie. the number of simultaneous smtp connections to piler.
number_of_worker_processes=10 number_of_worker_processes=10
@ -18,7 +21,7 @@ number_of_worker_processes=10
max_requests_per_child=1000 max_requests_per_child=1000
; SMTP HELO identification string ; SMTP HELO identification string
hostid=av-engine.localhost hostid=mailarchiver.localhost
; write pid file ; write pid file
pidfile=/var/run/piler/piler.pid pidfile=/var/run/piler/piler.pid
@ -32,7 +35,7 @@ clamd_socket=/tmp/clamd
session_timeout=420 session_timeout=420
; the 2nd parameter of the listen() system call. Please note that this is set ; the 2nd parameter of the listen() system call. Please note that this is set
; when clapf starts up and you should restart clapf if you change this variable. ; when piler starts up and you should restart piler if you change this variable.
; Please also note that the meaning of this variable depends on your Unix implementation ; Please also note that the meaning of this variable depends on your Unix implementation
backlog=20 backlog=20
@ -68,7 +71,7 @@ spam_header_line=
; memcached stuff ; memcached stuff
; ;
; memcached server to use. Currently clapf support only 1 memcached server ; memcached server to use. Currently piler supports only 1 memcached server
memcached_servers=127.0.0.1 memcached_servers=127.0.0.1
; ttl (in secs) of a stored object ; ttl (in secs) of a stored object
@ -82,7 +85,7 @@ update_counters_to_memcached=0
; this setting is only effective if you have update_counters_to_memcached=1 ; this setting is only effective if you have update_counters_to_memcached=1
; ;
; hint: if you are using a mysql replicated environment and you do _not_ want ; hint: if you are using a mysql replicated environment and you do _not_ want
; clapf to write to the replicated database (because you do sync it some other ; piler to write to the replicated database (because you do sync it some other
; way to the master database or you are not interested in keeping the counters ; way to the master database or you are not interested in keeping the counters
; persistantly at all), then specify a big number here, that fits to the ; persistantly at all), then specify a big number here, that fits to the
; "long int" size, eg. 2147483647 ; "long int" size, eg. 2147483647
@ -97,26 +100,7 @@ memcached_to_db_interval=900
;mysqlport=3306 ;mysqlport=3306
mysqlsocket=/tmp/mysql.sock mysqlsocket=/tmp/mysql.sock
mysqluser=piler mysqluser=piler
mysqlpwd=changeme mysqlpwd=verystrongpassword
mysqldb=piler mysqldb=piler
mysql_connect_timeout=2 mysql_connect_timeout=2
;
; sqlite3 stuff
;
; If you are using spamdrop (not the clapf daemon), you have two options:
; 1. You may specify this variable, then every user will share this token
; database (=shared database) OR
; 2. comment this variable out, and spamdrop will figure out where the users'
; individual token databases are.
sqlite3=/var/lib/piler/data/tokens.sdb
; set sqlite3 pragma, see http://www.sqlite.org/pragma.html for more details
; possible values are:
; PRAGMA synchronous = FULL
; PRAGMA synchronous = NORMAL
; PRAGMA synchronous = OFF
sqlite3_pragma=PRAGMA synchronous = OFF

View File

@ -6,9 +6,9 @@ source main
{ {
type = mysql type = mysql
sql_host = localhost sql_host = localhost
sql_db = sphinx sql_db = piler
sql_user = sphinx sql_user = piler
sql_pass = sphinx sql_pass = piler
sql_query_pre = SET NAMES utf8 sql_query_pre = SET NAMES utf8
sql_query = SELECT id, `from`, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `attachments`, `attachment_types` FROM sph_index \ sql_query = SELECT id, `from`, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `attachments`, `attachment_types` FROM sph_index \
@ -26,9 +26,9 @@ source delta
{ {
type = mysql type = mysql
sql_host = localhost sql_host = localhost
sql_db = sphinx sql_db = piler
sql_user = sphinx sql_user = piler
sql_pass = sphinx sql_pass = piler
sql_query_pre = SET NAMES utf8 sql_query_pre = SET NAMES utf8
sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM sph_index sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM sph_index
@ -52,9 +52,9 @@ source tag
{ {
type = mysql type = mysql
sql_host = localhost sql_host = localhost
sql_db = sphinx sql_db = piler
sql_user = sphinx sql_user = piler
sql_pass = sphinx sql_pass = piler
sql_query_pre = SET NAMES utf8 sql_query_pre = SET NAMES utf8
sql_query = SELECT id, `uid`, `tag` FROM `tag` sql_query = SELECT id, `uid`, `tag` FROM `tag`
@ -67,7 +67,7 @@ source tag
index main1 index main1
{ {
source = main source = main
path = /var/data/main1 path = /var/piler/sphinx/main1
docinfo = extern docinfo = extern
charset_type = utf-8 charset_type = utf-8
} }
@ -76,7 +76,7 @@ index main1
index delta1 index delta1
{ {
source = delta source = delta
path = /var/data/delta1 path = /var/piler/sphinx/delta1
docinfo = extern docinfo = extern
charset_type = utf-8 charset_type = utf-8
} }
@ -85,7 +85,7 @@ index delta1
index tag1 index tag1
{ {
source = tag source = tag
path = /var/data/tag1 path = /var/piler/sphinx/tag1
docinfo = extern docinfo = extern
charset_type = utf-8 charset_type = utf-8
} }
@ -99,14 +99,14 @@ indexer
searchd searchd
{ {
listen = 9312 listen = 127.0.0.1:9312
listen = 9306:mysql41 listen = 127.0.0.1:9306:mysql41
log = /var/data/log/searchd.log log = /dev/null
binlog_path = binlog_path =
query_log = /var/data/log/query.log ##query_log =
read_timeout = 5 read_timeout = 5
max_children = 30 max_children = 30
pid_file = /var/data/log/searchd.pid pid_file = /var/piler/sphinx/searchd.pid
max_matches = 1000 max_matches = 1000
seamless_rotate = 1 seamless_rotate = 1
preopen_indexes = 1 preopen_indexes = 1

View File

@ -68,30 +68,18 @@ test: test.c libpiler.a
install-piler: install-piler:
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) -d $(DESTDIR)$(libdir)
$(INSTALL) -m 0644 libpiler.a $(DESTDIR)$(libdir) $(INSTALL) -m 0644 libpiler.a $(DESTDIR)$(libdir)
$(INSTALL) -m 0755 libpiler.so.$(LIBPILER_VERSION) $(DESTDIR)$(libdir) $(INSTALL) -m 0755 libpiler.so.$(LIBPILER_VERSION) $(DESTDIR)$(libdir)
(cd $(DESTDIR)$(libdir) && ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so) (cd $(DESTDIR)$(libdir) && ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so)
(cd $(DESTDIR)$(libdir) && ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so.$(PILER_VERSION)) (cd $(DESTDIR)$(libdir) && ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so.$(PILER_VERSION))
$(INSTALL) -d $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -d $(DESTDIR)$(datarootdir)/piler
$(INSTALL) -m 0755 piler $(DESTDIR)$(sbindir) $(INSTALL) -m 0755 piler $(DESTDIR)$(sbindir)
$(INSTALL) -m 0755 pilerconf $(DESTDIR)$(sbindir) $(INSTALL) -m 0755 pilerconf $(DESTDIR)$(sbindir)
$(INSTALL) -m 0755 pilerget $(DESTDIR)$(bindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerget $(DESTDIR)$(bindir)
$(INSTALL) -m 0755 pilerimport $(DESTDIR)$(bindir) $(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerimport $(DESTDIR)$(bindir)
chown $(RUNNING_USER):$(RUNNING_GROUP) $(DESTDIR)$(bindir)/pilerget
chown $(RUNNING_USER):$(RUNNING_GROUP) $(DESTDIR)$(bindir)/pilerimport
chmod +s $(DESTDIR)$(bindir)/pilerget
chmod +s $(DESTDIR)$(bindir)/pilerimport
clean: clean:
rm -f *.o *.a libpiler.so* piler pilerconf pilerget pilerimport pilertest rm -f *.o *.a libpiler.so* piler pilerconf pilerget pilerimport pilerexport pilertest
distclean: clean distclean: clean
rm -f Makefile rm -f Makefile

View File

@ -86,7 +86,6 @@ struct _parse_rule config_parse_rules[] =
{ "queuedir", "string", (void*) string_parser, offsetof(struct __config, queuedir), QUEUE_DIR, MAXVAL-1}, { "queuedir", "string", (void*) string_parser, offsetof(struct __config, queuedir), QUEUE_DIR, MAXVAL-1},
{ "session_timeout", "integer", (void*) int_parser, offsetof(struct __config, session_timeout), "420", sizeof(int)}, { "session_timeout", "integer", (void*) int_parser, offsetof(struct __config, session_timeout), "420", sizeof(int)},
{ "spam_header_line", "string", (void*) string_parser, offsetof(struct __config, spam_header_line), "", MAXVAL-1}, { "spam_header_line", "string", (void*) string_parser, offsetof(struct __config, spam_header_line), "", MAXVAL-1},
{ "sqlite3_pragma", "string", (void*) string_parser, offsetof(struct __config, sqlite3_pragma), "", MAXVAL-1},
{ "update_counters_to_memcached", "integer", (void*) int_parser, offsetof(struct __config, update_counters_to_memcached), "0", sizeof(int)}, { "update_counters_to_memcached", "integer", (void*) int_parser, offsetof(struct __config, update_counters_to_memcached), "0", sizeof(int)},
{ "username", "string", (void*) string_parser, offsetof(struct __config, username), "piler", MAXVAL-1}, { "username", "string", (void*) string_parser, offsetof(struct __config, username), "piler", MAXVAL-1},
{ "use_antivirus", "integer", (void*) int_parser, offsetof(struct __config, use_antivirus), "1", sizeof(int)}, { "use_antivirus", "integer", (void*) int_parser, offsetof(struct __config, use_antivirus), "1", sizeof(int)},

View File

@ -57,11 +57,6 @@ struct __config {
char mysqldb[MAXVAL]; char mysqldb[MAXVAL];
int mysql_connect_timeout; int mysql_connect_timeout;
// sqlite3 stuff
char sqlite3[MAXVAL];
char sqlite3_pragma[MAXVAL];
int update_counters_to_memcached; int update_counters_to_memcached;
int memcached_to_db_interval; int memcached_to_db_interval;

View File

@ -35,13 +35,6 @@ void check_and_create_directories(struct __config *cfg, uid_t uid, gid_t gid){
} }
createdir(cfg->queuedir, uid, gid, 0700); createdir(cfg->queuedir, uid, gid, 0700);
p = strrchr(cfg->sqlite3, '/');
if(p){
*p = '\0';
createdir(cfg->sqlite3, uid, gid, 0755);
*p = '/';
}
p = strrchr(cfg->pidfile, '/'); p = strrchr(cfg->pidfile, '/');
if(p){ if(p){
*p = '\0'; *p = '\0';

36
util/Makefile.in Normal file
View File

@ -0,0 +1,36 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
includedir = @includedir@
libdir = @libdir@
libexecdir = @libexecdir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
mandir = @mandir@
datarootdir = @datarootdir@
localstatedir = @localstatedir@
CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@
DEFS = @defs@
INCDIR = -I. -I../.. -I../../src @INCDIR@ @mysql_includes@
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src
LIBS = @LIBS@ @mysql_libs@
RUNNING_USER = @RUNNING_USER@
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`
INSTALL = @INSTALL@
all:
install:
$(INSTALL) -m 0755 $(srcdir)/ldap_sync.php $(DESTDIR)$(libexecdir)/piler
clean:
distclean: clean
rm -f Makefile

13
util/gen-iv.pl Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/perl
#
@x = ('A'..'Z','a'..'z',0..9);
$iv = "";
srand;
for($i=0; $i<16; $i++){
$iv .= @x[rand @x];
}
print $iv;

View File

@ -75,7 +75,7 @@ define('DB_DRIVER', 'mysql');
define('DB_PREFIX', ''); define('DB_PREFIX', '');
define('DB_HOSTNAME', 'localhost'); define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'piler'); define('DB_USERNAME', 'piler');
define('DB_PASSWORD', 'q57tPYem'); define('DB_PASSWORD', 'piler');
define('DB_DATABASE', 'piler'); define('DB_DATABASE', 'piler');
define('TABLE_USER', 'user'); define('TABLE_USER', 'user');

View File

@ -1,36 +0,0 @@
<?php
require_once("config.php");
require(DIR_SYSTEM . "/startup.php");
$now = time();
$data = "";
$ts1 = $now - ($now % 3600);
$ts2 = $ts1 + 3600;
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX);
$query = $db->query("select vcode FROM " . TABLE_META . " WHERE sent >= ? AND sent < ? ORDER BY id ASC", array($ts1, $ts2));
print $query->query . " $ts1, $ts2\n\n";
foreach ($query->rows as $q) {
$data .= $q['vcode'];
}
print $data . "\n";
$digest = openssl_digest($data, "SHA256");
print "$digest\n";
print fetch_url("http://ecrive.net/api/plain?mode=sign&data=$digest");
//print fetch_url("http://ecrive.net/api/plain?mode=check&data=$digest&signature=$s");