# vim: syntax=sh
# $Id: defaults.in,v 1.103 2002/08/16 21:57:09 vanbaal Exp $

#
# Copyright (C) 2000-2002 Stichting LogReport Foundation LogReport@LogReport.org
#
#     This file is part of Lire.
# 
#     Lire is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.
# 
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
# 
#     You should have received a copy of the GNU General Public License
#     along with this program (see COPYING); if not, check with
#     http://www.gnu.org/copyleft/gpl.html or write to the Free Software 
#     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
#

#
# This is the Lire configuration file.  Format is sh.  Variables you might
# like to override in your defaults.local file:
#
# LR_DEBUG
# LR_KEEP
# LR_SIGNATUREFILE
# LR_DISCLAIMERFILE
# LR_LOGGING
# LR_DEFAULT_OUTPUT_FORMAT
# LR_TARGET_USER
# LR_USERLEVEL
#
# All boolean-style values are set to either '1' or ''.  E.g. either
#
#  LR_KEEP=1
#
# or
#
#  LR_KEEP=
#
# (LR_KEEP=0 will _NOT_ do what you want.  (Unless you know what you're
# doing, of course).  Tnx alex_ for enlightening us.)
#
#
# Note: running lr_config will create a default.local file for you.  It's
# a bit more userfriendly than vi.


###########################################################################

# first of all, dereference sysconfdir's prefix dependency, so that this
# gets expanded in other variables
# 
prefix="/usr/local"
exec_prefix="${prefix}"


# Lire shouldn't be run as root. It hasn't been audited for security
# and is a complex piece of software with many interactions. There
# are many places where data from untrusted sources (email received by
# responders, logfiles logging actions from untrusted clients) is read.
# Root permissions are never needed for Lire to run.  The only special
# permission Lire needs is read access to the logs.  You are advised to
# store your logfiles groupreadable, and owned by a group especially set
# up for this purpose.  If, however, you decide to keep your logs
# readable by root only, you force yourself to run Lire as root.  In this
# case, you should set the variable below to 1.  See also the thread,
# starting with 
# http://www.nlnet.nl/projects/logreport/hypermail/logreport/questions/0057.html
#
# LR_SKIP_ID_TEST=

####################################################################
#
#  variables about Lire's handling of tmp files
#
####################################################################

#
# where to store logfiles which are getting processed, as well as intermediate
# files
#
# make sure there's enough space here.  btw:
#   sort(1) (which we call) uses `TMPDIR' too.
# TMPDIR="/usr/local/tmp"
TMPDIR="$HOME/tmp"

#
# set this to 1 if you want to keep intermediate files in $HOME/tmp, 
# for debugging.
#
# LR_KEEP=1
LR_KEEP=

#
# LR_ARCHIVE indicates wether files should get archived.  If set, files which
# are candidates for archiving are moved from TMPDIR to the archive.
# Furthermore, metainfo about the archived files gets stored in a Lire
# database.
#
# LR_ARCHIVE=1
LR_ARCHIVE=

#
# LR_ARCHIVEDIR is the parent directory of LR_DBDIR and of LR_DBFILE.
# LR_DBFILE is used to store metainformation about processed logfiles
# LR_ARCHIVEDIR is where the Lire archive gets build. Furthermore,
# LR_ARCHIVEDIR it's the root of LR_FAILEDDIR, where emails the online
# responder failed to process get stored.
LR_ARCHIVEDIR="${prefix}/var/lib/lire/data"

####################################################################
#
#  logging - variables about Lire's own logging
#
####################################################################

#
# whether to show or suppress messages with loglevel info and debug
#
# LR_DEBUG=1
LR_DEBUG=

#
# whether to keep the tempory DLF files created for extended and
# derived schema. This is only usually set to debug the extended or
# derived schemas cerator.
#
LR_KEEP_TEMP_DLF=0

# used by lr_run
#
# where to sent logmessages to
LR_LOGGING=stderr
# LR_LOGGING=syslog

#
# defines the way logger(1) gets called
LR_FACILITY=local2
LR_LOGGERTAG="lire"



####################################################################
#
#  variables about the preferred report format
#
####################################################################

# The default report output format. This can be one
# of xml, txt, html or pdf
LR_DEFAULT_OUTPUT_FORMAT="txt"

# if LR_INCLUDEIMAGES is set to 1 images will be included in PDF reports
# 
# LR_INCLUDEIMAGES=1
LR_INCLUDEIMAGES=

# The type of the images to create. Can be either jpeg, png or gif.
LR_IMAGE_FORMAT=png

# Controls if the number are scaled into more human 
# readable format : 22.1M, 10.5k, etc.
LR_SCALE_BYTES=1

# Controls if the seconds are scaled into more human 
# readable format : 2m, 1.1h, etc.
LR_SCALE_SEC=1

# Controls if the number are scaled into more human 
# readable format : 5M, 1k, etc.
LR_SCALE_NUMBER=

# The default user for which the reports are targetted. This can be one of:
# manager, sysadmin.  This variable controls the amount and style of
# explanation in the reports
LR_TARGET_USER="sysadmin"

