config is in clamav-milter 0.99+dfsg-1ubuntu1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | #!/bin/sh
set -e
# Source debconf library
. /usr/share/debconf/confmodule
# This conf script is capable of backing up
db_version 2.0
db_capb backup
to_lower()
{
word="$1"
lcword=$(echo "$word" | tr A-Z a-z)
echo "$lcword"
}
is_true()
{
var="$1"
lcvar=$(to_lower "$var")
[ 'true' = "$lcvar" ] || [ 'yes' = "$lcvar" ] || [ 1 = "$lcvar" ]
return $?
}
is_false()
{
var="$1"
lcvar=$(to_lower "$var")
[ 'false' = "$lcvar" ] || [ 'no' = "$lcvar" ] || [ 0 = "$lcvar" ]
return $?
}
ucf_cleanup()
{
# This only does something if I've fucked up before
# Not entirely impossible :(
configfile=$1
if [ `grep "$configfile" /var/lib/ucf/hashfile | wc -l` -gt 1 ]; then
grep -v "$configfile" /var/lib/ucf/hashfile > /var/lib/ucf/hashfile.tmp
grep "$configfile" /var/lib/ucf/hashfile | tail -n 1 >> /var/lib/ucf/hashfile.tmp
mv /var/lib/ucf/hashfile.tmp /var/lib/ucf/hashfile
fi
}
add_to_ucf()
{
configfile=$1
ucffile=$2
if ! grep -q "$configfile" /var/lib/ucf/hashfile; then
md5sum $configfile >> /var/lib/ucf/hashfile
cp $configfile $ucffile
fi
}
ucf_upgrade_check()
{
configfile=$1
sourcefile=$2
ucffile=$3
if [ -f "$configfile" ]; then
add_to_ucf $configfile $ucffile
ucf --three-way --debconf-ok "$sourcefile" "$configfile"
else
[ -d /var/lib/ucf/cache ] || mkdir -p /var/lib/ucf/cache
pathfind restorecon && restorecon /var/lib/ucf/cache
cp $sourcefile $configfile
add_to_ucf $configfile $ucffile
fi
}
slurp_config()
{
CLAMAVCONF="$1"
if [ -e "$CLAMAVCONF" ]; then
for variable in `egrep -a -v '^[[:space:]]*(#|$)' "$CLAMAVCONF" | awk '{print $1}'`; do
case "$variable" in
DatabaseMirror)
if [ -z "$DatabaseMirror" ]; then
for i in `grep -a ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$value $i"
done
else
continue
fi
;;
DatabaseCustomURL)
if [ -z "$DatabaseCustomURL" ]; then
for i in `grep -a ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$value $i"
done
else
continue
fi
;;
IncludePUA)
if [ -z "$IncludePUA" ]; then
for i in `grep -a ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$i $value"
done
else
continue
fi
;;
ExcludePUA)
if [ -z "$ExcludePUA" ]; then
for i in `grep -a ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$i $value"
done
else
continue
fi
;;
ExtraDatabase)
if [ -z "$ExtraDatabase" ]; then
for i in `grep -a ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$value $i"
done
else
continue
fi
;;
VirusEvent|OnUpdateExecute|OnErrorExecute|RejectMsg)
value=`grep -a ^$variable $CLAMAVCONF | head -n1 | sed -e s/$variable\ //`
;;
*)
value=`grep -a "^$variable[[:space:]]" $CLAMAVCONF | head -n1 | awk '{print $2}'`
;;
esac
if [ -z "$value" ]; then
export "$variable"="true"
elif [ "$value" != "$variable" ]; then
export "$variable"="$value"
else
export "$variable"="true"
fi
unset value
done
fi
}
pathfind() {
OLDIFS="$IFS"
IFS=:
for p in $PATH; do
if [ -x "$p/$*" ]; then
IFS="$OLDIFS"
return 0
fi
done
IFS="$OLDIFS"
return 1
}
set_debconf_value()
{
prog=$1
name=$2
eval variable="\$${name}"
if [ -n "$variable" ]; then
db_set clamav-$prog/$name "$variable" || true
fi
}
make_dir()
{
DIR=$1
if [ -d "$DIR" ]; then
return 0;
fi
[ -n "$User" ] || User=clamav
mkdir -p -m 0755 "$DIR"
chown "$User" "$DIR"
pathfind restorecon && restorecon "$DIR"
}
# Debconf Functions
isdigit ()
{
case $1 in
[[:digit:]]*)
ISDIGIT=1
;;
*)
ISDIGIT=0
;;
esac
}
inputdigit ()
{
ISDIGIT=0
while [ "$ISDIGIT" = '0' ]; do
db_input "$1" "$2" || true
if ! db_go; then
return 30
fi
db_get $2 || true
isdigit $RET
if [ "$ISDIGIT" = '0' ]; then
db_input critical clamav-base/numinfo || true
db_go
fi
done
return 0
}
StateGeneric()
{
PRIO=$1
QUESTION=$2
NEXT=$3
LAST=$4
db_input $PRIO $QUESTION || true
if db_go; then
STATE=$NEXT
else
STATE=$LAST
fi
}
StateGenericDigit()
{
PRIO=$1
QUESTION=$2
NEXT=$3
LAST=$4
inputdigit $PRIO $QUESTION || true
if db_go; then
STATE=$NEXT
else
STATE=$LAST
fi
}
CLAMAVMILTERCONF='/etc/clamav/clamav-milter.conf'
slurp_config "$CLAMAVMILTERCONF"
# Store conf file values as debconf answers - make sure user changes made
# outside of debconf are preserved
set_debconf_value milter MilterSocket
set_debconf_value milter FixStaleSocket
set_debconf_value milter MilterSocketGroup
set_debconf_value milter MilterSocketMode
if [ -n "$User" ]; then
db_set clamav-milter/User "$User" || true
if ! [ "$User" = 'root' ]; then
AddGroups=`groups "$User" | awk -F ':' '{print $2}' | sed -e s/"$User"//`
fi
if [ -n "$AddGroups" ]; then
db_set clamav-milter/AddGroups "$AddGroups" || true
fi
fi
set_debconf_value milter ReadTimeout
set_debconf_value milter Foreground
set_debconf_value milter Chroot
if [ -n "$PidFile" ]; then
db_set clamav-milter/PidFile "$PidFile" || true
fi
set_debconf_value milter TemporaryDirectory
if [ -n "$ClamdSocket" ]; then
db_set clamav-milter/ClamdSocket "$ClamdSocket" || true
fi
set_debconf_value milter LocalNet
set_debconf_value milter Whitelist
set_debconf_value milter OnInfected
set_debconf_value milter OnFail
set_debconf_value milter RejectMsg
set_debconf_value milter AddHeader
set_debconf_value milter LogFile
set_debconf_value milter LogFileUnlock
set_debconf_value milter LogFileMaxSize
set_debconf_value milter LogTime
set_debconf_value milter LogSyslog
set_debconf_value milter LogFacility
set_debconf_value milter LogVerbose
set_debconf_value milter LogInfected
set_debconf_value milter LogClean
if [ -n "$MaxFileSize" ]; then
MaxFileSize="`echo $MaxFileSize | sed -e s/M//g`"
else
MaxFileSize=25
fi
db_set clamav-milter/MaxFileSize "$MaxFileSize" || true
set_debconf_value milter SupportMultipleRecipients
set_debconf_value milter LogRotate
# States
StateDebconf()
{
db_input medium clamav-milter/debconf || true
if ! db_go; then
STATE="End"
else
db_get clamav-milter/debconf || true
if [ "$RET" = "false" ]; then
STATE="End"
else
STATE="User"
fi
fi
}
StateUser()
{
db_input medium clamav-milter/User || true
if db_go; then
db_metaget clamav-milter/User value
if [ "$RET" = "" ]; then
db_set clamav-milter/User "clamav" || true
fi
STATE="AddGroups"
else
STATE="Debconf"
fi
}
StateMilterSocketGroup()
{
db_input low clamav-milter/MilterSocketGroup || true
if db_go; then
db_metaget clamav-milter/MilterSocketGroup value
if [ "$RET" = "" ]; then
db_set clamav-milter/MilterSocketGroup "clamav" || true
fi
STATE="MilterSocketMode"
else
STATE="MilterSocket"
fi
}
StateLogFile()
{
db_input low clamav-milter/LogFile || true
if db_go; then
db_metaget clamav-milter/LogFile value
if [ "$RET" = "" ]; then
db_set clamav-milter/LogFile "/var/log/clamav/clamav-milter.log" || true
STATE="LogFileUnlock"
elif [ "$RET" = 'none' ]; then
db_set clamav-milter/LogFile "" || true
STATE="LogSyslog"
else
STATE="LogFileUnlock"
fi
else
STATE="AddHeader"
fi
}
# To many options to configure at configure
if [ "$1" = "reconfigure" ]; then
STATE="Init"
elif [ -n "$2" ]; then
if [ -z "$User" ]; then
STATE="User"
fi
else
STATE="End"
fi
[ -z "$STATE" ] && STATE='End'
# This is the statemachine that controls execution. All the 'real' work is
# performed by subfunctions above.
while [ "$STATE" != "End" ]; do
case "$STATE" in
"Init")
StateDebconf
;;
"User")
StateUser
;;
"AddGroups")
StateGeneric medium clamav-milter/AddGroups MilterSocket User
;;
"MilterSocket")
StateGeneric low clamav-milter/MilterSocket MilterSocketGroup AddGroups
;;
"MilterSocketGroup")
StateMilterSocketGroup
;;
"MilterSocketMode")
StateGenericDigit low clamav-milter/MilterSocketMode FixStaleSocket MilterSocketGroup
;;
"FixStaleSocket")
StateGeneric low clamav-milter/FixStaleSocket ReadTimeout MilterSocketMode
;;
"ReadTimeout")
StateGenericDigit low clamav-milter/ReadTimeout Foreground FixStaleSocket
;;
"Foreground")
StateGeneric low clamav-milter/Foreground Chroot ReadTimeout
;;
"Chroot")
StateGeneric low clamav-milter/Chroot PidFile Foreground
;;
"PidFile")
StateGeneric low clamav-milter/PidFile TemporaryDirectory Chroot
;;
"TemporaryDirectory")
StateGeneric low clamav-milter/TemporaryDirectory ClamdSocket PidFile
;;
"ClamdSocket")
StateGeneric low clamav-milter/ClamdSocket LocalNet TemporaryDirectory
;;
"LocalNet")
StateGeneric low clamav-milter/LocalNet Whitelist ClamdSocket
;;
"Whitelist")
StateGeneric low clamav-milter/Whitelist OnInfected LocalNet
;;
"OnInfected")
StateGeneric low clamav-milter/OnInfected OnFail Whitelist
;;
"OnFail")
StateGeneric low clamav-milter/OnFail RejectMsg OnInfected
;;
"RejectMsg")
StateGeneric low clamav-milter/RejectMsg AddHeader OnFail
;;
"AddHeader")
StateGeneric low clamav-milter/AddHeader LogFile RejectMsg
;;
"LogFile")
StateLogFile
;;
"LogFileUnlock")
StateGeneric low clamav-milter/LogFileUnlock LogFileMaxSize LogFile
;;
"LogFileMaxSize")
StateGenericDigit low clamav-milter/LogFileMaxSize LogTime LogFileUnlock
;;
"LogTime")
StateGeneric low clamav-milter/LogTime LogSyslog LogFileMaxSize
;;
"LogSyslog")
StateGeneric low clamav-milter/LogSyslog LogFacility LogTime
;;
"LogFacility")
StateGeneric low clamav-milter/LogFacility LogVerbose LogSyslog
;;
"LogVerbose")
StateGeneric low clamav-milter/LogVerbose LogInfected LogFacility
;;
"LogInfected")
StateGeneric low clamav-milter/LogInfected LogClean LogVerbose
;;
"LogClean")
StateGeneric low clamav-milter/LogClean MaxFileSize LogInfected
;;
"MaxFileSize")
StateGenericDigit low clamav-milter/MaxFileSize SupportMultipleRecipients LogClean
;;
"SupportMultipleRecipients")
StateGeneric low clamav-milter/SupportMultipleRecipients LogRotate MaxFileSize
;;
"LogRotate")
StateGeneric low clamav-milter/LogRotate End SupportMultipleRecipients
;;
esac
done
db_stop || true
exit 0
|