Giter Club home page Giter Club logo

dino's Introduction

dino

build status Coverage Documentation Python 3.6+

a modern DNS record editor for PowerDNS. It uses the PowerDNS-API, has a high test coverage, rich documentation and comes with batteries included!

Setup

Refer to our documentation to learn how to use dino in a production environment.

Development

The following instructions are for development setups only. Refer to the documentation linked above on how to get a production setup up and running.

Setup

Start a PowerDNS server, mysql (for PowerDNS only) and dino inside docker:

docker-compose up --build

... then visit http://localhost:8000 :)

If you prefer to run django locally for easier debugging, you can skip it in the docker setup, like so:

docker-compose up --build --scale django=0
export DINO_DEBUG=True
export DINO_SECRET_KEY=secret
export DINO_PDNS_APIURL=http://localhost:8081/api/v1
export DINO_PDNS_APIKEY=pdnsapikey
cd src
./manage.py runserver

... then, again, visit http://localhost:8000 :)

Tests

Run all tests including the linter, like they would be run in CI:

$ tox
GLOB sdist-make: /home/luto/uberspace/dino/src/setup.py
lint recreate: /home/luto/uberspace/dino/.env
(...)
lint: commands succeeded
test-py36: commands succeeded
test-py37: commands succeeded
congratulations :)

Takes too long? Run tox --listenvs to get a list of tasks, run them individually using tox -e $ENV:

$ tox -e lint
GLOB sdist-make: /home/luto/uberspace/dino/src/setup.py
lint recreate: /home/luto/uberspace/dino/.env
(...)
lint: commands succeeded
congratulations :)

Acknowledgements

Some meta configuration like setup.py and setup.cfg has been lifted from the awesome conference management system pretalx (MIT). Thanks!

dino's People

Contributors

fabii547 avatar leahoswald avatar luto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dino's Issues

update database when zones are deleted

Deleting zones in dino works just fine, but the local database is never updated, leading to dormant entries in the DB and UI.

  • when deleting a zone, delete the database entry as well
  • when the database has a zone, but it's not present in the pdns API ask the user what to do
    • admins: "this zone vanished in pdns, want to delete?"
    • users: "this zone vanished in pdns. ask your admin for details."

turning an A record into a CNAME yields error

Could not create new record. PowerDNS error: RRset www.asd.com. IN CNAME: Conflicts with pre-existing non-CNAME RRset

Depending on the old and new rtype, change the delete behavior. For example, create new SOA before deleting old one, delete old record before creating CNAME,...

clean up django admin

  • move apps not needed to the bottom
    • accounts
    • sites
    • social accounts
  • boil remaining ones down to as few categories as possible
    • User Management
    • Tenants

crashes on startup, if cwd is not accessible

  File "/var/dino/.local/lib/python3.6/site-packages/dino/settings.py", line 24, in <module>
    os.path.abspath('./dino.cfg'),
  File "/usr/lib64/python3.6/posixpath.py", line 376, in abspath
    cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
  1. su -
  2. cd ~root
  3. sudo -u www-dino /bin/uwsgi --http :8081 --module dino.wsgi

editing SOA records duplicates them

When editing the SOA record created by PowerDNS we end up with two of them. This probably applies to all apex/root records, but I can't test that due to #24.

split Dockerfile into prod and dev variant

Our dockerfile currently installs the development dependencies and uses runserver. Neither is a good idea in production.

  • define a production Dockerfile, without dev dependencies and with uwsgi/gunicorn
  • try to derive the development Dockerfile from the prod one, installing only additional packages and changing the CMD to runserver
  • adapt docker-compose.yml
  • try to run it in the CI

introduce simple HTTP API

The powerdns API only supports a single API key with full permissions and is thus not easy to use outside or even inside on organisation.

  • per-user, per-tenant (and global?) API keys
  • pagination
  • read only zones and records
  • write records
  • write zones

Use django REST framework or come up with a good reason to use another scheme and use that.

creating zones and records with non-ascii characters in them does not work

Creating a zone or record with umlauts or other non-ascii characters currently yields an PowerDNS API error:

