Add to Favourites Add to Favourites    Print this Article Print this Article

How to prevent the creation of domains with certain characters

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
$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


Was this answer helpful?

Also Read