mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Compare commits
5 Commits
dev/refer-
...
dev/separa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05752faec0 | ||
|
|
1cf3813fb6 | ||
|
|
1216ae709b | ||
|
|
a7b3af534b | ||
|
|
87e006ceeb |
File diff suppressed because one or more lines are too long
@@ -17,7 +17,6 @@ $access{'defaults'} || &error($text{'trusted_ecannot'});
|
||||
my $conf = &get_config();
|
||||
my $options = &find("options", $conf);
|
||||
my $mems = $options->{'members'};
|
||||
my @dlv = &find("dnssec-lookaside", $mems);
|
||||
my $tkeys = &find("trusted-keys", $conf);
|
||||
$tkeys ||= { 'members' => [ ] };
|
||||
|
||||
@@ -38,33 +37,6 @@ if (&supports_dnssec_client() == 2) {
|
||||
$text{'default'}, undef);
|
||||
}
|
||||
|
||||
# Trusted DLVs (obsolete)
|
||||
if (@dlv) {
|
||||
my @dtable = ( );
|
||||
my $i = 0;
|
||||
foreach my $d (@dlv, { 'values' => [ '.' ] }) {
|
||||
my $dlv = $d->{'values'}->[0];
|
||||
$dlv = "" if ($dlv eq ".");
|
||||
push(@dtable, [
|
||||
&ui_opt_textbox("anchor_$i", $d->{'values'}->[2],
|
||||
30, $text{'trusted_none'}),
|
||||
&ui_opt_textbox("dlv_$i", $dlv, 20,
|
||||
$text{'trusted_root'}) ]);
|
||||
$i++;
|
||||
}
|
||||
print &ui_table_row($text{'trusted_dlvs'},
|
||||
&ui_radio("dlv_auto",
|
||||
@dlv == 0 ? 2 :
|
||||
@dlv == 1 && $dlv[0]->{'values'}->[0] eq 'auto' ? 1 : 0,
|
||||
[ [ 1, $text{'trusted_dlvs1'} ],
|
||||
[ 2, $text{'trusted_dlvs2'} ],
|
||||
[ 0, $text{'trusted_dlvs0'} ] ])."<br>\n".
|
||||
&ui_columns_table([ $text{'trusted_anchor'},
|
||||
$text{'trusted_dlv'} ],
|
||||
undef,
|
||||
\@dtable), 3);
|
||||
}
|
||||
|
||||
# Trusted keys
|
||||
if (@{$tkeys->{'members'}}) {
|
||||
my @ktable = ( );
|
||||
|
||||
@@ -24,46 +24,6 @@ if (&supports_dnssec_client() == 2) {
|
||||
&save_choice("dnssec-validation", $options, 1);
|
||||
}
|
||||
|
||||
# Save DLV zones
|
||||
if (defined($in{'dlv_auto'})) {
|
||||
my @dlvs = ( );
|
||||
if ($in{'dlv_auto'} == 1) {
|
||||
# Automatic mode
|
||||
push(@dlvs, { 'name' => 'dnssec-lookaside',
|
||||
'values' => [ 'auto' ] });
|
||||
}
|
||||
elsif ($in{'dlv_auto'} == 0) {
|
||||
# Listed zones
|
||||
my $dlv;
|
||||
for(my $i=0; defined($in{"anchor_$i"}); $i++) {
|
||||
if (!$in{"anchor_${i}_def"}) {
|
||||
$in{"anchor_$i"} =~ /^[a-z0-9\.\-\_]+$/ ||
|
||||
&error(&text('trusted_eanchor', $i+1));
|
||||
$in{"anchor_$i"} .= "."
|
||||
if ($in{"anchor_$i"} !~ /\.$/);
|
||||
if ($in{"dlv_${i}_def"}) {
|
||||
$dlv = ".";
|
||||
}
|
||||
else {
|
||||
$in{"dlv_$i"} =~ /^[a-z0-9\.\-\_]+$/ ||
|
||||
&error(&text('trusted_edlv', $i+1));
|
||||
$dlv = $in{"dlv_$i"};
|
||||
$dlv .= "." if ($dlv !~ /\.$/);
|
||||
}
|
||||
push(@dlvs, { 'name' => 'dnssec-lookaside',
|
||||
'values' => [
|
||||
$dlv, "trust-anchor",
|
||||
$in{"anchor_$i"} ] });
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($in{'dlv_auto'} == 2) {
|
||||
# None
|
||||
@dlvs = ( );
|
||||
}
|
||||
&save_directive($options, "dnssec-lookaside", \@dlvs, 1);
|
||||
}
|
||||
|
||||
# Save trusted keys
|
||||
if (defined($in{'zone_0'})) {
|
||||
my @keys = ( );
|
||||
|
||||
@@ -107,7 +107,7 @@ if ($product eq "webmin") {
|
||||
$size = int(`du -sk $tmp_dir`);
|
||||
@deps = ( "perl", "libnet-ssleay-perl", "openssl", "libauthen-pam-perl", "libpam-runtime", "libio-pty-perl", "unzip", "shared-mime-info", "tar", "libdigest-sha-perl", "libdigest-md5-perl", "gzip" );
|
||||
$deps = join(", ", @deps);
|
||||
@recommends = ( "libdatetime-perl", "libdatetime-timezone-perl", "libdatetime-locale-perl", "libtime-piece-perl", "libencode-detect-perl", "libtime-hires-perl", "libsocket6-perl", "libthreads-perl", "libthreads-shared-perl", "lynx", "qrencode" );
|
||||
@recommends = ( "libdatetime-perl", "libdatetime-timezone-perl", "libdatetime-locale-perl", "libtime-piece-perl", "libencode-detect-perl", "libtime-hires-perl", "libsocket6-perl", "lynx", "qrencode" );
|
||||
$recommends = join(", ", @recommends);
|
||||
open(CONTROL, ">$control_file");
|
||||
print CONTROL <<EOF;
|
||||
|
||||
@@ -87,7 +87,7 @@ Release: $rel
|
||||
Provides: %{name}-%{version} perl(WebminCore)
|
||||
Requires(pre): /usr/bin/perl
|
||||
Requires: /bin/sh /usr/bin/perl perl(lib) perl(open) perl(Net::SSLeay) perl(Time::Local) perl(Data::Dumper) perl(File::Path) perl(File::Basename) perl(Digest::SHA) perl(Digest::MD5) openssl unzip tar gzip
|
||||
Recommends: perl(DateTime) perl(DateTime::TimeZone) perl(DateTime::Locale) perl(Time::Piece) perl(Encode::Detect) perl(Time::HiRes) perl(Socket6) perl(threads) perl(threads::shared) lynx shared-mime-info perl-File-Basename perl-File-Path qrencode
|
||||
Recommends: perl(DateTime) perl(DateTime::TimeZone) perl(DateTime::Locale) perl(Time::Piece) perl(Encode::Detect) perl(Time::HiRes) perl(Socket6) lynx shared-mime-info perl-File-Basename perl-File-Path qrencode
|
||||
AutoReq: 0
|
||||
License: BSD-3-clause
|
||||
Group: System/Tools
|
||||
|
||||
@@ -74,7 +74,7 @@ if (&foreign_installed("package-updates") && $config{'collect_pkgs'}) {
|
||||
}
|
||||
|
||||
# CPU and drive temps
|
||||
if (!$config{'collect_notemp'} && defined(&proc::get_current_cpu_data)) {
|
||||
if (!$config{'collect_notemp2'} && defined(&proc::get_current_cpu_data)) {
|
||||
my ($cpu, $fans) = &proc::get_current_cpu_data();
|
||||
$info->{'cputemps'} = $cpu if (ref($cpu) && @{$cpu} >= 1);
|
||||
$info->{'cpufans'} = $fans if (ref($fans) && @{$fans} >= 1);
|
||||
|
||||
@@ -8010,6 +8010,100 @@ return ref($s) && $s->{'host'} && $s->{'port'} ?
|
||||
ref($s) ? "" : "$s.$$";
|
||||
}
|
||||
|
||||
=head2 verify_session_id(session-id, [sessiondb], [miniserv])
|
||||
|
||||
Returns the username (or an array with user, last login, and IP address) for the
|
||||
given session (or session hash) ID, or undefined if session ID is invalid.
|
||||
|
||||
Args:
|
||||
|
||||
$sid: The session ID to verify
|
||||
|
||||
$sessiondb: A reference to the session database hash (optional)
|
||||
|
||||
$miniserv: A reference to the miniserv configuration hash (optional)
|
||||
|
||||
Returns:
|
||||
|
||||
In list context: A list containing the user, last activity time, and IP
|
||||
address associated with the session ID.
|
||||
|
||||
In scalar context: The user associated with the session ID.
|
||||
|
||||
If the session ID is not found, returns an empty list in list context
|
||||
or undef in scalar context.
|
||||
|
||||
Usage:
|
||||
|
||||
Retrieve the username associated with the session ID or undef if
|
||||
session is invalid.
|
||||
|
||||
my $user = verify_session_id($main::session_id);
|
||||
Example of return:
|
||||
root
|
||||
|
||||
Retrieve array containing the user, last login, and IP address
|
||||
for given session hash ID or undef if session is invalid.
|
||||
|
||||
my (@user) = verify_session_id('BSRxr6wpF25lqeRinQ/sv0');
|
||||
Example of return:
|
||||
[
|
||||
'root',
|
||||
'1719401071',
|
||||
'10.211.55.2'
|
||||
]
|
||||
|
||||
Retrieve the username associated with the session ID, using given
|
||||
session DB or undef if session is invalid.
|
||||
|
||||
my %sessiondb;
|
||||
dbmopen(%sessiondb, "$var_directory/sessiondb", 0400);
|
||||
my $user = verify_session_id($main::session_id, \%sessiondb);
|
||||
dbmclose(%sessiondb);
|
||||
Example of return:
|
||||
someuser1
|
||||
|
||||
=cut
|
||||
sub verify_session_id
|
||||
{
|
||||
my ($sid, $sessiondb, $miniserv) = @_;
|
||||
my $hashsessionidfunc = \&miniserv::hash_session_id;
|
||||
my %miniserv;
|
||||
if ($miniserv) {
|
||||
# Use provided miniserv configuration
|
||||
%miniserv = %{$miniserv};
|
||||
}
|
||||
else {
|
||||
# Load miniserv configuration if not provided
|
||||
&get_miniserv_config(\%miniserv);
|
||||
}
|
||||
my %sessiondb_;
|
||||
if ($sessiondb) {
|
||||
# Use provided session database
|
||||
%sessiondb_ = %{$sessiondb};
|
||||
}
|
||||
elsif (&foreign_available('acl')) {
|
||||
# Use session database using ACL module API
|
||||
&foreign_require("acl");
|
||||
&acl::open_session_db(\%miniserv);
|
||||
$hashsessionidfunc = \&acl::hash_session_id;
|
||||
%sessiondb_ = %acl::sessiondb;
|
||||
}
|
||||
else {
|
||||
return wantarray ? ( ) : undef;
|
||||
}
|
||||
# Verify given session (hash) ID against the session database
|
||||
foreach my $k (grep { $sessiondb_{$_} } keys %sessiondb_) {
|
||||
if ($k eq $sid ||
|
||||
(defined($hashsessionidfunc) && $k eq $hashsessionidfunc->($sid))) {
|
||||
my ($user, $last, $ip) = split(/\s+/, $sessiondb_{$k});
|
||||
return wantarray ? ($user, $last, $ip) : $user;
|
||||
}
|
||||
}
|
||||
# Return an empty list or undef if session ID is not found
|
||||
return wantarray ? ( ) : undef;
|
||||
}
|
||||
|
||||
=head2 remote_foreign_require(server, module, file)
|
||||
|
||||
Connects to rpc.cgi on a remote webmin server and have it open a session
|
||||
|
||||
@@ -18,6 +18,7 @@ else {
|
||||
|
||||
# Save collection options
|
||||
$system_status::config{'collect_pkgs'} = $in{'pkgs'};
|
||||
$system_status::config{'collect_notemp2'} = !$in{'temp2'};
|
||||
$system_status::config{'collect_notemp'} = !$in{'temp'};
|
||||
$system_status::config{'collect_units'} = $in{'units'};
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@ print &ui_table_row($text{'status_interval'},
|
||||
print &ui_table_row($text{'status_pkgs'},
|
||||
&ui_yesno_radio("pkgs", $system_status::config{'collect_pkgs'}));
|
||||
|
||||
# Collect CPU temerature?
|
||||
print &ui_table_row($text{'status_temp2'},
|
||||
&ui_yesno_radio("temp2", !$system_status::config{'collect_notemp2'}));
|
||||
|
||||
# Collect drive temps?
|
||||
print &ui_table_row($text{'status_temp'},
|
||||
&ui_yesno_radio("temp", !$system_status::config{'collect_notemp'}));
|
||||
|
||||
@@ -1061,6 +1061,7 @@ status_interval0=Every
|
||||
status_mins=minutes
|
||||
status_pkgs=Collect available package updates?
|
||||
status_temp=Collect drive temperatures?
|
||||
status_temp2=Collect CPU temperatures and fans speed?
|
||||
status_units=Units for temperatures
|
||||
status_celsius=Celsius
|
||||
status_fahrenheit=Fahrenheit
|
||||
|
||||
Reference in New Issue
Block a user