# The default level of this user. This can be one of:
# normal, advanced
LR_USERLEVEL="normal"

# The first day of the week, can be either mon or sun
LR_WEEK_STARTS_ON="sun"

########################################################################
#
# (Experimental) - SQL DLF storage
#
########################################################################

# The superservices for which we should archive the DLF into a
# SQL database
# Ex: LR_SQL_ARCHIVE="email dnszone"
LR_SQL_ARCHIVE=

# The DBI URI specifying the data source where SQL-DLF are stored.
# Only MySQL data sources are currently supported
# Ex: 
LR_DBI_URI=

# The user name to use to connect to the database
LR_DBI_USER=

# A file containing the password to use to connect to the database
LR_DBI_PASSWD_FILE=

# The max number of entrie in the sql table per superservice
LR_SQL_MAX_SIZE="1000000"

########################################################################
#
#  XML/SGML Configuration - variables pointing to various external tools
#
########################################################################

# Where can we find jade or openjade on this system ? Jade or 
# OpenJade are needed to generate HTML and PDF reports.
LR_JADE=""

# Where can we find pdfjadetex on this system ? This is needed
# to generate PDF reports.
LR_PDFJADETEX=""

# Path to DocBook XML 4.1 DTD, as distributed with e.g. libxslt.
# This is needed to generate PDF and HTML reports.
LR_DBK_XML_DTD=""

# Paths to Norman Walsh's DocBook DSSSL Style sheets 
# as distributed with docbook-dsssl. The Print
# stylesheet is needed to generate PDF reports.
LR_DBK_PRINT_STYLESHEET="/usr/local/share/sgml/docbook/dsssl/modular/print/docbook.dsl"

# Paths to Norman Walsh's DocBook XSL style sheets for
# HTML and XHTML output.
LR_DBK_HTML_XSL="/usr/local/share/xsl/docbook/html/chunk.xsl"
LR_DBK_HTML_ONEPAGE_XSL="/usr/local/share/xsl/docbook/html/docbook.xsl"
LR_DBK_XHTML_XSL="/usr/local/share/xsl/docbook/xhtml/chunk.xsl"
LR_DBK_XHTML_ONEPAGE_XSL="/usr/local/share/xsl/docbook/xhtml/docbook.xsl"

# The FO stuff can be used to generate print output (PDF) without needing
# DSSSL tools (i.e. (open)jade and the DSSSL stylesheets). One can use the 
# FO XSL stylesheets and xsltproc to generate a FO file from the DocBook
# file. The FO file then needs to be processed using a FO backend to
# generate the PDF. Two freely available packages are  fotex (like
# jadetex, an old version of fotex is available in xmltex) a TeX based
# processor and the fo library which is part of the
# Java Apache project.
# XSLT and fotex is faster than DSSSL and jade. All new stylesheets
# development is also now done around the XSLT FO stylesheets (samething
# with fotex vs jadetex).
#
# See also http://www.tei-c.org.uk/Software/passivetex/ ,
# http://wwwinfo.cern.ch/asdoc/WWW/publications/xmldev99/passivetex.html
#
# a Debian package is available from 
# http://www.braincells.com/debian/passivetex/
#
# However, in Lire, we do not use it (yet).
#
# LR_DBK_FO_XSL="/usr/local/share/xsl/docbook/fo/docbook.xsl"

# This sets the XSLT process to use. If we ever will support alternatives to
# libxslt's xsltproc, like xalan-c or sablotron (they currenlty cause 
# problems), this could be set here.  When none is used, a builtin convertor
# for XML is used to generate the ASCII reports. HTML, RTF or PDF reports are
# not available in this case.
LR_XSLT_PROCESSOR="xsltproc"

# Path to Xalan-C on this system.
# XALAN_C="@PATHTOXALANC@"
# Path to Sablotron on this system
# SABLOTRON="@PATHTOSABLOTRON@"

# Path to XsltProc on this system
LR_XSLTPROC="/usr/local/bin/xsltproc"

########################################################################
#
#  variables about paths to some programs
#
########################################################################

# gzip and tar are used to bundle images with HTML or DocBook reports.
LR_GZIP="/usr/local/bin/gzip"

LR_TAR="/usr/local/bin/tar"

# Zip is used to bundle the images with the RTF report.
LR_ZIP="/usr/local/bin/zip"

# sendmail is used by lr_report2mail and lr_log2mail
LR_SENDMAIL="/usr/sbin/sendmail"

########################################################################
#
#  variables about the Lire online responder
#
########################################################################

# where the emails sent to the responder are spooled
LR_SPOOLDIR="/usr/local/var/spool/lire"

# 'LR_FAILEDDIR', where emails which failed to get processed get stored, gets
# constructed from LR_ARCHIVEDIR.  see the end of this file

# seconds to wait between spoolruns
#
# LR_SPOOLINTERVAL=10
LR_SPOOLINTERVAL=300


########################################################################
#
#  variables about the emails Lire sents, containing the reports
#
########################################################################

