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


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


Top Level » DirectAdmin » Custom Scripting

Using the domain_create_pre.sh to prevent adding of domains for other domainsLast Modified: Aug 21, 2008, 4:48 pm
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:
http://www.directadmin.com/features.php?id=183


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