Server IP : 85.214.239.14 / Your IP : 18.191.84.179 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/lib/dpkg/info/ |
Upload File : |
#!/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 } CLAMAVCONF='/etc/clamav/clamd.conf' # Read the configuration file slurp_config "$CLAMAVCONF" # Store conf file values as debconf answers - make sure user changes made # outside of debconf are preserved # This hack is needed due to the switch from clamav-base.templates to clamav-daemon.templates, # because the clamav-daemon/debconf value is not saved directly in the clamd.conf file. if [ -e "$CLAMAVCONF" ]; then if dpkg --compare-versions "$2" lt 0.98.3; then # Test for '##' at the beginning of the configuration file. # These are present in the example configuration file presented for manual editing, # but not in the automatically created one, when using debconf to manage clamd.conf. if [ -z `cat /etc/clamav/clamd.conf | sed -n 1p | grep -a '##'` ]; then db_set clamav-daemon/debconf true else db_set clamav-daemon/debconf false fi fi fi # Store the settings loaded from the configuration file in debconf. if [ -n "$TCPSocket" ]; then db_set clamav-daemon/TcpOrLocal TCP || true elif [ -n "$LocalSocket" ]; then db_set clamav-daemon/TcpOrLocal UNIX || true fi set_debconf_value daemon LocalSocket set_debconf_value daemon FixStaleSocket set_debconf_value daemon LocalSocketGroup set_debconf_value daemon LocalSocketMode set_debconf_value daemon TCPSocket set_debconf_value daemon TCPAddr set_debconf_value daemon ScanMail set_debconf_value daemon ScanArchive if [ -n "$StreamMaxLength" ]; then StreamMaxLength="`echo $StreamMaxLength | sed -e s/M//`" if [ "$StreamMaxLength" = "0" ]; then StreamMaxLength="25" fi db_set clamav-daemon/StreamMaxLength "$StreamMaxLength" || true fi set_debconf_value daemon MaxDirectoryRecursion set_debconf_value daemon FollowDirectorySymlinks set_debconf_value daemon FollowFileSymlinks if [ -n "$ReadTimeout" ] && [ -z "$ThreadTimeout" ]; then db_set clamav-daemon/ReadTimeout "$ReadTimeout" || true elif [ -z "$ReadTimeout" ] && [ -n "$ThreadTimeout" ]; then ReadTimeout="$ThreadTimeout" db_set clamav-daemon/ReadTimeout "$ReadTimeout" || true elif [ -n "$ReadTimeout" ]; then db_set clamav-daemon/ReadTimeout "$ReadTimeout" || true fi set_debconf_value daemon MaxThreads set_debconf_value daemon MaxConnectionQueueLength set_debconf_value daemon LogSyslog set_debconf_value daemon LogFile set_debconf_value daemon LogTime set_debconf_value daemon LogRotate set_debconf_value daemon OnAccessMaxFileSize set_debconf_value daemon AllowAllMatchScan set_debconf_value daemon ForceToDisk set_debconf_value daemon DisableCertCheck set_debconf_value daemon ScanSWF set_debconf_value daemon MaxEmbeddedPE set_debconf_value daemon MaxHTMLNormalize set_debconf_value daemon MaxHTMLNoTags set_debconf_value daemon MaxScriptNormalize set_debconf_value daemon MaxZipTypeRcg set_debconf_value daemon SelfCheck if [ -n "$User" ]; then db_set clamav-daemon/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-daemon/AddGroups "$AddGroups" || true fi fi set_debconf_value daemon Bytecode set_debconf_value daemon BytecodeSecurity set_debconf_value daemon BytecodeTimeout # States StateDebconf() { db_input medium clamav-daemon/debconf || true if ! db_go; then STATE="End" else db_get clamav-daemon/debconf || true if [ "$RET" = "false" ]; then STATE="End" else STATE="Socket" fi fi } StateSocket() { db_input medium clamav-daemon/TcpOrLocal || true if ! db_go; then STATE="Init" else db_metaget clamav-daemon/TcpOrLocal value STATE=$RET fi } StateLocalSocketGroup() { db_input low clamav-daemon/LocalSocketGroup || true if db_go; then db_metaget clamav-daemon/LocalSocketGroup value if [ "$RET" = "" ]; then db_set clamav-daemon/LocalSocketGroup "clamav" || true fi STATE="LocalSocketMode" else STATE="UNIX" fi } StateScanMail() { db_input medium clamav-daemon/ScanMail || true if db_go; then STATE="ScanArchive" else db_metaget clamav-daemon/TcpOrLocal value if [ "$RET" = "TCP" ]; then STATE="TCPAddr" else STATE="FixStale" fi fi } StateScanArchive() { db_input low clamav-daemon/ScanArchive || true if db_go; then db_metaget clamav-daemon/ScanArchive value if [ "$RET" = "true" ]; then STATE="StreamMaxLength" else STATE="MaxDirectoryRecursion" fi else STATE="ScanMail" fi } StateMaxDirectoryRecursion() { if inputdigit low clamav-daemon/MaxDirectoryRecursion; then db_metaget clamav-daemon/MaxDirectoryRecursion value if [ "$RET" = "0" ]; then STATE="FollowDirectorySymlinks" else STATE="FollowFileSymlinks" fi else STATE="ScanArchive" fi } StateFollowFileSymlinks() { db_input low clamav-daemon/FollowFileSymlinks || true if db_go; then STATE="ReadTimeout" else db_metaget clamav-daemon/MaxDirectoryRecursion value; if [ "$RET" = "0" ]; then STATE="FollowDirectorySymlinks" else STATE="MaxDirectoryRecursion" fi fi } StateLogFile() { db_input low clamav-daemon/LogFile || true if db_go; then db_metaget clamav-daemon/LogFile value if [ "$RET" = "" ]; then db_set clamav-daemon/LogFile "/var/log/clamav/clamav.log" || true STATE="LogTime" elif [ "$RET" = 'none' ]; then db_set clamav-daemon/LogFile "" || true STATE="SelfCheck" else STATE="LogTime" fi else STATE="LogSyslog" fi } StateUser() { db_input medium clamav-daemon/User || true if db_go; then db_metaget clamav-daemon/User value if [ "$RET" = "" ]; then db_set clamav-daemon/User "clamav" || true fi STATE="AddGroups" else STATE="SelfCheck" fi } StateBytecode() { db_input low clamav-daemon/Bytecode || true if db_go; then db_metaget clamav-daemon/Bytecode value if [ "$RET" = "true" ]; then STATE="BytecodeSecurity" else STATE="End" fi else STATE="AddGroups" fi } # Too many options to configure at configure. if [ "$1" = "reconfigure" ]; then STATE="Init" elif [ -n "$2" ]; then # On fresh installation, ask for the User clamav should use. 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 ;; "Socket") StateSocket ;; "TCP") StateGenericDigit low clamav-daemon/TCPSocket TCPAddr Socket ;; "TCPAddr") StateGeneric low clamav-daemon/TCPAddr ScanMail TCP ;; "UNIX") StateGeneric low clamav-daemon/LocalSocket LocalSocketGroup Socket ;; "LocalSocketGroup") StateLocalSocketGroup ;; "LocalSocketMode") StateGenericDigit low clamav-daemon/LocalSocketMode FixStale LocalSocketGroup ;; "FixStale") StateGeneric low clamav-daemon/FixStaleSocket ScanMail LocalSocketMode ;; "ScanMail") StateScanMail ;; "ScanArchive") StateScanArchive ;; "StreamMaxLength") StateGenericDigit low clamav-daemon/StreamMaxLength MaxDirectoryRecursion ScanArchive ;; "MaxDirectoryRecursion") StateMaxDirectoryRecursion ;; "FollowDirectorySymlinks") StateGeneric low clamav-daemon/FollowDirectorySymlinks FollowFileSymlinks MaxDirectoryRecursion ;; "FollowFileSymlinks") StateFollowFileSymlinks ;; "ReadTimeout") StateGenericDigit low clamav-daemon/ReadTimeout MaxThreads FollowFileSymlinks ;; "MaxThreads") StateGenericDigit low clamav-daemon/MaxThreads MaxConnectionQueueLength ReadTimeout ;; "MaxConnectionQueueLength") StateGenericDigit low clamav-daemon/MaxConnectionQueueLength LogSyslog MaxThreads ;; "LogSyslog") StateGeneric medium clamav-daemon/LogSyslog LogFile MaxConnectionQueueLength ;; "LogFile") StateLogFile ;; "LogTime") StateGeneric low clamav-daemon/LogTime LogRotate ;; "LogRotate") StateGeneric low clamav-daemon/LogRotate SelfCheck ;; "OnAccessMaxFileSize") StateGeneric low clamav-daemon/OnAccessMaxFileSize AllowAllMatchScan ;; "AllowAllMatchScan") StateGeneric low clamav-daemon/AllowAllMatchScan ForceToDisk OnAccessMaxFileSize ;; "ForceToDisk") StateGeneric low clamav-daemon/ForceToDisk DisableCertCheck AllowAllMatchScan ;; "DisableCertCheck") StateGeneric low clamav-daemon/DisableCertCheck ScanSWF ForceToDisk ;; "ScanSWF") StateGeneric low clamav-daemon/ScanSWF MaxEmbeddedPE DisableCertCheck ;; "MaxEmbeddedPE") StateGeneric low clamav-daemon/MaxEmbeddedPE MaxHTMLNormalize ScanSWF ;; "MaxHTMLNormalize") StateGeneric low clamav-daemon/MaxHTMLNormalize MaxHTMLNoTags MaxEmbeddedPE ;; "MaxHTMLNoTags") StateGeneric low clamav-daemon/MaxHTMLNoTags MaxScriptNormalize MaxHTMLNormalize ;; "MaxScriptNormalize") StateGeneric low clamav-daemon/MaxScriptNormalize MaxZipTypeRcg MaxHTMLNoTags ;; "MaxZipTypeRcg") StateGeneric low clamav-daemon/MaxZipTypeRcg SelfCheck MaxScriptNormalize ;; "SelfCheck") StateGeneric low clamav-daemon/SelfCheck User MaxZipTypeRcg ;; "User") StateUser ;; "AddGroups") StateGeneric medium clamav-daemon/AddGroups Bytecode User ;; "Bytecode") StateBytecode ;; "BytecodeSecurity") StateGeneric low clamav-daemon/BytecodeSecurity BytecodeTimeout Bytecode ;; "BytecodeTimeout") StateGenericDigit low clamav-daemon/BytecodeTimeout End BytecodeSecurity ;; esac done db_stop || true exit 0