Here's a simple (and insecure) perl script that will add a block of IPs to plesk from the command line. I accept no responsibility for its use or mis-use. Since it uses the plesk ipmanage tool, it is unlikely that you'll cause your system to implode.
#!/usr/bin/perl
# This script causes heavy load on the server and takes several minutes
# to run.
# The script assumes that the block is Class C or less.
# IP_SUBNET should be the first three octets of the IP.
# MASK should be in octet form (ex. 255.255.255.0)
#
# See (DIRECTORY)/psa/bin/ipmanage --help for more info
if (@ARGV != 5) {
print "Usage: create_ip_block.pl IP_SUBNET MASK INTERFACE TYPE CERT\n";
exit;
}
# Turn debug 'on' to test script before actually adding IPs!
# $debug = 'on';
# Change count based on the IPs you are trying to add. Settings below
# are for a class C subnet
my $start_count = 1;
my $end_count = 254;
# replace with path to your psa/bin directory. Below is for FreeBSD
my $psa_bin_path = "/usr/local/psa/bin";
my $ip_subnet = $ARGV[0];
my $mask = $ARGV[1];
my $interface = $ARGV[2];
my $type = $ARGV[3];
my $ssl = $ARGV[4];
for ($count="$start_count"; $count <= $end_count; $count++) {
$ip = "$ip_subnet" . "." . "$count";
if ($debug eq 'on') {
print "$psa_bin_path/ipmanage -c $ip -mask $mask -interface $interface -type $type -ssl_certificate $ssl\n";
} else {
`$psa_bin_path/ipmanage -c $ip -mask $mask -interface $interface -type $type -ssl_certificate $ssl`;
}
}
#!/usr/bin/perl
# This script causes heavy load on the server and takes several minutes
# to run.
# The script assumes that the block is Class C or less.
# IP_SUBNET should be the first three octets of the IP.
# MASK should be in octet form (ex. 255.255.255.0)
#
# See (DIRECTORY)/psa/bin/ipmanage --help for more info
if (@ARGV != 5) {
print "Usage: create_ip_block.pl IP_SUBNET MASK INTERFACE TYPE CERT\n";
exit;
}
# Turn debug 'on' to test script before actually adding IPs!
# $debug = 'on';
# Change count based on the IPs you are trying to add. Settings below
# are for a class C subnet
my $start_count = 1;
my $end_count = 254;
# replace with path to your psa/bin directory. Below is for FreeBSD
my $psa_bin_path = "/usr/local/psa/bin";
my $ip_subnet = $ARGV[0];
my $mask = $ARGV[1];
my $interface = $ARGV[2];
my $type = $ARGV[3];
my $ssl = $ARGV[4];
for ($count="$start_count"; $count <= $end_count; $count++) {
$ip = "$ip_subnet" . "." . "$count";
if ($debug eq 'on') {
print "$psa_bin_path/ipmanage -c $ip -mask $mask -interface $interface -type $type -ssl_certificate $ssl\n";
} else {
`$psa_bin_path/ipmanage -c $ip -mask $mask -interface $interface -type $type -ssl_certificate $ssl`;
}
}