2015-05-04 19:52:53 +00:00
|
|
|
from orchestra.contrib.settings import Setting
|
2015-04-27 14:54:17 +00:00
|
|
|
from orchestra.core.validators import validate_ipv4_address, validate_ipv6_address, validate_ip_address
|
2015-05-04 19:52:53 +00:00
|
|
|
from orchestra.settings import ORCHESTRA_BASE_DOMAIN
|
2015-03-31 12:39:08 +00:00
|
|
|
|
2015-04-27 14:54:17 +00:00
|
|
|
from .validators import validate_zone_interval, validate_mx_record, validate_domain_name
|
|
|
|
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_DEFAULT_NAME_SERVER = Setting('DOMAINS_DEFAULT_NAME_SERVER',
|
2015-04-27 14:54:17 +00:00
|
|
|
'ns.{}'.format(ORCHESTRA_BASE_DOMAIN),
|
|
|
|
validators=[validate_domain_name],
|
|
|
|
help_text="Uses <tt>ORCHESTRA_BASE_DOMAIN</tt> by default."
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_DEFAULT_HOSTMASTER = Setting('DOMAINS_DEFAULT_HOSTMASTER',
|
2015-04-27 14:54:17 +00:00
|
|
|
'hostmaster@{}'.format(ORCHESTRA_BASE_DOMAIN),
|
|
|
|
help_text="Uses <tt>ORCHESTRA_BASE_DOMAIN</tt> by default."
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_DEFAULT_TTL = Setting('DOMAINS_DEFAULT_TTL',
|
2015-04-27 14:54:17 +00:00
|
|
|
'1h',
|
|
|
|
validators=[validate_zone_interval],
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_DEFAULT_REFRESH = Setting('DOMAINS_DEFAULT_REFRESH',
|
2015-04-27 14:54:17 +00:00
|
|
|
'1d',
|
|
|
|
validators=[validate_zone_interval],
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_DEFAULT_RETRY = Setting('DOMAINS_DEFAULT_RETRY',
|
2015-04-27 14:54:17 +00:00
|
|
|
'2h',
|
|
|
|
validators=[validate_zone_interval],
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-07-15 10:35:21 +00:00
|
|
|
DOMAINS_DEFAULT_EXPIRE = Setting('DOMAINS_DEFAULT_EXPIRE',
|
2015-04-27 14:54:17 +00:00
|
|
|
'4w',
|
|
|
|
validators=[validate_zone_interval],
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-07-15 10:35:21 +00:00
|
|
|
DOMAINS_DEFAULT_MIN_TTL = Setting('DOMAINS_DEFAULT_MIN_TTL',
|
2015-04-27 14:54:17 +00:00
|
|
|
'1h',
|
|
|
|
validators=[validate_zone_interval],
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_ZONE_PATH = Setting('DOMAINS_ZONE_PATH',
|
2015-03-31 12:39:08 +00:00
|
|
|
'/etc/bind/master/%(name)s'
|
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_MASTERS_PATH = Setting('DOMAINS_MASTERS_PATH',
|
2015-04-27 14:54:17 +00:00
|
|
|
'/etc/bind/named.conf.local',
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_SLAVES_PATH = Setting('DOMAINS_SLAVES_PATH',
|
2015-04-27 14:54:17 +00:00
|
|
|
'/etc/bind/named.conf.local',
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
|
|
|
|
2015-04-26 13:53:00 +00:00
|
|
|
DOMAINS_CHECKZONE_BIN_PATH = Setting('DOMAINS_CHECKZONE_BIN_PATH',
|
2015-05-04 12:57:41 +00:00
|
|
|
'named-checkzone -i local -k fail -n fail',
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-27 12:24:17 +00:00
|
|
|
DOMAINS_ZONE_VALIDATION_TMP_DIR = Setting('DOMAINS_ZONE_VALIDATION_TMP_DIR',
|
|
|
|
'/dev/shm',
|
2015-04-26 13:53:00 +00:00
|
|
|
help_text="Used for creating temporary zone files used for validation."
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2015-03-27 19:50:54 +00:00
|
|
|
|
|
|
|
|
2015-04-27 14:54:17 +00:00
|
|
|
DOMAINS_DEFAULT_A = Setting('DOMAINS_DEFAULT_A',
|
|
|
|
'10.0.3.13',
|
2015-04-27 12:24:17 +00:00
|
|
|
validators=[validate_ipv4_address]
|
2015-03-31 12:39:08 +00:00
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-27 12:24:17 +00:00
|
|
|
DOMAINS_DEFAULT_AAAA = Setting('DOMAINS_DEFAULT_AAAA', '',
|
|
|
|
validators=[validate_ipv6_address]
|
2015-04-20 14:23:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2015-04-27 14:54:17 +00:00
|
|
|
DOMAINS_DEFAULT_MX = Setting('DOMAINS_DEFAULT_MX',
|
|
|
|
default=(
|
|
|
|
'10 mail.{}.'.format(ORCHESTRA_BASE_DOMAIN),
|
|
|
|
'10 mail2.{}.'.format(ORCHESTRA_BASE_DOMAIN),
|
|
|
|
),
|
2015-05-03 17:44:46 +00:00
|
|
|
validators=[lambda mxs: list(map(validate_mx_record, mxs))],
|
2015-04-27 14:54:17 +00:00
|
|
|
help_text="Uses <tt>ORCHESTRA_BASE_DOMAIN</tt> by default."
|
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-27 14:54:17 +00:00
|
|
|
DOMAINS_DEFAULT_NS = Setting('DOMAINS_DEFAULT_NS',
|
|
|
|
default=(
|
|
|
|
'ns1.{}.'.format(ORCHESTRA_BASE_DOMAIN),
|
|
|
|
'ns2.{}.'.format(ORCHESTRA_BASE_DOMAIN),
|
|
|
|
),
|
2015-05-03 17:44:46 +00:00
|
|
|
validators=[lambda nss: list(map(validate_domain_name, nss))],
|
2015-04-27 14:54:17 +00:00
|
|
|
help_text="Uses <tt>ORCHESTRA_BASE_DOMAIN</tt> by default."
|
|
|
|
)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-10-03 17:37:36 +00:00
|
|
|
|
2015-04-27 14:54:17 +00:00
|
|
|
DOMAINS_FORBIDDEN = Setting('DOMAINS_FORBIDDEN',
|
|
|
|
'',
|
2015-04-26 13:53:00 +00:00
|
|
|
help_text=(
|
2015-04-26 15:52:40 +00:00
|
|
|
"This setting prevents users from providing random domain names, i.e. google.com<br>"
|
|
|
|
"You can generate a 5K forbidden domains list from Alexa's top 1M:<br>"
|
|
|
|
"<tt> wget http://s3.amazonaws.com/alexa-static/top-1m.csv.zip -O /tmp/top-1m.csv.zip && "
|
|
|
|
"unzip -p /tmp/top-1m.csv.zip | head -n 5000 | sed 's/^.*,//' > forbidden_domains.list</tt><br>"
|
2015-04-26 13:53:00 +00:00
|
|
|
"'%(site_dir)s/forbidden_domains.list')"
|
|
|
|
)
|
2015-04-05 10:46:24 +00:00
|
|
|
)
|
2015-04-16 15:46:26 +00:00
|
|
|
|
|
|
|
|
2015-04-27 12:24:17 +00:00
|
|
|
DOMAINS_MASTERS = Setting('DOMAINS_MASTERS',
|
|
|
|
(),
|
2015-05-03 17:44:46 +00:00
|
|
|
validators=[lambda masters: list(map(validate_ip_address, masters))],
|
2015-04-26 13:53:00 +00:00
|
|
|
help_text="Additional master server ip addresses other than autodiscovered by router.get_servers()."
|
2015-04-16 15:46:26 +00:00
|
|
|
)
|
2021-01-13 15:41:36 +00:00
|
|
|
|
|
|
|
#TODO remove pangea-specific default
|
|
|
|
DOMAINS_DEFAULT_DNS2136 = "key pangea.key;"
|