#742241 tmpreaper: please make it easy to use tmpreaper without running it from cron to clean /tmp

Package:
tmpreaper
Source:
tmpreaper
Description:
cleans up files in directories based on their age
Submitter:
Joost van Baal-Ilić
Date:
2021-12-14 12:30:04 UTC
Severity:
wishlist
Tags:
#742241#5
Date:
2014-03-21 06:04:51 UTC
From:
To:
Hi,

I'd like to use tmpreaper to clean other directories then /tmp.  Currently,
this would need editing both /etc/cron.daily/tmpreaper and /etc/tmpreaper.conf.
Applying this patch in the package would mean the user would have to edit only
one file and, furthermore, would point the user to a way not to suffer from
tmpreapers security issues.

Hope this is useful.

Thanks for making tmpreaper available for Debian!

Bye,

Joost


diff --git a/stribor/etc/cron.daily/tmpreaper b/stribor/etc/cron.daily/tmpreaper
index 8790e30..aabfe11 100755
--- a/stribor/etc/cron.daily/tmpreaper
+++ b/stribor/etc/cron.daily/tmpreaper
@@ -88,6 +88,10 @@ if [ "$SHOWWARNING" = true ]; then
     exit 0
 fi

+if [ "$RUNFROMCRON" != true ]; then
+    exit 0
+fi
+
 # Verify that these variables are set, and if not, set them to default values
 # This will work even if the required lines are not specified in the included
 # file above, but the file itself does exist.
diff --git a/stribor/etc/tmpreaper.conf b/stribor/etc/tmpreaper.conf
index 14ccc79..a2d89c8 100644
--- a/stribor/etc/tmpreaper.conf
+++ b/stribor/etc/tmpreaper.conf
@@ -13,6 +13,12 @@
 # see /usr/share/doc/tmpreaper/README.security.gz
 ## SHOWWARNING=true

+# Remove the next line if you prefer not to execute tmpreaper via
+# /etc/cron.daily/tmpreaper, but e.g. want to use it to clean not /tmp but
+# another directory.  Such usage will not have the issues mentioned in
+# /usr/share/doc/tmpreaper/README.security.gz.
+RUNFROMCRON=true
+
 # TMPREAPER_TIME
 #       is the max. age of files before they're removed.
 #       default:

#742241#10
Date:
2021-12-14 12:14:17 UTC
From:
To:
Sorry for ignoring this for so long...

Surely if you don't want to run tmpreaper from cron, simply delete the
cron.daily script?

If you don't use the cron.daily script (either by deleting it or by
implementing your suggested patch) then /etc/tmpreaper.conf is not used.
So if you want to run tmpreaper manually, just go for it, no need to
modify /tmp/tmpreaper.conf.

Maybe I've misunderstood what you're trying to do?


Regards,
Paul

#742241#15
Date:
2021-12-14 12:14:17 UTC
From:
To:
Sorry for ignoring this for so long...

Surely if you don't want to run tmpreaper from cron, simply delete the
cron.daily script?

If you don't use the cron.daily script (either by deleting it or by
implementing your suggested patch) then /etc/tmpreaper.conf is not used.
So if you want to run tmpreaper manually, just go for it, no need to
modify /tmp/tmpreaper.conf.

Maybe I've misunderstood what you're trying to do?


Regards,
Paul