mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Compare commits
19 Commits
dev/xterm-
...
dev/fix-la
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4006b0454e | ||
|
|
5d4ab58baa | ||
|
|
e6c7a60fe6 | ||
|
|
a75781d61a | ||
|
|
45348f5b02 | ||
|
|
548c078813 | ||
|
|
76ccb2b7ed | ||
|
|
61d2081371 | ||
|
|
458916b4d8 | ||
|
|
37451ad905 | ||
|
|
9eec58a1f1 | ||
|
|
178f527afa | ||
|
|
cd1555b3e1 | ||
|
|
2d7cfca67f | ||
|
|
e92a35b3ed | ||
|
|
e35efd0f00 | ||
|
|
a12f385a5b | ||
|
|
5dc7cfafd7 | ||
|
|
35aee74311 |
@@ -1988,6 +1988,8 @@ if (@transfer) {
|
||||
}
|
||||
}
|
||||
if (@notify) {
|
||||
my %done;
|
||||
@notify = grep { !$done{$_->{'name'}}++ } @notify;
|
||||
my $also = { 'name' => 'also-notify',
|
||||
'type' => 1,
|
||||
'members' => \@notify};
|
||||
@@ -1996,6 +1998,8 @@ if (@notify) {
|
||||
'values' => [ 'yes' ] });
|
||||
}
|
||||
if (@transfer) {
|
||||
my %done;
|
||||
@transfer = grep { !$done{$_->{'name'}}++ } @transfer;
|
||||
my $allow = { 'name' => 'allow-transfer',
|
||||
'type' => 1,
|
||||
'members' => \@transfer };
|
||||
|
||||
@@ -350,7 +350,7 @@ if ($fh6) {
|
||||
while(1) {
|
||||
$$port++;
|
||||
if ($$port < 0 || $$port > 65535) {
|
||||
return "Failed to allocate a free port number: $port";
|
||||
return "Failed to allocate a free port number: $$port";
|
||||
}
|
||||
$pack = pack_sockaddr_in($$port, INADDR_ANY);
|
||||
next if (!bind($fh, $pack));
|
||||
|
||||
@@ -2371,6 +2371,8 @@ if (ref($opts)) {
|
||||
&print_tempfile(CFILE, "ExecReload=$kill -HUP \$MAINPID\n") if ($opts->{'reload'} eq '0');
|
||||
&print_tempfile(CFILE, "ExecStop=$opts->{'stop'}\n") if ($opts->{'stop'});
|
||||
&print_tempfile(CFILE, "ExecReload=$opts->{'reload'}\n") if ($opts->{'reload'});
|
||||
&print_tempfile(CFILE, "ExecStartPre=$opts->{'startpre'}\n") if ($opts->{'startpre'});
|
||||
&print_tempfile(CFILE, "ExecStartPost=$opts->{'startpost'}\n") if ($opts->{'startpost'});
|
||||
&print_tempfile(CFILE, "Type=$opts->{'type'}\n") if ($opts->{'type'});
|
||||
&print_tempfile(CFILE, "Environment=\"$opts->{'env'}\"\n") if ($opts->{'env'});
|
||||
&print_tempfile(CFILE, "User=$opts->{'user'}\n") if ($opts->{'user'});
|
||||
@@ -2381,8 +2383,8 @@ if (ref($opts)) {
|
||||
&print_tempfile(CFILE, "RestartSec=$opts->{'restartsec'}\n") if ($opts->{'restartsec'});
|
||||
&print_tempfile(CFILE, "TimeoutSec=$opts->{'timeout'}\n") if ($opts->{'timeout'});
|
||||
&print_tempfile(CFILE, "TimeoutStopSec=$opts->{'timeoutstopsec'}\n") if ($opts->{'timeoutstopsec'});
|
||||
&print_tempfile(CFILE, "StandardOutput=file:$opts->{'logstd'}\n") if ($opts->{'logstd'});
|
||||
&print_tempfile(CFILE, "StandardError=file:$opts->{'logerr'}\n") if ($opts->{'logerr'});
|
||||
&print_tempfile(CFILE, "StandardOutput=".($opts->{'logstd'} =~ /^\// ? 'file:' : '')."$opts->{'logstd'}\n") if ($opts->{'logstd'});
|
||||
&print_tempfile(CFILE, "StandardError=".($opts->{'logerr'} =~ /^\// ? 'file:' : '')."$opts->{'logerr'}\n") if ($opts->{'logerr'});
|
||||
}
|
||||
|
||||
&print_tempfile(CFILE, "\n");
|
||||
|
||||
@@ -4412,10 +4412,10 @@ elsif ($line =~ /^END:VEVENT/) {
|
||||
# Try to add local 'when (period)'
|
||||
my $dtstart_local_obj =
|
||||
$event{'_obj_dtstart_local_time'} =
|
||||
make_date($event{'dtstart_local_timestamp'}, { _ });
|
||||
make_date($event{'dtstart_local_timestamp'}, { });
|
||||
my $dtend_local_obj =
|
||||
$event{'_obj_dtend_local_time'} =
|
||||
make_date($event{'dtend_local_timestamp'}, { _ });
|
||||
make_date($event{'dtend_local_timestamp'}, { });
|
||||
# Build when local, e.g.:
|
||||
# Tue Jun 04, 2024 04:30 PM – 05:15
|
||||
# PM (Asia/Nicosia +0300)
|
||||
|
||||
@@ -330,7 +330,7 @@ Corvus Latinux 8.0 redhat-linux 7.1 `cat /etc/latinux-release 2>/dev/null` =~
|
||||
Immunix Linux $1 redhat-linux $1 $etc_issue =~ /Immunix.*\s([0-9\.]+)/i || `cat /etc/immunix-release 2>/dev/null` =~ /([0-9\.]+)/
|
||||
|
||||
# All versions of Gentoo (which don't appear to have version numbers)
|
||||
Gentoo Linux Any version gentoo-linux * -d "/usr/portage"
|
||||
Gentoo Linux Any version gentoo-linux * -d "/usr/portage" || `cat /etc/os-release 2>/dev/null` =~ /gentoo/
|
||||
|
||||
# Secure Linux (now called Trustix?)
|
||||
Secure Linux 1.0 redhat-linux 7.2 `cat /etc/securelinux-release 2>/dev/null` =~ /SecureLinux.*1\.0/i
|
||||
|
||||
@@ -56,7 +56,7 @@ if ($in{'action'} eq $text{'action_sync'}) {
|
||||
if (defined($in{'sync_service_name'}) &&
|
||||
defined($in{'sync_service_status'})) {
|
||||
my $service_name = $in{'sync_service_name'};
|
||||
if ($service_name !~ /^(chronyd|systemd-timesyncd)$/) {
|
||||
if ($service_name !~ /^(chronyd|chrony|systemd-timesyncd)$/) {
|
||||
&error(&text('error_serviceunknown', &html_escape($service_name)));
|
||||
}
|
||||
my $service_status = int($in{'sync_service_status'});
|
||||
|
||||
@@ -5,7 +5,8 @@ use warnings;
|
||||
no warnings 'redefine';
|
||||
no warnings 'uninitialized';
|
||||
require './time-lib.pl';
|
||||
our (%in, %text, %config, %access, $base_remote_user, $get_hardware_time_error);
|
||||
our (%in, %text, %config, %access, $base_remote_user,
|
||||
$get_hardware_time_error, $cronyd_name);
|
||||
|
||||
my ($rawdate, $rawhwdate, %system_date, $rawtime, %hw_date, $txt);
|
||||
$txt = "";
|
||||
@@ -174,13 +175,14 @@ if ( ( !$access{ 'sysdate' } && &has_command( "date" ) || !$access{ 'hwdate' } &
|
||||
$config{'timeserver_hardware'}));
|
||||
}
|
||||
}
|
||||
if (&foreign_require('init') && &init::action_status('chronyd') > 0 && &has_command("chronyc")) {
|
||||
my $chronyd_running = &init::status_action('chronyd');
|
||||
my $chronyd_run_atboot = &init::action_status('chronyd');
|
||||
my $ui_hiddens = &ui_hidden("sync_service_name", "chronyd");
|
||||
if (&foreign_require('init') &&
|
||||
&init::action_status($cronyd_name) > 0 && &has_command("chronyc")) {
|
||||
my $chronyd_running = &init::status_action($cronyd_name);
|
||||
my $chronyd_run_atboot = &init::action_status($cronyd_name);
|
||||
my $ui_hiddens = &ui_hidden("sync_service_name", $cronyd_name);
|
||||
$ui_hiddens .= &ui_hidden("timeserver", $config{'timeserver'})
|
||||
if (!$ntp_support);
|
||||
print &ui_table_row(&text('index_tabsync2', 'chronyd'),
|
||||
print &ui_table_row(&text('index_tabsync2', $cronyd_name),
|
||||
$ui_hiddens.
|
||||
&ui_radio("sync_service_status",
|
||||
(($chronyd_run_atboot == 2 && $chronyd_running) ? 2 :
|
||||
|
||||
@@ -13,6 +13,7 @@ our ($timezones_file, $currentzone_link, $currentzone_file, $timezones_dir,
|
||||
$sysclock_file);
|
||||
our ($get_hardware_time_error);
|
||||
our $cron_cmd = "$module_config_directory/sync.pl";
|
||||
our $cronyd_name = $gconfig{'os_type'} eq 'debian-linux' ? 'chrony' : 'chronyd';
|
||||
our $rawtime;
|
||||
if ($config{'zone_style'}) {
|
||||
do "$config{'zone_style'}-lib.pl";
|
||||
@@ -49,13 +50,13 @@ if (&has_command("ntpdate")) {
|
||||
elsif (&has_command("sntp")) {
|
||||
$out = &backquote_logged("sntp -s $servs 2>&1");
|
||||
}
|
||||
elsif (&foreign_require('init') && &init::action_status('chronyd') > 0 && &has_command("chronyc")) {
|
||||
my $chronyd_running = &init::status_action('chronyd');
|
||||
$out = &backquote_logged("systemctl restart chronyd 2>&1");
|
||||
elsif (&foreign_require('init') && &init::action_status($cronyd_name) > 0 && &has_command("chronyc")) {
|
||||
my $chronyd_running = &init::status_action($cronyd_name);
|
||||
$out = &backquote_logged("systemctl restart $cronyd_name 2>&1");
|
||||
$out .= &backquote_logged("chronyc makestep 2>&1");
|
||||
sleep ($chronyd_running ? 5 : 15);
|
||||
if (!$chronyd_running) {
|
||||
&backquote_logged("systemctl stop chronyd 2>&1");
|
||||
&backquote_logged("systemctl stop $cronyd_name 2>&1");
|
||||
}
|
||||
}
|
||||
elsif (&foreign_require('init') && &init::action_status('systemd-timesyncd') > 0) {
|
||||
|
||||
@@ -21,7 +21,8 @@ return 0;
|
||||
sub open_last_command
|
||||
{
|
||||
local ($fh, $user) = @_;
|
||||
open($fh, "last $user |");
|
||||
local $quser = quotemeta($user);
|
||||
open($fh, "(last -w $quser || last $quser) |");
|
||||
}
|
||||
|
||||
# read_last_line(handle)
|
||||
@@ -34,7 +35,9 @@ while(1) {
|
||||
chop($line = <$fh>);
|
||||
if (!$line) { return (); }
|
||||
if ($line =~ /^(reboot|shutdown)/) { next; }
|
||||
if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\S+)\s+\((\d+:\d+)\)/) {
|
||||
if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\S+)\s+\((.*?\d+:\d+.*?)\)/) {
|
||||
# root pts/0 10.211.55.2 Tue Nov 22 21:06 - 23:16 (02:10:00)
|
||||
# root pts/1 10.211.55.2 Wed Jun 29 13:13 - shutdown (7+00:01:20)
|
||||
return ($1, $2, $3, $4, $5 eq "shutdown" ? "Shutdown" :
|
||||
$5 eq "crash" ? "Crash" : $5, $6);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ sub open_last_command
|
||||
{
|
||||
local ($fh, $user) = @_;
|
||||
local $quser = quotemeta($user);
|
||||
open($fh, "(last -F $quser || last $quser) |");
|
||||
open($fh, "(last -F -w $quser || last -w $quser) |");
|
||||
}
|
||||
|
||||
# read_last_line(handle)
|
||||
@@ -39,12 +39,15 @@ while(1) {
|
||||
# jcameron pts/0 fudu Thu Feb 22 09:47 - 10:15
|
||||
return ($1, $2, $3, $4, $5 eq "down" ? "Shutdown" : $5, $6);
|
||||
}
|
||||
elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\-\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\((\d+:\d+)\)/) {
|
||||
elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\-\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\((.*?\d+:\d+)\)/) {
|
||||
# jcameron pts/0 fudu Thu Feb 22 09:47 - 10:15
|
||||
# jcameron pts/0 fudu Sun Feb 4 02:26:28 2024 - Wed Feb 7 18:25:09 2024 (3+15:58)
|
||||
return ($1, $2, $3, $4, $5 eq "down" ? "Shutdown" : $5, $6);
|
||||
}
|
||||
elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+still/) {
|
||||
# root pts/0 fudu Fri Feb 23 18:46 still logged in
|
||||
elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+still/ ||
|
||||
$line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+still/) {
|
||||
# root pts/0 fudu Fri Feb 23 18:46 still logged in
|
||||
# root pts/0 fudu Tue Jun 18 23:10:30 2024 still logged in
|
||||
return ($1, $2, $3, $4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2176,7 +2176,7 @@ if (!$@ && $] > 5.011) {
|
||||
}
|
||||
|
||||
# Return fully detailed object
|
||||
if (%{$opts}) {
|
||||
if (ref($only)) {
|
||||
# Can we get ago time
|
||||
my $ago;
|
||||
my $ago_secs = time() - $secs;
|
||||
|
||||
@@ -128,7 +128,7 @@ if (!$eol_data->{'_eol_timestamp'}) {
|
||||
&error_stderr("The provided data is not a valid EOL data hash reference");
|
||||
return undef;
|
||||
}
|
||||
my $eol_date = &make_date($eol_data->{'_eol_timestamp'}, { '_' => 1 });
|
||||
my $eol_date = &make_date($eol_data->{'_eol_timestamp'}, { });
|
||||
if (ref($eol_date)) {
|
||||
my $eol_in = sub {
|
||||
my $eol_date = shift;
|
||||
|
||||
@@ -10,6 +10,10 @@ my ($o) = @_;
|
||||
print &ui_table_row($text{'acl_user'},
|
||||
&ui_opt_textbox("user", $o->{'user'} eq '*' ? undef : $o->{'user'},
|
||||
20, $text{'acl_sameuser'}));
|
||||
|
||||
print &ui_table_row($text{'acl_sudoenforce'},
|
||||
&ui_yesno_radio("sudoenforce",
|
||||
$o->{'sudoenforce'} == 1 ? 1 : 0));
|
||||
}
|
||||
|
||||
sub acl_security_save
|
||||
@@ -17,4 +21,5 @@ sub acl_security_save
|
||||
my ($o) = @_;
|
||||
|
||||
$o->{'user'} = $in{'user_def'} ? '*' : $in{'user'};
|
||||
$o->{'sudoenforce'} = $in{'sudoenforce'} ? 1 : 0;
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
user=root
|
||||
sudoenforce=1
|
||||
|
||||
@@ -175,7 +175,8 @@ my $user = $access{'user'};
|
||||
if ($user eq "*") {
|
||||
$user = $remote_user;
|
||||
}
|
||||
elsif ($user eq "root" && $remote_user ne $user && !$in{'user'}) {
|
||||
elsif ($user eq "root" && $remote_user ne $user && !$in{'user'} &&
|
||||
$access{'sudoenforce'} ne '0') {
|
||||
# If possible, start with a sudo-capable user
|
||||
my @uinfo = getpwnam($remote_user);
|
||||
if (@uinfo && $uinfo[7]) {
|
||||
|
||||
@@ -9,3 +9,4 @@ index_eproxy=The Terminal module cannot be used when accessing Webmin via anothe
|
||||
|
||||
acl_user=Run shell as Unix user
|
||||
acl_sameuser=Same as Webmin login
|
||||
acl_sudoenforce=Enforce <em>sudo</em>-only privileges
|
||||
|
||||
Reference in New Issue
Block a user