# explanation on how to handle raw anon reports
LR_EXPLANATIONFILE="${prefix}/etc/lire/explanation"

# disclaimer to append to the email we sent
LR_DISCLAIMERFILE="${prefix}/etc/lire/disclaimer"

# signature to append to the email we sent
LR_SIGNATUREFILE="${prefix}/etc/lire/signature"



#########################################################################

if test xno = xyes
then
    if test -z "$LD_LIBRARY_PATH"
    then
	LD_LIBRARY_PATH="${exec_prefix}/lib"
    else
	LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${exec_prefix}/lib"
    fi
    export LD_LIBRARY_PATH
fi

if test -d "/usr/local/lib/perl5"
then
    eval `/usr/bin/perl -V:myarchname`
    if test -z "$PERL5LIB"
    then
	PERL5LIB="/usr/local/lib/perl5:/usr/local/lib/perl5/$myarchname"
    else
	PERL5LIB="$PERL5LIB:/usr/local/lib/perl5:/usr/local/lib/perl5/$myarchname"
    fi
    export PERL5LIB
fi

# one can override the variables set here in defaults.local. this file
# will not be overwritten during upgrade or reinstall
localfile="${prefix}/etc/lire/defaults.local"

if test -r "$localfile"
then
    . $localfile
fi

if test -r $HOME/.lirerc
then
    . $HOME/.lirerc
    echo >&2 "all all none defaults warning you have a file $HOME/.lirerc . this is deprecated. please move its contents to $HOME/.lire/etc/defaults"
fi

# will this fail miserably when there's no directory $HOME/.lire/etc ?
if test -r $HOME/.lire/etc/defaults
then
    . $HOME/.lire/etc/defaults
fi

# find out if we are able to write to LR_DBFILE

LR_DBDIR="$LR_ARCHIVEDIR/meta"
LR_DBFILE="$LR_DBDIR/index"

# BEWARE! this might break on solaris, since it's shell is more picky on -e..
if touch "$LR_DBFILE" 2>/dev/null
then
    # everything is fine
    :
else
    if test ! -d "$LR_DBDIR"
    then
        mkdir -p "$LR_DBDIR" 2>/dev/null || true
    fi

    if touch "$LR_DBFILE" 2>/dev/null
    then
        # seems we've fixed it
        :
    else
        # we probably have no write access.  choose another directory
        if test -n "$LR_ARCHIVE"
        then
            LR_ARCHIVEDIR=$HOME/.lire/data
        else
            LR_ARCHIVEDIR=$TMPDIR
        fi
        echo >&2 "all all none defaults warning LR_ARCHIVEDIR is changed to $LR_ARCHIVEDIR.  please set this variable explicitly by doing e.g. ' echo LR_ARCHIVEDIR=$LR_ARCHIVEDIR >> ~/.lire/etc/defaults '."
    fi
fi

# build LR_DBDIR, LR_DBFILE and LR_FAILEDDIR from LR_ARCHIVEDIR.  LR_FAILEDDIR
# is used by lr_spool only
LR_DBDIR="$LR_ARCHIVEDIR/meta"
LR_DBFILE="$LR_DBDIR/index"
LR_FAILEDDIR="$LR_ARCHIVEDIR/email/raw/failed"

export LR_SERVICE
export LR_SUPERSERVICE

export LR_DEBUG
export LR_KEEP
export LR_ARCHIVE
export TMPDIR
export LR_DISCLAIMERFILE
export LR_SIGNATUREFILE

export LR_TARGET_USER
export LR_USERLEVEL

export LR_SCALE_BYTES
export LR_SCALE_NUMBER
export LR_SCALE_SEC
export LR_IMAGE_FORMAT

export LR_ARCHIVEDIR
export LR_DBDIR
export LR_DBFILE

export LR_SQL_ARCHIVE
export LR_DBI_URI
export LR_DBI_USER
export LR_DBI_PASSWD_FILE
export LR_SQL_MAX_SIZE

export LR_FAILEDDIR

export lr_jobfiles_daily
export lr_jobfiles_weekly

# We export those for Config.pm
export LR_GZIP
export LR_TAR
export LR_SENDMAIL

export LR_FROM
export LR_REPLYTO

# The security check for root
if test -x /usr/xpg4/bin/id
then
    # solaris' /usr/bin/id doesn't grok -u
    # don't you just love it...
    runid=/usr/xpg4/bin/id
else
    runid=id
fi

if test -z "$LR_SKIP_ID_TEST"
then
    if test "`$runid -u`" -eq 0 -o "`$runid -ru`" -eq 0
    then
	cat >&2 <<EOF
Lire isn't made to run as root.
Please run it as an unprivileged user.

If you need root access to read the log file, you can 
pipe the log file to $PROGRAM :

su -c 'cat /path/to/logfile' root | $PROGRAM ...

Alternatively, if you don't care about somebody compromising your
system, you can add "LR_SKIP_ID_TEST=1" to $HOME/.lire/etc/defaults
EOF
	exit 1
    fi
fi

# Local Variables:
# mode: sh
# End:
