1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2008 (1.71)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Clam daemon</TITLE>
<META NAME="description" CONTENT="Clam daemon">
<META NAME="keywords" CONTENT="clamdoc">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="clamdoc.css">
<LINK REL="next" HREF="node30.html">
<LINK REL="previous" HREF="node28.html">
<LINK REL="up" HREF="node28.html">
<LINK REL="next" HREF="node30.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html595"
HREF="node30.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html591"
HREF="node28.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html585"
HREF="node28.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html593"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html596"
HREF="node30.html">Clamdscan</A>
<B> Up:</B> <A NAME="tex2html592"
HREF="node28.html">Usage</A>
<B> Previous:</B> <A NAME="tex2html586"
HREF="node28.html">Usage</A>
<B> <A NAME="tex2html594"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00061000000000000000"></A><A NAME="clamd"></A>
<BR>
Clam daemon
</H2>
<code>clamd</code> is a multi-threaded daemon that uses <I>libclamav</I>
to scan files for viruses. It may work in one or both modes listening on:
<UL>
<LI>Unix (local) socket
</LI>
<LI>TCP socket
</LI>
</UL>
The daemon is fully configurable via the <code>clamd.conf</code> file
<A NAME="tex2html21"
HREF="footnode.html#foot244"><SUP>9</SUP></A>. <code>clamd</code> recognizes the following commands:
<UL>
<LI><B>PING</B>
<BR>
Check the daemon's state (should reply with "PONG").
</LI>
<LI><B>VERSION</B>
<BR>
Print program and database versions.
</LI>
<LI><B>RELOAD</B>
<BR>
Reload the databases.
</LI>
<LI><B>SHUTDOWN</B>
<BR>
Perform a clean exit.
</LI>
<LI><B>SCAN file/directory</B>
<BR>
Scan file or directory (recursively) with archive support
enabled (a full path is required).
</LI>
<LI><B>RAWSCAN file/directory</B>
<BR>
Scan file or directory (recursively) with archive and special file
support disabled (a full path is required).
</LI>
<LI><B>CONTSCAN file/directory</B>
<BR>
Scan file or directory (recursively) with archive support
enabled and don't stop the scanning when a virus is found.
</LI>
<LI><B>MULTISCAN file/directory</B>
<BR>
Scan file in a standard way or scan directory (recursively) using
multiple threads (to make the scanning faster on SMP machines).
</LI>
<LI><B>ALLMATCHSCAN file/directory</B>
<BR>
ALLMATCHSCAN works just like SCAN except that it sets a mode
where, after finding a virus within a file, continues scanning for
additional viruses.
</LI>
<LI><B>INSTREAM</B>
<BR> <I>It is mandatory to prefix this command with <B>n</B> or
<B>z</B>.</I>
<BR>
Scan a stream of data. The stream is sent to clamd in chunks,
after INSTREAM, on the same socket on which the command
was sent. This avoids the overhead of establishing new TCP
connections and problems with NAT. The format of the chunk is:
<code><length><data></code> where <code><length></code> is the size of the
following data in bytes expressed as a 4 byte unsigned integer in
network byte order and <code><data></code> is the actual chunk. Streaming
is terminated by sending a zero-length chunk. Note: do not exceed
StreamMaxLength as defined in clamd.conf, otherwise clamd will
reply with <I>INSTREAM size limit exceeded</I> and close the
connection.
</LI>
<LI><B>FILDES</B>
<BR> <I>It is mandatory to newline terminate this command, or prefix
with <B>n</B> or <B>z</B>. This command only works on UNIX
domain sockets.</I>
<BR>
Scan a file descriptor. After issuing a FILDES command a subsequent
rfc2292/bsd4.4 style packet (with at least one dummy character) is
sent to clamd carrying the file descriptor to be scanned inside the
ancillary data. Alternatively the file descriptor may be sent in
the same packet, including the extra character.
</LI>
<LI><B>STATS</B>
<BR> <I>It is mandatory to newline terminate this command, or prefix
with <B>n</B> or <B>z</B>, it is recommended to only use the
<B>z</B> prefix.</I>
<BR>
On this command clamd provides statistics about the scan queue,
contents of scan queue, and memory usage. The exact reply format is
subject to changes in future releases.
</LI>
<LI><B>IDSESSION, END</B>
<BR> <I>It is mandatory to prefix this command with <B>n</B> or
<B>z</B>, also all commands inside <B>IDSESSION</B> must be
prefixed.</I>
<BR>
Start/end a clamd session. Within a session multiple
SCAN, INSTREAM, FILDES, VERSION, STATS commands can be sent on the
same socket without opening new connections. Replies from clamd
will be in the form <code><id>: <response></code> where <code><id></code> is
the request number (in ASCII, starting from 1) and <code><response></code>
is the usual clamd reply. The reply lines have the same delimiter
as the corresponding command had. Clamd will process the commands
asynchronously, and reply as soon as it has finished processing.
Clamd requires clients to read all the replies it sent, before
sending more commands to prevent send() deadlocks. The recommended
way to implement a client that uses IDSESSION is with non-blocking
sockets, and a select()/poll() loop: whenever send would block,
sleep in select/poll until either you can write more data, or read
more replies. <I>Note that using non-blocking sockets without
the select/poll loop and alternating recv()/send() doesn't comply
with clamd's requirements.</I> If clamd detects that a client has
deadlocked, it will close the connection. Note that clamd may
close an IDSESSION connection too if the client doesn't follow the
protocol's requirements.
</LI>
<LI><B>STREAM</B> (deprecated, use <B>INSTREAM</B> instead)
<BR>
Scan stream: clamd will return a new port number you should
connect to and send data to scan.
</LI>
</UL>
It's recommended to prefix clamd commands with the letter <B>z</B>
(eg. zSCAN) to indicate that the command will be delimited by a NULL
character and that clamd should continue reading command data until a NULL
character is read. The null delimiter assures that the complete command
and its entire argument will be processed as a single command. Alternatively
commands may be prefixed with the letter <B>n</B> (e.g. nSCAN) to use
a newline character as the delimiter. Clamd replies will honour the
requested terminator in turn. If clamd doesn't recognize the command, or
the command doesn't follow the requirements specified below, it will reply
with an error message, and close the connection.
Clamd can handle the following signals:
<UL>
<LI><B>SIGTERM</B> - perform a clean exit
</LI>
<LI><B>SIGHUP</B> - reopen the log file
</LI>
<LI><B>SIGUSR2</B> - reload the database
</LI>
</UL>
Clamd should not be started in the background using the shell operator
<code>&</code> or external tools. Instead, you should run and wait for clamd
to load the database and daemonize itself. After that, clamd is instantly
ready to accept connections and perform file scanning.
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html595"
HREF="node30.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html591"
HREF="node28.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html585"
HREF="node28.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html593"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html596"
HREF="node30.html">Clamdscan</A>
<B> Up:</B> <A NAME="tex2html592"
HREF="node28.html">Usage</A>
<B> Previous:</B> <A NAME="tex2html586"
HREF="node28.html">Usage</A>
<B> <A NAME="tex2html594"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Cisco 2014-11-21
</ADDRESS>
</BODY>
</HTML>
|