From d7475e252a64e296913ed8893261e52e72163d55 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Thu, 21 Nov 2024 20:03:42 -0600 Subject: [PATCH] Make apt-get-update able to be terminated securely --- usr/libexec/security-misc/apt-get-update | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/usr/libexec/security-misc/apt-get-update b/usr/libexec/security-misc/apt-get-update index 9c5dde1..3086e55 100755 --- a/usr/libexec/security-misc/apt-get-update +++ b/usr/libexec/security-misc/apt-get-update @@ -3,6 +3,13 @@ ## Copyright (C) 2012 - 2024 ENCRYPTED SUPPORT LP ## See the file COPYING for copying conditions. +write_pid_file() { + safe-rm -rf /tmp/security-misc-apt-get-update-pid; + install -m644 /dev/null /tmp/security-misc-apt-get-update-pid \ + || exit 1 + echo "$$" > /tmp/security-misc-apt-get-update-pid +} + sigterm_trap() { if [ "$lastpid" = "" ]; then exit 143 @@ -21,6 +28,8 @@ trap "sigterm_trap" SIGTERM SIGINT [ -n "$timeout_after" ] || timeout_after="600" [ -n "$kill_after" ] || kill_after="10" +write_pid_file + timeout \ --kill-after="$kill_after" \ "$timeout_after" \