passwd_file=/etc/security/passwd
passwd_uindex=0
passwd_pindex=1
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
return @new_order;
}
-
-
1;
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_pindex=1
by_view=0
+tempdelete_days=7
--- /dev/null
+find_pid_command=ps auwwwx | grep NAME | grep -v grep | awk '{ print $2 }'
+path=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
+ld_env=LD_LIBRARY_PATH
+passwd_file=/etc/shadow
+passwd_uindex=0
+passwd_pindex=1
+passwd_cindex=2
+passwd_mindex=4
+by_view=0
+tempdelete_days=7
passwd_pindex=1
by_view=0
+tempdelete_days=7
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_mindex=4
by_view=0
no_hostname_f=1
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_cindex=2
passwd_mindex=4
by_view=0
+tempdelete_days=7
passwd_uindex=0
passwd_pindex=1
by_view=0
+tempdelete_days=7
path=c:/perl/bin;c:/windows/system32;c:/windows
tempdir=c:/webmintemp
+tempdelete_days=7
else {
$range_cmd = "$module_config_directory/range.pl";
}
+$temp_delete_cmd = "$module_config_directory/tempdelete.pl";
$cron_temp_file = &transname();
use Time::Local;
--- /dev/null
+
+require 'cron-lib.pl';
+
+sub module_install
+{
+# Create a cron job to delete old files in /tmp/.webmin
+eval {
+ $main::error_must_die = 1;
+ local @jobs = &cron::list_cron_jobs();
+ local ($job) = grep { $_->{'user'} eq 'root' &&
+ $_->{'command'} eq $temp_delete_cmd } @jobs;
+ if (!$job) {
+ $job = { 'user' => 'root',
+ 'active' => 1,
+ 'command' => $temp_delete_cmd,
+ 'mins' => int(rand()*60),
+ 'hours' => int(rand()*24),
+ 'days' => '*',
+ 'months' => '*',
+ 'weekdays' => '*', };
+ &create_cron_job($job);
+ &create_wrapper($temp_delete_cmd, $module_name,"tempdelete.pl");
+ }
+ };
+if ($@) {
+ print STDERR "Failed to setup /tmp cleanup cron job : $@\n";
+ }
+}
+
+
--- /dev/null
+#!/usr/local/bin/perl
+# Delete any Webmin temp files older than 7 days
+
+$no_acl_check++;
+require './cron-lib.pl';
+
+if ($ARGV[0] eq "-debug" || $ARGV[0] eq "--debug") {
+ shift(@ARGV);
+ $debug = 1;
+ }
+
+# Don't run if disabled
+if (!$gconfig{'tempdelete_days'}) {
+ print "Temp file clearing is disabled\n";
+ exit(0);
+ }
+if ($gconfig{'tempdir'}) {
+ print "Temp file clearing is not done for the custom directory $gconfig{'tempdir'}\n";
+ exit(0);
+ }
+
+$tempdir = &transname();
+$tempdir =~ s/\/([^\/]+)$//;
+if ($debug) {
+ print "Checking temp directory $tempdir\n";
+ }
+
+$cutoff = time() - $gconfig{'tempdelete_days'}*24*60*60;
+opendir(DIR, $tempdir);
+foreach my $f (readdir(DIR)) {
+ next if ($f eq "." || $f eq "..");
+ local @st = lstat("$tempdir/$f");
+ if ($st[9] < $cutoff) {
+ if ($debug) {
+ print "Deleting $tempdir/$f\n";
+ }
+ &unlink_file("$tempdir/$f");
+ }
+ }
+closedir(DIR);
+
--- /dev/null
+
+require 'cron-lib.pl';
+
+sub module_uninstall
+{
+# Remove the cron job to delete old files in /tmp/.webmin
+eval {
+ $main::error_must_die = 1;
+ local @jobs = &cron::list_cron_jobs();
+ local ($job) = grep { $_->{'user'} eq 'root' &&
+ $_->{'command'} eq $temp_delete_cmd } @jobs;
+ if ($job) {
+ &delete_cron_job($job);
+ }
+ };
+if ($@) {
+ print STDERR "Failed to remove /tmp cleanup cron job : $@\n";
+ }
+}
+
+
Added an option to the Authentication page to block users with too many failed logins, as well as hosts.
Created the new Blocked Hosts and Users page to show blocks currently in force, and allow them to be cleared.
Added an option to the Ports and Addresses page to control if Webmin attempts to to reverse-resolve the connected-to IP address when issuing redirects, such as from non-SSL to SSL mode.
+---- Changes since 1.360 ----
+Added a field to the Advanced Options page to control the number of days that files in /tmp/.webmin are kept before automatic deletion.
$gconfig{'tempdir'} = $in{'tempdir'};
}
+# Save temp clearing options
+$gconfig{'tempdirdelete'} = $in{'tempdirdelete'};
+if ($in{'tempdelete_def'}) {
+ $gconfig{'tempdelete_days'} = '';
+ }
+else {
+ $in{'tempdelete'} =~ /^[0-9\.]+$/ ||
+ &error($text{'advanced_etempdelete'});
+ $gconfig{'tempdelete_days'} = $in{'tempdelete'};
+ }
+
# Save per-module temp dirs
for($i=0; defined($tmod = $in{'tmod_'.$i}); $i++) {
next if (!$tmod);
# Global temp directory
print &ui_table_row($text{'advanced_temp'},
&ui_opt_textbox("tempdir", $gconfig{'tempdir'},
- 30, $text{'advanced_tempdef'}));
+ 30, $text{'advanced_tempdef'})."<br>".
+ &ui_checkbox("tempdirdelete", 1, $text{'advanced_tdd'},
+ $gconfig{'tempdirdelete'}));
+
+# Temp files clearing period
+print &ui_table_row($text{'advanced_tempdelete'},
+ &ui_opt_textbox("tempdelete", $gconfig{'tempdelete_days'},
+ 5, $text{'advanced_nodelete'})." ".
+ $text{'advanced_days'});
# Per-module temp directories
@mods = sort { $a->{'desc'} cmp $b->{'desc'} } &get_all_module_infos();
advanced_header=Advanced and experimental options
advanced_temp=Temporary files directory
advanced_tempdef=Default (<tt>/tmp/.webmin</tt>)
+advanced_tdd=Clear temp files in non-standard directory?
+advanced_tempdelete=Maximum age of temporary files
+advanced_nodelete=Unlimited
+advanced_days=days
advanced_preload=Pre-load Webmin functions library?
advanced_err=Failed to save advanced options
advanced_etemp=Missing or non-existant temporary files directory
advanced_showstderr=Show Perl errors in browser?
advanced_umask=Umask (unset permission bits) for created files
advanced_eumask=Umask must be a 3-digit octal number
+advanced_etempdelete=Missing or invalid maximum age of temporary files
syslog_errorlog=Webmin error log