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
$(srcdir)/mkinstalldirs \
$(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)/piler $(DESTDIR)$(sysconfdir) \
$(DESTDIR)$(datarootdir)/piler $(DESTDIR)$(includedir)/piler $(DESTDIR)$(localstatedir)/piler/store \
$(DESTDIR)$(localstatedir)/piler/stat $(DESTDIR)$(localstatedir)/piler/tmp
$(DESTDIR)$(localstatedir)/piler/store \
$(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)/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 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:

9
configure vendored
View File

@ -604,6 +604,7 @@ LIBOBJS
DATADIR
CFGDIR
MYSQL_CONFIG
iv
id_bin
libclamav_extra_libs
mysql_obj
@ -3400,6 +3401,7 @@ done
have_libclamav="no"
have_libtool="no"
have_clamd="no"
@ -3421,7 +3423,7 @@ os=`uname -s`
id_bin="id"
SUBDIRS="src"
SUBDIRS="src etc util"
@ -4143,13 +4145,15 @@ fi
echo "piler data directory: $data_dir/piler"
iv=`util/gen-iv.pl`
echo; echo
CFLAGS="$static -O2 -Wall -g"
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"
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
# This file is a shell script that caches the results of configure
@ -4857,6 +4861,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/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;;
esac

View File

@ -27,6 +27,7 @@ AC_SUBST(mysql_libs)
AC_SUBST(mysql_obj)
AC_SUBST(libclamav_extra_libs)
AC_SUBST(id_bin)
AC_SUBST(iv)
have_libclamav="no"
have_libtool="no"
@ -50,7 +51,7 @@ os=`uname -s`
id_bin="id"
dnl SUBDIRS="src etc util perl init.d templates history contrib/stat"
SUBDIRS="src"
SUBDIRS="src etc util"
dnl static build
@ -267,12 +268,14 @@ fi
echo "piler data directory: $data_dir/piler"
iv=`util/gen-iv.pl`
echo; echo
CFLAGS="$static -O2 -Wall -g"
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"
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile])
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile])
AC_OUTPUT

View File

@ -26,11 +26,11 @@ INSTALL = @INSTALL@
all:
sed -e 's%pidfile=.*%pidfile=$(localstatedir)/run/piler/piler.pid%g' \
-e 's%workdir=.*%workdir=$(localstatedir)/spool/piler/tmp%g' \
-e 's%queuedir=.*%queuedir=$(localstatedir)/piler/queue%g' < $(srcdir)/example.conf > $(srcdir)/piler.conf
-e 's%iv=.*%iv=@iv@%g' \
-e 's%workdir=.*%workdir=$(localstatedir)/piler/tmp%g' < $(srcdir)/example.conf > $(srcdir)/piler.conf
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:
rm -f piler.conf cron.jobs

View File

@ -25,5 +25,5 @@ piler's crontab:
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 tag1 --rotate
*/15 * * * * /usr/local/bin/indexer --quiet tag1 --rotate

View File

@ -11,6 +11,9 @@ verbosity=1
; it it was started by root
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=10
@ -18,7 +21,7 @@ number_of_worker_processes=10
max_requests_per_child=1000
; SMTP HELO identification string
hostid=av-engine.localhost
hostid=mailarchiver.localhost
; write pid file
pidfile=/var/run/piler/piler.pid
@ -32,7 +35,7 @@ clamd_socket=/tmp/clamd
session_timeout=420
; 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
backlog=20
@ -68,7 +71,7 @@ spam_header_line=
; 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
; 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
;
; 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
; persistantly at all), then specify a big number here, that fits to the
; "long int" size, eg. 2147483647
@ -97,26 +100,7 @@ memcached_to_db_interval=900
;mysqlport=3306
mysqlsocket=/tmp/mysql.sock
mysqluser=piler
mysqlpwd=changeme
mysqlpwd=verystrongpassword
mysqldb=piler
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
sql_host = localhost
sql_db = sphinx
sql_user = sphinx
sql_pass = sphinx
sql_db = piler
sql_user = piler
sql_pass = piler
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 \
@ -26,9 +26,9 @@ source delta
{
type = mysql
sql_host = localhost
sql_db = sphinx
sql_user = sphinx
sql_pass = sphinx
sql_db = piler
sql_user = piler
sql_pass = piler
sql_query_pre = SET NAMES utf8
sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM sph_index
@ -52,9 +52,9 @@ source tag
{
type = mysql
sql_host = localhost
sql_db = sphinx
sql_user = sphinx
sql_pass = sphinx
sql_db = piler
sql_user = piler
sql_pass = piler
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, `uid`, `tag` FROM `tag`
@ -67,7 +67,7 @@ source tag
index main1
{
source = main
path = /var/data/main1
path = /var/piler/sphinx/main1
docinfo = extern
charset_type = utf-8
}
@ -76,7 +76,7 @@ index main1
index delta1
{
source = delta
path = /var/data/delta1
path = /var/piler/sphinx/delta1
docinfo = extern
charset_type = utf-8
}
@ -85,7 +85,7 @@ index delta1
index tag1
{
source = tag
path = /var/data/tag1
path = /var/piler/sphinx/tag1
docinfo = extern
charset_type = utf-8
}
@ -99,14 +99,14 @@ indexer
searchd
{
listen = 9312
listen = 9306:mysql41
log = /var/data/log/searchd.log
listen = 127.0.0.1:9312
listen = 127.0.0.1:9306:mysql41
log = /dev/null
binlog_path =
query_log = /var/data/log/query.log
##query_log =
read_timeout = 5
max_children = 30
pid_file = /var/data/log/searchd.pid
pid_file = /var/piler/sphinx/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1

View File

@ -68,30 +68,18 @@ test: test.c libpiler.a
install-piler:
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) -d $(DESTDIR)$(libdir)
$(INSTALL) -m 0644 libpiler.a $(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.$(PILER_VERSION))
$(INSTALL) -d $(DESTDIR)$(libexecdir)/piler
$(INSTALL) -d $(DESTDIR)$(datarootdir)/piler
$(INSTALL) -m 0755 piler $(DESTDIR)$(sbindir)
$(INSTALL) -m 0755 pilerconf $(DESTDIR)$(sbindir)
$(INSTALL) -m 0755 pilerget $(DESTDIR)$(bindir)
$(INSTALL) -m 0755 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
$(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerget $(DESTDIR)$(bindir)
$(INSTALL) -m 6755 -o $(RUNNING_USER) -g $(RUNNING_GROUP) pilerimport $(DESTDIR)$(bindir)
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
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},
{ "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},
{ "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)},
{ "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)},

View File

@ -57,11 +57,6 @@ struct __config {
char mysqldb[MAXVAL];
int mysql_connect_timeout;
// sqlite3 stuff
char sqlite3[MAXVAL];
char sqlite3_pragma[MAXVAL];
int update_counters_to_memcached;
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);
p = strrchr(cfg->sqlite3, '/');
if(p){
*p = '\0';
createdir(cfg->sqlite3, uid, gid, 0755);
*p = '/';
}
p = strrchr(cfg->pidfile, '/');
if(p){
*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_HOSTNAME', 'localhost');
define('DB_USERNAME', 'piler');
define('DB_PASSWORD', 'q57tPYem');
define('DB_PASSWORD', 'piler');
define('DB_DATABASE', 'piler');
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");