mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25321b467b | ||
|
|
dc17b3cbe5 | ||
|
|
a4621a800b | ||
|
|
97308e69aa | ||
|
|
86144e16f7 | ||
|
|
b18b9decd4 | ||
|
|
90cd81893e | ||
|
|
9d7c3fdd9a | ||
|
|
c0e36426bd | ||
|
|
9dd678946d | ||
|
|
d440ba7f58 | ||
|
|
090a769145 | ||
|
|
bcec22b385 | ||
|
|
dbfc621482 | ||
|
|
6bc70a7738 | ||
|
|
f5b3f9cc1d | ||
|
|
24055330d3 | ||
|
|
0ac51a83e9 | ||
|
|
e517300fe0 | ||
|
|
ae34d0ef86 | ||
|
|
8236fb2fd8 | ||
|
|
f499c62da4 | ||
|
|
a51e3d0a22 | ||
|
|
e1398bf75b | ||
|
|
ba26d2aac0 | ||
|
|
7225ccab73 | ||
|
|
d224d0aafc | ||
|
|
8220fef7e0 | ||
|
|
1a658b1010 | ||
|
|
4c3b792adc | ||
|
|
19940bae86 | ||
|
|
256178c6c3 | ||
|
|
2a43a870c2 | ||
|
|
615765b995 | ||
|
|
6f7003965e | ||
|
|
d8a7a583a3 | ||
|
|
c51cc8f38a | ||
|
|
5210f623f3 | ||
|
|
ba4b65774e | ||
|
|
b1d273c555 | ||
|
|
b03f1b766f | ||
|
|
a9ed10401d | ||
|
|
253d85b6ee | ||
|
|
0247b71fb7 |
@@ -7,13 +7,13 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.head_commit.message, '[build]')
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: git tar gzip openssl curl openssh-client rpm perl libjson-pp-perl libdigest-sha-perl liblist-moreutils-perl libencode-detect-perl
|
||||
packages: git tar gzip openssl curl openssh-client rpm perl libjson-pp-perl libdigest-sha-perl liblist-moreutils-perl libencode-detect-perl zstd
|
||||
version: 1.0
|
||||
- uses: szenius/set-timezone@v1.2
|
||||
with:
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,5 +1,15 @@
|
||||
## Changelog
|
||||
|
||||
#### 2.202 (August 12, 2024)
|
||||
* Add support for importing schemas to the LDAP Server module
|
||||
* Add support for displaying disk and network I/Os in FreeBSD on the dashboard
|
||||
* Fix to automatically set the WebSocket URL webprefix correctly
|
||||
* Fix to name downloaded backup file nicely in Backup Configuration Files module [#2239](https://github.com/webmin/webmin/issues/2239)
|
||||
* Fix to optimize getting table index stats for large tables in MySQL/MariaDB module [pull#2234](https://github.com/webmin/webmin/pull/2234)
|
||||
* Fix duplication of _systemd_ actions and init scripts [#2227](https://github.com/webmin/webmin/issues/2227)
|
||||
* Fix BIND service name for Debian 12 and Ubuntu 24.04
|
||||
* Update the Authentic theme to the latest version with various fixes and improvements
|
||||
|
||||
#### 2.201 (July 24, 2024)
|
||||
* Fix real-time monitoring not updating graphs in the Dashboard [#2222](https://github.com/webmin/webmin/issues/2222)
|
||||
* Fix Terminal module to work correctly with _sudo_-capable users [#2223](https://github.com/webmin/webmin/issues/2223)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX qw(strftime);
|
||||
no warnings 'redefine';
|
||||
no warnings 'uninitialized';
|
||||
require './backup-config-lib.pl';
|
||||
@@ -59,7 +60,12 @@ print &ui_tabs_end_tab();
|
||||
|
||||
# Show immediate form
|
||||
print &ui_tabs_start_tab("tab", "backup");
|
||||
print &ui_form_start("backup.cgi/backup.tgz", "post");
|
||||
my $filename = 'webmin-backup-config-on-';
|
||||
my $hostname = &get_system_hostname();
|
||||
$hostname =~ s/\./-/g;
|
||||
$filename .= $hostname;
|
||||
$filename .= "-".strftime("%Y-%m-%d-%H-%M", localtime);
|
||||
print &ui_form_start("backup.cgi/$filename.tgz", "post");
|
||||
print &ui_table_start($text{'index_header'}, undef, 2);
|
||||
|
||||
my @dmods = split(/\s+/, $config{'mods'} || "");
|
||||
|
||||
50
bind8/config-Ubuntu-Linux-24.04-ALL
Normal file
50
bind8/config-Ubuntu-Linux-24.04-ALL
Normal file
@@ -0,0 +1,50 @@
|
||||
soa_style=1
|
||||
named_path=/usr/sbin/named
|
||||
named_conf=/etc/bind/named.conf
|
||||
show_list=1
|
||||
records_order=0
|
||||
max_zones=50
|
||||
rev_def=0
|
||||
support_aaaa=1
|
||||
allow_comments=0
|
||||
allow_wild=1
|
||||
allow_long=0
|
||||
master_ttl=1
|
||||
whois_cmd=whois
|
||||
short_names=0
|
||||
updserial_def=0
|
||||
updserial_on=1
|
||||
updserial_man=1
|
||||
ndc_cmd=ndc
|
||||
forwardzonefilename_format=ZONE.hosts
|
||||
reversezonefilename_format=ZONE.rev
|
||||
rev_must=0
|
||||
ipv6_mode=1
|
||||
allow_underscore=1
|
||||
by_view=0
|
||||
confirm_zone=1
|
||||
confirm_rec=0
|
||||
no_chroot=0
|
||||
relative_paths=0
|
||||
rndc_cmd=rndc
|
||||
pid_file=/var/run/named/named.pid
|
||||
zones_file=/etc/bind/named.conf.local
|
||||
master_dir=/var/lib/bind
|
||||
slave_dir=/var/lib/bind
|
||||
no_pid_chroot=0
|
||||
soa_start=0
|
||||
rndc_conf=/etc/bind/rndc.conf
|
||||
rndcconf_cmd=rndc-confgen
|
||||
largezones=0
|
||||
checkzone=named-checkzone
|
||||
keygen=dnssec-keygen
|
||||
signzone=dnssec-signzone
|
||||
checkconf=named-checkconf
|
||||
other_slaves=1
|
||||
force_random=0
|
||||
spf_record=0
|
||||
dnssec_info=1
|
||||
start_cmd=systemctl start named.service
|
||||
stop_cmd=systemctl stop named.service
|
||||
restart_cmd=systemctl reload named.service
|
||||
dnssec_period=21
|
||||
50
bind8/config-debian-linux-10.0-11.99
Normal file
50
bind8/config-debian-linux-10.0-11.99
Normal file
@@ -0,0 +1,50 @@
|
||||
soa_style=1
|
||||
named_path=/usr/sbin/named
|
||||
named_conf=/etc/bind/named.conf
|
||||
show_list=1
|
||||
records_order=0
|
||||
max_zones=50
|
||||
rev_def=0
|
||||
support_aaaa=1
|
||||
allow_comments=0
|
||||
allow_wild=1
|
||||
allow_long=0
|
||||
master_ttl=1
|
||||
whois_cmd=whois
|
||||
short_names=0
|
||||
updserial_def=0
|
||||
updserial_on=1
|
||||
updserial_man=1
|
||||
ndc_cmd=ndc
|
||||
forwardzonefilename_format=ZONE.hosts
|
||||
reversezonefilename_format=ZONE.rev
|
||||
rev_must=0
|
||||
ipv6_mode=1
|
||||
allow_underscore=1
|
||||
by_view=0
|
||||
confirm_zone=1
|
||||
confirm_rec=0
|
||||
no_chroot=0
|
||||
relative_paths=0
|
||||
rndc_cmd=rndc
|
||||
pid_file=/var/run/named/named.pid
|
||||
zones_file=/etc/bind/named.conf.local
|
||||
master_dir=/var/lib/bind
|
||||
slave_dir=/var/lib/bind
|
||||
no_pid_chroot=0
|
||||
soa_start=0
|
||||
rndc_conf=/etc/bind/rndc.conf
|
||||
rndcconf_cmd=rndc-confgen
|
||||
largezones=0
|
||||
checkzone=named-checkzone
|
||||
keygen=dnssec-keygen
|
||||
signzone=dnssec-signzone
|
||||
checkconf=named-checkconf
|
||||
other_slaves=1
|
||||
force_random=0
|
||||
spf_record=0
|
||||
dnssec_info=1
|
||||
start_cmd=systemctl start bind9.service
|
||||
stop_cmd=systemctl stop bind9.service
|
||||
restart_cmd=systemctl reload bind9.service
|
||||
dnssec_period=21
|
||||
50
bind8/config-debian-linux-12.0-ALL
Normal file
50
bind8/config-debian-linux-12.0-ALL
Normal file
@@ -0,0 +1,50 @@
|
||||
soa_style=1
|
||||
named_path=/usr/sbin/named
|
||||
named_conf=/etc/bind/named.conf
|
||||
show_list=1
|
||||
records_order=0
|
||||
max_zones=50
|
||||
rev_def=0
|
||||
support_aaaa=1
|
||||
allow_comments=0
|
||||
allow_wild=1
|
||||
allow_long=0
|
||||
master_ttl=1
|
||||
whois_cmd=whois
|
||||
short_names=0
|
||||
updserial_def=0
|
||||
updserial_on=1
|
||||
updserial_man=1
|
||||
ndc_cmd=ndc
|
||||
forwardzonefilename_format=ZONE.hosts
|
||||
reversezonefilename_format=ZONE.rev
|
||||
rev_must=0
|
||||
ipv6_mode=1
|
||||
allow_underscore=1
|
||||
by_view=0
|
||||
confirm_zone=1
|
||||
confirm_rec=0
|
||||
no_chroot=0
|
||||
relative_paths=0
|
||||
rndc_cmd=rndc
|
||||
pid_file=/var/run/named/named.pid
|
||||
zones_file=/etc/bind/named.conf.local
|
||||
master_dir=/var/lib/bind
|
||||
slave_dir=/var/lib/bind
|
||||
no_pid_chroot=0
|
||||
soa_start=0
|
||||
rndc_conf=/etc/bind/rndc.conf
|
||||
rndcconf_cmd=rndc-confgen
|
||||
largezones=0
|
||||
checkzone=named-checkzone
|
||||
keygen=dnssec-keygen
|
||||
signzone=dnssec-signzone
|
||||
checkconf=named-checkconf
|
||||
other_slaves=1
|
||||
force_random=0
|
||||
spf_record=0
|
||||
dnssec_info=1
|
||||
start_cmd=systemctl start named.service
|
||||
stop_cmd=systemctl stop named.service
|
||||
restart_cmd=systemctl reload named.service
|
||||
dnssec_period=21
|
||||
@@ -68,8 +68,28 @@ if (@keyrecs) {
|
||||
my $ds = &get_ds_record($zone);
|
||||
if ($ds) {
|
||||
print $text{'zonekey_ds'},"<br>\n";
|
||||
print &ui_textarea("ds", join("\n".$desc, split(/$desc/, $ds)), 2, 80, "off", 0,
|
||||
# Split DS records in string into a list
|
||||
my @ds = split(/\s(?=\S+\.\s+\d+\s+IN\s+DS\s+\d+\s+
|
||||
\d+\s+\d+\s+[0-9A-Fa-f]{16,})/x, $ds);
|
||||
print &ui_textarea("ds", join("\n", @ds), 2, 80, "off", 0,
|
||||
"readonly style='width:90%'"),"<br>\n";
|
||||
print &ui_columns_start([
|
||||
$text{'zonekey_ds_keytag'},
|
||||
$text{'zonekey_ds_alg'},
|
||||
$text{'zonekey_ds_type'},
|
||||
$text{'zonekey_ds_digest'},
|
||||
]);
|
||||
foreach my $r (@ds) {
|
||||
if ($r =~ /
|
||||
\bDS\s+(?<key_tag>\d+)\s+(?<algorithm>\d+)\s+
|
||||
(?<digest_type>\d+)\s+
|
||||
(?<digest>[0-9A-Fa-f]+)\b/x) {
|
||||
print &ui_columns_row([
|
||||
$+{key_tag}, $+{algorithm},
|
||||
$+{digest_type}, $+{digest}]);
|
||||
}
|
||||
}
|
||||
print &ui_columns_end();
|
||||
}
|
||||
|
||||
# Offer to disable
|
||||
|
||||
@@ -68,7 +68,7 @@ my $chroot = &get_chroot() || "";
|
||||
&restart_links().'<br>'.
|
||||
&help_search_link("bind", "doc", "google"), undef, undef,
|
||||
&text($chroot eq "/" || !$chroot ? 'index_version' : 'index_chroot',
|
||||
$bind_version, "<tt>$chroot</tt>"));
|
||||
&get_bind_version(), "<tt>$chroot</tt>"));
|
||||
|
||||
# If the named.conf file does not exist, offer to create it
|
||||
if ($need_create) {
|
||||
|
||||
@@ -1282,6 +1282,10 @@ zonekey_private=Private key details :
|
||||
zonekey_privatefile=Private key file : $1
|
||||
zonekey_algorithm=DNSSEC algorithm : $1
|
||||
zonekey_ds=DS record for parent zone :
|
||||
zonekey_ds_keytag=Key tag
|
||||
zonekey_ds_alg=Algorithm
|
||||
zonekey_ds_type=Digest type
|
||||
zonekey_ds_digest=Digest string
|
||||
zonekey_expandksk=Show public and private key-signing-key details ..
|
||||
zonekey_expandzone=Show public and private zone-key details ..
|
||||
zonekey_noprivate=However, Webmin could not find the private key associated with the zone, and so will not be able to re-sign it.
|
||||
|
||||
@@ -173,7 +173,10 @@ if ($ok) {
|
||||
print &ui_buttons_row("stop.cgi", $text{'index_stop'},
|
||||
$text{'index_stopdesc'},
|
||||
[ [ "zone", $zone->{'name'} ] ]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print &ui_alert_box($text{'index_downrules'}, 'warn');
|
||||
}
|
||||
|
||||
# Show Start and disable/enabled at boot button
|
||||
if (!$ok) {
|
||||
|
||||
@@ -45,6 +45,7 @@ index_restart_firewallddesc=Reload the FirewallD server and apply the rules that
|
||||
index_listrules_restartdesc=List details about existing rich and direct FirewallD rules in $1 zone.
|
||||
index_dependent=Failed to restart $1 dependent service
|
||||
index_manual=Edit Config Files.
|
||||
index_downrules=FirewallD rules cannot be created or edited and are not enforced unless the server is running.
|
||||
|
||||
manual_title=Edit Config Files
|
||||
manual_editsel=Edit FirewallD configuration file
|
||||
|
||||
@@ -2212,6 +2212,7 @@ if ($ecount && keys(%info) < 2) {
|
||||
|
||||
# Extract info we want
|
||||
my @rv;
|
||||
my %done;
|
||||
foreach my $name (keys %info) {
|
||||
my $root = &get_systemd_root($name);
|
||||
my $i = $info{$name};
|
||||
@@ -2233,6 +2234,7 @@ foreach my $name (keys %info) {
|
||||
'pid' => $i->{'ExecMainPID'},
|
||||
'file' => $i->{'FragmentPath'} || $root."/".$name,
|
||||
});
|
||||
$done{$name}++;
|
||||
}
|
||||
|
||||
# Also add legacy init scripts
|
||||
@@ -2240,6 +2242,7 @@ if (!$noinit) {
|
||||
my @rls = &get_inittab_runlevel();
|
||||
foreach my $a (&list_actions()) {
|
||||
$a =~ s/\s+\d+$//;
|
||||
next if ($done{$a} || $done{$a.".service"});
|
||||
my $f = &action_filename($a);
|
||||
my $s = { 'name' => $a,
|
||||
'legacy' => 1 };
|
||||
|
||||
@@ -235,6 +235,7 @@ if ($ldap_hosts) {
|
||||
&find_svalue("port", $conf) ||
|
||||
($use_ssl == 1 ? 636 : 389);
|
||||
foreach my $h (@hosts) {
|
||||
local $SIG{'PIPE'} = 'ignore';
|
||||
eval {
|
||||
$ldap = Net::LDAP->new($h, port => $port,
|
||||
scheme => $use_ssl == 1 ? 'ldaps' : 'ldap',
|
||||
@@ -267,10 +268,18 @@ elsif ($uri) {
|
||||
elsif (!$port && $proto eq "ldaps") {
|
||||
$port = 636;
|
||||
}
|
||||
$ldap = Net::LDAP->new($host, port => $port,
|
||||
scheme => $proto,
|
||||
inet6 => &should_use_inet6($host));
|
||||
if (!$ldap) {
|
||||
local $SIG{'PIPE'} = 'ignore';
|
||||
eval {
|
||||
$ldap = Net::LDAP->new($host, port => $port,
|
||||
scheme => $proto,
|
||||
inet6 => &should_use_inet6($host));
|
||||
};
|
||||
if ($@) {
|
||||
$err = &text('ldap_econn2',
|
||||
"<tt>$host</tt>", "<tt>$port</tt>",
|
||||
&html_escape($@));
|
||||
}
|
||||
elsif (!$ldap) {
|
||||
$err = &text('ldap_econn',
|
||||
"<tt>$host</tt>","<tt>$port</tt>");
|
||||
}
|
||||
|
||||
@@ -4,3 +4,4 @@ slapd=slapd
|
||||
ldap_user=ldap
|
||||
browse_max=100
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/init.d/ldap stop
|
||||
apply_cmd=/etc/init.d/ldap restart
|
||||
init_name=ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=/etc/init.d/slapd start
|
||||
stop_cmd=/etc/init.d/slapd stop
|
||||
apply_cmd=/etc/init.d/slapd restart
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -9,3 +9,4 @@ apply_cmd=/etc/init.d/ldap restart
|
||||
init_name=ldap
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,6 +6,7 @@ browse_max=100
|
||||
start_cmd=systemctl start slapd
|
||||
stop_cmd=systemctl stop slapd
|
||||
apply_cmd=systemctl restart slapd
|
||||
init_name=ldap
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/init.d/slapd stop
|
||||
apply_cmd=/etc/init.d/slapd restart
|
||||
init_name=slapd
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/init.d/slapd stop
|
||||
apply_cmd=/etc/init.d/slapd restart
|
||||
init_name=slapd
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/init.d/slapd stop
|
||||
apply_cmd=/etc/init.d/slapd restart
|
||||
init_name=slapd
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -7,3 +7,4 @@ attr_count=6
|
||||
start_cmd=/usr/local/etc/rc.d/slapd start
|
||||
stop_cmd=/usr/local/etc/rc.d/slapd stop
|
||||
apply_cmd=/usr/local/etc/rc.d/slapd restart
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ start_cmd=/usr/local/etc/rc.d/slapd forcestart
|
||||
stop_cmd=/usr/local/etc/rc.d/slapd forcestop
|
||||
apply_cmd=/usr/local/etc/rc.d/slapd onerestart
|
||||
init_name=slapd
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/rc./init.d/ldap stop
|
||||
apply_cmd=/etc/rc./init.d/ldap restart
|
||||
init_name=ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=systemctl stop ldap
|
||||
apply_cmd=systemctl restart ldap
|
||||
init_name=ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -6,3 +6,4 @@ browse_max=100
|
||||
data_dir=/var/lib/openladp-data
|
||||
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -9,3 +9,4 @@ apply_cmd=/etc/init.d/ldap restart
|
||||
init_name=ldap
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -9,3 +9,4 @@ apply_cmd=systemctl restart slapd.service
|
||||
init_name=slapd
|
||||
data_dir=/var/lib/ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -5,3 +5,4 @@ slapd=/opt/csw/libexec/slapd
|
||||
ldap_user=ldap
|
||||
browse_max=100
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/init.d/ldap stop
|
||||
apply_cmd=/etc/init.d/ldap restart
|
||||
init_name=ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ config_file=/etc/ldap/slapd.conf
|
||||
stop_cmd=/etc/init.d/ldap stop
|
||||
attr_count=6
|
||||
browse_max=100
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -8,3 +8,4 @@ stop_cmd=/etc/rc./init.d/ldap stop
|
||||
apply_cmd=/etc/rc./init.d/ldap restart
|
||||
init_name=ldap
|
||||
attr_count=6
|
||||
ldapadd=ldapadd
|
||||
|
||||
@@ -7,6 +7,7 @@ ssl=Use encryption with LDAP server?,1,-Detect automatically,1-Yes,2-Yes TLS,0-N
|
||||
|
||||
line4=LDAP server options,11
|
||||
slapd=Full path to OpenLDAP server program,8
|
||||
ldapadd=Full path to <tt>ldapadd</tt> command,8
|
||||
config_file=OpenLDAP server configuration file or directory,8
|
||||
schema_dir=OpenLDAP schema directory,7
|
||||
ldap_user=User OpenLDAP server runs as,5
|
||||
|
||||
@@ -6,11 +6,10 @@ require './ldap-server-lib.pl';
|
||||
$access{'slapd'} || &error($text{'slapd_ecannot'});
|
||||
&ui_print_header(undef, $text{'slapd_title'}, "", "slapd");
|
||||
$conf = &get_ldif_config();
|
||||
@tds = ( "width=30%" );
|
||||
|
||||
print &ui_form_start("save_ldif.cgi", "post");
|
||||
print &ui_hidden_table_start($text{'slapd_header'}, "width=100%", 2,
|
||||
"basic", 1,\@tds);
|
||||
"basic", 1);
|
||||
|
||||
# Top-level DN
|
||||
$defdb = &get_default_db();
|
||||
@@ -74,7 +73,7 @@ print &ui_hidden_table_end("basic");
|
||||
|
||||
# SSL section
|
||||
print &ui_hidden_table_start($text{'slapd_header2'}, "width=100%", 2,
|
||||
"ssl", 0, \@tds);
|
||||
"ssl", 0);
|
||||
|
||||
# Protocols to serve
|
||||
if (&can_get_ldap_protocols()) {
|
||||
|
||||
@@ -18,7 +18,12 @@ if (&get_config_type() == 1) {
|
||||
}
|
||||
|
||||
# Show a table of all known schema files, with checkboxes
|
||||
print $text{'schema_pagedesc'},"<p>\n";
|
||||
if (&get_config_type() == 1) {
|
||||
print $text{'schema_pagedesc'},"<p>\n";
|
||||
}
|
||||
else {
|
||||
print $text{'schema_pagedesc2'},"<p>\n";
|
||||
}
|
||||
@tds = ( $editable ? ( "width=5" ) : ( ),
|
||||
"width=20%", "width=65%", "width=10%", "width=5% nowrap" );
|
||||
print &ui_form_start("save_schema.cgi", "post");
|
||||
@@ -31,8 +36,8 @@ print &ui_columns_start([ $editable ? ( "" ) : ( ),
|
||||
@files = sort { &schema_sorter } &list_schema_files();
|
||||
for($i=0; $i<@files; $i++) {
|
||||
$s = $files[$i];
|
||||
@acts = ( &ui_link("view_sfile.cgi?file=".&urlize($s->{'file'})."",$text{'schema_view'}),
|
||||
&ui_link("edit_sfile.cgi?file=".&urlize($s->{'file'})."",$text{'schema_edit'}) );
|
||||
@acts = ( &ui_link("view_sfile.cgi?file=".&urlize($s->{'file'}), $text{'schema_view'}),
|
||||
&ui_link("edit_sfile.cgi?file=".&urlize($s->{'file'}), $text{'schema_edit'}) );
|
||||
if ($incs{$s->{'file'}}) {
|
||||
$mover = &ui_up_down_arrows(
|
||||
"up_schema.cgi?file=".&urlize($s->{'file'}),
|
||||
@@ -56,6 +61,8 @@ for($i=0; $i<@files; $i++) {
|
||||
}
|
||||
else {
|
||||
# View files only
|
||||
push(@acts, &ui_link("import_sfile.cgi?file=".&urlize($s->{'file'}),
|
||||
$text{'schema_import'}));
|
||||
print &ui_columns_row(
|
||||
[ $s->{'name'},
|
||||
$s->{'desc'} || $s->{'file'},
|
||||
|
||||
61
ldap-server/import_sfile.cgi
Executable file
61
ldap-server/import_sfile.cgi
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Import a schema file into the server
|
||||
|
||||
require './ldap-server-lib.pl';
|
||||
&error_setup($text{'import_err'});
|
||||
&local_ldap_server() == 1 || &error($text{'slapd_elocal'});
|
||||
$access{'schema'} || &error($text{'schema_ecannot'});
|
||||
&ReadParse();
|
||||
&is_under_directory($config{'schema_dir'}, $in{'file'}) ||
|
||||
&error($text{'schema_edir'});
|
||||
&has_command($config{'ldapadd'}) ||
|
||||
&error(&text('import_eldapadd', "<tt>$config{'ldapadd'}</tt>"));
|
||||
|
||||
# Get login credentials
|
||||
$user = $config{'user'};
|
||||
$pass = $config{'pass'};
|
||||
if (&get_config_type() == 1) {
|
||||
my $conf = &get_config();
|
||||
$user ||= &find_value("rootdn", $conf);
|
||||
$pass ||= &find_value("rootpw", $conf);
|
||||
}
|
||||
else {
|
||||
$defdb = &get_default_db();
|
||||
$conf = &get_ldif_config();
|
||||
$user ||= &find_ldif_value("olcRootDN", $conf, $defdb);
|
||||
$pass ||= &find_ldif_value("olcRootPW", $conf, $defdb);
|
||||
}
|
||||
$user || &error($text{'import_euser'});
|
||||
|
||||
# Check that there's a corresponding LDIF file
|
||||
$ldiffile = $in{'file'};
|
||||
$ldiffile =~ s/\.schema$/.ldif/;
|
||||
-r $ldiffile ||
|
||||
&error(&text('import_eldif', "<tt>".&html_escape($ldiffile)."</tt>"));
|
||||
|
||||
# Run the import command
|
||||
$cmd = $config{'ldapadd'}.
|
||||
" -D ".quotemeta($user).
|
||||
" -w ".quotemeta($pass).
|
||||
" -H ldapi:///".
|
||||
" -Y external".
|
||||
" -f ".quotemeta($ldiffile);
|
||||
|
||||
&ui_print_unbuffered_header(undef, $text{'import_title'}, "");
|
||||
|
||||
print &text('import_doing', "<tt>".&html_escape($ldiffile)."</tt>"),"<p>\n";
|
||||
print "<pre>\n";
|
||||
&open_execute_command(CMD, $cmd, 2);
|
||||
while(<CMD>) {
|
||||
print &html_escape($_);
|
||||
}
|
||||
close(CMD);
|
||||
print "</pre>\n";
|
||||
if ($?) {
|
||||
print $text{'import_failed'},"<p>\n";
|
||||
}
|
||||
else {
|
||||
print $text{'import_ok'},"<p>\n";
|
||||
}
|
||||
|
||||
&ui_print_footer("edit_schema.cgi", $text{'schema_return'});
|
||||
@@ -84,11 +84,13 @@ schema_title=Manage Schema
|
||||
schema_file=Name
|
||||
schema_desc=Description
|
||||
schema_pagedesc=The LDAP schema determines which object classes and attributes can be stored in your LDAP database. This page allows you to select which schema types are supported by your server - but be careful de-selecting any entries that are used by existing objects.
|
||||
schema_pagedesc2=The LDAP schema determines which object classes and attributes can be stored in your LDAP database. Schemas files must be imported before their types can be used to create objects.
|
||||
schema_err=Failed to save schema
|
||||
schema_move=Move
|
||||
schema_act=Actions..
|
||||
schema_view=View
|
||||
schema_edit=Edit
|
||||
schema_import=Import
|
||||
schema_edir=File is not in the schema directory!
|
||||
schema_etitle=Edit Schema File
|
||||
schema_eheader=Schema file contents
|
||||
@@ -214,6 +216,7 @@ apply_ecannot=You are not allowed to apply the configuration
|
||||
stop_err=Failed to stop LDAP server
|
||||
stop_ecmd=$1 failed : $2
|
||||
stop_egone=No longer running!
|
||||
stop_egone2=Running but PID is unknown!
|
||||
stop_ekill=Kill process failed : $1
|
||||
stop_ecannot=You are not allowed to stop the LDAP server
|
||||
|
||||
@@ -328,4 +331,13 @@ eacl_eaccess=Missing or invalid access level in row $1
|
||||
eacl_order=Rule order
|
||||
eacl_noorder=None set
|
||||
|
||||
import_err=Failed to import schema
|
||||
import_eldapadd=Could not find the $1 command
|
||||
import_euser=Could not work out LDAP server login
|
||||
import_eldif=LDIF file $1 does not exist
|
||||
import_title=Import Schema
|
||||
import_doing=Importing LDIF schema file $1 ..
|
||||
import_failed=.. import failed!
|
||||
import_ok=.. import completed successfully
|
||||
|
||||
__norefs=1
|
||||
|
||||
@@ -526,6 +526,7 @@ if ($config{'stop_cmd'}) {
|
||||
else {
|
||||
local $pid = &is_ldap_server_running();
|
||||
$pid || return $text{'stop_egone'};
|
||||
$pid > 1 || return $text{'stop_egone2'};
|
||||
return kill('TERM', $pid) ? undef : &text('stop_ekill', $!);
|
||||
}
|
||||
}
|
||||
@@ -564,6 +565,9 @@ else {
|
||||
# Returns the process ID of the running LDAP server, or undef
|
||||
sub is_ldap_server_running
|
||||
{
|
||||
&foreign_require("init");
|
||||
my $iname = $config{'init_name'} || $module_name;
|
||||
return 1 if (&init::status_action($iname) == 1);
|
||||
local $pidfile = &get_ldap_server_pidfile();
|
||||
if ($pidfile) {
|
||||
return &check_pid_file($pidfile);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/pam_ldap/auth_ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/usr/share/libnss-ldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaSamAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/libnss-ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaSamAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaSamAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/ldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaSamAccount
|
||||
imap_class=SquirrelMailUser inetLocalMailRecipient
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/openldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/openldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaSamAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/openldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
samba_class=sambaAccount
|
||||
auth_ldap=/etc/pam_ldap/auth_ldap.conf
|
||||
ldap_tls=0
|
||||
imap_login=cyrus
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/openldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
auth_ldap=/etc/openldap/ldap.conf
|
||||
imap_login=cyrus
|
||||
samba_class=sambaAccount
|
||||
imap_class=SuSEeMailObject
|
||||
|
||||
@@ -8,8 +8,9 @@ do 'ldap-useradmin-lib.pl';
|
||||
# For mode 0, returns 1 if installed, 0 if not
|
||||
sub is_installed
|
||||
{
|
||||
if ($config{'auth_ldap'}) {
|
||||
return 0 if (!-r $config{'auth_ldap'});
|
||||
my $cfile = &ldap_client::get_ldap_config_file();
|
||||
if ($cfile) {
|
||||
return 0 if (!-r $cfile);
|
||||
}
|
||||
else {
|
||||
if ($_[0]) {
|
||||
|
||||
@@ -92,8 +92,15 @@ else { &error($ldap); }
|
||||
sub get_user_base
|
||||
{
|
||||
local $conf = &ldap_client::get_config();
|
||||
local $passwd_base;
|
||||
foreach my $b (&ldap_client::find_value("base", $conf)) {
|
||||
if ($b =~ /^passwd\s+(\S+)/) {
|
||||
$passwd_base = $1;
|
||||
}
|
||||
}
|
||||
local $base = $config{'user_base'} ||
|
||||
&ldap_client::find_svalue("nss_base_passwd", $conf) ||
|
||||
$passwd_base ||
|
||||
&ldap_client::find_svalue("base", $conf);
|
||||
$base =~ s/\?.*$//;
|
||||
return $base;
|
||||
@@ -103,8 +110,15 @@ return $base;
|
||||
sub get_group_base
|
||||
{
|
||||
local $conf = &ldap_client::get_config();
|
||||
local $group_base;
|
||||
foreach my $b (&ldap_client::find_value("base", $conf)) {
|
||||
if ($b =~ /^group\s+(\S+)/) {
|
||||
$group_base = $1;
|
||||
}
|
||||
}
|
||||
local $base = $config{'group_base'} ||
|
||||
&ldap_client::find_svalue("nss_base_group", $conf) ||
|
||||
$group_base ||
|
||||
&ldap_client::find_svalue("base", $conf);
|
||||
$base =~ s/\?.*$//;
|
||||
return $base;
|
||||
@@ -241,6 +255,9 @@ my $schema = $ldap->schema();
|
||||
if ($schema->objectclass("person") && $config{'person'}) {
|
||||
push(@classes, "person");
|
||||
}
|
||||
if ($config{'given'}) {
|
||||
push(@classes, $config{'given_class'});
|
||||
}
|
||||
@classes = &uniquelc(@classes);
|
||||
@classes = grep { /\S/ } @classes; # Remove empty
|
||||
my @attrs = &user_to_dn($user);
|
||||
|
||||
@@ -117,9 +117,11 @@ elsif (@titles || @indexes) {
|
||||
local @str = &table_structure($in{'db'}, $t);
|
||||
push(@fields, scalar(@str));
|
||||
}
|
||||
my $table_index_stats = &get_table_index_stats($in{'db'});
|
||||
foreach $t (@indexes) {
|
||||
push(@types, $text{'dbase_typeindex'});
|
||||
$str = &index_structure($in{'db'}, $t);
|
||||
$str = &parse_index_structure($table_index_stats,
|
||||
$in{'db'}, $t);
|
||||
push(@rows, "<i>$text{'dbase_index'}</i>");
|
||||
push(@fields, scalar(@{$str->{'cols'}}));
|
||||
}
|
||||
|
||||
@@ -26,9 +26,13 @@ if (@{$d->{'data'}}) {
|
||||
$i++;
|
||||
next if ($access{'perms'} == 2 && !&can_edit_db($u->[1]));
|
||||
local @cols;
|
||||
my $dbname = &unquote_mysql_database($u->[1]);
|
||||
my $big_style = ' style="position: absolute; margin-top: -2px;"';
|
||||
my $wildcard = $u->[1]=~ /\_/ &&
|
||||
$u->[1] eq $dbname ? "<big$big_style>∗</big>" : '';
|
||||
push(@cols, "<a href='edit_db.cgi?idx=$i'>".
|
||||
($u->[1] eq '%' || $u->[1] eq '' ? $text{'dbs_any'}
|
||||
: &html_escape($u->[1]))."</a>");
|
||||
($u->[1] eq '%' || $u->[1] eq '' ? $text{'dbs_any'} :
|
||||
&html_escape($dbname))." $wildcard</a>");
|
||||
push(@cols, $u->[2] eq '' ? $text{'dbs_anon'}
|
||||
: &html_escape($u->[2]));
|
||||
push(@cols, $u->[0] eq '%' ? $text{'dbs_any'} :
|
||||
|
||||
@@ -675,6 +675,15 @@ $db =~ s/%/\\%/g;
|
||||
return $db;
|
||||
}
|
||||
|
||||
# unquote_mysql_database(name)
|
||||
# Returns a MySQL database name with \% and \_ characters unescaped
|
||||
sub unquote_mysql_database {
|
||||
my ($db) = @_;
|
||||
$db =~ s/\\%/%/g;
|
||||
$db =~ s/\\_/_/g;
|
||||
return $db;
|
||||
}
|
||||
|
||||
# escapestr(string)
|
||||
# Returns a string with quotes escaped, for use in SQL
|
||||
sub escapestr
|
||||
@@ -1304,6 +1313,39 @@ return &ui_textbox($name, $value, 8)."\n".
|
||||
[ "M", "MB" ], [ "G", "GB" ] ]);
|
||||
}
|
||||
|
||||
# get_table_index_stats(db)
|
||||
# Retrieves index stats for all tables in the given database
|
||||
sub get_table_index_stats
|
||||
{
|
||||
my ($db) = @_;
|
||||
my @tables = &list_tables($db);
|
||||
my $sql_query = "
|
||||
SELECT
|
||||
TABLE_SCHEMA,
|
||||
TABLE_NAME,
|
||||
INDEX_NAME,
|
||||
NON_UNIQUE,
|
||||
SEQ_IN_INDEX,
|
||||
COLUMN_NAME,
|
||||
COLLATION,
|
||||
CARDINALITY,
|
||||
SUB_PART,
|
||||
PACKED,
|
||||
NULLABLE,
|
||||
INDEX_TYPE,
|
||||
COMMENT,
|
||||
INDEX_COMMENT
|
||||
FROM
|
||||
INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE
|
||||
TABLE_SCHEMA = ?
|
||||
AND
|
||||
TABLE_NAME IN (" . join(", ", ("?") x @tables) . ")
|
||||
";
|
||||
my $rs = &execute_sql_safe($db, $sql_query, $db, @tables);
|
||||
return $rs;
|
||||
}
|
||||
|
||||
# list_indexes(db)
|
||||
# Returns the names of all indexes in some database
|
||||
sub list_indexes
|
||||
@@ -1352,6 +1394,33 @@ foreach my $table (&list_tables($db)) {
|
||||
return $info;
|
||||
}
|
||||
|
||||
# parse_index_structure(&db_stats, db, indexname)
|
||||
# Returns information on an index based on the database stats hash
|
||||
sub parse_index_structure
|
||||
{
|
||||
my ($db_stats, $db, $index) = @_;
|
||||
my ($r, $info);
|
||||
foreach my $table (&list_tables($db)) {
|
||||
my $s = { %$db_stats };
|
||||
$s->{'data'} = [grep { $_->[1] eq $table } @{$s->{'data'}}];
|
||||
my (%tp, $i);
|
||||
for($i=0; $i<@{$s->{'titles'}}; $i++) {
|
||||
$tp{lc($s->{'titles'}->[$i])} = $i;
|
||||
}
|
||||
foreach $r (@{$s->{'data'}}) {
|
||||
if ($r->[$tp{'index_name'}] eq $index) {
|
||||
# Found some info
|
||||
$info->{'table'} = $r->[$tp{'table_name'}];
|
||||
$info->{'name'} = $index;
|
||||
$info->{'type'} = lc($r->[$tp{'index_type'}]) ||
|
||||
lc($r->[$tp{'comment'}]);
|
||||
push(@{$info->{'cols'}}, $r->[$tp{'column_name'}]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
# list_views(db)
|
||||
# Returns the names of all views in some database
|
||||
sub list_views
|
||||
|
||||
@@ -173,7 +173,20 @@ return ( ) if ($?);
|
||||
my @lines = split(/\r?\n/, $out);
|
||||
my @w = split(/\s+/, $lines[$#lines]);
|
||||
shift(@w) if ($w[0] eq '');
|
||||
return ( $w[-3], $w[-2], $w[-1], 0, 0, undef, undef );
|
||||
my ($bi, $bo) = (0, 0);
|
||||
my $out2 = &backquote_command("iostat -Ix -d -t da 0.25 2 2>/dev/null");
|
||||
if (!$?) {
|
||||
foreach my $l (split(/\r?\n/, $out2)) {
|
||||
# Getting the 4th and 5th columns of the last line for direct access device
|
||||
# device r/i w/i kr/i kw/i qlen tsvc_t/i sb/i
|
||||
# ada0 3457.0 134574.0 61068.0 8443152.0 0 36.3 19.2
|
||||
if ($l =~ /^.*?da\d+\s+\S+\s+\S+\s+(\S+)\s+(\S+)\s+\d/) {
|
||||
$bi = int($1) * 4; # kr/i per period, i.e. 0.25 seconds
|
||||
$bo = int($2) * 4; # kw/i per period, i.e. 0.25 seconds
|
||||
}
|
||||
}
|
||||
}
|
||||
return ( $w[-3], $w[-2], $w[-1], 0, 0, $bi, $bo );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -710,5 +710,29 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
# count_processes()
|
||||
sub count_processes
|
||||
{
|
||||
my $process_count = 0;
|
||||
if ($gconfig{'os_type'} eq 'windows') {
|
||||
open(my $ps, '-|', 'tasklist /FO CSV') || return -1;
|
||||
while (my $line = <$ps>) {
|
||||
next if $. == 1; # Skip the header line
|
||||
$process_count++;
|
||||
}
|
||||
close($ps);
|
||||
return $process_count;
|
||||
}
|
||||
else {
|
||||
open(my $ps, '-|', 'ps -e') || return -1;
|
||||
while (<$ps>) {
|
||||
$process_count++;
|
||||
}
|
||||
close($ps);
|
||||
# Skip the header line
|
||||
return $process_count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
sub get_alive_status
|
||||
{
|
||||
local $out = `uptime 2>/dev/null`;
|
||||
local $out = &backquote_command("uptime 2>/dev/null");
|
||||
return { 'up' => 1,
|
||||
'desc' => $out =~ /\s+up\s+([^,]+),/ ? &text('alive_up', "$1")
|
||||
: undef };
|
||||
|
||||
9
status/firewalld-monitor.pl
Normal file
9
status/firewalld-monitor.pl
Normal file
@@ -0,0 +1,9 @@
|
||||
# Monitorthe firewalld server on this host
|
||||
|
||||
sub get_firewalld_status
|
||||
{
|
||||
my ($mon, $mod) = @_;
|
||||
return { 'up' => -1 } if (!&foreign_installed("firewalld"));
|
||||
&foreign_require("firewalld");
|
||||
return { 'up' => &firewalld::is_firewalld_running() };
|
||||
}
|
||||
@@ -182,7 +182,9 @@ if ($access{'edit'}) {
|
||||
print &ui_submit($text{'index_madd'});
|
||||
my @opts;
|
||||
foreach $h (sort { $a->[1] cmp $b->[1] } &list_handlers()) {
|
||||
push(@opts, [ $h->[0], $h->[1] ]);
|
||||
if (!$h->[2]) {
|
||||
push(@opts, [ $h->[0], $h->[1] ]);
|
||||
}
|
||||
}
|
||||
print &ui_select("type", undef, \@opts);
|
||||
print &ui_form_end();
|
||||
|
||||
@@ -76,6 +76,7 @@ type_slapd=LDAP Server
|
||||
type_ldap=LDAP Connection
|
||||
type_smtp=SMTP Connection
|
||||
type_imap=IMAP Connection
|
||||
type_firewalld=FirewallD Server
|
||||
|
||||
mon_create=Create Monitor
|
||||
mon_edit=Edit Monitor
|
||||
|
||||
@@ -43,6 +43,8 @@ $templates_dir = "$module_config_directory/templates";
|
||||
%monitor_os_support = ( 'traffic' => { 'os_support' => '*-linux freebsd' },
|
||||
);
|
||||
|
||||
%monitor_deprecated = ( 'dnsadmin' => 1 );
|
||||
|
||||
@monitor_statuses = ( 'up', 'down', 'un', 'webmin', 'timed', 'isdown' );
|
||||
|
||||
$mysql_variant = "mysql";
|
||||
@@ -230,7 +232,8 @@ return map { $_->{'dir'} } grep { &check_os_support($_) }
|
||||
|
||||
# list_handlers()
|
||||
# Returns a list of the module's monitor type handlers, and those
|
||||
# defined in other modules.
|
||||
# defined in other modules. Each is a array ref with ID, description
|
||||
# and deprecated fields.
|
||||
sub list_handlers
|
||||
{
|
||||
my ($f, @rv);
|
||||
@@ -240,7 +243,8 @@ while($f = readdir(DIR)) {
|
||||
my $m = $1;
|
||||
my $oss = $monitor_os_support{$m};
|
||||
next if ($oss && !&check_os_support($oss));
|
||||
push(@rv, [ $m, $text{"type_$m"} ]);
|
||||
my $dep = $monitor_deprecated{$m} ? 1 : 0;
|
||||
push(@rv, [ $m, $text{"type_$m"}, $dep ]);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
@@ -252,7 +256,7 @@ foreach my $m (&get_all_module_infos()) {
|
||||
&check_os_support($m)) {
|
||||
&foreign_require($m->{'dir'}, "status_monitor.pl");
|
||||
my @mms = &foreign_call($m->{'dir'}, "status_monitor_list");
|
||||
push(@rv, map { [ $m->{'dir'}."::".$_->[0], $_->[1] ] } @mms);
|
||||
push(@rv, map { [ $m->{'dir'}."::".$_->[0], $_->[1], $_->[2] ] } @mms);
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
|
||||
@@ -1690,7 +1690,7 @@ if (!$tconfig{'nohr'} && !$tconfig{'nobottomhr'}) {
|
||||
return $rv;
|
||||
}
|
||||
|
||||
=head2 ui_print_header(subtext, image, [help], [config], [nomodule], [nowebmin], [rightside], [head-stuff], [body-stuff], [below])
|
||||
=head2 ui_print_header(subtext, title, image, [help], [config], [nomodule], [nowebmin], [rightside], [head-stuff], [body-stuff], [below])
|
||||
|
||||
Print HTML for a header with the post-header line. The args are the same
|
||||
as those passed to header(), defined in web-lib-funcs.pl, with the addition
|
||||
|
||||
@@ -13718,6 +13718,7 @@ my ($port, $host, $module) = @_;
|
||||
$module ||= $module_name;
|
||||
my $ws_proto = lc($ENV{'HTTPS'}) eq 'on' ? 'wss' : 'ws';
|
||||
my %miniserv;
|
||||
my $webprefix = &get_webprefix();
|
||||
&get_miniserv_config(\%miniserv);
|
||||
my $http_host_conf = &trim($miniserv{'websocket_host'} || $host);
|
||||
# Pass as defined
|
||||
@@ -13731,12 +13732,12 @@ if ($http_host_conf) {
|
||||
if (!defined($http_host_conf)) {
|
||||
my $forwarded_host = $ENV{'HTTP_X_FORWARDED_HOST'};
|
||||
if ($forwarded_host) {
|
||||
$http_host_conf = "$ws_proto://$forwarded_host".
|
||||
&get_webprefix();
|
||||
$http_host_conf =~ s/\/$//;
|
||||
$http_host_conf = "$ws_proto://$forwarded_host";
|
||||
$http_host_conf =~ s/[\/]+$//g;
|
||||
}
|
||||
}
|
||||
my $http_host = $http_host_conf || "$ws_proto://$ENV{'HTTP_HOST'}";
|
||||
$http_host .= $webprefix if ($webprefix);
|
||||
return "$http_host/$module/ws-$port";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user