Debian auditing package prioritization guidelines recommend to check the packages containing
Anything which contains a cronjob or other automated script which runs with root privileges.
How can I find the packages which meet the aforementioned rule?
For cronjobs, packages have cronjobs listed in their files:
$ dpkg-query -L mdadm | grep cron
/etc/cron.daily
/etc/cron.daily/mdadm
/etc/cron.d
/etc/cron.d/mdadm
So you could do:
ALL_PKGS=$(dpkg -l | awk '{ print $2 }' | tail -n +6)
for PKG in $ALL_PKGS; do
if dpkg-query -L $PKG | grep -q /etc/cron; then
echo $PKG
fi
done
Note that this tail -n +6
is because of the extra output from dpkg -l
, you might have to do a slightly different adjustment to get all packages.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.