Added function for IPv6 prefixes in multiserver mirror setups.
| | |
| | | auto_network_configuration=n |
| | | ip_address=0.0.0.0 |
| | | netmask=255.255.255.0 |
| | | v6_prefix=
|
| | | gateway=0.0.0.0 |
| | | hostname=server1.domain.tld |
| | | nameservers=8.8.8.8,8.8.4.4 |
| | |
| | | website_path=/var/www/clients/client[client_id]/web[website_id] |
| | | website_symlinks=/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/ |
| | | website_symlinks_rel=n |
| | | vhost_rewrite_v6=n
|
| | | vhost_conf_dir=/etc/apache2/sites-available |
| | | vhost_conf_enabled_dir=/etc/apache2/sites-enabled |
| | | nginx_vhost_conf_dir=/etc/nginx/sites-available |
| | |
| | | } |
| | | } |
| | | break; |
| | | case 'ISV6PREFIX':
|
| | | $v6_prefix_ok = 0;
|
| | | $explode_field_value = explode(':',$field_value);
|
| | | if ($explode_field_value[count($explode_field_value)-1]=='' && $explode_field_value[count($explode_field_value)-2]=='' ){
|
| | | if ( count($explode_field_value) <= 9 ) {
|
| | | if(filter_var(substr($field_value,0,strlen($field_value)-2),FILTER_VALIDATE_IP,FILTER_FLAG_IPV6) or filter_var(substr($field_value,0,strlen($field_value)-2).'::0',FILTER_VALIDATE_IP,FILTER_FLAG_IPV6) or filter_var(substr($field_value,0,strlen($field_value)-2).':0',FILTER_VALIDATE_IP,FILTER_FLAG_IPV6) ) {
|
| | | $v6_prefix_ok = 1;
|
| | | }
|
| | | }
|
| | | } else { |
| | | $v6_prefix_ok = 2; |
| | | }
|
| | | // check subnet against defined server-ipv6
|
| | | $sql_v6 = $app->db->queryOneRecord("SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' LIMIT 0,1");
|
| | | $sql_v6_explode=explode(':',$sql_v6['ip_address']);
|
| | | if ( count($sql_v6_explode) < count($explode_field_value) && isset($sql_v6['ip_address']) ) { |
| | | $v6_prefix_ok = 3; |
| | | }
|
| | | if($v6_prefix_ok == 0) { |
| | | $errmsg = $validator['errmsg']; |
| | | }
|
| | | if($v6_prefix_ok == 2) { |
| | | $errmsg = 'IPv6 Prefix must end with ::'; |
| | | }
|
| | | if($v6_prefix_ok == 3) { |
| | | $errmsg = 'IPv6 Prefix too long (according to Server IP Addresses)'; |
| | | }
|
| | | if($v6_prefix_ok <> 1){
|
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | }
|
| | | break;
|
| | | case 'ISIPV4': |
| | | $vip=1; |
| | | if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ |
| | |
| | | 'width' => '15', |
| | | 'maxlength' => '255' |
| | | ), |
| | | 'v6_prefix' => array(
|
| | | 'datatype' => 'VARCHAR',
|
| | | 'formtype' => 'TEXT',
|
| | | 'validators' => array(0 => array('type' => 'ISV6PREFIX',
|
| | | 'errmsg' => 'v6_prefix_wrong'),
|
| | | ),
|
| | | 'default' => ''
|
| | | ),
|
| | | 'gateway' => array( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | |
| | | 'width' => '40', |
| | | 'maxlength' => '255' |
| | | ), |
| | |
|
| | | 'vhost_rewrite_v6' => array (
|
| | | 'datatype' => 'VARCHAR',
|
| | | 'formtype' => 'CHECKBOX',
|
| | | 'default' => 'n',
|
| | | 'value' => array(0 => 'n',1 => 'y')
|
| | | ),
|
| | |
|
| | |
|
| | |
|
| | | 'vhost_conf_dir' => array( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | |
| | | $wb["web_folder_protection_txt"] = 'Make web folders immutable (extended attributes)'; |
| | | $wb["overtraffic_notify_admin_txt"] = 'Send overtraffic notification to admin'; |
| | | $wb["overtraffic_notify_client_txt"] = 'Send overtraffic notification to client'; |
| | | $wb["v6_prefix_txt"] = 'IPv6 Prefix';
|
| | | $wb["vhost_rewrite_v6_txt"] = 'Rewrite IPv6 on Mirror';
|
| | | $wb["v6_prefix_wrong"] = 'Invalid v6 Netmask format.';
|
| | | ?> |
| | |
| | | <input name="netmask" id="netmask" value="{tmpl_var name='netmask'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" /> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="v6_prefix">{tmpl_var name='v6_prefix_txt'}</label>
|
| | | <input name="v6_prefix" id="v6_prefix" value="{tmpl_var name='v6_prefix'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" />
|
| | | </div>
|
| | | <div class="ctrlHolder">
|
| | | <label for="gateway">{tmpl_var name='gateway_txt'}</label> |
| | | <input name="gateway" id="gateway" value="{tmpl_var name='gateway'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" /> |
| | | </div> |
| | |
| | | <input name="website_autoalias" id="website_autoalias" value="{tmpl_var name='website_autoalias'}" size="40" maxlength="255" type="text" class="textInput" /> {tmpl_var name='website_autoalias_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[client_id]</a>, <a href="javascript:void(0);" class="addPlaceholder">[client_username]</a>, <a href="javascript:void(0);" class="addPlaceholder">[website_id]</a>, <a href="javascript:void(0);" class="addPlaceholder">[website_domain]</a> |
| | | </div> |
| | | <div class="ctrlHolder apache"> |
| | | <label for="vhost_rewrite_v6">{tmpl_var name='vhost_rewrite_v6_txt'}</label>
|
| | | <div class="multiField">
|
| | | {tmpl_var name='vhost_rewrite_v6'}
|
| | | </div>
|
| | | </div>
|
| | | <div class="ctrlHolder apache">
|
| | | <label for="vhost_conf_dir">{tmpl_var name='vhost_conf_dir_txt'}</label> |
| | | <input name="vhost_conf_dir" id="vhost_conf_dir" value="{tmpl_var name='vhost_conf_dir'}" size="40" maxlength="255" type="text" class="textInput" /> |
| | | </div> |
| | |
| | | |
| | | //* Add vhost for IPv6 IP |
| | | if($data['new']['ipv6_address'] != '') { |
| | | if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
|
| | | if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
|
| | | $explode_v6prefix=explode(':',$conf['serverconfig']['server']['v6_prefix']);
|
| | | $explode_v6=explode(':',$data['new']['ipv6_address']);
|
| | |
|
| | | print_r($explode_v6prefix);
|
| | | print_r($explode_v6);
|
| | |
|
| | | for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
|
| | | $explode_v6[$i] = $explode_v6prefix[$i];
|
| | | }
|
| | | $data['new']['ipv6_address'] = implode(':',$explode_v6);
|
| | | }
|
| | | }
|
| | | if(count($rewrite_rules) > 0){ |
| | | $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80, 'redirects' => $rewrite_rules); |
| | | } else { |