Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Enhanced ClamAV Configuration Files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
huffd
n00b
n00b


Joined: 10 Mar 2003
Posts: 33

PostPosted: Sat Jan 31, 2004 2:56 am    Post subject: Enhanced ClamAV Configuration Files Reply with quote

I took the time to do this last year and never posted it hoping the current emerge would be corrected. It hasn't, so here are some files that will start clamd, clmilter, and freshclam correctly. This setup WILL enable you to scan sendmail properly(after you've setup sendmail according to directions, of course), I have had these in use for quite a while.

For those of you that don't know this AV automagically updates twice daily on random intervals. (I knew about MyDoom Sunday night)

Happy Computing!


/etc/clamav.conf
##
## Example config file for the Clam AV daemon
## Please read the clamav.conf(5) manual before editing this file.
##


# Comment or remove the line below.
# Example

# Uncomment this option to enable logging.
# LogFile must be writable for the user running the daemon.
# Full path is required.
LogFile /var/log/clamd.log

# By default the log file is locked for writing - the lock protects against
# running clamd multiple times (if want to run another clamd, please
# copy the configuration file, change the LogFile variable, and run
# the daemon with --config-file option). That's why you shouldn't uncomment
# this option.
#LogFileUnlock

# Maximal size of the log file. Default is 1 Mb.
# Value of 0 disables the limit.
# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes)
# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size
# in bytes just don't use modifiers.
#LogFileMaxSize 2M

# Log time with an each message.
LogTime

# Use system logger (can work together with LogFile).
LogSyslog

# Enable verbose logging.
LogVerbose

# This option allows you to save the process identifier of the listening
# daemon (main thread).
PidFile /var/run/clamd.pid

# Path to a directory containing .db files.
# Default is the hardcoded directory (mostly /usr/local/share/clamav,
# it depends on installation options).
#DataDirectory /var/lib/clamav
DataDirectory /usr/share/clamav

# The daemon works in local or network mode. Currently the local mode is
# recommended for security reasons.

# Path to the local socket. The daemon doesn't change the mode of the
# created file (portability reasons). You may want to create it in a directory
# which is only accessible for a user running daemon.
LocalSocket /var/run/clamd.sock

# TCP port address.
#TCPSocket 3310

# Maximum length the queue of pending connections may grow to.
# Default is 15.
#MaxConnectionQueueLength 30

# When activated, input stream (see STREAM command) will be saved to disk before
# scanning - this allows scanning within archives.
StreamSaveToDisk

# Close the connection if this limit is exceeded.
#StreamMaxLength 10M

# Maximal number of a threads running at the same time.
# Default is 5, and it should be sufficient for a typical workstation.
# You may need to increase threads number for a server machine.
#MaxThreads 10

# Thread (scanner - single task) will be stopped after this time (seconds).
# Default is 180. Value of 0 disables the timeout. SECURITY HINT: Increase the
# timeout instead of disabling it.
#ThreadTimeout 500
#ThreadTimeout 0

# Maximal depth the directories are scanned at.
MaxDirectoryRecursion 15

# Follow a directory symlinks.
# SECURITY HINT: You should have enabled directory recursion limit to
# avoid potential problems.
#FollowDirectorySymlinks

# Follow regular file symlinks.
#FollowFileSymlinks

# Do internal checks (eg. check the integrity of the database structures)
# By default clamd checks itself every 3600 seconds (1 hour).
#SelfCheck 600

# Run as selected user (clamd must be started by root).
# By default it doesn't drop privileges.
#User clamav

# Initialize the supplementary group access (for all groups in /etc/group
# user is added in. clamd must be started by root).
#AllowSupplementaryGroups

# Don't fork into background. Useful in debugging.
#Foreground

##
## Mail support
##

# Uncomment this option if you are planning to scan mail files.
ScanMail

##
## Archive support
##


# Comment this line to disable scanning of the archives.
ScanArchive

# Options below protect your system against Denial of Service attacks
# with archive bombs.

# Files in archives larger than this limit won't be scanned.
# Value of 0 disables the limit.
# WARNING: Due to the unrarlib implementation, whole files (one by one) in RAR
# archives are decompressed to the memory. That's why never disable
# this limit (but you may increase it of course!)
ArchiveMaxFileSize 10M

# Archives are scanned recursively - e.g. if Zip archive contains RAR file,
# the RAR file will be decompressed, too (but only if recursion limit is set
# at least to 1). With this option you may set the recursion level.
# Value of 0 disables the limit.
ArchiveMaxRecursion 5

# Number of files to be scanned within archive.
# Value of 0 disables the limit.
ArchiveMaxFiles 1000

# Use slower decompression algorithm which uses less memory. This option
# affects bzip2 decompressor only.
#ArchiveLimitMemoryUsage

##
## Clamuko settings
## WARNING: This is experimental software. It is very likely it will hang
## up your system !!!
##

# Enable Clamuko. Dazuko (/dev/dazuko) must be configured and running.
#ClamukoScanOnLine

# Set access mask for Clamuko.
ClamukoScanOnOpen
ClamukoScanOnClose
ClamukoScanOnExec

# Set the include paths (all files in them will be scanned). You can have
# multiple ClamukoIncludePath options, but each directory must be added
# in a seperate option. All subdirectories are scanned, too.
ClamukoIncludePath /home
#ClamukoIncludePath /students

# Set the exclude paths. All subdirectories are also excluded.
#ClamukoExcludePath /home/guru

# Limit the file size to be scanned (probably you don't want to scan your movie
# files ;))
# Value of 0 disables the limit. 1 Mb should be fine.
ClamukoMaxFileSize 1M

# Enable archive support. It uses the limits from clamd section.
# (This option doesn't depend on ScanArchive, you can have archive support
# in clamd disabled).
ClamukoScanArchive


/etc/conf.d/clamd
# Config file for /etc/conf.d/clamd

START_CLAMD=yes
CLAMD_OPTS=""
CLAMD_LOG=""

START_CLMILTER=yes
CLMILTER_OPTS="--max-children=10 -blo /var/run/clmilter.sock"
CLMILTER_LOG=""

START_FRESHCLAM=yes
FRESHCLAM_OPTS="-d -c 2"
FRESHCLAM_LOG="/var/log/clam-update.log"


/etc/init.d/clamd
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later

depend() {
need net
}

start() {
if [ "${START_CLAMD}" = "yes" ]; then
if [ -n "${CLAMD_LOG}" -a ! -f "${CLAMD_LOG}" ]; then
touch "${CLAMD_LOG}"
chown clamav.clamav "${CLAMD_LOG}"
fi
ebegin "Starting clamd"
start-stop-daemon --start --quiet \
--exec /usr/sbin/clamd -- ${CLAMD_OPTS}
touch /var/lock/subsys/clamd

eend $? "Failed to start clamd"
fi
if [ "${START_CLMILTER}" = "yes" ]; then
if [ -n "${CLMILTER_LOG}" -a ! -f "${CLMILTER_LOG}" ]; then
touch "${CLMILTER_LOG}"
chown clamav.clamav "${CLMILTER_LOG}"
fi
ebegin "Starting clmilter"
start-stop-daemon --start --quiet \
--exec /usr/sbin/clamav-milter -- ${CLMILTER_OPTS}
touch /var/lock/subsys/clamav-milter
eend $? "Failed to start clmilter"
fi
if [ "${START_FRESHCLAM}" = "yes" ]; then
if [ -n "${FRESHCLAM_LOG}" -a ! -f "${FRESHCLAM_LOG}" ]; then
touch "${FRESHCLAM_LOG}"
chown clamav.clamav "${FRESHCLAM_LOG}"
FRESHCLAM_OPTS="${FRESHCLAM_OPTS} -l ${FRESHCLAM_LOG}"
fi
ebegin "Starting freshclam"
start-stop-daemon --start --quiet \
--exec /usr/bin/freshclam -- ${FRESHCLAM_OPTS} -l ${FRESHCLAM_LOG}
eend $? "Failed to start freshclam"
fi
}

stop() {
if [ "${START_CLAMD}" = "yes" ]; then
ebegin "Stopping clamd"
start-stop-daemon --stop --quiet --pidfile /var/run/clamd.pid
rm -f /var/run/clamd.pid
rm -f /var/run/clamd.sock
rm -f /var/lock/subsys/clamd
eend $? "Failed to stop clamd"
fi
if [ "${START_CLMILTER}" = "yes" ]; then
ebegin "Stopping clmilter"
start-stop-daemon --stop --quiet --name clamav-milter
rm -f /var/run/clmilter.sock
rm -f /var/lock/subsys/clamav-milter
eend $? "Failed to stop clmilter"
fi
if [ "${START_FRESHCLAM}" = "yes" ]; then
ebegin "Stopping freshclam"
start-stop-daemon --stop --quiet --name freshclam
eend $? "Failed to stop freshclam"
fi
}
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Sat Jan 31, 2004 10:22 am    Post subject: Reply with quote

Why not just put freshclam in a cron job?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum