ACL option for fetchmail daemon

This commit is contained in:
Jamie Cameron
2008-03-11 04:48:47 +00:00
parent bbf78ae4b2
commit 7d42b72f66
11 changed files with 23 additions and 4 deletions
+2
View File
@@ -2,3 +2,5 @@
A new form has been added for creating and scheduling a Cron job to run Fetchmail, as an alternative to running the daemon
---- Changes since 1.200 ----
The Scheduled Checking page is now available even when the module is configured to manage Fetchmail for all users on the system, and can setup a Cron job to fetch mail for all users.
---- Changes since 1.400 ----
Added an access control option to limit access to the Fetchmail daemon.
+5
View File
@@ -23,6 +23,10 @@ printf "<input name=userscannot size=40 value='%s'> %s</td> </tr>\n",
print "<tr> <td valign=top><b>$text{'acl_cron'}</b></td> <td>\n";
print &ui_radio("cron", $_[0]->{'cron'},
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td>\n";
print "<td valign=top><b>$text{'acl_daemon'}</b></td> <td>\n";
print &ui_radio("daemon", $_[0]->{'daemon'},
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
}
@@ -35,6 +39,7 @@ $_[0]->{'users'} = $in{'mode'} == 0 || $in{'mode'} == 3 ? "" :
$in{'mode'} == 1 ? $in{'userscan'}
: $in{'userscannot'};
$_[0]->{'cron'} = $in{'cron'};
$_[0]->{'daemon'} = $in{'daemon'};
}
+5
View File
@@ -52,6 +52,11 @@ sub run_fetchmail
{
local ($config, $user) = @_;
# Check if we have anything to do
local @conf = &parse_config_file($config);
@conf = grep { $_->{'poll'} } @conf;
return if (!@conf);
# Build the command
local $cmd = "$config{'fetchmail_path'} -v -f ".quotemeta($config);
if ($config{'mda_command'}) {
+1
View File
@@ -2,3 +2,4 @@ noconfig=0
users=
mode=0
cron=1
daemon=1
+1 -1
View File
@@ -4,7 +4,7 @@
require './fetchmail-lib.pl';
&foreign_require("cron", "cron-lib.pl");
$access{'cron'} || &error($text{'cron_ecannot2'});
$can_cron || &error($text{'cron_ecannot2'});
&ui_print_header(undef, $text{'cron_title'}, "");
print "$text{'cron_desc'}<p>\n";
+1 -1
View File
@@ -118,7 +118,7 @@ foreach $u (@users) {
print "<tr> <td><b>$text{'poll_is'}</b></td> <td colspan=3>\n";
printf "<input name=is_$i size=60 value='%s'></td> </tr>\n",
join(" ", @{$u->{'is'}});
join(" ", @{$u->{'is'}}) || $remote_user;
print "<tr> <td><b>$text{'poll_keep'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=keep_$i value=1 %s> %s\n",
+4 -1
View File
@@ -17,11 +17,15 @@ if ($module_info{'usermin'}) {
$cron_cmd = "$user_module_config_directory/check.pl";
$cron_user = $remote_user;
$fetchmail_config = "$remote_user_info[7]/.fetchmailrc";
$can_cron = $config{'can_cron'};
$can_daemon = $config{'can_daemon'};
}
else {
$cron_cmd = "$module_config_directory/check.pl";
$cron_user = "root";
$fetchmail_config = $config{'config_file'};
$can_cron = $access{'cron'};
$can_daemon = $access{'daemon'};
}
# parse_config_file(file, [&global])
@@ -297,6 +301,5 @@ print &ui_links_row(\@links);
}
1;
+1
View File
@@ -105,6 +105,7 @@ acl_this=Current webmin user
acl_only=Only users
acl_except=All except users
acl_cron=Can configure scheduled checking?
acl_daemon=Can configure Fetchmail daemon?
cron_title=Scheduled Checking
cron_desc=This page can be used to enable or disable a Cron job to check the mail servers in your Fetchmail configuration on a regular schedule. Using a Cron job superior to running the Fetchmail daemon, as it does not need to be re-started at boot time.
+1 -1
View File
@@ -4,7 +4,7 @@
require './fetchmail-lib.pl';
&foreign_require("cron", "cron-lib.pl");
$access{'cron'} || &error($text{'cron_ecannot2'});
$can_cron || &error($text{'cron_ecannot2'});
&error_setup($text{'cron_err'});
&ReadParse();
+1
View File
@@ -6,6 +6,7 @@ require './fetchmail-lib.pl';
&ReadParse();
&error_setup($text{'start_err'});
$config{'config_file'} || $< || &error($text{'start_ecannot'});
$can_daemon || &error($text{'start_ecannot'});
if ($config{'start_cmd'}) {
$out = &backquote_logged("$config{'start_cmd'} 2>&1");
+1
View File
@@ -6,6 +6,7 @@ require './fetchmail-lib.pl';
&ReadParse();
&error_setup($text{'stop_err'});
$config{'config_file'} || $< || &error($text{'stop_ecannot'});
$can_daemon || &error($text{'start_ecannot'});
if ($config{'stop_cmd'}) {
$out = &backquote_logged("$config{'stop_cmd'} 2>&1");