5
# Source debconf library
6
. /usr/share/debconf/confmodule
8
# This conf script is capable of backing up
14
CLAMAVCONF='/etc/clamav/clamd.conf'
16
slurp_config "$CLAMAVCONF"
18
# Store conf file values as debconf answers - make sure user changes made
19
# outside of debconf are preserved
20
if [ -n "$User" ]; then
21
db_set clamav-base/User "$User" || true
22
if ! [ "$User" = 'root' ]; then
23
AddGroups=`groups "$User" | awk -F ':' '{print $2}' | sed -e s/"$User"//`
25
if [ -n "$AddGroups" ]; then
26
db_set clamav-base/AddGroups "$AddGroups" || true
29
if [ -n "$TCPSocket" ]; then
30
db_set clamav-base/TcpOrLocal TCP || true
31
elif [ -n "$LocalSocket" ]; then
32
db_set clamav-base/TcpOrLocal UNIX || true
34
if [ -n "$LocalSocket" ]; then
35
db_set clamav-base/LocalSocket "$LocalSocket" || true
37
if [ -n "$LocalSocketGroup" ]; then
38
db_set clamav-base/LocalSocketGroup "$LocalSocketGroup" || true
40
if [ -n "$LocalSocketMode" ]; then
41
db_set clamav-base/LocalSocketMode "$LocalSocketMode" || true
43
if [ "$FixStaleSocket" = "true" ]; then
44
db_set clamav-base/FixStaleSocket true || true
46
if [ -n "$TCPSocket" ]; then
47
db_set clamav-base/TCPSocket "$TCPSocket" || true
49
if [ -n "$TCPaddr" ]; then
50
db_set clamav-base/TCPAddr "$TCPaddr" || true
52
if [ "$ScanMail" = "true" ]; then
53
db_set clamav-base/ScanMail true || true
55
if [ "$ScanArchive" = "true" ]; then
56
db_set clamav-base/ScanArchive true || true
58
if [ -n "$StreamMaxLength" ]; then
59
StreamMaxLength="`echo $StreamMaxLength | sed -e s/M//`"
60
if [ "$StreamMaxLength" = "0" ]; then
63
db_set clamav-base/StreamMaxLength "$StreamMaxLength" || true
65
if [ -n "$MaxDirectoryRecursion" ]; then
66
db_set clamav-base/MaxDirectoryRecursion "$MaxDirectoryRecursion" || true
68
if [ "$FollowDirectorySymlinks" = "true" ]; then
69
db_set clamav-base/FollowDirectorySymlinks true || true
71
if [ "$FollowFileSymlinks" = "true" ]; then
72
db_set clamav-base/FollowFileSymlinks true || true
74
if [ -n "$ReadTimeout" ] && [ -z "$ThreadTimeout" ]; then
75
db_set clamav-base/ReadTimeout "$ReadTimeout" || true
77
[ -z "$ReadTimeout" ] && [ -n "$ThreadTimeout" ]; then
78
ReadTimeout="$ThreadTimeout"
79
db_set clamav-base/ReadTimeout "$ReadTimeout" || true
80
elif [ -n "$ReadTimeout" ]; then
81
db_set clamav-base/ReadTimeout "$ReadTimeout" || true
83
if [ -n "$MaxThreads" ]; then
84
db_set clamav-base/MaxThreads "$MaxThreads" || true
86
if [ -n "$MaxConnectionQueueLength" ]; then
87
db_set clamav-base/MaxConnectionQueueLength "$MaxConnectionQueueLength" || true
89
if [ "$LogSyslog" = "true" ]; then
90
db_set clamav-base/LogSyslog true || true
92
if [ -n "$LogFile" ]; then
93
db_set clamav-base/LogFile "$LogFile" || true
95
if [ "$LogTime" = "true" ]; then
96
db_set clamav-base/LogTime true || true
98
if [ "$LogRotate" = "true" ]; then
99
db_set clamav-base/LogRotate true || true
101
if [ "$ScanOnAccess" = "true" ]; then
102
db_set clamav-base/ScanOnAccess true || true
104
if [ -n "$OnAccessMaxFileSize" ]; then
105
db_set clamav-base/OnAccessMaxFileSize "$OnAccessMaxFileSize" || true
107
if [ "$AllowAllMatchScan" = "true" ]; then
108
db_set clamav-base/AllowAllMatchScan true || true
110
if [ "$ForceToDisk" = "true" ]; then
111
db_set clamav-base/ForceToDisk true || true
113
if [ "$DisableCertCheck" = "true" ]; then
114
db_set clamav-base/DisableCertCheck true || true
116
if [ "$ScanSWF" = "true" ]; then
117
db_set clamav-base/ScanSWF true || true
119
if [ -n "$MaxEmbeddedPE" ]; then
120
db_set clamav-base/MaxEmbeddedPE "$MaxEmbeddedPE" || true
122
if [ -n "$MaxHTMLNormalize" ]; then
123
db_set clamav-base/MaxHTMLNormalize "$MaxHTMLNormalize" || true
125
if [ -n "$MaxHTMLNoTags" ]; then
126
db_set clamav-base/MaxHTMLNoTags "$MaxHTMLNoTags" || true
128
if [ -n "$MaxScriptNormalize" ]; then
129
db_set clamav-base/MaxScriptNormalize "$MaxScriptNormalize" || true
131
if [ -n "$MaxZipTypeRcg" ]; then
132
db_set clamav-base/MaxZipTypeRcg "$MaxZipTypeRcg" || true
134
if [ "$Bytecode" = "true" ]; then
135
db_set clamav-base/Bytecode true || true
137
if [ -n "$BytecodeSecurity" ]; then
138
db_set clamav-base/BytecodeSecurity "$BytecodeSecurity" || true
140
if [ -n "$BytecodeTimeout" ]; then
141
db_set clamav-base/BytecodeTimeout "$BytecodeTimeout" || true
148
db_input medium clamav-base/debconf || true
152
db_get clamav-base/debconf || true
153
if [ "$RET" = "false" ]; then
163
db_input medium clamav-base/TcpOrLocal || true
167
db_metaget clamav-base/TcpOrLocal value
172
StateLocalSocketGroup()
174
db_input low clamav-base/LocalSocketGroup || true
176
db_metaget clamav-base/LocalSocketGroup value
177
if [ "$RET" = "" ]; then
178
db_set clamav-base/LocalSocketGroup "clamav" || true
180
STATE="LocalSocketMode"
188
db_input medium clamav-base/ScanMail || true
192
db_metaget clamav-base/TcpOrLocal value
193
if [ "$RET" = "TCP" ]; then
203
db_input low clamav-base/ScanArchive || true
205
db_metaget clamav-base/ScanArchive value
206
if [ "$RET" = "true" ]; then
207
STATE="StreamMaxLength"
209
STATE="MaxDirectoryRecursion"
216
StateMaxDirectoryRecursion()
218
if inputdigit low clamav-base/MaxDirectoryRecursion; then
219
db_metaget clamav-base/MaxDirectoryRecursion value
220
if [ "$RET" = "0" ]; then
221
STATE="FollowDirectorySymlinks"
223
STATE="FollowFileSymlinks"
230
StateFollowFileSymlinks()
232
db_input low clamav-base/FollowFileSymlinks || true
236
db_metaget clamav-base/MaxDirectoryRecursion value;
237
if [ "$RET" = "0" ]; then
238
STATE="FollowDirectorySymlinks"
240
STATE="MaxDirectoryRecursion"
247
db_input low clamav-base/LogFile || true
249
db_metaget clamav-base/LogFile value
250
if [ "$RET" = "" ]; then
251
db_set clamav-base/LogFile "/var/log/clamav/clamav.log" || true
253
elif [ "$RET" = 'none' ]; then
254
db_set clamav-base/LogFile "" || true
266
db_input medium clamav-base/User || true
268
db_metaget clamav-base/User value
269
if [ "$RET" = "" ]; then
270
db_set clamav-base/User "clamav" || true
280
db_input low clamav-base/Bytecode || true
282
db_metaget clamav-base/Bytecode value
283
if [ "$RET" = "true" ]; then
284
STATE="BytecodeSecurity"
293
# To many options to configure at configure
294
if [ "$1" = "reconfigure" ]; then
296
elif [ -n "$2" ]; then
297
if [ -z "$User" ]; then
304
[ -z "$STATE" ] && STATE='End'
306
# This is the statemachine that controls execution. All the 'real' work is
307
# performed by subfunctions above.
309
while [ "$STATE" != "End" ]; do
318
StateGenericDigit low clamav-base/TCPSocket TCPAddr Socket
321
StateGeneric low clamav-base/TCPAddr ScanMail TCP
324
StateGeneric low clamav-base/LocalSocket LocalSocketGroup Socket
327
StateLocalSocketGroup
330
StateGenericDigit low clamav-base/LocalSocketMode FixStale LocalSocketGroup
333
StateGeneric low clamav-base/FixStaleSocket ScanMail LocalSocketMode
342
StateGenericDigit low clamav-base/StreamMaxLength MaxDirectoryRecursion ScanArchive
344
"MaxDirectoryRecursion")
345
StateMaxDirectoryRecursion
347
"FollowDirectorySymlinks")
348
StateGeneric low clamav-base/FollowDirectorySymlinks FollowFileSymlinks MaxDirectoryRecursion
350
"FollowFileSymlinks")
351
StateFollowFileSymlinks
354
StateGenericDigit low clamav-base/ReadTimeout MaxThreads FollowFileSymlinks
357
StateGenericDigit low clamav-base/MaxThreads MaxConnectionQueueLength ReadTimeout
359
"MaxConnectionQueueLength")
360
StateGenericDigit low clamav-base/MaxConnectionQueueLength LogSyslog MaxThreads
363
StateGeneric medium clamav-base/LogSyslog LogFile MaxConnectionQueueLength
369
StateGeneric low clamav-base/LogTime LogRotate LogFile
372
StateGeneric low clamav-base/LogRotate ScanOnAccess LogFile
375
StateGeneric low clamav-base/ScanOnAccess OnAccessMaxFileSize LogFile
377
"OnAccessMaxFileSize")
378
StateGeneric low clamav-base/OnAccessMaxFileSize AllowAllMatchScan ScanOnAccess
381
StateGeneric low clamav-base/AllowAllMatchScan ForceToDisk OnAccessMaxFileSize
384
StateGeneric low clamav-base/ForceToDisk DisableCertCheck AllowAllMatchScan
387
StateGeneric low clamav-base/DisableCertCheck ScanSWF ForceToDisk
390
StateGeneric low clamav-base/ScanSWF MaxEmbeddedPE DisableCertCheck
393
StateGeneric low clamav-base/MaxEmbeddedPE MaxHTMLNormalize ScanSWF
396
StateGeneric low clamav-base/MaxHTMLNormalize MaxHTMLNoTags MaxEmbeddedPE
399
StateGeneric low clamav-base/MaxHTMLNoTags MaxScriptNormalize MaxHTMLNormalize
401
"MaxScriptNormalize")
402
StateGeneric low clamav-base/MaxScriptNormalize MaxZipTypeRcg MaxHTMLNoTags
405
StateGeneric low clamav-base/MaxZipTypeRcg SelfCheck MaxScriptNormalize
408
StateGeneric low clamav-base/SelfCheck User MaxZipTypeRcg
414
StateGeneric medium clamav-base/AddGroups Bytecode User
420
StateGeneric low clamav-base/BytecodeSecurity BytecodeTimeout Bytecode
423
StateGenericDigit low clamav-base/BytecodeTimeout End BytecodeSecurity