# Check the status of a SSL cert on a remote server sub get_sslcert_status { local $up = 0; local $desc; local $certfile; local ($host, $port, $page, $ssl); if ($_[0]->{'url'}) { # Parse the URL and connect ($host, $port, $page, $ssl) = &parse_http_url($_[0]->{'url'}); # Run the openssl command to connect local $cmd = "openssl s_client -host ".quotemeta($host). " -servername ".quotemeta($host). " -port ".quotemeta($port)." </dev/null 2>&1"; local $out = &backquote_with_timeout($cmd, 10); if ($?) { # Try again without -servername, as some openssl versions # don't support it $cmd = "openssl s_client -host ".quotemeta($host). " -port ".quotemeta($port)." </dev/null 2>&1"; $out = &backquote_with_timeout($cmd, 10); } if ($?) { # Connection failed return { 'up' => -1, 'desc' => $text{'sslcert_edown'} }; } # Extract the cert part and save $certfile = &transname(); if ($out =~ /(-----BEGIN CERTIFICATE-----\n(.*\n)+-----END CERTIFICATE-----\n)/) { local $cert = $1; &open_tempfile(CERT, ">$certfile", 0, 1); &print_tempfile(CERT, $cert); &close_tempfile(CERT); } else { # No cert? return { 'up' => 0, 'desc' => $text{'sslcert_ecert'} }; } } else { # Cert is already in a file $certfile = $_[0]->{'file'}; } # Get end date with openssl x509 -in cert.pem -inform PEM -text -noout -enddate local $info = &backquote_command("openssl x509 -in ".quotemeta($certfile). " -inform PEM -text -noout -enddate ". " </dev/null 2>&1"); # Check dates &foreign_require("mailboxes"); local ($start, $end); if ($info =~ /Not\s*Before\s*:\s*(.*)/i) { $start = &mailboxes::parse_mail_date("$1"); } if ($info =~ /Not\s+After\s*:\s*(.*)/i) { $end = &mailboxes::parse_mail_date("$1"); } local $now = time(); if ($start && $now < $start) { # Too new?! $desc = &text('sslcert_estart', &make_date($start)); } elsif ($end && $now > $end-$_[0]->{'days'}*24*60*60) { # Too old $desc = &text('sslcert_eend', &make_date($end)); } elsif ($_[0]->{'mismatch'} && $_[0]->{'url'} && $info =~ /Subject:.*CN=([a-z0-9\.\-\_\*]+)/i) { # Check hostname local $cn = $1; local $match = $1; $match =~ s/\*/\.\*/g; # Make perl RE local @matches = ( $match ); if ($info =~ /Subject\s+Alternative\s+Name.*\r?\n\s*(.*)\n/) { # Add UCC alternate names local $alts = $1; $alts =~ s/^\s+//; $alts =~ s/\s+$//; foreach my $a (split(/[, ]+/, $alts)) { if ($a =~ /^DNS:(\S+)/) { $match = $1; $match =~ s/\*/\.\*/g; # Make perl RE push(@matches, $match); } } } local $ok = 0; foreach $match (@matches) { $ok++ if ($host =~ /^$match$/i); } if (!$ok) { $desc = &text('sslcert_ematch', $host, $cn); } } if (!$desc) { # All OK! $desc = &text('sslcert_left', int(($end-$now)/(24*60*60))); $up = 1; } return { 'up' => $up, 'desc' => $desc }; } sub show_sslcert_dialog { # URL or file to check print &ui_table_row($text{'sslcert_src'}, &ui_radio_table("src", $_[0]->{'file'} ? 1 : 0, [ [ 0, $text{'sslcert_url'}, &ui_textbox("url", $_[0]->{'url'}, 50) ], [ 1, $text{'sslcert_file'}, &ui_textbox("file", $_[0]->{'file'}, 50)." ". &file_chooser_button("file") ] ]), 3); # Days before expiry to warn print &ui_table_row($text{'sslcert_days'}, &ui_opt_textbox("days", $_[0]->{'days'}, 5, $text{'sslcert_when'})); # Warn about mismatch print &ui_table_row($text{'sslcert_mismatch'}, &ui_yesno_radio("mismatch", $_[0]->{'mismatch'})); } sub parse_sslcert_dialog { &has_command("openssl") || &error($text{'sslcert_eopenssl'}); if ($in{'src'} == 0) { # Parse URL $in{'url'} =~ /^https:\/\/(\S+)$/ || &error($text{'sslcert_eurl'}); $_[0]->{'url'} = $in{'url'}; delete($_[0]->{'file'}); } else { # Parse file $in{'file'} =~ /^\// && -r $in{'file'} || &error($text{'sslcert_efile'}); $_[0]->{'file'} = $in{'file'}; delete($_[0]->{'url'}); } # Parse number of days if ($in{'days_def'}) { delete($_[0]->{'days'}); } else { $in{'days'} =~ /^[1-9]\d*$/ || &error($text{'sslcert_edays'}); $_[0]->{'days'} = $in{'days'}; } # Check hostname $_[0]->{'mismatch'} = $in{'mismatch'}; if ($in{'mismatch'} && $in{'src'}) { &error($text{'sslcert_emismatch'}); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
services | Folder | 0755 |
|
|
CHANGELOG | File | 6.42 KB | 0644 |
|
WEBMIN-STATUS-MIB.txt | File | 1.53 KB | 0644 |
|
acl_security.pl | File | 508 B | 0755 |
|
alive-monitor.pl | File | 241 B | 0755 |
|
apache-monitor.pl | File | 697 B | 0755 |
|
backup_config.pl | File | 801 B | 0755 |
|
bind8-monitor.pl | File | 710 B | 0755 |
|
cfengine-monitor.pl | File | 415 B | 0755 |
|
cgi_args.pl | File | 321 B | 0755 |
|
change-monitor.pl | File | 791 B | 0755 |
|
config | File | 182 B | 0644 |
|
config-ALL-linux | File | 210 B | 0644 |
|
config-debian-linux | File | 225 B | 0644 |
|
config-debian-linux-3.0 | File | 216 B | 0644 |
|
config-debian-linux-3.1-ALL | File | 216 B | 0644 |
|
config-freebsd | File | 195 B | 0644 |
|
config-hpux | File | 182 B | 0644 |
|
config-netbsd | File | 182 B | 0644 |
|
config-solaris | File | 182 B | 0644 |
|
config-syno-linux | File | 197 B | 0644 |
|
config.info | File | 1.09 KB | 0644 |
|
config.info.ca | File | 1.31 KB | 0644 |
|
config.info.cs | File | 802 B | 0644 |
|
config.info.de | File | 1.28 KB | 0644 |
|
config.info.es | File | 659 B | 0644 |
|
config.info.fa | File | 994 B | 0644 |
|
config.info.fr | File | 1.42 KB | 0644 |
|
config.info.hu | File | 0 B | 0644 |
|
config.info.it | File | 0 B | 0644 |
|
config.info.ja | File | 1.04 KB | 0644 |
|
config.info.ko | File | 764 B | 0644 |
|
config.info.nl | File | 984 B | 0644 |
|
config.info.no | File | 962 B | 0644 |
|
config.info.pl | File | 1021 B | 0644 |
|
config.info.ru | File | 486 B | 0644 |
|
config.info.sv | File | 99 B | 0644 |
|
config.info.tr | File | 567 B | 0644 |
|
config.info.uk | File | 479 B | 0644 |
|
config.info.zh | File | 86 B | 0644 |
|
config.info.zh_TW | File | 229 B | 0644 |
|
consume-monitor.pl | File | 1.89 KB | 0755 |
|
defaultacl | File | 15 B | 0644 |
|
delete_mons.cgi | File | 1.03 KB | 0755 |
|
delete_tmpls.cgi | File | 712 B | 0755 |
|
dhcpd-monitor.pl | File | 616 B | 0755 |
|
dns-monitor.pl | File | 1.3 KB | 0755 |
|
dnsadmin-monitor.pl | File | 667 B | 0755 |
|
dovecot-monitor.pl | File | 302 B | 0755 |
|
du-monitor.pl | File | 790 B | 0644 |
|
edit_mon.cgi | File | 9.61 KB | 0755 |
|
edit_sched.cgi | File | 3.24 KB | 0755 |
|
edit_tmpl.cgi | File | 1.81 KB | 0755 |
|
exec-monitor.pl | File | 1.52 KB | 0755 |
|
fail2ban-monitor.pl | File | 516 B | 0755 |
|
feedback_files.pl | File | 175 B | 0755 |
|
file-monitor.pl | File | 3.35 KB | 0755 |
|
ftp-monitor.pl | File | 3.05 KB | 0755 |
|
hostsentry-monitor.pl | File | 521 B | 0755 |
|
http-monitor.pl | File | 4.13 KB | 0755 |
|
iface-monitor.pl | File | 908 B | 0755 |
|
index.cgi | File | 4.77 KB | 0755 |
|
inetd-monitor.pl | File | 399 B | 0755 |
|
init-monitor.pl | File | 576 B | 0644 |
|
jabber-monitor.pl | File | 667 B | 0755 |
|
ldap-monitor.pl | File | 1.51 KB | 0755 |
|
list_tmpls.cgi | File | 1.05 KB | 0755 |
|
load-monitor.pl | File | 1.1 KB | 0755 |
|
log_parser.pl | File | 673 B | 0755 |
|
mailq-monitor.pl | File | 1.3 KB | 0755 |
|
memory-monitor.pl | File | 1.55 KB | 0755 |
|
module.info | File | 168 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 128 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 167 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 198 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 247 B | 0644 |
|
module.info.ca | File | 118 B | 0644 |
|
module.info.ca.auto | File | 14 B | 0644 |
|
module.info.cs | File | 33 B | 0644 |
|
module.info.cs.auto | File | 105 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 120 B | 0644 |
|
module.info.de | File | 121 B | 0644 |
|
module.info.de.auto | File | 15 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 274 B | 0644 |
|
module.info.es | File | 40 B | 0644 |
|
module.info.es.auto | File | 95 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 132 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 185 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 134 B | 0644 |
|
module.info.fr | File | 42 B | 0644 |
|
module.info.fr.auto | File | 107 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 155 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 134 B | 0644 |
|
module.info.hu | File | 37 B | 0644 |
|
module.info.hu.auto | File | 99 B | 0644 |
|
module.info.it | File | 39 B | 0644 |
|
module.info.it.auto | File | 96 B | 0644 |
|
module.info.ja | File | 57 B | 0644 |
|
module.info.ja.auto | File | 130 B | 0644 |
|
module.info.ko | File | 36 B | 0644 |
|
module.info.ko.auto | File | 92 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 131 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 136 B | 0644 |
|
module.info.ms | File | 119 B | 0644 |
|
module.info.ms.auto | File | 15 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 146 B | 0644 |
|
module.info.nl | File | 33 B | 0644 |
|
module.info.nl.auto | File | 97 B | 0644 |
|
module.info.no | File | 32 B | 0644 |
|
module.info.no.auto | File | 96 B | 0644 |
|
module.info.pl | File | 97 B | 0644 |
|
module.info.pl.auto | File | 15 B | 0644 |
|
module.info.pt | File | 0 B | 0644 |
|
module.info.pt.auto | File | 133 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 142 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 153 B | 0644 |
|
module.info.ru | File | 56 B | 0644 |
|
module.info.ru.auto | File | 165 B | 0644 |
|
module.info.sk | File | 33 B | 0644 |
|
module.info.sk.auto | File | 106 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 135 B | 0644 |
|
module.info.sv | File | 33 B | 0644 |
|
module.info.sv.auto | File | 92 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 250 B | 0644 |
|
module.info.tr | File | 32 B | 0644 |
|
module.info.tr.auto | File | 105 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 208 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 174 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 182 B | 0644 |
|
module.info.zh | File | 36 B | 0644 |
|
module.info.zh.auto | File | 76 B | 0644 |
|
module.info.zh_TW | File | 40 B | 0644 |
|
module.info.zh_TW.auto | File | 82 B | 0644 |
|
mon-monitor.pl | File | 431 B | 0755 |
|
monitor.pl | File | 14.59 KB | 0755 |
|
mysql-monitor.pl | File | 450 B | 0755 |
|
nfs-monitor.pl | File | 394 B | 0755 |
|
nut-monitor.pl | File | 2.13 KB | 0755 |
|
oldfile-monitor.pl | File | 864 B | 0755 |
|
ping-monitor.pl | File | 6.84 KB | 0755 |
|
portsentry-monitor.pl | File | 535 B | 0755 |
|
postfix-monitor.pl | File | 509 B | 0755 |
|
postgresql-monitor.pl | File | 480 B | 0755 |
|
prefs.info | File | 58 B | 0644 |
|
proc-monitor.pl | File | 1.7 KB | 0755 |
|
proftpd-monitor.pl | File | 842 B | 0755 |
|
qmailadmin-monitor.pl | File | 424 B | 0755 |
|
query-monitor.pl | File | 2.89 KB | 0755 |
|
raid-monitor.pl | File | 1.66 KB | 0755 |
|
refresh.cgi | File | 550 B | 0755 |
|
rssh-monitor.pl | File | 2.63 KB | 0755 |
|
safeacl | File | 15 B | 0644 |
|
samba-monitor.pl | File | 453 B | 0755 |
|
save_mon.cgi | File | 3.23 KB | 0755 |
|
save_sched.cgi | File | 2.44 KB | 0755 |
|
save_tmpl.cgi | File | 1.25 KB | 0755 |
|
sendmail-monitor.pl | File | 682 B | 0755 |
|
sensors-monitor.pl | File | 3.9 KB | 0755 |
|
slapd-monitor.pl | File | 606 B | 0755 |
|
space-monitor.pl | File | 3.09 KB | 0755 |
|
squid-monitor.pl | File | 881 B | 0755 |
|
sshd-monitor.pl | File | 817 B | 0755 |
|
sslcert-monitor.pl | File | 4.11 KB | 0755 |
|
status-lib.pl | File | 17.62 KB | 0755 |
|
status_monitor_api.pl | File | 593 B | 0755 |
|
system_info.pl | File | 1.48 KB | 0644 |
|
tcp-monitor.pl | File | 1.23 KB | 0755 |
|
traffic-monitor.pl | File | 2.4 KB | 0755 |
|
uninstall.pl | File | 434 B | 0755 |
|
usermin-monitor.pl | File | 496 B | 0755 |
|
webmin-monitor.pl | File | 363 B | 0755 |
|
xinetd-monitor.pl | File | 491 B | 0755 |
|