Using the domain_create_pre.sh to prevent adding of domains for other domains

If you don't wish to want any of your users to create a subdomain on your domain, you can use the domain_create_pre.sh to prevent it. This script assumes you don't want them to create “sub.mydomain.com” (anything on mydomain.com).

Insert the following code into: /usr/local/directadmin/scripts/custom/domain_create_pre.sh:

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

$res = strstr($domain, ".".$reserved);

if ($res === FALSE) { exit(0); }
else
{
echo "You may not create a sub domain on $reserved";
exit(1);
}
?>

Chmod the domain_create_pre.sh to 755.

Note that this script runs as root. With root you can also do other things like check the contents of the /etc/virtual/domainowners to ensure that the subdomain he's creating belongs on a domain he owns, etc. (Could also check /usr/local/directadmin/data/users/username/domains.list).

Related information

 
config/pre.sh_2.txt · Last modified: 2010/02/28 16:03 by muscardin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Please visit Automatic Backlinks to start earning free backlinks Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki