As there is no way to mass-add ip addresses, I just wrote a little php script to mass-add ipv6 addresses:
PHP Code:
<?php
// Define /16 Subnet
define('SUB_', '2a01:4f8:160:1234::');
define('START_', '1008'); // use Hex values
define('END_', '100F'); // use Hex values
// Define Server / Database options
define('SERVER_ID_', '1');
define('CLIENT_ID_', '0');
define('IP_TYPE_', 'IPv6');
define('VIRTUALHOST_', 'y');
define('VIRTUALHOST_PORT_', '80,443');
// ISPConfig
define('USER_', 'admin');
define('PASSWD_', '***');
define('DOMAIN_', 'https://YOUR_ISPCONFIG_DOMAIN.COM');
define('START_PAGE_', DOMAIN_ . '/index.php');
define('LOGIN_PAGE_', DOMAIN_ . '/content.php');
define('SUBMIT_PAGE_', DOMAIN_ . '/admin/server_ip_edit.php');
define('PORT_', '8080');
define('USERAGENT_', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0');
define('COOKIE_', '/tmp/ispc_admin_cookie.txt'); // Make sure cookie write path exists... especially on windows
/**************************************************************************************************************
* *
* HERE BE DRAGONS *
* *
**************************************************************************************************************/
// Start Session Prefetching
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, START_PAGE_);
curl_setopt($ch, CURLOPT_PORT , PORT_);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, USERAGENT_);
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
$r = curl_exec($ch);
// Build post data
$data = array(
'username' => USER_,
'passwort' => PASSWD_,
's_mod' => 'login',
's_pg' => 'index'
);
// Transfer post data into url string
foreach ($data as $key => $val) {
$tmp = urlencode($key) . '=' . urlencode($val) . '&';
$qstring .= $tmp;
}
// Make login
curl_setopt($ch, CURLOPT_URL, LOGIN_PAGE_);
curl_setopt($ch, CURLOPT_PORT , PORT_);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, USERAGENT_);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $qstring);
curl_setopt($ch, CURLOPT_REFERER, START_PAGE_);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
$r = curl_exec($ch);
// Get the PHPSESSID from the cookie
$filename = COOKIE_;
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
$phpsessid = explode( 'PHPSESSID', $contents);
define('PHPSESSID_', trim($phpsessid[1]));
// Get the ip_edit form to create necessary sessions vars
curl_setopt($ch, CURLOPT_URL, SUBMIT_PAGE_);
curl_setopt($ch, CURLOPT_PORT , PORT_);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, USERAGENT_);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_REFERER, START_PAGE_);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
$r = curl_exec($ch);
// Loop through the adding addresses
$i = hexdec(START_);
$j = hexdec(END_);
while ($i <= $j) {
$ip = dechex($i);
$ip_address = SUB_ . $ip;
echo "i: $i - j: $j - ip: $ip_address<br>";
// Build data array
unset($data);
$data = array(
'server_id' => SERVER_ID_,
'client_id' => CLIENT_ID_,
'ip_type' => IP_TYPE_,
'ip_address' => $ip_address,
'virtualhost' => VIRTUALHOST_,
'virtualhost_port' => VIRTUALHOST_PORT_,
'id' => '',
'next_tab' => '',
'phpsessid' => PHPSESSID_
);
// Transfer post data into url string
unset($qstring);
foreach ($data as $key => $val) {
$tmp = urlencode($key) . '=' . urlencode($val) . '&';
$qstring .= $tmp;
}
// Make Query
curl_setopt($ch, CURLOPT_URL, SUBMIT_PAGE_);
curl_setopt($ch, CURLOPT_USERAGENT, USERAGENT_);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $qstring);
curl_setopt($ch, CURLOPT_REFERER, START_PAGE_);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
$r = curl_exec($ch);
$i++;
}
?>
Make sure to add your password, set your domain for ISPConfig, define your subnet and the desired range.
The script uses curl and write a cookie file to /tmp. So either use it locally on your computer or if you run it from a server, make sure to delete the cookie afterwards.
It's not an elegant solution and the script also takes it's time to run but it's still faster than adding them by hand. Afterwards you only have to assign them to clients when needed.
Recent comments
1 day 1 hour ago
1 day 6 hours ago
1 day 10 hours ago
1 day 12 hours ago
2 days 2 hours ago
2 days 2 hours ago
2 days 7 hours ago
2 days 14 hours ago
2 days 15 hours ago
2 days 16 hours ago