Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ClamAV virus database updates more robust #103

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions rpminspect_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ get_before_module_build() {
}


freshclam_log=${TMT_TEST_DATA:-.}/freshclam.log

update_clamav_database() {
# Update the virus dababase
config_file="freshclam.conf"
Expand All @@ -163,7 +165,12 @@ update_clamav_database() {
sed -i "s|^DatabaseMirror .*|DatabaseMirror $CLAMAV_DATABASE_MIRROR_URL|" "$config_file"
fi

freshclam --config-file="$config_file" > freshclam.log 2>&1 || :
freshclam --config-file="$config_file" > "$freshclam_log" 2>&1 || :
# freshclam returns 0 even if the update download fails
# https://github.com/Cisco-Talos/clamav/issues/965
# Let's check the log for the complaint about the outdated database
# and return non-zero if we find it there
! grep -q 'virus database is older' "$freshclam_log"
}


Expand Down Expand Up @@ -211,7 +218,12 @@ commit_ref=$(echo "${repo_ref}" | awk -F'#' '{ print $2 }' | awk -F'?' '{ print

fetch-my-conf.py "${repo_url}" "${CONFIG_BRANCHES}" "${commit_ref}" || :

update_clamav_database
if ! update_clamav_database; then
# Oops, incremental update of the ClamAV virus database has failed.
# Let's try again. freshclam should attempt to download the whole
# daily.cvd this time, instead of just incremental patches.
update_clamav_database || :
fi

# Update annobin
# FIXME: we don't want to touch packages when the base image is Rawhide...
Expand Down Expand Up @@ -284,6 +296,7 @@ if [ -n "$TMT_TEST_DATA" ]; then
- viewer.html
- verbose.log
- result.json
- freshclam.log
EOF
# if dist-git uses a custom rpminspect config, add that as an artifact as well
for ext in ${exts} ; do
Expand Down
Loading