Could not create new record. PowerDNS error: Name '\195\182.asd.com.' contains unsupported characters

  • punnycode zone names during creation
  • punnycode record names during creation and editing

allow to whitelist email domains for signup

Signup is currently either disabled for everyone or enabled for everyone. Change this so it's disabled for everyone, but enabled for users from a list of domains (e.g. @company.com).

  • add a DINO_VALID_SIGNUP_DOMAINS setting (type: list)
  • add a documentation page about social signup, explaining security model behind this (we trust the social provider to only give us verified email addresses)
  • check email address during signup in NoNewUsersAccountAdapter.clean_email
  • give NoNewUsersAccountAdapter a new name ;)
  • check that clean_email is actually called for social accounts (it's not.)
  • implement a SocialAccountAdapter
  • if DINO_VALID_SIGNUP_DOMAINS is set, ...
    • set SOCIALACCOUNT_EMAIL_VERIFICATION = False
    • set SOCIALACCOUNT_EMAIL_REQUIRED = True
    • set ACCOUNT_EMAIL_VERIFICATION = True
    • set ACCOUNT_EMAIL_REQUIRED = True
  • add google config, if there is only one domain given (UX only, google doesn't enforce this):
SOCIALACCOUNT_PROVIDERS = {
    'google': {
        'AUTH_PARAMS': {
            'hd': DINO_VALID_SIGNUP_DOMAINS[0],
        }
    }
}

enable tenants to define zone templates

Some users might have many look-alike zones. Introduce zone templates (a list of predefined records), allow basic templating within the values (e.g. zone name, current time), allow global and per-tenant templates. Optionally allow users to select a template creating a new zone.

add clear search button

Add a small button with an x. Clicking it clears all search inputs and shows the full list of records/zones.

introduce auditing for zone changes

Write down when one of the following happens:

  • zone created/deleted
  • record created/deleted

Display a searchable audit log

  • global log for superusers
  • per-tenant

Use either the system/models built into the django admin or one of these.

show link to django admin

Display a link to /admin in the top-right corner, next to "Logout", if user may has staff permissions.

convert README to rst

rst is more common in the python world and more easily imported into sphinx or pypi.

document global admin settings

Dino offers a number of configuration values, which can be set via the environment.

  • add a doc site listing the names, default values, example values and a short description
  • try to get that list from the code, so we don't duplicate it

introduce .env file to load configuration from a file

Currently configuration can only be read from the process environment. While this is handy for docker-base deployments, setting values in a simple text file might be desiderable.

  • Introduce a .env-dino or .dino-env key-value text file.
  • Load these values and use them as defaults when there is no value in the process environment.
  • Think about having multiple ones (e.g. global, in $HOME, cwd) and load them in a sane order.

show punnycoded zones/records in decoded form

Zone names are currently shown just like the PowerDNS API returns them. For zones containing non-ascii characters, the punnycoded form is shown.

  • decode zone names when listing in frontend
  • decode zone names when managing tenants in admin
  • decode record names when listing

Editing punnycoded zones/records is a different beast and handled in #46.

handle vanished zones in powerdns

Zones may not be present in the PowerDNS API when we expect them to. This may happen if some other system changed the data or when PowerDNS temporarily returns no or faulty data.

If we detect that a zone is present in our database, but not in API responses, present the user with a "this zone has vanished, want to delete?" screen. In case the user does not have permission to delete that zone, present a similar screen, asking them to contact their admin.

test powerdns end-to-end

The test coverage currently ends at our pdns wrapper class. Add a new type of tests, spinning up an actual powerdns in docker and test a few basic workflows against it. A new powerdns instance should be used for each test case.

  • create zone and check that it's in the list
  • create zone with invalid zone name, check if error message is passed onto client
  • delete zone
  • create record and check that it's in the list
  • delete record

cannot create records at apex/root

enable users to create records at apex/root using the following as name:

  • empty string
  • the character @

Also consider . (a dot) and the domain name itself (e.g. example.com with or without the trailing dot).

add zones to django-admin

  • add zones to django-admin
  • disable deletion
  • list tenants

This is mainly to enable admins to get a list of tenants for a given domain.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.