Documentation
¶
Overview ¶
Package clamd talks to a ClamAV daemon over its socket protocol.
meles never links against libclamav (GPLv2): clamd runs as a separate process and keeps the signature database in memory once.
With a tls:// address the client talks to meles clamd-proxy instead, which adds TLS and token authentication in front of clamd: the first command on every connection is "zAUTH <token>\0", answered with "AUTH OK\0".
Index ¶
Constants ¶
const ( AuthCommand = "AUTH" AuthOK = "AUTH OK" AuthFailed = "AUTH FAILED" )
Authentication with meles clamd-proxy.
const MaxFileSize = 1<<31 - 1
MaxFileSize is the largest file ClamAV can scan ("technical design limitations", see clamd.conf). StreamMaxLength must be at least as large.
Variables ¶
This section is empty.
Functions ¶
func LoadCA ¶
LoadCA returns a TLS configuration that trusts only the CA certificates (PEM) in file, e.g. the CA of meles clamd-proxy.
func ParseReply ¶
ParseReply interprets a session reply: "<id>: stream: OK", "<id>: stream: <signature> FOUND" or "<id>: <message> ERROR".
func ParseVersion ¶
ParseVersion splits a clamd VERSION reply into engine and signature database version.
Types ¶
type Client ¶
type Client struct {
// Timeout bounds each step of a scan: sending a chunk and waiting for the
// verdict. A stalled clamd fails the scan, while a large file may take
// longer as a whole.
Timeout time.Duration
// TLSConfig is used for tls:// addresses. Nil means the system roots.
TLSConfig *tls.Config
// Token authenticates with meles clamd-proxy. It is only sent over TLS.
Token string
// ConnectRetry is how long refused or timed-out connections are retried.
// A new pod may be rejected by network policies for a few seconds until
// the CNI knows it (seen with k3s/kube-router), and clamd may just be
// restarting.
ConnectRetry time.Duration
// contains filtered or unexported fields
}
Client connects to clamd. The zero value is not usable; use New.
func New ¶
New parses addr: "unix:///run/clamav/clamd.ctl", "tcp://host:3310" or "tls://host:3310" (meles clamd-proxy).