diff --git a/.gitignore b/.gitignore index 83e5248..77b76b0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.conf *~ /binder/secret.txt +/binder/local_settings.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..18f353f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: python +python: + - "2.7" +env: + - DJANGO="Django>=1.6,<1.7" + - DJANGO="Django>=1.7,<1.8" + - DJANGO="Django>=1.8,<1.9" +install: + - pip install -q $DJANGO + - pip install -r requirements.txt +script: + - python manage.py test diff --git a/README.markdown b/README.markdown index 115f3ab..723fbe1 100644 --- a/README.markdown +++ b/README.markdown @@ -1,5 +1,7 @@ # Binder # +[![Build Status](https://travis-ci.org/jforman/binder.svg?branch=master)](https://travis-ci.org/jforman/binder) + A Django web application for viewing and editing BIND DNS zone records. Binder supports adding and deleting DNS records (and eventually editing in place). TSIG-authenticated transfers and updates are supported. diff --git a/binder/forms.py b/binder/forms.py index 420205b..ef9c040 100644 --- a/binder/forms.py +++ b/binder/forms.py @@ -2,11 +2,11 @@ # 3rd Party from django import forms +from django.conf import settings from django.forms import ValidationError # App Imports from models import Key -import local_settings ### Custom Form Fields @@ -40,10 +40,10 @@ class FormAddForwardRecord(forms.Form): """ Form used to add a Forward DNS record. """ dns_server = forms.CharField(max_length=100) record_name = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$", required=False) - record_type = forms.ChoiceField(choices=local_settings.RECORD_TYPE_CHOICES) + record_type = forms.ChoiceField(choices=settings.RECORD_TYPE_CHOICES) zone_name = forms.CharField(max_length=100) record_data = forms.GenericIPAddressField() - ttl = forms.ChoiceField(choices=local_settings.TTL_CHOICES) + ttl = forms.ChoiceField(choices=settings.TTL_CHOICES) create_reverse = forms.BooleanField(required=False) key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False) @@ -54,7 +54,7 @@ class FormAddReverseRecord(forms.Form): record_type = forms.RegexField(regex=r"^PTR$",error_messages={"invalid" : "The only valid choice here is PTR."}) zone_name = forms.CharField(max_length=100) record_data = CustomStringPeriodSuffix(required=True) - ttl = forms.ChoiceField(choices=local_settings.TTL_CHOICES) + ttl = forms.ChoiceField(choices=settings.TTL_CHOICES) key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False) create_reverse = forms.BooleanField(required=False) @@ -64,7 +64,7 @@ class FormAddCnameRecord(forms.Form): originating_record = forms.CharField(max_length=100) cname = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$") zone_name = forms.CharField(max_length=256) - ttl = forms.ChoiceField(choices=local_settings.TTL_CHOICES) + ttl = forms.ChoiceField(choices=settings.TTL_CHOICES) key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False) class FormDeleteRecord(forms.Form): diff --git a/binder/local_settings.py b/binder/local_settings.py deleted file mode 100644 index a7a7f32..0000000 --- a/binder/local_settings.py +++ /dev/null @@ -1,10 +0,0 @@ -### Local settings to be shared across modules. - -TTL_CHOICES = ((300, "5 minutes"), - (1800, "30 minutes"), - (3600, "1 hour"), - (43200, "12 hours"), - (86400, "1 day")) - -RECORD_TYPE_CHOICES = (("A", "A"), - ("AAAA", "AAAA")) diff --git a/binder/settings.py b/binder/settings.py index a2be546..a23da1a 100644 --- a/binder/settings.py +++ b/binder/settings.py @@ -88,4 +88,18 @@ INSTALLED_APPS = ( TEST_RUNNER = 'django.test.runner.DiscoverRunner' +TTL_CHOICES = ((300, "5 minutes"), + (1800, "30 minutes"), + (3600, "1 hour"), + (43200, "12 hours"), + (86400, "1 day")) + +RECORD_TYPE_CHOICES = (("A", "A"), + ("AAAA", "AAAA")) + LOGIN_REDIRECT_URL = '/' + +try: + from local_settings import * +except ImportError: + pass diff --git a/binder/templates/base.html b/binder/templates/base.html index 8d1657f..a648650 100644 --- a/binder/templates/base.html +++ b/binder/templates/base.html @@ -3,7 +3,9 @@ {% block header %} Binder DNS Admin - + + + {% endblock header %} @@ -30,7 +32,7 @@
- {% block pageheader %}{% endblock pageheader %} + {% block pageheader %}{% endblock pageheader %}
diff --git a/binder/templates/bcommon/add_cname_record_form.html b/binder/templates/bcommon/add_cname_record_form.html index d0f284c..a2d3bde 100644 --- a/binder/templates/bcommon/add_cname_record_form.html +++ b/binder/templates/bcommon/add_cname_record_form.html @@ -6,37 +6,37 @@
{% csrf_token %} Create CNAME record
- +
- +
- +
- +
- +
- +
- +
{% if form_errors.cname %} - + {% endif %}
- -
.{{zone_name}}
+ +
.{{zone_name}}
@@ -45,17 +45,17 @@
{% for ttl, description in ttl_choices %} - + {% endfor %}
- +
- {% for key in tsig_keys %} {% empty %} @@ -64,8 +64,7 @@
- - + Cancel diff --git a/binder/templates/bcommon/add_record_form.html b/binder/templates/bcommon/add_record_form.html index d9146be..78bf651 100644 --- a/binder/templates/bcommon/add_record_form.html +++ b/binder/templates/bcommon/add_record_form.html @@ -6,22 +6,22 @@
{% csrf_token %} Create Record
- +
- +
- +
- +
- +
{% if form_errors.record_name %} {% endif %}
- -
.{{zone_name}}
+ +
.{{zone_name}}
@@ -40,34 +40,34 @@
{% if "in-addr.arpa" not in zone_name and "ip6.arpa" not in zone_name %} {% for type, name in record_type_choices %} -
- +
- {% if form_errors.record_data %} - + {% endif %} +
+ + {% if "in-addr.arpa" not in zone_name and "ip6.arpa" not in zone_name %} +
IP Address
+ {% else %} +
FQDN
+ {% endif %} +
@@ -75,28 +75,28 @@
{% for ttl, description in ttl_choices %} - + {% endfor %}
{% if "in-addr.arpa" not in zone_name and "ip.arpa" not in zone_name %}
- +
+ Yes +
{% endif %}
- +
- {% for key in tsig_keys %} {% empty %} @@ -106,7 +106,7 @@
- + Cancel
{% endblock body %} diff --git a/binder/templates/bcommon/delete_record_initial.html b/binder/templates/bcommon/delete_record_initial.html index 8d5017f..ff3c28c 100644 --- a/binder/templates/bcommon/delete_record_initial.html +++ b/binder/templates/bcommon/delete_record_initial.html @@ -22,24 +22,24 @@ - TSIG Key +
- {% for key in tsig_keys %} {% empty %}
- + Cancel diff --git a/binder/templates/bcommon/list_zone.html b/binder/templates/bcommon/list_zone.html index 81e4785..503633f 100644 --- a/binder/templates/bcommon/list_zone.html +++ b/binder/templates/bcommon/list_zone.html @@ -4,10 +4,14 @@ {% block body %} {% if not errors %} -
{% csrf_token %} - -Add Record +Add Record +{% csrf_token %} + + + + +
@@ -18,17 +22,9 @@ - - {% for current_record in zone_array %} - + @@ -37,7 +33,7 @@
Select Name
-
- -
-
{{ current_record.rr_name }} {{ current_record.rr_ttl }} {{ current_record.rr_class }}
- +