Skip to main content

Overhead of DNS records on subdomains

Comments

4 comments

  • cPanelMichael
    Hello, Assuming you want to keep those subdomains for the primary domain names associated with the cPanel accounts, you could develop a custom script that manually removes those DNS records through the manipulation of the corresponding zone file in the /var/named/ directory. Then, configure that custom script to run as a post hook every time a new subdomain is added: Guide to Standardized Hooks - Software Development Kit - cPanel Documentation You can find the corresponding API function for a hook by enabling "Debug mode is on. The system displays information about every stage for every hookable event, even if no hooks exist for that stage." under the "Development" tab in "WHM >> Tweak Settings". Then, perform the specific action you want to hook into via cPanel or WHM, and watch the output in /usr/local/cpanel/logs/error_log. For example, the following cPanel API 1 function is utilized when adding an Alias in cPanel: Cpanel::Api1::Park::park You can find documentation on hooks with cPanel functions at:
    0
  • darkshifty
    Hello, Assuming you want to keep those subdomains for the primary domain names associated with the cPanel accounts, you could develop a custom script that manually removes those DNS records through the manipulation of the corresponding zone file in the /var/named/ directory. Then, configure that custom script to run as a post hook every time a new subdomain is added: under the "Development" tab in "WHM >> Tweak Settings". Then, perform the specific action you want to hook into via cPanel or WHM, and watch the output in /usr/local/cpanel/logs/error_log. For example, the following cPanel API 1 function is utilized when adding an Alias in cPanel: Cpanel::Api1::Park::park You can find documentation on hooks with cPanel functions at:
    0
  • darkshifty
    Sounds good, i will have a look at that. Thanks!

    I've looked into it but i cant come to a viable solution, the only way with these hooks is removing records per line which isn't very attractive to program as i have to identify all the 9 records, remove them per line and add an A record. Isn't there a way to adjust the template for subdomains or create a pre hook that uses such a template? The documentation is very general and limited.
    0
  • cPanelMichael
    Hello, Most of the subdomains you referenced are part of the proxy subdomains feature. They are automatically created as part of the following option under the "Domains" tab in "WHM >> Tweak Settings": Proxy subdomain creation Per it's description: Automatically create cpanel, webmail, webdisk, cpcalendars, cpcontacts, and whm proxy subdomain DNS entries for new accounts. When this is initially enabled it will add appropriate proxy subdomain DNS entries to all existing accounts. (Use /scripts/proxydomains to reconfigure the DNS entries manually) One potential alternative is to run a command like this in a custom script that runs as a post action hook during the addition of a new subdomain:
    /scripts/proxydomains --domain=sub.domain.tld remove
    Thank you.
    0

Please sign in to leave a comment.