Added function for IPv6 prefixes in multiserver mirror setups.
| | |
| | | |
| | | |
| | | [server] |
| | | auto_network_configuration=n |
| | | ip_address=0.0.0.0 |
| | | netmask=255.255.255.0 |
| | | gateway=0.0.0.0 |
| | | hostname=server1.domain.tld |
| | | nameservers=8.8.8.8,8.8.4.4 |
| | | 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
|
| | | firewall=bastille |
| | | loglevel=2 |
| | | backup_dir=/var/backup |
| | |
| | | [web] |
| | | server_type=apache |
| | | website_basedir=/var/www |
| | | 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_conf_dir=/etc/apache2/sites-available |
| | | vhost_conf_enabled_dir=/etc/apache2/sites-enabled |
| | | nginx_vhost_conf_dir=/etc/nginx/sites-available |
| | | 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
|
| | | nginx_vhost_conf_enabled_dir=/etc/nginx/sites-enabled |
| | | security_level=20 |
| | | user=www-data |
| | |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n"; |
| | | } else { |
| | | $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)){ |
| | | }
|
| | | }
|
| | | 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)){
|
| | | $groups=explode(".",$field_value); |
| | | foreach($groups as $group){ |
| | | if($group<0 OR $group>255) |
| | |
| | | 'errmsg' => 'netmask_error_wrong'), |
| | | ), |
| | | 'value' => '', |
| | | 'width' => '15', |
| | | 'maxlength' => '255' |
| | | ), |
| | | 'gateway' => array( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | | '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',
|
| | | 'default' => '192.168.0.1', |
| | | 'validators' => array(0 => array('type' => 'ISIPV4', |
| | | 'errmsg' => 'gateway_error_wrong'), |
| | |
| | | 'formtype' => 'TEXT', |
| | | 'default' => '', |
| | | 'value' => '', |
| | | 'width' => '40', |
| | | 'maxlength' => '255' |
| | | ), |
| | | 'vhost_conf_dir' => 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',
|
| | | 'default' => '', |
| | | 'validators' => array(0 => array('type' => 'NOTEMPTY', |
| | | 'errmsg' => 'vhost_conf_dir_error_empty'), |
| | |
| | | $wb["firewall_txt"] = 'Firewall'; |
| | | $wb["mailbox_quota_stats_txt"] = 'Mailbox quota statistics'; |
| | | $wb["enable_ip_wildcard_txt"] = 'Enable IP wildcard (*)'; |
| | | $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["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="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="255" type="text" class="textInput formLengthIPv4" /> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="netmask">{tmpl_var name='netmask_txt'}</label> |
| | | <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="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" /> |
| | | <label for="netmask">{tmpl_var name='netmask_txt'}</label>
|
| | | <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> |
| | | <div class="ctrlHolder"> |
| | | <label for="hostname">{tmpl_var name='hostname_txt'}</label> |
| | |
| | | <div class="buttonHolder buttons"> |
| | | <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onclick="submitForm('pageForm','admin/server_config_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button> |
| | | <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onclick="loadContent('admin/server_config_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div>
|
| | | </div>
|
| | | |
| | | </div>
|
| | |
| | | </div> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="website_autoalias">{tmpl_var name='website_autoalias_txt'}</label> |
| | | <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_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" /> |
| | | <label for="website_autoalias">{tmpl_var name='website_autoalias_txt'}</label>
|
| | | <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> |
| | | <div class="ctrlHolder apache"> |
| | | <label for="vhost_conf_enabled_dir">{tmpl_var name='vhost_conf_enabled_dir_txt'}</label> |
| | |
| | | jQuery('.apache').hide(); |
| | | } else { |
| | | jQuery('.nginx').hide(); |
| | | jQuery('.apache').show(); |
| | | } |
| | | } |
| | | </script> |
| | | jQuery('.apache').show();
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
| | | } else { |
| | | $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443'); |
| | | } |
| | | $app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG); |
| | | } |
| | | |
| | | //* Add vhost for IPv6 IP |
| | | if($data['new']['ipv6_address'] != '') { |
| | | if(count($rewrite_rules) > 0){ |
| | | $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80, 'redirects' => $rewrite_rules); |
| | | } else { |
| | | $app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
|
| | | }
|
| | | |
| | | //* 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 {
|
| | | $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80); |
| | | } |
| | | |