Jump to content
Froxlor Forum
  • 0

Host Site on IPv4 and IPv6


zumbuschk

Question

10 answers to this question

Recommended Posts

None that I know of. I tried ipv6 hosting with some domains manually (adding an aaaa-record to the zonefiles and configure the apache VirtualHosts). It works so far, but every time froxlor updates the config files your changes will be gone.

Link to comment
Share on other sites

I tried an other "solution":

I disable the "domain already exists"-check in admin_domains.php and then I can add the same domain with IPv6. Froxlor also adds the domain into the panel_domains-table, but it does not show up in the Froxlor-domain-list.

Link to comment
Share on other sites

At the moment I am thinking of what the best practice for ipv6 would be. Creating vHosts the same way as with ipv4 (one ip lots of vHosts) or give every vHost it's own IP, as there are enough IPs.

 

Are there any thoughts on how froxlor is going to handle this in the future?

Link to comment
Share on other sites

As I use 1 IPv4 and 1 IPv6 address on my server for the vhosts..

I just searched the /var/www/froxlor/scripts/jobs/cron_tasks.inc.http.10.apache.php for VirtualHost and replaced the VirtualHost entry's with *:80 :)

works great on single IP based nodes.

 

root@mail:/var/www/froxlor/scripts/jobs# cat cron_tasks.inc.http.10.apache.php | grep VirtualHost
                               $this->virtualhosts_data[$vhosts_filename].= 'NameVirtualHost *:80' . "\n";
                               $this->virtualhosts_data[$vhosts_filename].= '<VirtualHost *:80>' . "\n";
                               $this->virtualhosts_data[$vhosts_filename].= '</VirtualHost>' . "\n";
               $vhost_content = '<VirtualHost *:80>' . "\n";
               $vhost_content.= '</VirtualHost>' . "\n";
       public function createVirtualHosts()
                       fwrite($this->debugHandler, '  apache::createVirtualHosts: creating vhost container for domain ' . $domain['id'] . ', customer ' . $domain['loginname'] . "\n");
root@mail:/var/www/froxlor/scripts/jobs#

 

It now creates the following vhost configs:

root@mail:/var/www/froxlor/scripts/jobs# cat /etc/apache2/sites-enabled/22_froxlor_normal_vhost_$domain.conf
# 22_froxlor_normal_vhost_$domain.conf
# Created 21.05.2011 10:31
# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.

# Domain ID: 6 - CustomerID: 1 - CustomerLogin: $user
<VirtualHost *:80>
 ServerName $domain
 ServerAlias *.$domain
 ServerAdmin $user@$domain
 DocumentRoot "/var/customers/webs/$user/$domain/"
 php_admin_value open_basedir "/var/customers/webs/$user/$domain/:/tmp/"
 php_admin_flag safe_mode On
 Alias /webalizer "/var/customers/webs/$user/webalizer"
 ErrorLog "/var/customers/logs/$domain-error.log"
 CustomLog "/var/customers/logs/$domain-access.log" combined
</VirtualHost>

Link to comment
Share on other sites

I tried an other "solution":

I disable the "domain already exists"-check in admin_domains.php and then I can add the same domain with IPv6. Froxlor also adds the domain into the panel_domains-table, but it does not show up in the Froxlor-domain-list.

 

well ... this is caused due to the array being used ... you have to do one more patch:

 

one single line will fix this:

 

it's around line 75 in admin_domains.php:

 

if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))

{

$row['ipandport'] = '[' . $row['ip'] . ']:' . $row['port'];

$row['domain'] = $row['domain']." (IP V6)";

}

else

{

$row['ipandport'] = $row['ip'] . ':' . $row['port'];

}

 

if you add ' (IP V6)' to the domain name, you get both domains listed: the ipv4-domain without any additional text, the ipv6-domain with the additional text 'IP V6'.

 

however: this allows only one ip per protocol being listed (IP V4, IP V6 and the same in SSL) ... but you may now use different ip's for different domains ;-)

 

this avoids the GNUTls-'hack' for froxlor for IPV6 ... ;-)

 

(you don't really want to use GNUTls for IPV6, don't you? ;-) )

 

bye for now ...

 

dirk

 

 

PS: if you need the GNUTls-patch for froxlor, feel free to ask ... (and ... yes ... works with IPV4 and IPV6 ... ;-) )

Link to comment
Share on other sites

two more patches are necessary to get the IPV4/IPV6-dualstack run:

 

around line 900 (function createVirtualHosts) we need to get the IP-adress:

 

$this->logger->logAction(CRON_ACTION, LOG_INFO, 'creating vhost container for domain ' . $domain['id'] . ', customer ' . $domain['loginname']);

 

if($domain['ssl'] == '1')

{

$query = "SELECT * FROM " . TABLE_PANEL_IPSANDPORTS . " WHERE `id`='" . $domain['ssl_ipandport'] . "'";

}

else

{

$query = "SELECT * FROM " . TABLE_PANEL_IPSANDPORTS . " WHERE `id`='" . $domain['ipandport'] . "'";

}

 

$ipandport = $this->db->query_first($query);

$domain['ip'] = $ipandport['ip'];

 

$vhosts_filename = $this->getVhostFilename($domain);

// Apply header

 

then we can set the filename (otherwise our ipv4-config will be removed during the creation of apache-files) in function getVhostFilename:

 

if(filter_var($domain['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))

{

if((int)$domain['parentdomainid'] 0

&& isCustomerStdSubdomain((int)$domain['id']) false

&& ((int)$domain['ismainbutsubto'] 0

|| domainMainToSubExists($domain['ismainbutsubto']) false)

) {

$vhost_no = '27';

}

elseif((int)$domain['parentdomainid'] 0

&& isCustomerStdSubdomain((int)$domain['id']) false

&& (int)$domain['ismainbutsubto'] > 0

) {

$vhost_no = '26';

}

else

{

$vhost_no = '25';

}

 

}

 

... and finally the cleanup:

 

replace:

&& preg_match('/^(05|10|20|21|22|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename)

 

by

&& preg_match('/^(05|10|20|21|22|25|26|27|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...