forked from communigate/communigate-cpanel-adaptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable-services.pl
executable file
·46 lines (40 loc) · 1.76 KB
/
enable-services.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use MIME::Base64;
if ($#ARGV != 0) {
print "usage $0 <root password>\nNeeded for WHM XML API CALL\n";
exit(1);
}
my $user = "root";
my $pass = $ARGV[0];
my $auth = "Basic " . MIME::Base64::encode( $user . ":" . $pass );
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( GET => "http://127.0.0.1:2086/xml-api/configureservice?service=spamd&enabled=1&monitored=1" );
$request->header( Authorization => $auth );
my $response = $ua->request($request);
print $response->content;
my $request = HTTP::Request->new( GET => "http://127.0.0.1:2086/xml-api/configureservice?service=exim&enabled=1&monitored=1" );
$request->header( Authorization => $auth );
my $response = $ua->request($request);
print $response->content;
my $request = HTTP::Request->new( GET => "http://127.0.0.1:2086/xml-api/configureservice?service=mailman&enabled=1&monitored=1" );
$request->header( Authorization => $auth );
my $response = $ua->request($request);
print $response->content;
my $request = HTTP::Request->new( GET => "http://127.0.0.1:2086/xml-api/configureservice?service=pop&enabled=1&monitored=1" );
$request->header( Authorization => $auth );
my $response = $ua->request($request);
print $response->content;
my $request = HTTP::Request->new( GET => "http://127.0.0.1:2086/xml-api/configureservice?service=imap&enabled=1&monitored=1" );
$request->header( Authorization => $auth );
my $response = $ua->request($request);
print $response->content;
my $cmd = "cat /var/cpanel/cpanel.config | grep -v skipspamassassin > /tmp/toto";
system($cmd);
$cmd = "echo skipspamassassin=0 >> /tmp/toto";
system($cmd);
$cmd = "mv /tmp/toto /var/cpanel/cpanel.config";
system($cmd);
$cmd = "/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings";
system($cmd);