How to prevent the creation of domains with certain characters


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin

How to prevent the creation of domains with certain charactersLast Modified: Aug 31, 2018, 3:02 pm
Update Feb 2018
New directadmin.conf option to block special characters:
https://www.directadmin.com/features.php?id=2082


Although the proper fix for this issue will be to implement punycode for IDNs, that's a larger project for the future.
The reason for the issue is a change in the policy bind uses for approved domain names.
It was allowed in the past, hence DA allows them, but since domains were already created with those characters, DA cannot simply disallow them, else live domains will become broken.

In any case, to prevent future domains from being created with those characters, create the script:

/usr/local/directadmin/scripts/custom/domain_create_pre.sh

and add the code

#!/usr/local/bin/php
<?php
$domain = getenv("domain");

if (strpos($domain, 'é') !== false)
{
   echo "Domain must not contain the character é\n";
   exit(1);
}
if (strpos($domain, 'à') !== false)
{
   echo "Domain must not contain the character à\n";
   exit(1);
}

exit(0);
?>

and chmod the script to 755.

If you need to add an IDN to DA, add the punycode value instead, so it doesn't hurt named:
http://www.charset.org/punycode.php

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST