����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/1630575/root/usr/lib64/nagios/plugins/extra/ |
Upload File : |
#!/bin/perl
use strict;
use warnings;
use English;
use Getopt::Long;
my $exit_code = 0;
my $opt_d;
&help if !(@ARGV);
GetOptions(
"help|h" => \&help,
"d=s" => \$opt_d
);
&help unless ($opt_d);
my @domains = split( ',', $opt_d );
my ( @emails, @errors );
for my $domain (@domains) {
my @whois = `whois $domain | grep -E "(Registrant|Admin|Billing|Tech) Email" | awk '{print \$3}' | sort | uniq`;
chomp @whois;
if (!@whois) {
push( @errors, 'Cannot acquire whois info for ' . $domain . "\n" );
$exit_code = 2;
next;
}
push( @emails, @whois );
}
for my $email (@emails) {
my $recipient = `mysql -sNe "select FORWARD_TO from redirmail.D_FORWARD_LIST where RECIPIENT=\'$email\'"`;
chomp $recipient;
if ( !$recipient ) {
push( @errors, 'Cannot acquire recipient address for ' . $email . "\n" );
$exit_code = 1;
next;
}
my $rediremail = `docker exec -i mailredirect_exim exim -bt "$email" | egrep -i $recipient`;
chomp $rediremail;
if ($rediremail) {
print "$email redirects to $rediremail\n";
}
else {
push( @errors, "$email: redirect email $rediremail does not match \n" );
$exit_code = 1;
}
}
print "OK - redirect email is match\n" if !$exit_code;
print join( "\n", @errors ) if @errors;
exit $exit_code;
sub help {
print "Usage : $0 -d domain1.com,domain2.com,... \n\n";
print "Options :\n";
print " -d\n\tList of domains to check, separated by comma\n";
print " -h, --help\n\tPrint this help screen\n";
exit 3;
}