Dns

Discussion in 'Installation/Configuration' started by martinoc, Jan 29, 2006.

  1. martinoc

    martinoc New Member

    Is it true that there are currently bugs in the ISP module regarding the automatic creation of DNS entries. Specifically MX entries.

    It would seem that for any given site, the *Domain Name* of the ISPConfig server (Administrative Domain) gets added as the MX.

    This should be corrected either by prepending the ISPConfig servers *Host Name* followed by a dot to its Domain Name, or to follow the example of the DNS manager module and set up a link to mail.site.tld.

    Until this is resolved, I would reccommend *ALL* DNS configuration through the DNS manager module.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    I don't think there's a bug, but let me check first.

    ISPConfig takes the host name + domain name that you specified during the ISPConfig setup which is ok since this FQDN points to the ISPConfig server (otherwise you wouldn't be able to access the web interface).

    This is always recommended if you want to use settings that go beyond the default records.
     
  3. martinoc

    martinoc New Member

    No, I'm running two servers and in both cases, the FQDN was not added to the MX of my vhosts. Only the domain name portion was added. I've had to manually edit them.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    You seem to be right. I've just changed /home/admispconfig/ispconfig/lib/classes/ispconfig/isp_web.lib.php and added this line right after line 976:
    PHP:
    if(trim($server['server_host']) != ''$domain trim($server['server_host']).'.'.$domain;
    Please try this; if it works it will go into the next ISPConfig release.

    Things like these happen if you test in an environment where you don't have a hostname... - then the result looks ok... :eek:
     
  5. martinoc

    martinoc New Member

    Have tried it on both servers, and can confirm that it works.
     
  6. martinoc

    martinoc New Member

    I think there is a slight problem with this behaviour. The FQDN of the web and not the server should be added as an MX record. I have tried to use the $web["web_host"] and $web["web_domain"] variables in the above mentioned code, but the output seems to be w.w
    Perhaps you might have more success falko :)

    [edit] perhaps the web should use $web["web_domain"] only as you would send mail to [email protected] and not [email protected] :)
     
    Last edited: Jan 29, 2006
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    I just had a look at the code. I think a solution will be to replace lines 976 - 978:
    Code:
    $domain = trim($server["server_domain"]);
    $host = $go_api->db->queryOneRecord("SELECT web_host FROM isp_isp_web WHERE doc_id = $doc_id");
    $host = trim($host['web_host']);
    with this code:

    Code:
    $web = $go_api->db->queryOneRecord("SELECT web_host, web_domain FROM isp_isp_web WHERE doc_id = $doc_id");
    $domain = trim($web["web_domain"]);
    if(trim($web['web_host']) != '') $domain = trim($web['web_host']).'.'.$domain;
    $host = '';
    if you want to use the domain only, without the host, you can use this:

    Code:
    $web = $go_api->db->queryOneRecord("SELECT web_host, web_domain FROM isp_isp_web WHERE doc_id = $doc_id");
    $domain = trim($web["web_domain"]);
    $host = '';
     
  8. falko

    falko Super Moderator Howtoforge Staff

    I don't think there's a problem with this because both - the FQDN of the server and the web site - point to the same IP address.

    If you want an MX record for domain.tld instead of www.domain.tld, go to the Co-Domain tab and create a default MX record for domain.tld.
    ISPConfig gives you the possibility to create MX records for www.domain.tld and domain.tld because there are quite a lot people who need MX records for www.domain.tld.
     
  9. martinoc

    martinoc New Member

    I know, but it is just about keeping the DNS record "clean" looking. Its a cosmetic thing I think.

    Yes, I think till's first modification should suit that. Thats what you should patch into the next release, I think.

    [edit]Till, your changes cause the IP address to dissappear from the www A record in the newly created DNS
     
    Last edited: Jan 29, 2006
  10. falko

    falko Super Moderator Howtoforge Staff

    I think you misunderstood me there. This is already in ISPConfig, and it's intended the way it is. :)
     
  11. martinoc

    martinoc New Member

    I have re read it.I understand what you mean by that. The only outstanding issue, if it is an issue (as for most its not), is the cosmetics of having the FQDN of the server instead of the web written in the MX records. Unfortunatly, while the code posted by till fixes this, it breaks other things. I have noticed that the IP address field entered for the default WWW is blank. This may be due to a variable not being set that previously was.

    Although I haven't tested it, I would suspect that using the variable $web is the problem. I'd suspect it is already being used earlier in the script for some purpose, and the results of the new query overwrite some vital details. I will test this when I get the opportunity.
     
  12. martinoc

    martinoc New Member

    I have confirmed the problem I mentioned in the above post:

    I have replaced lines 976-978 :

    Code:
    $domain = trim($server["server_domain"]);
    $host = $go_api->db->queryOneRecord("SELECT web_host FROM isp_isp_web WHERE doc_id = $doc_id");
    $host = trim($host['web_host']);
    with
    Code:
            $web2 = $go_api->db->queryOneRecord("SELECT web_host, web_domain FROM isp_isp_web WHERE doc_id = $doc_id");
            $domain = trim($web2["web_domain"]);
            $host = $go_api->db->queryOneRecord("SELECT web_host FROM isp_isp_web WHERE doc_id = $doc_id");
            $host = trim($host['web_host']);
            if(trim($web['web_host']) != '') $domain = trim($web['web_host']).'.'.$domain;
    
    Now, I need to edit the code behind the co-domains feature as it is still exhibiting the old behaviour. Could one of you point me in the right direction?

    Also, the above code still does not respect the web_dns_mx (variable name ???) as set in the web. I think it should be called $web2["web_dns_mx"] but I couldnt verify it.
     
    Last edited: Jan 30, 2006
  13. martinoc

    martinoc New Member

    Any look locating the DNS code for the co-domains section of the web module. This needs to be updated independantly from the web code above??
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Please have a look at the file /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_domain.lib.php

    The code is in the lines 464 ++
     
  15. martinoc

    martinoc New Member

    Hi,

    I have changed lines 466 in /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_domain.lib.php to the following.

    Code:
    $domain2 = $domain;
    $domain = trim($domain["domain_domain"]);
    if (trim($domain2["domain_host"]) != '') $domain = trim($domain2["domain_host"]).'.'.$domain;
    This leaves us with one last bug. The code in /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_web.lib.php does not respect the Create DNS MX option.
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Code:
    The code in /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_web.lib.php does not respect the Create DNS MX option.
    Is the record always created even when "Create DNS MX" is not set?
     
  17. martinoc

    martinoc New Member

    Unfortunatly it is. The correct variable is not being checked for int the code so a record gets created wheather or not the option is checked.
     
    Last edited: Feb 9, 2006
  18. martinoc

    martinoc New Member

    Any luck in finding the variable in question?
     
  19. till

    till Super Moderator Staff Member ISPConfig Developer

    The field is "web_dns_mx" in the isp_isp_web table.
     

Share This Page