├── misc ├── screenshot_config.png ├── screenshot_domains.png └── screenshot_livestats.png ├── public ├── images │ └── forkme_right_red.png ├── javascripts │ ├── ui_graph.js │ ├── ui_domains.js │ ├── ui_records.js │ ├── ui_graph_adv.js │ └── bootstrap-select.min.js └── stylesheets │ ├── style.css │ ├── gh-fork-ribbon.css │ └── bootstrap-select.min.css ├── views ├── error.jade ├── statistics.jade ├── configuration.jade ├── statistics_adv.jade ├── inc │ └── footer.jade ├── about.jade ├── index.jade ├── layout.jade ├── servers.jade ├── domains.jade └── records.jade ├── make_release.sh ├── libs ├── pdnsapi.js ├── pdns │ ├── statistics.js │ ├── log.js │ ├── config.js │ ├── records.js │ └── zones.js └── db.js ├── routes ├── pdns.js ├── about.js ├── index.js ├── pdns │ ├── config.js │ ├── stats.js │ ├── records.js │ └── domains.js └── servers.js ├── startup.sh ├── bin └── www ├── .gitignore ├── bower.json ├── package.json ├── app.js ├── Dockerfile ├── Docker.md ├── Monitoring.md ├── README.md └── LICENSE /misc/screenshot_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbgmsharp/yapdnsui/HEAD/misc/screenshot_config.png -------------------------------------------------------------------------------- /misc/screenshot_domains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbgmsharp/yapdnsui/HEAD/misc/screenshot_domains.png -------------------------------------------------------------------------------- /misc/screenshot_livestats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbgmsharp/yapdnsui/HEAD/misc/screenshot_livestats.png -------------------------------------------------------------------------------- /public/images/forkme_right_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xbgmsharp/yapdnsui/HEAD/public/images/forkme_right_red.png -------------------------------------------------------------------------------- /views/error.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} 7 | -------------------------------------------------------------------------------- /make_release.sh: -------------------------------------------------------------------------------- 1 | export VERSION=`git rev-parse --short --verify HEAD` 2 | echo $VERSION 3 | # npm version 0.0.2-$VERSION 4 | # git status 5 | # git push 6 | 7 | -------------------------------------------------------------------------------- /libs/pdnsapi.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | 'config': require('./pdns/config.js'), 4 | 'zones': require('./pdns/zones.js'), 5 | 'records': require('./pdns/records.js'), 6 | 'stats': require('./pdns/statistics.js') 7 | }; 8 | -------------------------------------------------------------------------------- /routes/pdns.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | 'domains': require('./pdns/domains.js'), 4 | 'records': require('./pdns/records.js'), 5 | 'config': require('./pdns/config.js'), 6 | 'stats': require('./pdns/stats.js'), 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /routes/about.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET about page. */ 5 | router.get('/', function(req, res) { 6 | res.render('about', { 'navmenu': 'about' }); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LANG=C #needed for perl locale 3 | 4 | set -eu 5 | 6 | # Start the services 7 | # We limit to service to avoid the container to exit on app crash 8 | /usr/sbin/sshd -D & 9 | PORT=8080 DEBUG=yapdnsui node /app/yapdnsui/bin/www 10 | 11 | -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var database = require('../libs/db'); 3 | var router = express.Router(); 4 | 5 | /* GET home page. */ 6 | router.get('/', function(req, res) { 7 | if (!req.db) { res.render('', {}); } 8 | database.list(req, res, function(req, res, rows) { 9 | res.render('', { 'serverlist': rows, 'navmenu': '' }); 10 | }); 11 | }); 12 | 13 | module.exports = router; 14 | -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var debug = require('debug')('yapdnsui'); 3 | var app = require('../app'); 4 | 5 | var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.PORT || 3000 6 | var host = process.env.OPENSHIFT_NODEJS_IP || process.env.HOST 7 | 8 | app.set('port', port); 9 | 10 | // Allow self sign SSL Certs 11 | process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; 12 | 13 | var server = app.listen(app.get('port'), host, function() { 14 | debug('Express server listening on port ' + server.address().port); 15 | }); 16 | -------------------------------------------------------------------------------- /views/statistics.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container-fluid 5 | // Page header 6 | .page-header 7 | h2 8 | | Graph 9 | div.content 10 | div.graph_tcp(id="graph_cachehitrate") 11 | 12 | include inc/footer 13 | 14 | // Highcharts Libraries 15 | script(src='/highcharts-release/highcharts.js') 16 | script(src='/highcharts-release/modules/data.js') 17 | script(src='/highcharts-release/modules/exporting.js') 18 | // My Library 19 | script(src='/javascripts/ui_graph.js') 20 | -------------------------------------------------------------------------------- /views/configuration.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container-fluid 5 | // Page header 6 | .page-header 7 | h2 8 | | Configuration 9 | |   10 | small= data.length 11 | |  config items 12 | div 13 | table.table.table-striped.table-condensed 14 | thead 15 | tr 16 | th Name 17 | th Value 18 | tbody 19 | each item in data 20 | tr 21 | td= item.name 22 | td= item.value 23 | 24 | include inc/footer 25 | -------------------------------------------------------------------------------- /libs/pdns/statistics.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | 3 | /* -------------------------------------------------------- */ 4 | /* STATISTICS */ 5 | exports.statistics = function(req, res, callback){ 6 | if (req.server.url && req.server.password) { 7 | request( 8 | { 9 | dataType: 'json', 10 | method: 'GET', 11 | url: req.server.url+"/servers/localhost/statistics", 12 | headers: { "X-API-Key" : req.server.password } 13 | }, 14 | function (error, response, body) { 15 | callback(error, response, body); 16 | }); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /libs/pdns/log.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | 3 | /* -------------------------------------------------------- */ 4 | /* SEARCH */ 5 | 6 | exports.search = function(req, res, callback){ 7 | if (req.server.url && req.server.password && req.params.search_term) { 8 | request( 9 | { 10 | dataType: 'json', 11 | method: 'GET', 12 | url: req.server.url+"/servers/localhost/search-log?q="+req.params.search_term, 13 | headers: { "X-API-Key" : req.server.password } 14 | }, 15 | function (error, response, body) { 16 | callback(error, response, body); 17 | }); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /views/statistics_adv.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container 5 | div.content 6 | fieldset 7 | legend Graph 8 | div.graph_queries(id="graph_queries") 9 | div.graph_resp_answers(id="graph_resp_answers") 10 | div.graph_answers(id="graph_answers") 11 | div.graph_tcp(id="graph_tcp") 12 | div.graph_tcp(id="graph_cachehitrate") 13 | 14 | include inc/footer 15 | 16 | // Highcharts Libraries 17 | script(src='/Highcharts/js/highcharts.js') 18 | script(src='/Highcharts/js/modules/data.js') 19 | script(src='/Highcharts/js/modules/exporting.js') 20 | // My Library 21 | script(src='/javascripts/ui_graph_adv.js') 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | 27 | # Bower public vendor 28 | bower_components 29 | 30 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yapdnsui", 3 | "version": "0.0.7-ca5ad22", 4 | "dependencies": { 5 | "bootstrap": "~3.3.5", 6 | "jquery": "~1.11.3", 7 | "jqueryui": "~1.11.4", 8 | "highcharts-release": "~4.1.7", 9 | "bootstrap-checkbox": "~1.2.8", 10 | "form.validation": "*", 11 | "datatables": "~1.10.8", 12 | "font-awesome": "~4.3.0", 13 | "pnotify": "~2.0.1" 14 | }, 15 | "homepage": "https://github.com/xbgmsharp/yapdnsui", 16 | "description": "Yet Another PowerDNS web interface", 17 | "main": "app.js", 18 | "keywords": [ 19 | "pdns" 20 | ], 21 | "authors": [ 22 | "Francois Lacroix " 23 | ], 24 | "license": "GPL", 25 | "ignore": [ 26 | "**/.*", 27 | "node_modules", 28 | "bower_components", 29 | "test", 30 | "tests" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /views/inc/footer.jade: -------------------------------------------------------------------------------- 1 | 2 | noscript 3 | | For full functionality of this site it is necessary to enable JavaScript. 4 | | Here are the 5 | a(href="http://www.enable-javascript.com/", target="_blank") instructions 6 | | how to enable JavaScript in your web browser. 7 | 8 | div.footer.center 9 | hr 10 | p(style="text-align: center") 11 | | Powered by 12 | a(href="https://github.com/xbgmsharp/yapdnsui/", target="_blank") yaPDNSui 13 | |, © Francois Lacroix, Copyright 2014-2015 Julmay. 14 | p(style="text-align: center") 15 | | Designed, build and made in London with all the love. 16 | 17 | // Placed at the end of the document so the pages load faster 18 | script(src='/jquery/dist/jquery.min.js') 19 | script(src='/jqueryui/jquery-ui.min.js') 20 | script(src='/bootstrap/dist/js/bootstrap.min.js') 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yapdnsui", 3 | "description": "Yet Another PowerDNS web interface", 4 | "author": "Francois Lacroix ", 5 | "homepage": "http://xbgmsharp.github.io/yapdnsui/", 6 | "readmeFilename": "README.md", 7 | "repository": { 8 | "type": "git", 9 | "url": "git://github.com/xbgmsharp/yapdnsui.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/xbgmsharp/yapdnsui/issues" 13 | }, 14 | "version": "0.0.7-ca5ad22", 15 | "license": "GPL-3.0+", 16 | "private": true, 17 | "scripts": { 18 | "start": "DEBUG=yapdnsui node ./bin/www" 19 | }, 20 | "main": "bin/www", 21 | "engines": { 22 | "node": ">= 0.10.0" 23 | }, 24 | "dependencies": { 25 | "body-parser": "~1.13.3", 26 | "cookie-parser": "~1.3.5", 27 | "debug": "~2.2.0", 28 | "express": "~4.13.3", 29 | "jade": "~1.11.x", 30 | "morgan": "~1.6.1", 31 | "request": "2.61.x", 32 | "serve-favicon": "~2.3.0", 33 | "sqlite3": "^3.1.1" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /libs/pdns/config.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | 3 | // Handle servers description 4 | exports.servers = function(req, res, callback) { 5 | if (req.server.url && req.server.password) { 6 | request( 7 | { 8 | dataType: 'json', 9 | method: 'GET', 10 | url: req.server.url+"/servers", 11 | headers: { "X-API-Key" : req.server.password } 12 | }, 13 | function (error, response, body) { 14 | callback(error, response, body); 15 | }); 16 | } 17 | }; 18 | 19 | // Handle configuration listing 20 | exports.list = function(req, res, callback){ 21 | if (req.server.url && req.server.password) { 22 | request( 23 | { 24 | dataType: 'json', 25 | method: 'GET', 26 | url: req.server.url+"/servers/localhost/config", 27 | headers: { "X-API-Key" : req.server.password } 28 | }, 29 | function (error, response, body) { 30 | callback(error, response, body); 31 | }); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /views/about.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container 5 | div.jumbotron 6 | h1= settings.title 7 | p #{settings.package.description} 8 | p Version #{settings.package.version} 9 | p 10 | a.btn.btn-primary.btn-large(href="https://github.com/xbgmsharp/yapdnsui") Documentation on GitHub 11 | div.container 12 | div.jumbotron 13 | h2 License 14 | p 15 | | Copyright © 2014-2015 Francois Lacroix. All Rights Reserved. 16 | br 17 | | This program is free software; you can redistribute it and/or modify it under the terms of the 18 | a(href="http://www.gnu.org/licenses/gpl.html") GNU General Public License 19 | | as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 20 | div.container 21 | div.jumbotron 22 | h2 Notes 23 | p 24 | | #{settings.title} is in alpha stage as well as the PowerDNS API and might break your server, your zones, this application, whatever. 25 | p 26 | | This is built using 27 | a(href="http://nodejs.org") NodeJS 28 | | and 29 | a(href="http://expressjs.com") Express 30 | p 31 | | yaPDNSui powered by 32 | a(href="http://nodejs.org") NodeJS 33 | | - Layout and CSS from 34 | a(href="http://twitter.github.com") Twitter Bootstrap 35 | 36 | include inc/footer 37 | -------------------------------------------------------------------------------- /views/index.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container 5 | div.jumbotron 6 | h1= settings.title 7 | p #{settings.package.description} 8 | p Version #{settings.package.version} 9 | p 10 | a.btn.btn-primary.btn-large(href="https://github.com/xbgmsharp/yapdnsui") Documentation on GitHub 11 | div.container 12 | div.jumbotron 13 | h2 License 14 | p 15 | | Copyright © 2014-2015 Francois Lacroix. All Rights Reserved. 16 | br 17 | | This program is free software; you can redistribute it and/or modify it under the terms of the 18 | a(href="http://www.gnu.org/licenses/gpl.html") GNU General Public License 19 | | as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 20 | div.container 21 | div.jumbotron 22 | h2 Notes 23 | p 24 | | #{settings.title} is in alpha stage as well as the PowerDNS API and might break your server, your zones, this application, whatever. 25 | p 26 | | This is built using 27 | a(href="http://nodejs.org") NodeJS 28 | | and 29 | a(href="http://expressjs.com") Express 30 | p 31 | | yaPDNSui powered by 32 | a(href="http://nodejs.org") NodeJS 33 | | - Layout and CSS from 34 | a(href="http://twitter.github.com") Twitter Bootstrap 35 | 36 | include inc/footer 37 | -------------------------------------------------------------------------------- /routes/pdns/config.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var database = require('../../libs/db'); 3 | var pdnsapi = require('../../libs/pdnsapi'); 4 | var router = express.Router(); 5 | 6 | // Route middleware to validate :id 7 | // Execute for all request 8 | // It return the full server object from the DB 9 | router.param('id', function(req, res, next, id){ 10 | console.log("server_id: [%s]", id); 11 | if (parseInt(id)) { 12 | database.get(req, res, id, function(err, server){ 13 | if (err) { 14 | return next(err); 15 | } 16 | else if (!server) { 17 | return next(new Error('failed to load server')); 18 | } 19 | req.server = server; 20 | database.list(req, res, function(req, res, rows) { 21 | if (!rows) { 22 | return next(new Error('failed to load servers')); 23 | } 24 | req.serverlist = rows; 25 | next(); 26 | }); 27 | }); 28 | } else { next(); } 29 | }); 30 | 31 | /* -------------------------------------------------*/ 32 | /* GET configuration page. */ 33 | router.get('/servers/:id/configuration', function(req, res) { 34 | console.log(req.db); 35 | console.log(req.params.id); 36 | console.log(req.server); 37 | // Redirect to index if missing value 38 | if (!req.db && !req.server) { res.redirect('/'); } // TODO warm user if missing a DB or a valid server 39 | pdnsapi.config.list(req, res, function (error, response, body) { 40 | // If any error redirect to index 41 | if (!body) { console.log(error); res.redirect('/'); } 42 | else { 43 | var json = JSON.parse(body); 44 | console.log(json); 45 | res.render('configuration', { 'data': json, 46 | 'serverlist': req.serverlist, 47 | 'navmenu': 'configuration', 48 | 'serverselected': req.server}); 49 | } 50 | }); 51 | }); 52 | 53 | module.exports = router; 54 | -------------------------------------------------------------------------------- /public/javascripts/ui_graph.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Request data from the server, add it to the graph and set a timeout 3 | * to request again 4 | * 5 | * Note: One event update all charts as all data are recevied at once from PDNS 6 | * 7 | */ 8 | 9 | function getURLParameter(name) { 10 | return window.location.pathname.split('/')[2]; 11 | } 12 | 13 | var graph_cachehitrate; 14 | 15 | function update_cachehitrate(point) { 16 | 17 | var series0 = graph_cachehitrate.series[0], 18 | shift0 = series0.data.length > 20; // shift if the series is 19 | // longer than 20 20 | console.log(point['packetcache-hit']); 21 | // add the point 22 | var x = new Date().getTime(); // current time 23 | var y = Math.round(Math.random() * 100); 24 | console.log([x, y]); 25 | console.log(point['packetcache-miss'][0]); 26 | var time = point['packetcache-miss'][0]; 27 | var perc = Math.round(point['packetcache-miss'][1]*100/point['packetcache-hit'][1], 2); 28 | //var perc-cache-hit = [ time, perc ]; 29 | console.log([ time, perc ]); 30 | graph_cachehitrate.series[0].addPoint([ time, perc ], true, shift0); 31 | } 32 | 33 | function requestData() { 34 | var server = getURLParameter('server'); 35 | $.ajax({ 36 | url: '/servers/'+server+'/statistics/dump', 37 | success: function(point) { 38 | console.log(point); 39 | update_cachehitrate(point); 40 | // call it again after one minute 41 | setTimeout(requestData, 5000); // 5sec 42 | }, 43 | cache: false, 44 | dataType: "json" 45 | }); 46 | } 47 | 48 | $(document).ready(function() { 49 | 50 | graph_cachehitrate = new Highcharts.Chart({ 51 | chart: { 52 | renderTo: 'graph_cachehitrate', 53 | defaultSeriesType: 'spline', 54 | events: { 55 | load: requestData 56 | } 57 | }, 58 | title: { 59 | text: 'Live Statistics - percentage cache hits' 60 | }, 61 | xAxis: { 62 | type: 'datetime', 63 | tickPixelInterval: 150, 64 | maxZoom: 20 * 1000 65 | }, 66 | yAxis: { 67 | minPadding: 0.2, 68 | maxPadding: 0.2, 69 | title: { 70 | text: '% percentage', 71 | margin: 80 72 | } 73 | }, 74 | series: [{ 75 | name: '% cache hitrate', 76 | data: [] 77 | }] 78 | }); 79 | 80 | 81 | }); 82 | 83 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var package = require('./package.json'); 2 | var express = require('express'); 3 | var path = require('path'); 4 | //var favicon = require('serve-favicon'); 5 | var logger = require('morgan'); 6 | var cookieParser = require('cookie-parser'); 7 | var bodyParser = require('body-parser'); 8 | 9 | // Load our routes 10 | var index = require('./routes/index'); 11 | var about = require('./routes/about'); 12 | var pdns = require('./routes/pdns'); 13 | var servers = require('./routes/servers'); 14 | 15 | // Load our DB library 16 | var database = require('./libs/db'); 17 | // Initiliaze the db 18 | var db = database.create(); 19 | // Initiliaze the app 20 | var app = express(); 21 | 22 | // Make our db is accessible to our router 23 | // Will be execute for all events 24 | app.use(function(req,res,next){ 25 | req.db = db; 26 | next(); 27 | }); 28 | 29 | // Set global package.json details for use in the webgui 30 | app.set('package', package); 31 | app.set('title', 'Yet Another PDNS UI'); 32 | 33 | // view engine setup 34 | app.set('views', path.join(__dirname, 'views')); 35 | app.set('view engine', 'jade'); 36 | 37 | // uncomment after placing your favicon in /public 38 | //app.use(favicon(__dirname + '/public/favicon.ico')); 39 | app.use(logger('dev')); 40 | app.use(bodyParser.json()); 41 | app.use(bodyParser.urlencoded({ extended: true })); 42 | app.use(cookieParser()); 43 | // Add my own public content 44 | app.use(express.static(path.join(__dirname, 'public'))); 45 | // Add vendor content from bower 46 | app.use(express.static(path.join(__dirname, 'bower_components'))); 47 | 48 | // Route the page 49 | app.use('/', index); 50 | app.use('/about', about); 51 | app.use('/servers', servers); 52 | app.use('/', pdns.config); 53 | app.use('/', pdns.domains); 54 | app.use('/', pdns.records); 55 | app.use('/', pdns.stats); 56 | 57 | /// catch 404 and forward to error handler 58 | app.use(function(req, res, next) { 59 | var err = new Error('Not Found'); 60 | err.status = 404; 61 | next(err); 62 | }); 63 | 64 | /// error handlers 65 | 66 | // development error handler 67 | // will print stacktrace 68 | if (app.get('env') === 'development') { 69 | app.use(function(err, req, res, next) { 70 | res.status(err.status || 500); 71 | res.render('error', { 72 | message: err.message, 73 | error: err 74 | }); 75 | }); 76 | } 77 | 78 | // production error handler 79 | // no stacktraces leaked to user 80 | app.use(function(err, req, res, next) { 81 | res.status(err.status || 500); 82 | res.render('error', { 83 | message: err.message, 84 | error: {} 85 | }); 86 | }); 87 | 88 | module.exports = app; 89 | -------------------------------------------------------------------------------- /libs/pdns/records.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | 3 | /* -------------------------------------------------------- 4 | * 5 | * RECORDS 6 | * https://doc.powerdns.com/md/httpapi/api_spec/ 7 | * 8 | */ 9 | 10 | // Handle records listing 11 | exports.list = function(req, res, callback){ 12 | if (req.server.url && req.server.password && req.params.zone_id) { 13 | request( 14 | { 15 | dataType: 'json', 16 | method: 'GET', 17 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id, 18 | headers: { "X-API-Key" : req.server.password } 19 | }, 20 | function (error, response, body) { 21 | callback(error, response, body); 22 | }); 23 | } 24 | }; 25 | 26 | // Handle records delete 27 | exports.delete = function(req, res, record, callback){ 28 | if (req.server.url && req.server.password && req.params.zone_id && record) { 29 | request( 30 | { 31 | dataType: 'json', 32 | method: 'PATCH', 33 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id, 34 | json: { "rrsets": [ { "name": record.name, "type": record.type, "changetype": "DELETE", "records": [ ] } ] }, 35 | headers: { "X-API-Key" : req.server.password, 36 | "Content-Type": "application/json" } 37 | }, 38 | function (error, response, body) { 39 | callback(error, response, body); 40 | }); 41 | } 42 | }; 43 | 44 | // Handle records update/add 45 | exports.add = function(req, res, record, callback){ 46 | if (req.server.url && req.server.password && req.params.zone_id && record) { 47 | json= { "rrsets": [ { "name": record.name, "type": record.type, "changetype": "REPLACE", "records": [ record ] } ] } 48 | console.log(json); 49 | request( 50 | { 51 | dataType: 'json', 52 | method: 'PATCH', 53 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id, 54 | json: { "rrsets": [ { "name": record.name, "type": record.type, "changetype": "REPLACE", "records": [ record ] } ] }, 55 | headers: { "X-API-Key" : req.server.password, 56 | "Content-Type": "application/json" } 57 | }, 58 | function (error, response, body) { 59 | callback(error, response, body); 60 | }); 61 | } 62 | }; 63 | 64 | -------------------------------------------------------------------------------- /public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top:70px; 3 | padding: 50px; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | 10 | .noscript { 11 | font-size: 25px; 12 | background-color: red; 13 | text-align: center; 14 | position: fixed; 15 | left: 0px; 16 | bottom: 50%; 17 | } 18 | 19 | .home-bkg { 20 | font-family: "Andika"; 21 | background-image: url("../images/dns.png"); 22 | background-size: cover; 23 | background-repeat: no-repeat; 24 | margin-top: -100px; 25 | padding: 180px; 26 | text-align: center; 27 | } 28 | 29 | /* Side notes for calling out things 30 | -------------------------------------------------- */ 31 | 32 | /* Base styles (regardless of theme) */ 33 | .bs-callout { 34 | margin: 20px 0; 35 | padding: 15px 30px 15px 15px; 36 | border-left: 5px solid #eee; 37 | } 38 | .bs-callout h4 { 39 | margin-top: 0; 40 | } 41 | .bs-callout p:last-child { 42 | margin-bottom: 0; 43 | } 44 | .bs-callout code, 45 | .bs-callout .highlight { 46 | background-color: #fff; 47 | } 48 | 49 | /* Themes for different contexts */ 50 | .bs-callout-danger { 51 | background-color: #fcf2f2; 52 | border-color: #dFb5b4; 53 | } 54 | .bs-callout-warning { 55 | background-color: #fefbed; 56 | border-color: #f1e7bc; 57 | } 58 | .bs-callout-info { 59 | background-color: #f0f7fd; 60 | border-color: #d0e3f0; 61 | } 62 | 63 | /* Layout thanks to pdnsui 64 | -------------------------------------------------- */ 65 | 66 | .table-condensed td { 67 | padding:0 !important; 68 | /*font-size: 20px !important;*/ 69 | } 70 | 71 | .page-header a { 72 | color:#333 !important; 73 | } 74 | 75 | .navbar a { 76 | color:#999; 77 | } 78 | 79 | #messenger { 80 | padding:4px 35px 4px 14px; 81 | position:absolute; 82 | width:900px; 83 | margin-top:-20px; 84 | height:20px; 85 | } 86 | 87 | /* Domains/Index */ 88 | 89 | .page-header { 90 | margin:10px 0 15px !important; 91 | } 92 | 93 | .table th a { 94 | color:#333 !important; 95 | } 96 | 97 | .mod-edit-type .help-block { 98 | margin-left:19px !important; 99 | } 100 | 101 | .mod-edit-type input { 102 | margin-top:-2px !important; 103 | margin-right:3px !important; 104 | } 105 | 106 | /* Domains/Records */ 107 | 108 | #servers-table td.servers-value-action { 109 | text-align:right !important; 110 | } 111 | 112 | #domains-table td.domains-value-action { 113 | text-align: right !important; 114 | } 115 | 116 | #records-table td.records-value-action { 117 | text-align:right !important; 118 | } 119 | 120 | /* Form Validation */ 121 | #form-add-domain .form-control-feedback { 122 | right: 10px !important; 123 | top: 25px !important; 124 | } 125 | 126 | #form-add-record .form-control-feedback { 127 | right: 10px !important; 128 | top: 25px !important; 129 | } 130 | 131 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # NodeJS + SSHD + myapp 2 | # 3 | # Base from ultimate-seed Dockerfile 4 | # https://github.com/pilwon/ultimate-seed 5 | # 6 | # Mainly to run yapdnsui 7 | # https://github.com/xbgmsharp/yapdnsui 8 | # 9 | # DOCKER-VERSION 0.9.1 10 | # VERSION 0.0.1 11 | 12 | # Pull base image. 13 | FROM ubuntu:latest 14 | MAINTAINER Francois Lacroix 15 | 16 | # Setup system and install tools 17 | RUN echo "initscripts hold" | dpkg --set-selections 18 | RUN echo 'alias ll="ls -lah --color=auto"' >> /etc/bash.bashrc 19 | 20 | # Set locale 21 | RUN apt-get -qqy install locales 22 | RUN locale-gen --purge en_US en_US.UTF-8 23 | RUN dpkg-reconfigure locales 24 | ENV LC_ALL en_US.UTF-8 25 | 26 | # Set ENV 27 | ENV HOME /root 28 | ENV DEBIAN_FRONTEND noninteractive 29 | 30 | # Update and Upgrade system 31 | RUN apt-get update && apt-get -y upgrade 32 | 33 | # Install deb dependencies for nodesource.com 34 | RUN apt-get -y install curl 35 | 36 | # Note the new setup script name for Node.js v0.12 37 | RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash - 38 | 39 | # Install nodejs 40 | RUN apt-get -y install nodejs 41 | 42 | # Install nodejs dependencies 43 | RUN npm install -g bower grunt-cli npm-check-updates 44 | # Install my application dependencies 45 | RUN npm install -g express express-generator jade request sqlite3 46 | 47 | # Install my dependencies 48 | RUN apt-get -y install nano curl wget vim libsqlite3-0 49 | # Install Git 50 | RUN apt-get -y install git-core 51 | 52 | # Install SSH 53 | RUN apt-get install -y openssh-server 54 | RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config 55 | RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config 56 | RUN sed 's/#PermitRootLogin yes/PermitRootLogin yes/' -i /etc/ssh/sshd_config 57 | RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/' -i /etc/ssh/sshd_config 58 | RUN mkdir /var/run/sshd 59 | RUN echo 'root:admin' | chpasswd 60 | 61 | # Add app directory 62 | RUN mkdir /app 63 | ADD startup.sh /app/startup.sh 64 | #ADD . /app 65 | 66 | # Install `yapdnsui` from git 67 | RUN cd /app && \ 68 | git clone https://github.com/xbgmsharp/yapdnsui 69 | 70 | RUN \ 71 | cd /app/yapdnsui && \ 72 | npm prune --production && \ 73 | npm install --production --unsafe-perm && \ 74 | npm rebuild && \ 75 | bower --allow-root install 76 | 77 | # Define environment variables 78 | #ENV NODE_ENV production 79 | ENV DEBUG yapdnsui 80 | ENV PORT 8080 81 | 82 | # Define working directory. 83 | WORKDIR /app/yapdnsui 84 | 85 | # Define default command. 86 | # Start ssh and other services. 87 | CMD ["/bin/bash", "/app/startup.sh"] 88 | 89 | # Expose ports. 90 | EXPOSE 22 8080 91 | 92 | # Clean up APT when done. 93 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 94 | 95 | # Make sure the package repository is up to date 96 | ONBUILD apt-get update && apt-get -y upgrade 97 | ONBUILD apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 98 | -------------------------------------------------------------------------------- /routes/pdns/stats.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var database = require('../../libs/db'); 3 | var pdnsapi = require('../../libs/pdnsapi'); 4 | var router = express.Router(); 5 | 6 | // Route middleware to validate :id 7 | // Execute for all request 8 | // It return the full server object from the DB 9 | router.param('id', function(req, res, next, id){ 10 | console.log("server_id: [%s]", id); 11 | if (parseInt(id)) { 12 | database.get(req, res, id, function(err, server){ 13 | if (err) { 14 | return next(err); 15 | } 16 | else if (!server) { 17 | return next(new Error('failed to load server')); 18 | } 19 | req.server = server; 20 | database.list(req, res, function(req, res, rows) { 21 | if (!rows) { 22 | return next(new Error('failed to load servers')); 23 | } 24 | req.serverlist = rows; 25 | next(); 26 | }); 27 | }); 28 | } else { next(); } 29 | }); 30 | 31 | /* -------------------------------------------------*/ 32 | /* STATS */ 33 | 34 | /* GET stats page. */ 35 | router.get('/servers/:id/statistics', function(req, res) { 36 | if (!req.db && !req.server) { res.render('', {}); } 37 | res.render('statistics', { 'serverlist': req.serverlist, 'navmenu': 'statistics', 'serverselected': req.server }); 38 | }); 39 | 40 | /* GET the statistics dump for graph */ 41 | router.get('/servers/:id/statistics/dump', function(req, res) { 42 | console.log(req.db); 43 | console.log(req.params); 44 | console.log(req.params.id); 45 | // If missing value redirect to index or to an error page!!! 46 | if (!req.db && !req.server) { res.redirect('/'); } 47 | pdnsapi.stats.statistics(req, res, function (error, response, body) { 48 | if (!body) { console.log(error); res.send(myJsonString, {'Content-type': 'text/json'}, 200); } 49 | else { 50 | // Do more stuff with 'body' here 51 | //console.log(req); 52 | //console.log(body); 53 | var json = JSON.parse(body); 54 | var timestamp = new Date().getTime(); // current time 55 | //var timestamp = req.query._; 56 | var arr = {}; 57 | //console.log(json); 58 | for (i in json) { 59 | console.log(json[i].name); 60 | arr[json[i].name] = [timestamp, parseInt(json[i].value)]; 61 | } 62 | //console.log(arr); 63 | var myJsonString = JSON.stringify(arr); 64 | console.log(myJsonString); 65 | res.send(myJsonString, {'Content-type': 'text/json'}, 200); 66 | } 67 | }); 68 | }); 69 | 70 | module.exports = router; 71 | -------------------------------------------------------------------------------- /libs/db.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var file = 'yapdnsui.sqlite3'; 3 | var exists = fs.existsSync(file); 4 | 5 | var sqlite3 = require('sqlite3').verbose(); 6 | var url = require('url'); 7 | 8 | if (!exists){ 9 | console.log("Creating DB File"); 10 | fs.openSync(file, "w"); 11 | } 12 | 13 | // Create internal DB for the server list in memory 14 | exports.create = function(){ 15 | var db = new sqlite3.Database(file); 16 | // Initiliaze the db 17 | db.serialize(function() { 18 | if (!exists) { 19 | db.run("CREATE TABLE servers (id integer primary key asc, name TEXT, url TEXT, password TEXT, pdns_type TEXT, pdns_id TEXT, pdns_url TEXT, pdns_daemon_type TEXT, pdns_version TEXT, pdns_config_url TEXT, pdns_zones_url TEXT)"); 20 | db.run("INSERT INTO servers VALUES (?,?,?,?,?,?,?,?,?,?,?)", [null, 'localhost', 'https://localhost:8053', 'changeme', null,null,null,null,null,null,null]); 21 | db.each("SELECT * FROM servers", function(err, row) { 22 | console.log("init db.js "+ row); 23 | }); 24 | } 25 | }); 26 | return db; 27 | }; 28 | 29 | exports.list = function(req, res, callback){ 30 | if (req.db) { 31 | req.db.all("SELECT * FROM servers", 32 | function (err, rows) { 33 | console.log("db.list "+ JSON.stringify(rows)); 34 | callback(req, res, rows); 35 | }); 36 | } 37 | }; 38 | 39 | exports.add = function(req, res, callback){ 40 | if (req.db && req.body.url && req.body.password) { 41 | var obj = url.parse(req.body.url); 42 | req.db.get("INSERT INTO servers VALUES (?,?,?,?,?,?,?,?,?,?,?)", [null, obj.host, req.body.url, req.body.password, null,null,null,null,null,null,null], 43 | function (err, row) { 44 | console.log("db.add"); 45 | callback(req, res, err); 46 | }); 47 | } 48 | }; 49 | 50 | exports.update = function(req, res, callback){ 51 | if (req.db && req.params.id && req.body.url && req.body.password) { 52 | var obj = url.parse(req.body.url); 53 | req.db.run("UPDATE servers SET name=?,url=?,password=? WHERE id=?", [obj.host, req.body.url, req.body.password, req.params.id], 54 | function (err, row) { 55 | console.log("db.update "+ this); 56 | callback(req, res, row); 57 | }); 58 | } 59 | }; 60 | 61 | 62 | exports.refresh = function(req, res, pdns, callback){ 63 | if (req.db && req.params.id && pdns) { 64 | req.db.run("UPDATE servers SET pdns_type=?, pdns_id=?, pdns_url=?, pdns_daemon_type=?, pdns_version=?, pdns_config_url=?, pdns_zones_url=? WHERE id=?", [pdns.type, pdns.id, pdns.url, pdns.daemon_type, pdns.version, pdns.config_url, pdns.zones_url, req.params.id], 65 | function (err, row) { 66 | console.log("db.refresh"+ this); 67 | callback(req, res, row); 68 | }); 69 | } 70 | }; 71 | 72 | exports.get = function(req, res, id, callback){ 73 | if (req.db && id) { 74 | req.db.get("SELECT * FROM servers WHERE id=? LIMIT 1", [id], 75 | function (err, row) { 76 | if (!row) { callback(req, res, err); } 77 | else { 78 | console.log("db.get "+ row); 79 | callback(err, row); 80 | } 81 | }); 82 | } 83 | }; 84 | 85 | exports.delete = function(req, res, callback){ 86 | if (req.db && req.params.id) { 87 | req.db.run("DELETE FROM servers WHERE id=?", [req.params.id], 88 | function (err, row) { 89 | console.log("db.del:" + err); 90 | callback(req, res, row); 91 | }); 92 | } 93 | }; 94 | -------------------------------------------------------------------------------- /Docker.md: -------------------------------------------------------------------------------- 1 | yapdnsui 2 | ======== 3 | 4 | *Yet Another PowerDNS web interface* 5 | 6 | Test using Docker 7 | ----------------- 8 | 9 | * Install Docker 10 | [Install documentation of Docker](https://docs.docker.com/installation/) 11 | 12 | The Docker deb package are valid for Ubuntu and Debian. 13 | 14 | ```bash 15 | $ wget http://get.docker.io/ -O - | sh 16 | ``` 17 | Or 18 | ```bash 19 | echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list 20 | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 21 | apt-get update && apt-get install -y lxc-docker 22 | ``` 23 | 24 | * Build the images 25 | 26 | The following command build the build directly from the github repository. 27 | 28 | The build process might take some time a while as it download the origin nodejs docker image. 29 | ```bash 30 | $ docker build --rm=true --no-cache=true -t xbgmsharp/yapdnsui github.com/xbgmsharp/yapdnsui.git 31 | ``` 32 | 33 | Alternatively, you can build the image localy after cloning the repository. 34 | ```bash 35 | $ docker build --rm=true --no-cache=true -t xbgmsharp/yapdnsui . 36 | ``` 37 | 38 | * Run the container 39 | 40 | Run as a detach container 41 | ```bash 42 | $ docker run -d -p 22:22 -p 8080:8080 -t xbgmsharp/yapdnsui 43 | ``` 44 | 45 | Or run the container with an attach shell 46 | ``` 47 | $ docker run -i --rm -p 22:22 -p 8080:8080 -t xbgmsharp/yapdnsui /bin/bash 48 | ``` 49 | 50 | * Check the IP 51 | 52 | ```bash 53 | $ docker ps -a 54 | $ docker inspect CONTAINER_ID | grep IPA 55 | ``` 56 | 57 | Or both command in one 58 | ```bash 59 | $ docker ps -a | grep yapdnsui | awk '{print $1}' | xargs docker inspect | grep IPAddress 60 | ``` 61 | 62 | Or all in one with the ssh connection 63 | ```bash 64 | $ ssh $(docker ps -a | grep yapdnsui | awk '{print $1}' | xargs docker inspect | grep IPAddress | awk '{print $2}' | tr -d '"' | tr -d ',' ) 65 | ``` 66 | 67 | * Login in the container via SSH 68 | 69 | User is root and password is admin. 70 | 71 | ```bash 72 | $ ssh root@172.17.0.x 73 | ``` 74 | 75 | * Review logs 76 | ```bash 77 | $ docker logs CONTAINER_ID 78 | yapdnsui Express server listening on port 8080 +0ms 79 | ``` 80 | 81 | * Point your browser to: [http://172.17.0.x:8080/](http://172.17.0.x:8080/) 82 | * Enjoy! 83 | 84 | If the application crash. The container exit. 85 | From a SSH shell, you can restart the application. 86 | You can fillup an issue and add the backtrace or you fix it. 87 | 88 | Secure yapdnsui 89 | --------------- 90 | 91 | For security reasons, you may want to run a webserver (like Apache or nginx) in front of your PowerDNS webserver as a reverse proxy using SSL. 92 | As a best pratice, it is recommended to apply use SSL for the traffic between the end-user and the application. 93 | 94 | You can read this [HOWTO](http://blog.nachtarbeiter.net/2010/02/16/monitoring-powerdns-via-the-internal-web-server/) to see how. 95 | 96 | For security reasons, you probably want to use the same webserver for authentication purpose. 97 | 98 | You can read this [mod_auth_ldap - Apache HTTP Server](httpd.apache.org/docs/2.0/mod/mod_auth_ldap.html) 99 | 100 | E.g. you might want use a SSL connection and authenticate your co-workers using the internal LDAP or database server of your company intranet. 101 | 102 | -------------------------------------------------------------------------------- /views/layout.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | html(lang='en') 3 | head 4 | meta(charset='utf-8') 5 | meta(http-equiv="X-UA-Compatible" content="IE=edge") 6 | meta(name='viewport', content='width=device-width, initial-scale=1.0') 7 | meta(name='description', content='Yet Another PowerDNS web interface') 8 | meta(name='title', content='Yet Another PDNS UI') 9 | meta(name='author', content='Francois Lacroix') 10 | meta(name='copyright', content='Copyright (c) 2014-2015, Francois Lacroix') 11 | title= settings.title 12 | |   -   13 | = navmenu 14 | link(rel='stylesheet', href='/bootstrap/dist/css/bootstrap.min.css') 15 | link(rel='stylesheet', href='/bootstrap/dist/css/bootstrap-theme.min.css') 16 | link(rel='stylesheet', href='/font-awesome/css/font-awesome.min.css') 17 | link(rel='stylesheet', href='/datatables/media/css/dataTables.bootstrap.min.css') 18 | link(rel='stylesheet', href='/pnotify/pnotify.core.css') 19 | link(rel='stylesheet', href='/stylesheets/gh-fork-ribbon.css') 20 | link(rel='stylesheet', href='/stylesheets/style.css') 21 | body 22 | .navbar.navbar-default.navbar-fixed-top.navbar-inverse(role='navigation') 23 | .container-fluid 24 | .navbar-header 25 | button.navbar-toggle(type='button', data-toggle='collapse', data-target='.navbar-collapse') 26 | span.sr-only Toggle navigation 27 | span.icon-bar 28 | span.icon-bar 29 | span.icon-bar 30 | a.navbar-brand(href='/') Yet Another PDNS UI 31 | .collapse.navbar-collapse(id="bs-example-navbar-collapse-1") 32 | ul.nav.navbar-nav 33 | - if (serverselected) 34 | - var obj = {'/configuration':'Configuration', '/domains':'Domains', '/statistics':'Statistics' } 35 | - each val, key in obj 36 | - if ("/"+navmenu == key) 37 | li.active 38 | a.active(href="/servers/#{serverselected.id}#{key}"): = val 39 | - else 40 | li 41 | a(href="/servers/#{serverselected.id}#{key}"): = val 42 | 43 | - if ("/"+navmenu == 'about') 44 | li.active 45 | a(href='/about') About 46 | - else 47 | li 48 | a(href='/about') About 49 | ul.nav.navbar-nav.navbar-right 50 | li.dropdown 51 | - if (serverselected) 52 | a.dropdown-toggle(href="/servers/#{serverselected.id}", class="dropdown-toggle", data-toggle="dropdown") PDNS servers 53 | b.caret 54 | - else 55 | a.dropdown-toggle(href="/servers", class="dropdown-toggle", data-toggle="dropdown") PDNS servers 56 | b.caret 57 | ul.dropdown-menu(role="menu") 58 | li 59 | - if (serverselected) 60 | a(href="/servers/#{serverselected.id}") Manage servers 61 | - else 62 | a(href="/servers") Manage servers 63 | li.divider 64 | - if (serverlist) 65 | each item in serverlist 66 | - if (serverselected && serverselected.id == item.id) 67 | li.active 68 | a.active(href="/servers/#{item.id}"): = item.name 69 | |   70 | span.glyphicon.glyphicon-ok 71 | - else 72 | li 73 | a(href="/servers/#{item.id}"): = item.name 74 | - if (msg) 75 | div.alert(class="#{msg.class}") 76 | a.close(href="#", data-dismiss="alert" aria-hidden="true") 77 | | × 78 | strong 79 | = msg.title 80 | |   -   81 | = msg.msg 82 | 83 | block content 84 | -------------------------------------------------------------------------------- /public/stylesheets/gh-fork-ribbon.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * "Fork me on GitHub" CSS ribbon v0.1.1 | MIT License 3 | * https://github.com/simonwhitaker/github-fork-ribbon-css 4 | */ 5 | 6 | /* Left will inherit from right (so we don't need to duplicate code) */ 7 | .github-fork-ribbon { 8 | /* The right and left classes determine the side we attach our banner to */ 9 | position: absolute; 10 | 11 | /* Add a bit of padding to give some substance outside the "stitching" */ 12 | padding: 2px 0; 13 | 14 | /* Set the base colour */ 15 | background-color: #a00; 16 | 17 | /* Set a gradient: transparent black at the top to almost-transparent black at the bottom */ 18 | background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15))); 19 | background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)); 20 | background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)); 21 | background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)); 22 | background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)); 23 | background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15)); 24 | 25 | /* Add a drop shadow */ 26 | -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5); 27 | -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5); 28 | box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5); 29 | 30 | /* Set the font */ 31 | font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif; 32 | 33 | z-index: 9999; 34 | pointer-events: auto; 35 | } 36 | 37 | .github-fork-ribbon a, 38 | .github-fork-ribbon a:hover { 39 | /* Set the text properties */ 40 | color: #fff; 41 | text-decoration: none; 42 | text-shadow: 0 -1px rgba(0, 0, 0, 0.5); 43 | text-align: center; 44 | 45 | /* Set the geometry. If you fiddle with these you'll also need 46 | to tweak the top and right values in .github-fork-ribbon. */ 47 | width: 200px; 48 | line-height: 20px; 49 | 50 | /* Set the layout properties */ 51 | display: inline-block; 52 | padding: 2px 0; 53 | 54 | /* Add "stitching" effect */ 55 | border-width: 1px 0; 56 | border-style: dotted; 57 | border-color: #fff; 58 | border-color: rgba(255, 255, 255, 0.7); 59 | } 60 | 61 | .github-fork-ribbon-wrapper { 62 | width: 150px; 63 | height: 150px; 64 | position: absolute; 65 | overflow: hidden; 66 | top: 0; 67 | z-index: 9999; 68 | pointer-events: none; 69 | } 70 | 71 | .github-fork-ribbon-wrapper.fixed { 72 | position: fixed; 73 | } 74 | 75 | .github-fork-ribbon-wrapper.left { 76 | left: 0; 77 | } 78 | 79 | .github-fork-ribbon-wrapper.right { 80 | right: 0; 81 | } 82 | 83 | .github-fork-ribbon-wrapper.left-bottom { 84 | position: fixed; 85 | top: inherit; 86 | bottom: 0; 87 | left: 0; 88 | } 89 | 90 | .github-fork-ribbon-wrapper.right-bottom { 91 | position: fixed; 92 | top: inherit; 93 | bottom: 0; 94 | right: 0; 95 | } 96 | 97 | .github-fork-ribbon-wrapper.right .github-fork-ribbon { 98 | top: 42px; 99 | right: -43px; 100 | 101 | -webkit-transform: rotate(45deg); 102 | -moz-transform: rotate(45deg); 103 | -ms-transform: rotate(45deg); 104 | -o-transform: rotate(45deg); 105 | transform: rotate(45deg); 106 | } 107 | 108 | .github-fork-ribbon-wrapper.left .github-fork-ribbon { 109 | top: 42px; 110 | left: -43px; 111 | 112 | -webkit-transform: rotate(-45deg); 113 | -moz-transform: rotate(-45deg); 114 | -ms-transform: rotate(-45deg); 115 | -o-transform: rotate(-45deg); 116 | transform: rotate(-45deg); 117 | } 118 | 119 | 120 | .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon { 121 | top: 80px; 122 | left: -43px; 123 | 124 | -webkit-transform: rotate(45deg); 125 | -moz-transform: rotate(45deg); 126 | -ms-transform: rotate(45deg); 127 | -o-transform: rotate(45deg); 128 | transform: rotate(45deg); 129 | } 130 | 131 | .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon { 132 | top: 80px; 133 | right: -43px; 134 | 135 | -webkit-transform: rotate(-45deg); 136 | -moz-transform: rotate(-45deg); 137 | -ms-transform: rotate(-45deg); 138 | -o-transform: rotate(-45deg); 139 | transform: rotate(-45deg); 140 | } 141 | -------------------------------------------------------------------------------- /public/javascripts/ui_domains.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | PNotify.prototype.options.styling = "bootstrap3"; 4 | PNotify.prototype.options.delay = 5000; 5 | PNotify.prototype.options.width = "350px"; 6 | function mymessage(mytype, mytitle, mytext) { 7 | new PNotify({ 8 | type: mytype, 9 | title: mytitle, 10 | text: mytext, 11 | styling: 'bootstrap3' 12 | }); 13 | } 14 | 15 | $(document).on("click", ".notify-zone", function () { 16 | console.log("notify-zone"); 17 | var zone = $(this).data('id'); 18 | $.ajax({ 19 | 'url' : '/servers/'+$(this).data('server')+'/domains/notify/'+zone, 20 | 'type' : 'GET', 21 | 'cache' : false, 22 | 'dataType' : 'json', 23 | 'success' : function(data) { 24 | if(data.result) { 25 | mymessage("success", "Notify Zone", data.result +" for "+ zone); 26 | } 27 | if(data.error) { 28 | mymessage("error", "Notify Zone", data.error); 29 | } 30 | } 31 | }); 32 | }); 33 | 34 | $(document).on("click", ".retrieve-zone", function () { 35 | console.log("retrieve-zone"); 36 | var zone = $(this).data('id'); 37 | $.ajax({ 38 | 'url' : '/servers/'+$(this).data('server')+'/domains/retrieve/'+zone, 39 | 'type' : 'GET', 40 | 'cache' : false, 41 | 'dataType' : 'json', 42 | 'success' : function(data) { 43 | console.log(data); 44 | if(data.result) { 45 | mymessage("success", "axfr-retrieve zone", data.result + " for "+ zone); 46 | } 47 | if(data.error) { 48 | mymessage("error", "axfr-retrieve zone", data.error); 49 | } 50 | } 51 | }); 52 | }); 53 | 54 | // Init bootstrap form validation plugin 55 | $('#form-add-domain') 56 | .formValidation({ 57 | framework: 'bootstrap', 58 | excluded: [':disabled', ':hidden', ':not(:visible)'], 59 | icon: { 60 | valid: 'glyphicon glyphicon-ok', 61 | invalid: 'glyphicon glyphicon-remove', 62 | validating: 'glyphicon glyphicon-refresh' 63 | }, 64 | fields: { 65 | name: { 66 | message: 'The domain name is not valid', 67 | validators: { 68 | notEmpty: { 69 | message: 'The domain name is required' 70 | }, 71 | regexp: { 72 | enabled: true, 73 | regexp: /^[a-z0-9_\.-]+$/, 74 | message: 'The domain name can only consist of alphabetical, numbers, underscore, dash, dot' 75 | } 76 | } 77 | }, 78 | master: { 79 | message: 'The master list is not valid', 80 | validators: { 81 | regexp: { 82 | enabled: true, 83 | regexp: /^[0-9\.,:]+$/, 84 | message: 'The master list must be a list of IPv4 or Ipv6 separate by a comma' 85 | }, 86 | } 87 | }, 88 | } 89 | }) 90 | .on('error.field.bv', function (e, data) { 91 | console.log(data.field, data.element, '-->error'); 92 | }) 93 | .on('success.field.bv', function (e, data) { 94 | //console.log(data.field, data.element, '-->success'); 95 | }); 96 | 97 | // Reset all given fields. It hides the error messages and feedback icons. 98 | $('#add-domain-modal').on('hidden.bs.modal', function() { 99 | //console.log(".on hidden.bs.modal"); 100 | // Not working as expected 101 | $('#form-add-domain').formValidation('resetForm', true); 102 | // So let's do it manually, foreach input group 103 | $('.form-group').each(function(i, obj) { 104 | $(this).removeClass('has-error has-success'); 105 | }); 106 | // foreach icon result 107 | $('.form-control-feedback').each(function(i, obj) { 108 | $(this).css("display" ,"none"); 109 | $(this).removeClass('glyphicon glyphicon-remove glyphicon-ok'); 110 | }); 111 | }); 112 | 113 | }); 114 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap-select.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-select v1.3.5 3 | * http://silviomoreto.github.io/bootstrap-select/ 4 | * 5 | * Copyright 2013 bootstrap-select 6 | * Licensed under the MIT license 7 | */.bootstrap-select.btn-group,.bootstrap-select.btn-group[class*="span"]{float:none;display:inline-block;margin-bottom:10px;margin-left:0}.form-search .bootstrap-select.btn-group,.form-inline .bootstrap-select.btn-group,.form-horizontal .bootstrap-select.btn-group{margin-bottom:0}.bootstrap-select.form-control{padding:0;border:0}.bootstrap-select.btn-group.pull-right,.bootstrap-select.btn-group[class*="span"].pull-right,.row-fluid .bootstrap-select.btn-group[class*="span"].pull-right{float:right}.input-append .bootstrap-select.btn-group{margin-left:-1px}.input-prepend .bootstrap-select.btn-group{margin-right:-1px}.bootstrap-select:not([class*="span"]):not([class*="col-"]):not([class*="form-control"]){width:100px;margin-right:10px;}.bootstrap-select{width:100px\0}.bootstrap-select.form-control:not([class*="span"]){width:100%}.bootstrap-select>.btn{width:100%}.error .bootstrap-select .btn{border:1px solid #b94a48}.dropdown-menu{z-index:2000}.bootstrap-select.show-menu-arrow.open>.btn{z-index:2051}.bootstrap-select .btn:focus{outline:thin dotted #333 !important;outline:5px auto -webkit-focus-ring-color !important;outline-offset:-2px}.bootstrap-select.btn-group .btn .filter-option{overflow:hidden;position:absolute;left:12px;right:25px;text-align:left}.bootstrap-select.btn-group .btn .caret{position:absolute;top:50%;right:12px;margin-top:-2px;vertical-align:middle}.bootstrap-select.btn-group>.disabled,.bootstrap-select.btn-group .dropdown-menu li.disabled>a{cursor:not-allowed}.bootstrap-select.btn-group>.disabled:focus{outline:none !important}.bootstrap-select.btn-group[class*="span"] .btn{width:100%}.bootstrap-select.btn-group .dropdown-menu{min-width:100%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.bootstrap-select.btn-group .dropdown-menu.inner{position:static;border:0;padding:0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.bootstrap-select.btn-group .dropdown-menu dt{display:block;padding:3px 20px;cursor:default}.bootstrap-select.btn-group .div-contain{overflow:hidden}.bootstrap-select.btn-group .dropdown-menu li{position:relative}.bootstrap-select.btn-group .dropdown-menu li>a.opt{position:relative;padding-left:35px}.bootstrap-select.btn-group .dropdown-menu li>a{cursor:pointer}.bootstrap-select.btn-group .dropdown-menu li>dt small{font-weight:normal}.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a i.check-mark{display:inline-block;position:absolute;right:15px;margin-top:2.5px}.bootstrap-select.btn-group .dropdown-menu li a i.check-mark{display:none}.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text{margin-right:34px}.bootstrap-select.btn-group .dropdown-menu li small{padding-left:.5em}.bootstrap-select.btn-group .dropdown-menu li:not(.disabled)>a:hover small,.bootstrap-select.btn-group .dropdown-menu li:not(.disabled)>a:focus small{color:#64b1d8;color:rgba(255,255,255,0.4)}.bootstrap-select.btn-group .dropdown-menu li>dt small{font-weight:normal}.bootstrap-select.show-menu-arrow .dropdown-toggle:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #CCC;border-bottom-color:rgba(0,0,0,0.2);position:absolute;bottom:-4px;left:9px;display:none}.bootstrap-select.show-menu-arrow .dropdown-toggle:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid white;position:absolute;bottom:-4px;left:10px;display:none}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before{bottom:auto;top:-3px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after{bottom:auto;top:-3px;border-top:6px solid #fff;border-bottom:0}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before{right:12px;left:auto}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after{right:13px;left:auto}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle:before,.bootstrap-select.show-menu-arrow.open>.dropdown-toggle:after{display:block}.mobile-device{position:absolute;top:0;left:0;display:block !important;width:100%;height:100% !important;opacity:0}.bootstrap-select.fit-width{width:auto !important}.bootstrap-select.btn-group.fit-width .btn .filter-option{position:static}.bootstrap-select.btn-group.fit-width .btn .caret{position:static;top:auto;margin-top:-1px}.control-group.error .bootstrap-select .dropdown-toggle{border-color:#b94a48}.bootstrap-select-searchbox{padding:4px 8px} 8 | -------------------------------------------------------------------------------- /routes/servers.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var database = require('../libs/db'); 3 | var pdnsapi = require('../libs/pdnsapi'); 4 | var router = express.Router(); 5 | 6 | // Route middleware to validate :id 7 | // Execute for all request 8 | // It return the full server object from the DB 9 | router.param('id', function(req, res, next, id){ 10 | console.log("server_id: [%s]", id); 11 | console.log(parseInt(id)); 12 | if (parseInt(id)) { 13 | database.get(req, res, id, function(err, server){ 14 | if (err) { 15 | return next(err); 16 | } 17 | else if (!server) { 18 | return next(new Error('failed to load server')); 19 | } 20 | req.server = server; 21 | database.list(req, res, function(req, res, rows) { 22 | if (!rows) { 23 | return next(new Error('failed to load servers')); 24 | } 25 | req.serverlist = rows; 26 | next(); 27 | }); 28 | }); 29 | } else { next(); } 30 | }); 31 | 32 | /* GET servers page, when no servers in the list */ 33 | router.get('/', function(req, res) { 34 | if (!req.db) { res.redirect('/'); } 35 | database.list(req, res, function(req, res, rows) { 36 | res.render('servers', { 'serverlist': rows, 'navmenu': '' }); 37 | }); 38 | }); 39 | 40 | /* POST to add server Service */ 41 | router.post('/add', function(req, res) { 42 | console.log("Server add"); 43 | console.log(req.db); 44 | console.log(req.body); 45 | // Redirect to index if missing value from the form 46 | //if (!req.db || !req.body.url || !req.body.password) { res.redirect('/servers'); } 47 | // Do the job 48 | console.log("Add entry in db"); 49 | database.add(req, res, function(req, res) { 50 | res.redirect('/servers'); 51 | }); 52 | }); 53 | 54 | /* Now we have the servers set up, let use it as a middleware */ 55 | /* All page below require a valid server and DB */ 56 | 57 | /* GET servers page. */ 58 | router.get('/:id', function(req, res) { 59 | if (!req.db || !req.server || !req.params.id) { res.redirect('/'); } 60 | pdnsapi.config.servers(req, res, function (error, response, body) { 61 | var json = JSON.parse(body); 62 | database.refresh(req, res, json[0], function(req, res) { 63 | console.log("db refresh"); 64 | }); 65 | // If any error redirect to index 66 | if (!response || response.statusCode != 200) { 67 | console.log("Error: connection failed"); 68 | res.msg = {}; 69 | res.msg.class="alert-warning"; 70 | res.msg.title="Error!"; 71 | res.msg.msg= "Connection failed to "+ req.server.name; 72 | }else { 73 | var json = JSON.parse(body); 74 | console.log(json[0].type); 75 | res.msg = json[0]; 76 | res.msg.class="alert-success"; 77 | res.msg.title="Success!"; 78 | res.msg.msg = "Connected to "+ req.server.name +" "+ json[0].type +" "+ json[0].daemon_type +" Version "+ json[0].version; 79 | } 80 | 81 | res.render('servers', { 'msg': res.msg, 82 | 'serverlist': req.serverlist, 83 | 'serverselected': req.server}); 84 | }); 85 | }); 86 | 87 | router.get('/:id/del', function(req, res) { 88 | console.log("Server delete"); 89 | console.log(req.params); 90 | console.log(req.server); 91 | console.log(req.db); 92 | if (!req.db || !req.params.id) { res.redirect('/servers'); } 93 | database.delete(req, res, function(req, res, rows) { 94 | res.redirect('/servers'); 95 | }); 96 | }); 97 | 98 | router.post('/:id/update', function(req, res) { 99 | console.log("Server update"); 100 | console.log(req.params); 101 | console.log(req.server); 102 | console.log(req.db); 103 | if (!req.db || !req.params.id) { res.redirect('/servers'); } 104 | database.update(req, res, function(req, res, rows) { 105 | res.redirect('/servers'); 106 | }); 107 | }); 108 | 109 | router.get('/:id/refresh', function(req, res) { 110 | console.log("Server refresh"); 111 | console.log(req.params); 112 | console.log(req.server); 113 | console.log(req.db); 114 | if (!req.db || !req.params.id) { res.redirect('/servers'); } 115 | pdnsapi.config.servers(req, res, function (error, response, body) { 116 | var json = JSON.parse(body); 117 | database.refresh(req, res, json[0], function(req, res, rows) { 118 | res.redirect('/servers'); 119 | }); 120 | }); 121 | }); 122 | 123 | module.exports = router; 124 | -------------------------------------------------------------------------------- /routes/pdns/records.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var database = require('../../libs/db'); 3 | var pdnsapi = require('../../libs/pdnsapi'); 4 | var router = express.Router(); 5 | 6 | // Route middleware to validate :id 7 | // Execute for all request 8 | // It return the full server object from the DB 9 | router.param('id', function(req, res, next, id){ 10 | console.log("server_id: [%s]", id); 11 | if (parseInt(id)) { 12 | database.get(req, res, id, function(err, server){ 13 | if (err) { 14 | return next(err); 15 | } 16 | else if (!server) { 17 | return next(new Error('failed to load server')); 18 | } 19 | req.server = server; 20 | database.list(req, res, function(req, res, rows) { 21 | if (!rows) { 22 | return next(new Error('failed to load servers')); 23 | } 24 | req.serverlist = rows; 25 | next(); 26 | }); 27 | }); 28 | } else { next(); } 29 | }); 30 | 31 | /* -------------------------------------------------*/ 32 | /* RECORDS */ 33 | 34 | /* Get records of a domain */ 35 | router.get('/servers/:id/domains/:zone_id', function(req, res) { 36 | console.log("Get records of a domain"); 37 | console.log(req.db); 38 | console.log(req.params.id); 39 | console.log(req.params.zone_id); 40 | // If missing value redirect to index or to an error page!!! 41 | if (!req.db && !req.server) { res.redirect('/'); } 42 | pdnsapi.records.list(req, res, function (error, response, body) { 43 | if (error) { console.log("Error:"+ error); } 44 | console.log(body); 45 | // If any http error redirect to index 46 | if (error && response.statusCode != 200) { console.log(error); res.redirect('/servers'); } 47 | else { 48 | console.log(body); 49 | var json = JSON.parse(body); 50 | console.log(json); 51 | res.render('records', { 'data': json, 52 | 'serverlist': req.serverlist, 53 | 'navmenu': 'domains', 54 | 'serverselected': req.server}); 55 | } 56 | }); 57 | }); 58 | 59 | /* Delete a record */ 60 | router.get('/servers/:id/records/del/:zone_id/:record_name/:record_type', function(req, res) { 61 | console.log("Delete a record"); 62 | console.log(req.db); 63 | console.log(req.params.id); 64 | console.log(req.params.zone_id); 65 | console.log(req.params.record_name); 66 | console.log(req.params.record_type); 67 | // If missing value redirect to index or to an error page!!! 68 | if (!req.db && !req.server) { res.redirect('/'); } 69 | var record = { 'name': req.params.record_name, 'type': req.params.record_type }; 70 | pdnsapi.records.delete(req, res, record, function (error, response, body) { 71 | // If any http error redirect to index 72 | if (error && response.statusCode != 200) { console.log(error); res.redirect('/'); } 73 | else { 74 | // If app error see body.error 75 | if (body.error) { console.log("Error: " + body.error); } 76 | res.redirect('/servers/'+ req.params.id +'/domains/'+ req.params.zone_id); 77 | } 78 | }); 79 | }); 80 | 81 | /* Add/Update a record */ 82 | router.post('/servers/:id/records/save/:zone_id', function(req, res) { 83 | console.log("Add/Update a record"); 84 | console.log(req.db); 85 | console.log(req.params.id); 86 | console.log(req.params.zone_id); 87 | console.log(req.body); 88 | // If missing value redirect to index or to an error page!!! 89 | if (!req.db && !req.server) { res.redirect('/'); } 90 | // TODO Handle priority and disabled correctly 91 | var record = { 'name': req.body['name'], 'type': req.body['type'], 92 | 'priority': 0, 'content': req.body['content'], 93 | 'ttl': req.body['ttl'], 'disabled': false }; 94 | console.log(record); 95 | pdnsapi.records.update(req, res, record, function (error, response, body) { 96 | // If any http error redirect to index 97 | if (error && response.statusCode != 200) { console.log(error); res.redirect('/'); } 98 | else { 99 | // If app error see body.error 100 | if (body.error) { 101 | console.log("Error: " + body.error); 102 | console.log("Error: connection failed"); 103 | res.msg = {}; 104 | res.msg.class="alert-warning"; 105 | res.msg.title="Error!"; 106 | res.msg.msg= "Unable to add/update record. "+ body.error; 107 | res.render('records', { 'msg': res.msg, 108 | 'serverlist': req.serverlist, 109 | 'serverselected': req.server}); 110 | } 111 | res.redirect('/servers/'+ req.params.id +'/domains/'+ req.params.zone_id); 112 | } 113 | }); 114 | }); 115 | 116 | module.exports = router; 117 | -------------------------------------------------------------------------------- /libs/pdns/zones.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | 3 | /* -------------------------------------------------------- 4 | * 5 | * ZONES / DOMAINS 6 | * https://doc.powerdns.com/md/httpapi/api_spec/ 7 | * 8 | */ 9 | 10 | function getHeaders(req) { 11 | return { 12 | "Content-Type": "application/json", 13 | "X-API-Key": req.server.password 14 | }; 15 | } 16 | 17 | // Handle Zones listing 18 | exports.list= function(req, res, callback){ 19 | if (req.server.url && req.server.password) { 20 | request( 21 | { 22 | dataType: 'json', 23 | method: 'GET', 24 | url: req.server.url+"/servers/localhost/zones", 25 | headers: getHeaders(req) 26 | }, 27 | function (error, response, body) { 28 | callback(error, response, body); 29 | }); 30 | } 31 | }; 32 | 33 | // Handle Zones delete 34 | exports.delete = function(req, res, callback){ 35 | if (req.server.url && req.server.password && req.params.zone_id) { 36 | request( 37 | { 38 | dataType: 'json', 39 | method: 'DELETE', 40 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id, 41 | json: { "rrsets": [ { "name": req.params.zone_id, "changetype": "DELETE", "records": [] , "comments": [] } ] }, 42 | headers: getHeaders(req) 43 | }, 44 | function (error, response, body) { 45 | callback(error, response, body); 46 | }); 47 | } 48 | }; 49 | 50 | // Handle Zones add/update 51 | exports.add = function(req, res, callback){ 52 | if (req.server.url && req.server.password && req.body.name && req.body.type) { 53 | request( 54 | { 55 | dataType: 'json', 56 | method: 'POST', 57 | url: req.server.url+"/servers/localhost/zones", 58 | json: { "kind": req.body.type, "name": req.body.name, "masters": [req.body.master], "nameservers": [], "records": []}, 59 | headers: getHeaders(req) 60 | }, 61 | function (error, response, body) { 62 | callback(error, response, body); 63 | }); 64 | } 65 | }; 66 | 67 | // Handle Zones import 68 | exports.import = function(req, res, callback){ 69 | if (req.server.url && req.server.password && req.params.zone_id && req.body.name && req.body.type && req.body.zone) { 70 | request( 71 | { 72 | dataType: 'json', 73 | method: 'POST', 74 | url: req.server.url+"/servers/localhost/zones", 75 | json: { "kind": req.body.type, "name": req.body.name, "masters": [req.body.master], "nameservers": [], "zone": req.body.zone}, 76 | headers: getHeaders(req) 77 | }, 78 | function (error, response, body) { 79 | callback(error, response, body); 80 | }); 81 | } 82 | }; 83 | 84 | // Handle Zones export 85 | exports.export = function(req, res, callback){ 86 | if (req.server.url && req.server.password && req.params.zone_id) { 87 | request( 88 | { 89 | dataType: 'json', 90 | method: 'GET', 91 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id+"/export", 92 | headers: getHeaders(req) 93 | }, 94 | function (error, response, body) { 95 | callback(error, response, body); 96 | }); 97 | } 98 | }; 99 | 100 | // Handle Zone notify 101 | exports.notify = function(req, res, callback){ 102 | if (req.server.url && req.server.password && req.params.zone_id) { 103 | request( 104 | { 105 | dataType: 'json', 106 | method: 'PUT', 107 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id+"/notify", 108 | headers: getHeaders(req) 109 | }, 110 | function (error, response, body) { 111 | callback(error, response, body); 112 | }); 113 | } 114 | }; 115 | 116 | // Handle Zone axfr-retrieve 117 | exports.retrieve = function(req, res, callback){ 118 | if (req.server.url && req.server.password && req.params.zone_id) { 119 | request( 120 | { 121 | dataType: 'json', 122 | method: 'PUT', 123 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id+"/axfr-retrieve", 124 | headers: getHeaders(req) 125 | }, 126 | function (error, response, body) { 127 | callback(error, response, body); 128 | }); 129 | } 130 | }; 131 | 132 | // Handle Zone check - Not yet implemented. 133 | exports.check = function(req, res, callback){ 134 | if (req.server.url && req.server.password && req.params.zone_id) { 135 | request( 136 | { 137 | dataType: 'json', 138 | method: 'PUT', 139 | url: req.server.url+"/servers/localhost/zones/"+req.params.zone_id+"/check", 140 | headers: getHeaders(req) 141 | }, 142 | function (error, response, body) { 143 | callback(error, response, body); 144 | }); 145 | } 146 | }; 147 | -------------------------------------------------------------------------------- /Monitoring.md: -------------------------------------------------------------------------------- 1 | *Secure and Monitoring PowerDNS via the internal web server* 2 | 3 | There is a secure way to retrieve the information provided by PowerDNS from outside your DNS server host. You could use Apache, nginx or any other web server you like as a proxy server. That way you can use more advanced authentication methods built into that web server to secure your status page. I will now show you how to do this using Apache 2 on Debian. We’ll need mod_proxy, mod_proxy_http and mod_headers enabled on the Apache 2 server. If you do not want to run an instance of Apache 2 on your DNS server, you could use an SSL tunnel or a secure back channel link to a remote Apache server to retrieve the status page. But this is beyond the scope of this post. 4 | 5 | First, enable the internal PowerDNS web server by editing the configuration file. 6 | 7 | ``` 8 | webserver=yes 9 | webserver-address=127.0.0.1 10 | webserver-port=8081 11 | webserver-password=PowerDNS 12 | ``` 13 | 14 | Now install and enable the required modules of Apache 2 by executing the following commands. 15 | 16 | ``` 17 | $ apt-get install libapache2-mod-proxy-html 18 | $ a2enmod proxy 19 | $ a2enmod proxy_http 20 | $ a2enmod headers 21 | ``` 22 | 23 | The last module is only needed, if you set a password for your internal web server as recommended above. I assume that you’ve got some kind of virtual host configuration for your Apache server. You’ll want to add a new virtual host for the DNS status information. If you use a subdirectory, navigation might be a bit odd. Let’s add a new site to the available sites. 24 | 25 | ``` 26 | $ vi /etc/apache2/sites-available/status.dns.example.net 27 | 28 | ServerName status.dns.example.net 29 | DocumentRoot /var/www/ 30 | ProxyRequests Off 31 | 32 | Order deny,allow 33 | Allow from all 34 | ForceType 'text/html; charset=UTF-8' 35 | 36 | ProxyPass / http://localhost:8081 37 | ProxyPassReverse / http://localhost:8081 38 | 39 | ``` 40 | 41 | Alright, so what are we doing here? Basically, we’re adding a new virtual host status.dns.example.net on our main interface of dns.example.net. We’re using a reverse proxy to to send all requests coming from the outside to our internal PowerDNS web server on port 8081. Also, we’re forcing a text/html content type in the proxy request filter, because otherwise we would just get text/plain and we would simply see the source code, which is probably not what you want. Let’s enable the site for a test: 42 | 43 | ``` 44 | $ a2ensite status.dns.example.net 45 | $ /etc/init.d/apache2 reload 46 | ``` 47 | 48 | If you point your web browser to status.dns.example.net you should now see the internal status page of PowerDNS. If you set a password above, you will see a password dialogue. This is the password dialogue sent by the PowerDNS web server. The user name is admin and the password is your password. Try it out now, because we’ll get rid of this in a minute. 49 | 50 | For security reasons, you probably want to use Apache 2 for authentication. E.g. you might want use a SSL connection and authenticate your co-workers using the internal LDAP server of your company intranet. You might even stay with the insecure basic authentication method, but use other user names. This is entirely up to you and beyond the scope of this post. Consult the Apache 2 documentation on how to do this. What you probably don’t want to do, however, is to authenticate twice (first your secure authentication method and then PowerDNS basic authentication. Luckily, we can configure the Apache 2 proxy to do the authentication for us. This is a bit tricky, though. 51 | To authenticate at the PowerDNS server, Apache 2 needs to send an additional Authorization header line to the PowerDNS server with every request it handles. We use the RequestHeader directive to override any existing Authorization header with our own authentication data. Add the following lines just before the end of the virtual host container. 52 | 53 | ``` 54 | 55 | RequestHeader Set Authorization "Basic YWRtaW46UG93ZXJETlM=" 56 | 57 | ``` 58 | 59 | The above example works only for our example password, which is PowerDNS. Try it for a test. This is, because part of the header value is encrypted using the base64 algorithm. You need to change the encrypted part YWRtaW46UG93ZXJETlM=. In plain text the encrypted string would read admin:PowerDNS, where admin is the user name and PowerDNS is the password. To use your own password, you need to encrypt the string admin:yourownpassword using the base64 algorithm and replace our example string. Be sure to keep the Basic and the space. It is crucial for success, that you’ve got the right encrypted string. There are a number of online tools, to encode and decode these strings. To ensure, that you’ve got the correct encryption method, encode the example string and compare it to the string above for a reference. If you’ve got the wrong string, it will not work. 60 | 61 | Restart the Apache 2 server. To clear your password cache, restart your browser. Now surf to the site again. You will see, that the password dialogue is gone. Now, don’t forget to secure the page again using Apache 2. Under any circumstances, do not use Directory containers in the configuration. These will not apply to the proxy, because the proxy is not a physical directory on your server. Use Location containers like we did above for setting the RequestHeader directive. Also, you could still use insecure basic authentication to secure the page, if you wanted. It would work regardless of the RequestHeader magic. 62 | A light-weight alternative 63 | 64 | For those of you, who think that Apache is too heavy, here is an example for the nginx web server: 65 | ``` 66 | $ vi /etc/nginx/sites-available/status.dns.example.net 67 | server { 68 | listen 192.168.0.1:80; 69 | server_name status.dns.example.net; 70 | root /var/www/nginx-default; 71 | location / { 72 | index index.html 73 | proxy_pass http://localhost:8081; 74 | proxy_redirect off; 75 | proxy_set_header Authorization "Basic YWRtaW46UG93ZXJETlM="; 76 | } 77 | } 78 | ``` 79 | -------------------------------------------------------------------------------- /views/servers.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container 5 | .page-header 6 | h2 7 | | Servers 8 | |   9 | .btn-toolbar(style='margin-bottom: 10px;') 10 | .btn-group.pull-right 11 | button.btn.btn-default.add-server(id="add-server", data-toggle="modal", data-target="#add-server-modal") 12 | span.glyphicon.glyphicon-plus 13 | |  Add server 14 | 15 | .modal.fade.in(id="del-server-modal", tabindex="-1", role="dialog", aria-labelledby="del-server-label", aria-hidden="true") 16 | .modal-dialog 17 | .modal-content 18 | .modal-header 19 | button(type="button", class="close", data-dismiss="modal", aria-hidden="true") × 20 | h4(class="modal-title", id="del-server-label") 21 | #mod-delete-operation 22 | .modal-body 23 | .alert.alert-warning 24 | p 25 | strong Warning! 26 | | This operation will delete the server 27 | strong#mod-delete-text-name 28 | |  
Are you sure you want to do this ? 29 | .modal-footer 30 | a.btn.btn-default(href='#', data-dismiss='modal', aria-hidden="true") Cancel 31 | a.btn.btn-danger#mod-delete-submit(href='') Delete server 32 | 33 | .modal.fade.in(id="add-server-modal", tabindex="-1", role="dialog", aria-labelledby="add-server-label", aria-hidden="true") 34 | .modal-dialog 35 | .modal-content 36 | .modal-header 37 | button(type="button", class="close", data-dismiss="modal", aria-hidden="true") × 38 | h4(class="modal-title", id="add-server-label") 39 | #mod-edit-operation 40 | .modal-body 41 | form.modal-form(id="form-add-server", method='POST', action='/servers/add') 42 | fieldset 43 | .form-group 44 | label.control-label(for='mod-edit-url') URL: 45 | .controls 46 | input.form-control(id="mod-edit-url", type="text", placeholder="http://localhost:8053", name="url") 47 | .form-group 48 | label.control-label(for='mod-edit-api-key') API-Key: 49 | .controls 50 | input.form-control(id="mod-edit-api-key", type="text", placeholder="changeme", name="password") 51 | .modal-footer 52 | a.btn.btn-default(href='#', data-dismiss='modal', aria-hidden="true") Cancel 53 | button.btn.btn-success(href='', type="submit", id="mod-edit-submit") Add server 54 | 55 | div 56 | table.table.table-striped.table-condensed.table-hover#servers-table(width="100%", name="servers-table") 57 | thead 58 | tr 59 | th Name 60 | th URL 61 | th Daemon Type 62 | th Version 63 | th 64 | tbody 65 | each item in serverlist 66 | tr 67 | td 68 | a(href='/servers/#{item.id}')= item.name 69 | td= item.url 70 | td= item.pdns_daemon_type 71 | td= item.pdns_version 72 | td.servers-value-action 73 | .btn-group 74 | a.btn.btn-default.btn-xs.view-domain(id="view-domain", rel="tooltip", title="View zones for server", href="/servers/#{item.id}/domains") 75 | span.glyphicon.glyphicon-eye-open 76 | a.btn.btn.btn-default.btn-xs.refresh-server(id="refresh-server", data-id="#{item.id}", data-name="#{item.name}", rel="tooltip", title="Refresh server information", href="/servers/#{item.id}/refresh") 77 | span.glyphicon.glyphicon-retweet 78 | btn.btn.btn-default.btn-xs.edit-server(id="edit-server", data-toggle="modal", href="#add-server-modal", data-id="#{item.id}", data-name="#{item.name}", data-url="#{item.url}", data-apikey="#{item.password}", rel="tooltip", title="Edit server") 79 | span.glyphicon.glyphicon-pencil 80 | btn.btn.btn-danger.btn-xs.del-server(id="del-server", data-toggle="modal", href="#del-server-modal", data-id="#{item.id}", data-name="#{item.name}", rel="tooltip", title="Delete server") 81 | span.glyphicon.glyphicon-trash 82 | 83 | include inc/footer 84 | 85 | // Bootstrap plugin form validation 86 | //link(rel='stylesheet', href='/form.validation/dist/css/formValidation.min.css') 87 | //script(src='/form.validation/dist/js/formValidation.min.js') 88 | //script(src='/form.validation/dist/js/framework/bootstrap.js') 89 | // datatables 90 | script(src='/datatables/media/js/jquery.dataTables.min.js') 91 | script(src='/datatables/media/js/dataTables.bootstrap.min.js') 92 | // PNotify 93 | script(src='/pnotify/pnotify.core.js') 94 | // domains UI 95 | //script(src='/javascripts/ui_servers.js') 96 | 97 | | 132 | 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | yapdnsui 2 | ======== 3 | 4 | *Yet Another PowerDNS web interface* 5 | 6 | The ultimate goal is to produce a slick web interface to [PowerDNS](http://www.powerdns.com/) that 7 | will let you fully operate your PowerDNS instance via the official [PowerDNS API](https://github.com/PowerDNS/pdnsapi). 8 | 9 | The application should let you do add/delete/update domains and records as well as graph 10 | statistics and list/update configuration items **LIVE** from one or multiple PowerDNS instance via the PowerDNS API. 11 | 12 | In addition, the application should let you manage DNSSEC zones and zone metadata. 13 | 14 | It is not just another PowerDNS UI, it is the first to use the [PowerDNS API](https://github.com/PowerDNS/pdnsapi), therefor to be backend-agnostic and DNSSEC aware. 15 | 16 | Currently, you can list the configuration and see live statistics in a graph and list all the domains and records for demonstration purpose. 17 | 18 | You can checkout the web interface using the [live demo](http://yapdnsui-xbgmsharp.rhcloud.com/) running on OpenShift cloud. 19 | 20 | You are welcome to contribute. 21 | 22 | ![yapdnsui_livestats] 23 | (https://github.com/xbgmsharp/yapdnsui/raw/master/misc/screenshot_livestats.png) 24 | 25 | ![yapdnsui_config] 26 | (https://github.com/xbgmsharp/yapdnsui/raw/master/misc/screenshot_config.png) 27 | 28 | ![yapdnsui_domains] 29 | (https://github.com/xbgmsharp/yapdnsui/raw/master/misc/screenshot_domains.png) 30 | 31 | ![yapdnsui_records] 32 | (https://github.com/xbgmsharp/pdnsui/raw/master/misc/screenshot_records.png) 33 | 34 | yapdnsui Prereqs 35 | ---------------- 36 | 37 | You need [NodeJS](http://nodejs.org) v0.10.x+ for this application to work. 38 | 39 | It might work with lower requirements but I didn't test. 40 | 41 | PowerDNS Prereqs 42 | ---------------- 43 | Yes, you need a [PowerDNS](http://www.powerdns.com/) server. 44 | 45 | It can be either an [Authoritative](https://doc.powerdns.com/md/authoritative/) or a [Recursor](https://doc.powerdns.com/md/recursor/) to try this application out. 46 | 47 | You need to enable the [PowerDNS API](https://doc.powerdns.com/md/httpapi/README/) on your PowerDNS instances. 48 | 49 | For an Authoritative instance, configure as follows: 50 | ``` 51 | # Allow webserver 52 | webserver=yes 53 | # IP Address of web server to listen on 54 | webserver-address=127.0.0.1 55 | # Port of web server to listen on 56 | webserver-port=8081 57 | # Web server access is only allowed from these subnets 58 | webserver-allow-from=0.0.0.0/0,::/0 59 | # Enable JSON and API 60 | experimental-json-interface=yes 61 | experimental-api-key=changeme 62 | ``` 63 | 64 | In addition, you might want to configure the default domain value: 65 | ``` 66 | # default-soa-mail mail address to insert in the SOA record if none set in the backend 67 | default-soa-mail= 68 | # default-soa-name name to insert in the SOA record if none set in the backend 69 | default-soa-name=a.misconfigured.powerdns.server 70 | # default-ttl Seconds a result is valid if not set otherwise 71 | default-ttl=3600 72 | # soa-expire-default Default SOA expire 73 | soa-expire-default=604800 74 | # soa-refresh-default Default SOA refresh 75 | soa-refresh-default=10800 76 | # soa-retry-default Default SOA retry 77 | soa-retry-default=3600 78 | ``` 79 | 80 | * Restart 81 | ```bash 82 | $ /etc/init.d/pdns restart 83 | ``` 84 | 85 | * Test 86 | ```bash 87 | $ curl -v -H 'X-API-Key: changeme' http://localhost:8081/ 88 | ``` 89 | 90 | Installing 91 | ---------- 92 | 93 | * Clone the repository 94 | 95 | ```bash 96 | git clone https://github.com/xbgmsharp/yapdnsui 97 | cd yapdnsui 98 | ``` 99 | 100 | * Install dependencies 101 | 102 | ```bash 103 | $ npm install 104 | ``` 105 | 106 | ```bash 107 | $ bower install 108 | ``` 109 | 110 | * Start the application 111 | 112 | ```bash 113 | $ npm start 114 | ``` 115 | Or manually, you can define an IP and the PORT by using environment variables. 116 | ```bash 117 | $ HOST=127.0.0.1 PORT=8080 DEBUG=yapdnsui node bin/www 118 | ``` 119 | 120 | * Point your browser to: [http://localhost:8080/](http://localhost:8080/) 121 | * Enjoy! 122 | 123 | _Note_ : yaPDNSui use a sqlite database to store PowerDNS instances details. 124 | You can access the PowerDNS server manage interface using the menu on the right. 125 | 126 | Test using Docker 127 | ----------------- 128 | 129 | You can try yaPDNSui using Docker. Please refer to [Docker.md](Docker.md) 130 | 131 | 132 | Secure yapdnsui 133 | --------------- 134 | 135 | For security reasons, you may want to run a webserver (like Apache or Nginx) in front of your PowerDNS webserver as a reverse proxy using SSL. 136 | As a best pratice, it is recommended to apply use SSL for the traffic between the end-user and the application. 137 | 138 | You can read this [HOWTO Monitoring.md](Monitoring.md) for further details. 139 | 140 | For security reasons, you probably want to use the same webserver for authentication purpose. 141 | 142 | You can read this [mod_auth_ldap - Apache HTTP Server](httpd.apache.org/docs/2.0/mod/mod_auth_ldap.html) 143 | 144 | You might want to use a SSL connection and authenticate your co-workers using the internal LDAP or database server of your company intranet. 145 | 146 | Contributing to yapdnsui 147 | ------------------------ 148 | 149 | * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet 150 | * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it 151 | * Fork the project 152 | * Use a specific branch for your changes (one bonus point if it's prefixed with 'feature/') 153 | * _write tests_, doc, commit and push until you are happy with your contribution 154 | * Send a pull request 155 | * Please try not to mess with the package, version, or history 156 | 157 | License 158 | ------- 159 | 160 | This program is free software; you can redistribute it and/or modify it under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl.html) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 161 | 162 | This program comes without any warranty. 163 | 164 | Credits 165 | ------- 166 | 167 | * yaPDNSui is built with the awesome [NodeJS](http://nodejs.org) and [Express](http://expressjs.com) and [Bower](http://bower.io/). 168 | 169 | * PowerDNS [http://www.powerdns.com/](http://www.powerdns.com/) 170 | 171 | * Layout & CSS: [http://twitter.github.com/bootstrap/](http://twitter.github.com/bootstrap/) 172 | 173 | * Tables: [http://datatables.net/](http://datatables.net/) 174 | 175 | * Charts: [http://www.highcharts.com/](http://www.highcharts.com/) 176 | 177 | * Thanks to PDNSui [https://github.com/leucos/pdnsui/](https://github.com/leucos/pdnsui/) 178 | -------------------------------------------------------------------------------- /public/javascripts/ui_records.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | // Init bootstrap select plugin 4 | $('.selectpicker').selectpicker(); 5 | 6 | // Init bootstrap checkbox plugin 7 | $('#mod-edit-record-disabled').checkboxpicker(); 8 | 9 | // Init bootstrap form validation plugin 10 | $('#form-add-record') 11 | .formValidation({ 12 | framework: 'bootstrap', 13 | excluded: [':disabled', ':hidden', ':not(:visible)'], 14 | icon: { 15 | valid: 'glyphicon glyphicon-ok', 16 | invalid: 'glyphicon glyphicon-remove', 17 | validating: 'glyphicon glyphicon-refresh' 18 | }, 19 | fields: { 20 | name: { 21 | message: 'The record name is not valid', 22 | validators: { 23 | regexp: { 24 | enabled: true, 25 | regexp: /^[a-zA-Z0-9 _\.-]+$/, 26 | message: 'A record name can only consist of alphabetical, numbers, underscore, dash, dot or space' 27 | }, 28 | } 29 | }, 30 | content: { 31 | message: 'The content is not valid', 32 | validators: { 33 | notEmpty: { 34 | message: 'The record content is required' 35 | }, 36 | regexp: { 37 | enabled: true, 38 | regexp: /^[a-zA-Z0-9 _\.-]+$/, 39 | message: 'A record content can only consist of alphabetical, numbers, underscore, dash, dot or space' 40 | }, 41 | // Here are the validators need to be enabled/disabled dynamically 42 | digits: { 43 | enabled: false, 44 | message: 'The record can contain only digits' 45 | }, 46 | ip: { 47 | enabled: false, 48 | message: 'Please enter a valid IP address', 49 | ipv4: true, 50 | ipv6: true 51 | } 52 | } 53 | }, 54 | priority: { 55 | message: 'The priority is not valid', 56 | validators: { 57 | integer: { 58 | message: 'The priority can contain only digits' 59 | }, 60 | greaterThan: { 61 | message: 'The priority must be a positive number', 62 | value: 0 63 | } 64 | } 65 | }, 66 | ttl: { 67 | message: 'The ttl is not valid', 68 | validators: { 69 | notEmpty: { 70 | message: 'The TTL is required' 71 | }, 72 | integer: { 73 | message: 'The TTL can contain only digits' 74 | }, 75 | greaterThan: { 76 | message: 'The TTL must be a positive number', 77 | value: 0 78 | } 79 | } 80 | } 81 | } 82 | }) 83 | .on('error.field.bv', function (e, data) { 84 | console.log(data.field, data.element, '-->error'); 85 | }) 86 | .on('success.field.bv', function (e, data) { 87 | //console.log(data.field, data.element, '-->success'); 88 | }); 89 | 90 | // On update select 91 | $('#mod-edit-record-type').change(function () { 92 | var type = $(this).val(); 93 | switch (type) { 94 | case 'A': 95 | console.log('A'); 96 | $('#form-add-record') 97 | // Disable all other validators 98 | .formValidation('enableFieldValidators', 'content', false, 'regexp') 99 | .formValidation('enableFieldValidators', 'content', false, 'digits') 100 | // Enable ip validator 101 | .formValidation('enableFieldValidators', 'content', true, 'ip') 102 | // Enable ipv4 for the ip validator 103 | .formValidation('updateOption', 'content', 'ip', 'ipv6', false) 104 | // Disable ipv6 for the ip validator 105 | .formValidation('updateOption', 'content', 'ip', 'ipv4', true) 106 | // Update the message for ip validator 107 | .formValidation('updateMessage', 'content', 'ip', 'Please enter a valid IPv4 address'); 108 | $('#mod-edit-record-content').focus(); 109 | break; 110 | case 'AAAA': 111 | console.log('AAAA'); 112 | $('#form-add-record') 113 | // Disable all other validators 114 | .formValidation('enableFieldValidators', 'content', false, 'regexp') 115 | .formValidation('enableFieldValidators', 'content', false, 'digits') 116 | // Enable ip validator 117 | .formValidation('enableFieldValidators', 'content', true, 'ip') 118 | // Enable ipv6 for the ip validator 119 | .formValidation('updateOption', 'content', 'ip', 'ipv6', true) 120 | // Disable ipv4 for the ip validator 121 | .formValidation('updateOption', 'content', 'ip', 'ipv4', false) 122 | // Update the message for ip validator 123 | .formValidation('updateMessage', 'content', 'ip', 'Please enter a valid IPv6 address'); 124 | $('#mod-edit-record-content').focus(); 125 | break; 126 | case 'SRV': 127 | console.log('SRV'); 128 | $('#form-add-record') 129 | // Disable all other validators 130 | .formValidation('enableFieldValidators', 'content', false, 'ip') 131 | .formValidation('enableFieldValidators', 'content', false, 'digits') 132 | // Enable regexp validator 133 | .formValidation('enableFieldValidators', 'content', true, 'regexp') 134 | // Update the regexp for the regexp validator 135 | .formValidation('updateOption', 'content', 'regexp', 'regexp', /^[a-zA-Z0-9 _\.-]+$/) 136 | // Update the message for regexp validator 137 | .formValidation('updateMessage', 'content', 'regexp', 'Please enter a valid SRV record'); 138 | $('#mod-edit-record-content').focus(); 139 | break; 140 | // other cases 141 | default: 142 | $('#form-add-record') 143 | // Disable all other validators 144 | .formValidation('enableFieldValidators', 'content', false, 'digits') 145 | .formValidation('enableFieldValidators', 'content', false, 'ip') 146 | // Enable regexp validator 147 | .formValidation('enableFieldValidators', 'content', true, 'regexp'); 148 | $('#mod-edit-record-content').focus(); 149 | break; 150 | } 151 | }); 152 | 153 | // Reset all given fields. It hides the error messages and feedback icons. 154 | $('#add-record-modal').on('hidden.bs.modal', function() { 155 | // Not working as expected 156 | $('#form-add-record').formValidation('resetForm', true); 157 | // So let's do it manually, foreach input group 158 | $('.form-group').each(function(i, obj) { 159 | $(this).removeClass('has-error'); 160 | $(this).removeClass('has-error'); 161 | $(this).removeClass('has-success'); 162 | }); 163 | // foreach icon result 164 | $('.form-control-feedback').each(function(i, obj) { 165 | $(this).css("display" ,"none"); 166 | $(this).removeClass('glyphicon'); 167 | $(this).removeClass('glyphicon-remove'); 168 | $(this).removeClass('glyphicon-ok'); 169 | }); 170 | }); 171 | 172 | }); 173 | -------------------------------------------------------------------------------- /routes/pdns/domains.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var database = require('../../libs/db'); 3 | var pdnsapi = require('../../libs/pdnsapi'); 4 | var router = express.Router(); 5 | 6 | // Route middleware to validate :id 7 | // Execute for all request 8 | // It return the full server object from the DB 9 | router.param('id', function(req, res, next, id){ 10 | console.log("pdns_domains.js server_id: [%s]", id); 11 | if (parseInt(id)) { 12 | database.get(req, res, id, function(err, server){ 13 | if (err) { 14 | return next(err); 15 | } 16 | else if (!server) { 17 | return next(new Error('failed to load server')); 18 | } 19 | req.server = server; 20 | database.list(req, res, function(req, res, rows) { 21 | if (!rows) { 22 | return next(new Error('failed to load servers')); 23 | } 24 | req.serverlist = rows; 25 | next(); 26 | }); 27 | }); 28 | } else { next(); } 29 | }); 30 | 31 | /* -------------------------------------------------*/ 32 | /* DOMAINS */ 33 | 34 | /* GET domains page. */ 35 | router.get('/servers/:id/domains', function(req, res) { 36 | console.log("Get domains"); 37 | console.log(req.db); 38 | console.log(req.params.id); 39 | console.log(req.server); 40 | // If missing value redirect to index or to an error page!!! 41 | if (!req.db && !req.server) { res.redirect('/'); } 42 | pdnsapi.zones.list(req, res, function (error, response, body) { 43 | // If any error redirect to index 44 | if (!body) { console.log(error); res.redirect('/'); } 45 | else { 46 | var json = JSON.parse(body); 47 | console.log(json); 48 | res.render('domains', { 'data': json, 49 | 'serverlist': req.serverlist, 50 | 'navmenu': 'domains', 51 | 'serverselected': req.server}); 52 | } 53 | }); 54 | }); 55 | 56 | /* Delete a domain */ 57 | router.get('/servers/:id/del/:zone_id', function(req, res) { 58 | console.log("Delete a domain"); 59 | console.log(req.db); 60 | console.log(req.params.id); 61 | console.log(req.params.zone_id); 62 | // If missing value redirect to index or to an error page!!! 63 | if (!req.db && !req.server) { res.redirect('/'); } 64 | pdnsapi.zones.delete(req, res, function (error, response, body) { 65 | // If any error redirect to index 66 | if (error && response.statusCode != 204) { console.log(error); res.redirect('/servers'); } 67 | else { 68 | res.redirect('/servers/'+req.server.id+'/domains'); 69 | } 70 | }); 71 | }); 72 | 73 | /* Add a domain */ 74 | router.post('/servers/:id/add', function(req, res) { 75 | console.log("Add a domain"); 76 | console.log(req.db); 77 | console.log(req.params.id); 78 | console.log(req.body.name); 79 | console.log(req.body.type); 80 | console.log(req.body.master); 81 | // If missing value redirect to index or to an error page!!! 82 | if (!req.db && !req.server) { res.redirect('/'); } 83 | pdnsapi.zones.add(req, res, function (error, response, body) { 84 | // If any error redirect to index 85 | if (error && response.statusCode != 204) { console.log(error); res.redirect('/servers'); } 86 | else { 87 | res.redirect('/servers/'+req.server.id+'/domains'); 88 | } 89 | }); 90 | }); 91 | 92 | /* Import a domain */ 93 | router.post('/servers/:id/import', function(req, res) { 94 | console.log("Add a domain"); 95 | console.log(req.db); 96 | console.log(req.params.id); 97 | console.log(req.body.name); 98 | console.log(req.body.type); 99 | console.log(req.body.master); 100 | console.log(req.body.zone); 101 | // If missing value redirect to index or to an error page!!! 102 | if (!req.db && !req.server) { res.redirect('/'); } 103 | pdnsapi.zones.import(req, res, function (error, response, body) { 104 | // If any error redirect to index 105 | if (error && response.statusCode != 204) { console.log(error); res.redirect('/servers'); } 106 | else { 107 | res.redirect('/servers/'+req.server.id+'/domains'); 108 | } 109 | }); 110 | }); 111 | 112 | /* Export a domain */ 113 | router.get('/servers/:id/export/:zone_id', function(req, res) { 114 | console.log("Export a domain"); 115 | console.log(req.db); 116 | console.log(req.params.id); 117 | console.log(req.params.zone_id); 118 | // If missing value redirect to index or to an error page!!! 119 | if (!req.db && !req.server) { res.redirect('/'); } 120 | pdnsapi.zones.export(req, res, function (error, response, body) { 121 | console.log(body); 122 | // If any error redirect to index 123 | if (error && response.statusCode != 200) { console.log(error); res.redirect('/servers'); } 124 | else { 125 | res.setHeader('Content-disposition', 'attachment; filename='+req.params.zone_id+'axfr'); 126 | res.setHeader('Content-type', 'text/plain'); 127 | res.send(body); 128 | } 129 | }); 130 | }); 131 | 132 | /* Notify a domain */ 133 | router.get('/servers/:id/notify/:zone_id', function(req, res) { 134 | console.log("Notify a domain"); 135 | console.log(req.db); 136 | console.log(req.params.id); 137 | console.log(req.params.zone_id); 138 | // If missing value redirect to index or to an error page!!! 139 | if (!req.db && !req.server) { res.redirect('/'); } 140 | pdnsapi.zones.notify(req, res, function (error, response, body) { 141 | console.log(body); 142 | // If any error redirect to index 143 | if (error && response.statusCode != 200) { 144 | console.log(error); res.send(error); 145 | } else { 146 | res.send(body); 147 | } 148 | }); 149 | }); 150 | 151 | /* Retrieve a domain */ 152 | router.get('/retrieve/:zone_id', function(req, res) { 153 | console.log("Retrieve a domain"); 154 | console.log(req.db); 155 | console.log(req.params.id); 156 | console.log(req.params.zone_id); 157 | // If missing value redirect to index or to an error page!!! 158 | if (!req.db && !req.server) { res.redirect('/'); } 159 | pdnsapi.zones.retrieve(req, res, function (error, response, body) { 160 | console.log(body); 161 | // If any error redirect to index 162 | if (error && response.statusCode != 200) { 163 | console.log(error); res.send(error); 164 | } else { 165 | res.send(body); 166 | } 167 | }); 168 | }); 169 | 170 | module.exports = router; 171 | -------------------------------------------------------------------------------- /public/javascripts/ui_graph_adv.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Request data from the server, add it to the graph and set a timeout 3 | * to request again 4 | * 5 | * Note: One event update all charts as all data are recevied at once from PDNS 6 | * 7 | */ 8 | 9 | var graph_queries; 10 | var graph_resp_answers; 11 | var graph_answers; 12 | var graph_tcp; 13 | var graph_cachehitrate; 14 | 15 | function update_graph_queries(point) { 16 | 17 | var series0 = graph_queries.series[0], 18 | shift0 = series0.data.length > 20; // shift if the series is 19 | // longer than 20 20 | 21 | var series1 = graph_queries.series[1], 22 | shift1 = series1.data.length > 20; // shift if the series is 23 | // longer than 20 24 | 25 | var series2 = graph_queries.series[2], 26 | shift2 = series2.data.length > 20; // shift if the series is 27 | // longer than 20 28 | 29 | // add the point 30 | graph_queries.series[0].addPoint(point, true, shift0); 31 | graph_queries.series[1].addPoint(point, true, shift1); 32 | graph_queries.series[2].addPoint(point, true, shift2); 33 | 34 | } 35 | 36 | 37 | function update_graph_tcp(point) { 38 | 39 | var series0 = graph_tcp.series[0], 40 | shift0 = series0.data.length > 20; // shift if the series is 41 | // longer than 20 42 | 43 | var series1 = graph_tcp.series[1], 44 | shift1 = series1.data.length > 20; // shift if the series is 45 | // longer than 20 46 | 47 | var series2 = graph_tcp.series[2], 48 | shift2 = series2.data.length > 20; // shift if the series is 49 | // longer than 20 50 | 51 | // add the point 52 | graph_tcp.series[0].addPoint(point, true, shift0); 53 | graph_tcp.series[1].addPoint(eval(point), true, shift1); 54 | graph_tcp.series[2].addPoint(eval(point), true, shift2); 55 | 56 | } 57 | 58 | function update_cachehitrate(point) { 59 | 60 | var series0 = graph_cachehitrate.series[0], 61 | shift0 = series0.data.length > 20; // shift if the series is 62 | // longer than 20 63 | console.log(point['packetcache-hit']); 64 | // add the point 65 | var x = new Date().getTime(); // current time 66 | var y = Math.round(Math.random() * 100); 67 | console.log([x, y]); 68 | console.log(point['packetcache-miss'][0]); 69 | var time = point['packetcache-miss'][0]; 70 | var perc = Math.round(point['packetcache-miss'][1]*100/point['packetcache-hit'][1], 2); 71 | //var perc-cache-hit = [ time, perc ]; 72 | console.log([ time, perc ]); 73 | graph_cachehitrate.series[0].addPoint([ time, perc ], true, shift0); 74 | } 75 | 76 | function requestData() { 77 | $.ajax({ 78 | url: '/pdnsapi/statistics', 79 | success: function(point) { 80 | console.log(point); 81 | update_graph_queries(point); 82 | update_graph_tcp(point); 83 | update_cachehitrate(point); 84 | // call it again after one minute 85 | setTimeout(requestData, 5000); // 5sec 86 | }, 87 | cache: false, 88 | dataType: "json" 89 | }); 90 | } 91 | 92 | $(document).ready(function() { 93 | graph_queries = new Highcharts.Chart({ 94 | chart: { 95 | renderTo: 'graph_queries', 96 | defaultSeriesType: 'spline', 97 | events: { 98 | load: requestData 99 | } 100 | }, 101 | title: { 102 | text: 'Live Statistics' 103 | }, 104 | xAxis: { 105 | type: 'datetime', 106 | tickPixelInterval: 150, 107 | maxZoom: 20 * 1000 108 | }, 109 | yAxis: { 110 | minPadding: 0.2, 111 | maxPadding: 0.2, 112 | title: { 113 | text: 'Value', 114 | margin: 80 115 | } 116 | }, 117 | tooltip: { 118 | valueSuffix: 'q/s' 119 | }, 120 | legend: { 121 | layout: 'vertical', 122 | align: 'right', 123 | verticalAlign: 'middle', 124 | borderWidth: 0 125 | }, 126 | series: [{ 127 | name: 'All outqueries/s', 128 | data: [] 129 | }, 130 | { 131 | name: 'Questions/s', 132 | data: [] 133 | }, 134 | { 135 | name: 'Servfail answers/s', 136 | data: [] 137 | }] 138 | }); 139 | 140 | graph_resp_answers = new Highcharts.Chart({ 141 | chart: { 142 | renderTo: 'graph_resp_answers', 143 | defaultSeriesType: 'spline', 144 | }, 145 | title: { 146 | text: 'Live Statistics' 147 | }, 148 | xAxis: { 149 | type: 'datetime', 150 | tickPixelInterval: 150, 151 | maxZoom: 20 * 1000 152 | }, 153 | yAxis: { 154 | minPadding: 0.2, 155 | maxPadding: 0.2, 156 | title: { 157 | text: 'Value', 158 | margin: 80 159 | } 160 | }, 161 | series: [ 162 | { 163 | name: '100-1000ms answers/s', 164 | data: [] 165 | }, 166 | { 167 | name: '10-100ms answers/s', 168 | data: [] 169 | }, 170 | { 171 | name: '1-10ms answers/s', 172 | data: [] 173 | }, 174 | { 175 | name: '0ms answers/s', 176 | data: [] 177 | }, 178 | { 179 | name: '<1 ms answers/s', 180 | data: [] 181 | }, 182 | { 183 | name: '0ms answers/s', 184 | data: [] 185 | }, 186 | { 187 | name: 'Slow answers/s', 188 | data: [] 189 | }] 190 | }); 191 | 192 | graph_answers = new Highcharts.Chart({ 193 | chart: { 194 | renderTo: 'graph_answers', 195 | defaultSeriesType: 'spline', 196 | }, 197 | title: { 198 | text: 'Live Statistics' 199 | }, 200 | xAxis: { 201 | type: 'datetime', 202 | tickPixelInterval: 150, 203 | maxZoom: 20 * 1000 204 | }, 205 | yAxis: { 206 | minPadding: 0.2, 207 | maxPadding: 0.2, 208 | title: { 209 | text: 'Value', 210 | margin: 80 211 | } 212 | }, 213 | series: [{ 214 | name: 'Normal answers/s', 215 | data: [] 216 | }, 217 | { 218 | name: 'NXDOMAIN answers/s', 219 | data: [] 220 | }, 221 | { 222 | name: 'SERVFAIL answers/s', 223 | data: [] 224 | }] 225 | }); 226 | 227 | graph_tcp = new Highcharts.Chart({ 228 | chart: { 229 | renderTo: 'graph_tcp', 230 | defaultSeriesType: 'spline', 231 | }, 232 | title: { 233 | text: 'Live Statistics' 234 | }, 235 | xAxis: { 236 | type: 'datetime', 237 | tickPixelInterval: 150, 238 | maxZoom: 20 * 1000 239 | }, 240 | yAxis: { 241 | minPadding: 0.2, 242 | maxPadding: 0.2, 243 | title: { 244 | text: 'Value', 245 | margin: 80 246 | } 247 | }, 248 | series: [{ 249 | name: 'TCP/IP overflows/s', 250 | data: [] 251 | }, 252 | { 253 | name: 'TCP/IP outqueries/s', 254 | data: [] 255 | }, 256 | { 257 | name: 'TCP/IP questions/s', 258 | data: [] 259 | }] 260 | }); 261 | 262 | graph_cachehitrate = new Highcharts.Chart({ 263 | chart: { 264 | renderTo: 'graph_cachehitrate', 265 | defaultSeriesType: 'spline', 266 | }, 267 | title: { 268 | text: 'Live Statistics - percentage cache hits' 269 | }, 270 | xAxis: { 271 | type: 'datetime', 272 | tickPixelInterval: 150, 273 | maxZoom: 20 * 1000 274 | }, 275 | yAxis: { 276 | minPadding: 0.2, 277 | maxPadding: 0.2, 278 | title: { 279 | text: '% percentage', 280 | margin: 80 281 | } 282 | }, 283 | series: [{ 284 | name: '% cache hitrate', 285 | data: [] 286 | }] 287 | }); 288 | 289 | 290 | }); 291 | 292 | -------------------------------------------------------------------------------- /views/domains.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container-fluid 5 | // Page header 6 | .page-header 7 | h2 8 | | Domains 9 | |   10 | small= data.length 11 | |  domains in backend 12 | .btn-toolbar(style='margin-bottom: 10px;') 13 | .btn-group.pull-right 14 | button.btn.btn-default.add-domain(id="add-domain", data-toggle="modal", data-target="#add-domain-modal") 15 | span.glyphicon.glyphicon-plus 16 | |  Add domain 17 | button.btn.btn-default.import-zone.disabled(id="import-zone", data-toggle="modal", data-target="#import-zone-modal") 18 | span.glyphicon.glyphicon-import 19 | |  Import zone 20 | 21 | .modal.fade.in(id="add-domain-modal", tabindex="-1", role="dialog", aria-labelledby="add-domain-label", aria-hidden="true") 22 | .modal-dialog 23 | .modal-content 24 | .modal-header 25 | button(type="button", class="close", data-dismiss="modal", aria-hidden="true") × 26 | h4(class="modal-title", id="add-domain-label") 27 | #mod-edit-operation 28 | .modal-body 29 | form.modal-form(id="form-add-domain", method='POST', action='/servers/#{serverselected.id}/domains/add') 30 | fieldset 31 | .form-group 32 | label.control-label(for='name') Zone/Domain name: 33 | .controls 34 | input.form-control(id='mod-edit-name', name='name', type='text', placeholder='eg: example.com') 35 | .form-group 36 | label.control-label(for='type') Zone Type: 37 | .controls 38 | label 39 | input#mod-edit-type-master(type='radio', name='type', value='MASTER') 40 | strong Master 41 | span.help-block Send out notifications about zone changes to slaves. 42 | label 43 | input#mod-edit-type-slave(type='radio', name='type', value='SLAVE') 44 | strong Slave 45 | span.help-block Retrieve records from master, store in database. 46 | label 47 | input#mod-edit-type-native(type='radio', name='type', value='NATIVE') 48 | strong Native 49 | span.help-block Rely on database replication, don't replicate via DNS. 50 | .form-group 51 | #mod-edit-master-box.hide 52 | label.control-label(for='mod-edit-master') Zone master: 53 | .controls 54 | input.form-control(id='mod-edit-master', name='master', type='text', placeholder='1.2.3.4,9.8.7.6') 55 | span.help-block IP Address of the master host, which PDNS should replicate with. 56 | .modal-footer 57 | a.btn.btn-default(href='#', data-dismiss='modal', aria-hidden="true") Cancel 58 | button.btn.btn-success(href='', type="submit", id="mod-edit-submit") Add domain 59 | 60 | .modal.fade.in(id="del-domain-modal", tabindex="-1", role="dialog", aria-labelledby="del-domain-label", aria-hidden="true") 61 | .modal-dialog 62 | .modal-content 63 | .modal-header 64 | button(type="button", class="close", data-dismiss="modal", aria-hidden="true") × 65 | h4(class="modal-title", id="del-domain-label") 66 | #mod-delete-operation 67 | .modal-body 68 | .alert.alert-warning 69 | p 70 | strong Warning! 71 | | This operation will delete the domain and all associated records for 72 | strong#mod-delete-text-name 73 | |
Are you sure you want to do this ? 74 | .modal-footer 75 | a.btn.btn-default(href='#', data-dismiss='modal', aria-hidden="true") Cancel 76 | a.btn.btn-danger#mod-delete-submit(href='') Delete domain 77 | 78 | div 79 | table.table.table-striped.table-condensed.table-hover#domains-table(width="100%", name="domains-table") 80 | thead 81 | tr 82 | th Name 83 | th Type 84 | th Masters 85 | th DNSSEC 86 | th Serial 87 | th 88 | tbody 89 | each item in data 90 | tr 91 | td 92 | a(href='/servers/#{serverselected.id}/domains/#{item.id}')= item.name 93 | td= item.kind 94 | td= item.masters 95 | td 96 | -if (item.dnssec == true) 97 | span.fa.fa-lock.fa-lg 98 | -else 99 | span.fa.fa-unlock.fa-lg 100 | 101 | |   102 | = item.dnssec 103 | td= item.serial 104 | td.domains-value-action 105 | // row button group to spin up modal or delete domain 106 | .btn-group 107 | -if (item.kind == "slave" || item.kind == "Slave") 108 | btn.btn.btn-default.btn-xs.notify-zone(id="notify-zone", rel="tooltip", title="Send a DNS NOTIFY to all slaves", data-id="#{item.id}", data-server="#{serverselected.id}", href="#") 109 | span.glyphicon.glyphicon-retweet 110 | btn.btn.btn-default.btn-xs.retrieve-zone(id="retrieve-zone", rel="tooltip", title="Retrieves the zone from the master", data-id="#{item.id}", data-server="#{serverselected.id}", href="#") 111 | span.glyphicon.glyphicon-random 112 | a.btn.btn.btn-default.btn-xs.export-zone(id="export-zone", rel="tooltip", title="Returns the zone in AXFR format", href="/servers/#{serverselected.id}/domains/export/#{item.id}") 113 | span.glyphicon.glyphicon-export 114 | a.btn.btn.btn-default.btn-xs.disabled.verify-zone(id="verify-zone", rel="tooltip", title="Verify zone contents/configuration", href="#") 115 | span.glyphicon.glyphicon-ok 116 | a.btn.btn.btn-default.btn-xs.view-domain(id="view-domain", rel="tooltip", title="View records in zone", href="/servers/#{serverselected.id}/domains/#{item.id}") 117 | span.glyphicon.glyphicon-eye-open 118 | btn.btn.btn-default.btn-xs.edit-domain(id="edit-domain", data-toggle="modal", href="#add-domain-modal", data-id="#{item.id}", data-name="#{item.name}", data-kind="#{item.kind}", data-masters="#{item.masters}", rel="tooltip", title="Edit domain") 119 | span.glyphicon.glyphicon-pencil 120 | btn.btn.btn-danger.btn-xs.del-domain(id="del-domain", data-toggle="modal", href="#del-domain-modal", data-id="#{item.id}", data-name="#{item.name}", rel="tooltip", title="Delete domain") 121 | span.glyphicon.glyphicon-trash 122 | // row button end 123 | 124 | include inc/footer 125 | 126 | // Bootstrap plugin form validation 127 | link(rel='stylesheet', href='/form.validation/dist/css/formValidation.min.css') 128 | script(src='/form.validation/dist/js/formValidation.min.js') 129 | script(src='/form.validation/dist/js/framework/bootstrap.js') 130 | // datatables 131 | script(src='/datatables/media/js/jquery.dataTables.min.js') 132 | script(src='/datatables/media/js/dataTables.bootstrap.min.js') 133 | // PNotify 134 | script(src='/pnotify/pnotify.core.js') 135 | // domains UI 136 | script(src='/javascripts/ui_domains.js') 137 | 138 | | 192 | -------------------------------------------------------------------------------- /views/records.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | div.container-fluid 5 | // Page header 6 | .page-header 7 | h2 8 | | Domain / #{data.name} 9 | |   10 | small= data.records.length 11 | |   records 12 | .btn-toolbar(style='margin-bottom: 10px;') 13 | .btn-group.pull-right 14 | button.btn.btn-default.add-record(id="add-record", data-toggle="modal",data-target="#add-record-modal") 15 | span.glyphicon.glyphicon-plus 16 | |   Add record 17 | button.btn.btn-default.dropdown-toggle(href="#", data-toggle="dropdown", id="dropdownActions", aria-haspopup="true", aria-expanded="true") 18 | |   Zone actions   19 | span.caret 20 | ul.dropdown-menu(role="menu") 21 | li 22 | a(href='/servers/#{serverselected.id}/domains/del/#{data.id}', rel="tooltip", title="Delete zone") 23 | span.glyphicon.glyphicon-trash 24 | |   Delete 25 | li 26 | a(href='#', rel="tooltip", title="Send a DNS NOTIFY to all slaves") 27 | span.glyphicon.glyphicon-retweet 28 | |   Notify 29 | li 30 | a(href='#', rel="tooltip", title="Retrieves the zone from the master") 31 | span.glyphicon.glyphicon-random 32 | |   AXFR Retrieve 33 | li 34 | a(href='/servers/#{serverselected.id}/domains/export/#{data.id}', rel="tooltip", title="Returns the zone in AXFR format") 35 | span.glyphicon.glyphicon-export 36 | |   Export 37 | li 38 | a(href='#', rel="tooltip", title="Verify zone contents/configuration") 39 | span.glyphicon.glyphicon-ok 40 | |   Verify 41 | li.divider 42 | li 43 | a(href='#', rel="tooltip", title="View metadata") 44 | span.glyphicon.glyphicon-eye-open 45 | |   Zone Metadata 46 | li 47 | a(href='#', rel="tooltip", title="Manage Keys") 48 | span.glyphicon.glyphicon-lock 49 | |   CryptoKeys 50 | 51 | .modal.fade.in(id="del-record-modal", tabindex="-1", role="dialog", aria-labelledby="del-record-label", aria-hidden="true") 52 | .modal-dialog 53 | .modal-content 54 | .modal-header 55 | button(type="button", class="close", data-dismiss="modal", aria-hidden="true") × 56 | h4(class="modal-title", id="del-record-label") 57 | #mod-delete-operation 58 | .modal-body 59 | .alert.alert-warning 60 | p 61 | strong Warning! 62 | | This operation will delete the 63 | strong#mod-delete-text-name 64 | |   record.
Are you sure you want to do this ? 65 | .modal-footer 66 | a.btn.btn-default(href='#', data-dismiss='modal', aria-hidden="true") Cancel 67 | a.btn.btn-danger#mod-delete-submit(href='') Delete record 68 | 69 | .modal.fade.in(id="add-record-modal", tabindex="-1", role="dialog", aria-labelledby="add-record-label", aria-hidden="true") 70 | .modal-dialog 71 | .modal-content 72 | .modal-header 73 | button(type="button", class="close", data-dismiss="modal", aria-hidden="true") × 74 | h4(class="modal-title", id="add-record-label") 75 | #mod-edit-operation 76 | .modal-body 77 | form.modal-form(id="form-add-record", method='POST', enctype='application/json', action="/servers/#{serverselected.id}/records/save/#{data.id}", role="form") 78 | fieldset 79 | .form-group 80 | label.control-label(for='name') Name: 81 | .controls 82 | input.form-control(name="name", id="mod-edit-record-name", type="text", placeholder="eg. full FQDN or leave empty") 83 | .form-group 84 | label.control-label(for='type') Type: 85 | select.form-control.selectpicker(name="type", id="mod-edit-record-type") 86 | - var DNSTYPE = ['A', 'AAAA', 'CERT', 'CNAME', 'HINFO', 'KEY', 'LOC', 'MX', 'NAPTR', 'NS', 'PTR', 'RP', 'SOA', 'SPF', 'SSHFP', 'SRV', 'TXT'] 87 | - each item in DNSTYPE 88 | option(value="#{item}")= item 89 | .form-group 90 | label.control-label(for='priority') Priority: 91 | .controls 92 | input.form-control(name="priority", id="mod-edit-record-prio", type="text", placeholder="0", value="0") 93 | .form-group 94 | label.control-label(for='content') Content: 95 | .controls 96 | input.form-control(name="content", id="mod-edit-record-content", type="text", placeholder="eg. 192.0.43.10, web01.#{data.name}") 97 | .form-group 98 | label.control-label(for='ttl') TTL: 99 | .controls 100 | input.form-control(name="ttl", id="mod-edit-record-ttl", type="text", placeholder="86400", value="3600") 101 | .form-group 102 | label.control-label(for='disabled') Disabled: 103 | |   104 | input(name="disabled", id="mod-edit-record-disabled", type="checkbox", value="false", data-off-label="Visible", data-off-title="false", data-on-title="true", data-on-label="Hidden") 105 | .modal-footer 106 | a.btn.btn-default(href='#', data-dismiss='modal', aria-hidden="true") Cancel 107 | button.btn.btn-success(href='', type="submit", id="mod-edit-submit") Add record 108 | 109 | table.table.table-striped.table-condensed.table-hover.records#records-table(width="100%", name="records-table") 110 | thead 111 | tr 112 | th Name 113 | th Type 114 | th Prio 115 | th Content 116 | th TTL 117 | th Disabled 118 | th 119 | tbody 120 | each item in data.records 121 | tr 122 | td= item.name 123 | td= item.type 124 | td= item.priority 125 | td= item.content 126 | td= item.ttl 127 | td= item.disabled 128 | td.records-value-action 129 | .btn-group 130 | -if (item.type == "A" || item.type == "AAAA") 131 | button.btn.btn-default.btn-xs.2ptr-record.disabled(id="2ptr-record", href="#", rel="tooltip", title="Create PTR record from this") 132 | span.glyphicon.glyphicon-retweet 133 | button.btn.btn-default.btn-xs.edit-record(id="edit-record", data-toggle="modal", data-target="#add-record-modal", rel="tooltip", title="Edit record", data-name="#{item.name}", data-type="#{item.type}", data-priority="#{item.priority}", data-content="#{item.content}", data-ttl="#{item.ttl}", data-disabled="#{item.disabled}") 134 | span.glyphicon.glyphicon-pencil 135 | button.btn.btn-danger.btn-xs.del-record(id="del-record", data-toggle="modal", data-target="#del-record-modal", rel="tooltip", title="Delete record", data-name="#{item.name}", data-content="#{item.content}", data-type="#{item.type}") 136 | span.glyphicon.glyphicon-trash 137 | 138 | include inc/footer 139 | 140 | // Bootstrap plugin select 141 | link(rel='stylesheet', href='/stylesheets/bootstrap-select.min.css') 142 | script(src='/javascripts/bootstrap-select.min.js') 143 | // Bootstrap plugin checkbox 144 | script(src='/bootstrap-checkbox/dist/js/bootstrap-checkbox.min.js') 145 | // Bootstrap plugin form validation 146 | link(rel='stylesheet', href='/form.validation/dist/css/formValidation.min.css') 147 | script(src='/form.validation/dist/js/formValidation.min.js') 148 | script(src='/form.validation/dist/js/framework/bootstrap.js') 149 | // datatables 150 | script(src='/datatables/media/js/jquery.dataTables.min.js') 151 | script(src='/datatables/media/js/dataTables.bootstrap.min.js') 152 | // records UI 153 | script(src='/javascripts/ui_records.js') 154 | 155 | | 199 | -------------------------------------------------------------------------------- /public/javascripts/bootstrap-select.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-select v1.3.5 3 | * http://silviomoreto.github.io/bootstrap-select/ 4 | * 5 | * Copyright 2013 bootstrap-select 6 | * Licensed under the MIT license 7 | */ 8 | ;!function(b){b.expr[":"].icontains=function(e,c,d){return b(e).text().toUpperCase().indexOf(d[3].toUpperCase())>=0};var a=function(d,c,f){if(f){f.stopPropagation();f.preventDefault()}this.$element=b(d);this.$newElement=null;this.$button=null;this.$menu=null;this.options=b.extend({},b.fn.selectpicker.defaults,this.$element.data(),typeof c=="object"&&c);if(this.options.title==null){this.options.title=this.$element.attr("title")}this.val=a.prototype.val;this.render=a.prototype.render;this.refresh=a.prototype.refresh;this.setStyle=a.prototype.setStyle;this.selectAll=a.prototype.selectAll;this.deselectAll=a.prototype.deselectAll;this.init()};a.prototype={constructor:a,init:function(d){this.$element.hide();this.multiple=this.$element.prop("multiple");var f=this.$element.attr("id");this.$newElement=this.createView();this.$element.after(this.$newElement);this.$menu=this.$newElement.find("> .dropdown-menu");this.$button=this.$newElement.find("> button");this.$searchbox=this.$newElement.find("input");if(f!==undefined){var c=this;this.$button.attr("data-id",f);b('label[for="'+f+'"]').click(function(g){g.preventDefault();c.$button.focus()})}this.checkDisabled();this.clickListener();this.liveSearchListener();this.render();this.liHeight();this.setStyle();this.setWidth();if(this.options.container){this.selectPosition()}this.$menu.data("this",this);this.$newElement.data("this",this)},createDropdown:function(){var c=this.multiple?" show-tick":"";var f=this.options.header?'
'+this.options.header+"
":"";var e=this.options.liveSearch?'':"";var d="
";return b(d)},createView:function(){var c=this.createDropdown();var d=this.createLi();c.find("ul").append(d);return c},reloadLi:function(){this.destroyLi();var c=this.createLi();this.$menu.find("ul").append(c)},destroyLi:function(){this.$menu.find("li").remove()},createLi:function(){var d=this,e=[],c="";this.$element.find("option").each(function(h){var j=b(this);var g=j.attr("class")||"";var i=j.attr("style")||"";var n=j.data("content")?j.data("content"):j.html();var l=j.data("subtext")!==undefined?''+j.data("subtext")+"":"";var k=j.data("icon")!==undefined?' ':"";if(k!==""&&(j.is(":disabled")||j.parent().is(":disabled"))){k=""+k+""}if(!j.data("content")){n=k+''+n+l+""}if(d.options.hideDisabled&&(j.is(":disabled")||j.parent().is(":disabled"))){e.push('')}else{if(j.parent().is("optgroup")&&j.data("divider")!=true){if(j.index()==0){var m=j.parent().attr("label");var o=j.parent().data("subtext")!==undefined?''+j.parent().data("subtext")+"":"";var f=j.parent().data("icon")?' ':"";m=f+''+m+o+"";if(j[0].index!=0){e.push('
'+m+"
"+d.createA(n,"opt "+g,i))}else{e.push("
"+m+"
"+d.createA(n,"opt "+g,i))}}else{e.push(d.createA(n,"opt "+g,i))}}else{if(j.data("divider")==true){e.push('
')}else{if(b(this).data("hidden")==true){e.push("")}else{e.push(d.createA(n,g,i))}}}}});b.each(e,function(f,g){c+="
  • "+g+"
  • "});if(!this.multiple&&this.$element.find("option:selected").length==0&&!this.options.title){this.$element.find("option").eq(0).prop("selected",true).attr("selected","selected")}return b(c)},createA:function(e,c,d){return''+e+''},render:function(){var d=this;this.$element.find("option").each(function(h){d.setDisabled(h,b(this).is(":disabled")||b(this).parent().is(":disabled"));d.setSelected(h,b(this).is(":selected"))});this.tabIndex();var g=this.$element.find("option:selected").map(function(h,k){var l=b(this);var j=l.data("icon")&&d.options.showIcon?' ':"";var i;if(d.options.showSubtext&&l.attr("data-subtext")&&!d.multiple){i=' '+l.data("subtext")+""}else{i=""}if(l.data("content")&&d.options.showContent){return l.data("content")}else{if(l.attr("title")!=undefined){return l.attr("title")}else{return j+l.html()+i}}}).toArray();var f=!this.multiple?g[0]:g.join(", ");if(this.multiple&&this.options.selectedTextFormat.indexOf("count")>-1){var c=this.options.selectedTextFormat.split(">");var e=this.options.hideDisabled?":not([disabled])":"";if((c.length>1&&g.length>c[1])||(c.length==1&&g.length>=2)){f=this.options.countSelectedText.replace("{0}",g.length).replace("{1}",this.$element.find('option:not([data-divider="true"]):not([data-hidden="true"])'+e).length)}}if(!f){f=this.options.title!=undefined?this.options.title:this.options.noneSelectedText}this.$newElement.find(".filter-option").html(f)},setStyle:function(e,d){if(this.$element.attr("class")){this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device/gi,""))}var c=e?e:this.options.style;if(d=="add"){this.$button.addClass(c)}else{if(d=="remove"){this.$button.removeClass(c)}else{this.$button.removeClass(this.options.style);this.$button.addClass(c)}}},liHeight:function(){var f=this.$newElement.clone();f.appendTo("body");var e=f.addClass("open").find("> .dropdown-menu");var d=e.find("li > a").outerHeight();var c=this.options.header?e.find(".popover-title").outerHeight():0;var g=this.options.liveSearch?e.find(".bootstrap-select-searchbox").outerHeight():0;f.remove();this.$newElement.data("liHeight",d).data("headerHeight",c).data("searchHeight",g)},setSize:function(){var h=this,d=this.$menu,i=d.find(".inner"),p=i.find("li > a"),u=this.$newElement.outerHeight(),f=this.$newElement.data("liHeight"),s=this.$newElement.data("headerHeight"),l=this.$newElement.data("searchHeight"),k=d.find("li .divider").outerHeight(true),r=parseInt(d.css("padding-top"))+parseInt(d.css("padding-bottom"))+parseInt(d.css("border-top-width"))+parseInt(d.css("border-bottom-width")),o=this.options.hideDisabled?":not(.disabled)":"",n=b(window),g=r+parseInt(d.css("margin-top"))+parseInt(d.css("margin-bottom"))+2,q,v,t,j=function(){v=h.$newElement.offset().top-n.scrollTop();t=n.height()-v-u};j();if(this.options.header){d.css("padding-top",0)}if(this.options.size=="auto"){var e=function(){var w;j();q=t-g;h.$newElement.toggleClass("dropup",(v>t)&&(q-g)3){w=f*3+g-2}else{w=0}d.css({"max-height":q+"px",overflow:"hidden","min-height":w+"px"});i.css({"max-height":q-s-l-r+"px","overflow-y":"auto","min-height":w-r+"px"})};e();b(window).resize(e);b(window).scroll(e)}else{if(this.options.size&&this.options.size!="auto"&&d.find("li"+o).length>this.options.size){var m=d.find("li"+o+" > *").filter(":not(.div-contain)").slice(0,this.options.size).last().parent().index();var c=d.find("li").slice(0,m+1).find(".div-contain").length;q=f*this.options.size+c*k+r;this.$newElement.toggleClass("dropup",(v>t)&&q .dropdown-menu").css("width");d.remove();this.$newElement.css("width",c)}else{if(this.options.width=="fit"){this.$menu.css("min-width","");this.$newElement.css("width","").addClass("fit-width")}else{if(this.options.width){this.$menu.css("min-width","");this.$newElement.css("width",this.options.width)}else{this.$menu.css("min-width","");this.$newElement.css("width","")}}}if(this.$newElement.hasClass("fit-width")&&this.options.width!=="fit"){this.$newElement.removeClass("fit-width")}},selectPosition:function(){var e=this,d="
    ",f=b(d),h,g,c=function(i){f.addClass(i.attr("class")).toggleClass("dropup",i.hasClass("dropup"));h=i.offset();g=i.hasClass("dropup")?0:i[0].offsetHeight;f.css({top:h.top+g,left:h.left,width:i[0].offsetWidth,position:"absolute"})};this.$newElement.on("click",function(i){c(b(this));f.appendTo(e.options.container);f.toggleClass("open",!b(this).hasClass("open"));f.append(e.$menu)});b(window).resize(function(){c(e.$newElement)});b(window).on("scroll",function(i){c(e.$newElement)});b("html").on("click",function(i){if(b(i.target).closest(e.$newElement).length<1){f.removeClass("open")}})},mobile:function(){this.$element.addClass("mobile-device").appendTo(this.$newElement);if(this.options.container){this.$menu.hide()}},refresh:function(){this.reloadLi();this.render();this.setWidth();this.setStyle();this.checkDisabled();this.liHeight()},update:function(){this.reloadLi();this.setWidth();this.setStyle();this.checkDisabled();this.liHeight()},setSelected:function(c,d){this.$menu.find("li").eq(c).toggleClass("selected",d)},setDisabled:function(c,d){if(d){this.$menu.find("li").eq(c).addClass("disabled").find("a").attr("href","#").attr("tabindex",-1)}else{this.$menu.find("li").eq(c).removeClass("disabled").find("a").removeAttr("href").attr("tabindex",0)}},isDisabled:function(){return this.$element.is(":disabled")},checkDisabled:function(){var c=this;if(this.isDisabled()){this.$button.addClass("disabled").attr("tabindex",-1)}else{if(this.$button.hasClass("disabled")){this.$button.removeClass("disabled")}if(this.$button.attr("tabindex")==-1){if(!this.$element.data("tabindex")){this.$button.removeAttr("tabindex")}}}this.$button.click(function(){return !c.isDisabled()})},tabIndex:function(){if(this.$element.is("[tabindex]")){this.$element.data("tabindex",this.$element.attr("tabindex"));this.$button.attr("tabindex",this.$element.data("tabindex"))}},clickListener:function(){var c=this;b("body").on("touchstart.dropdown",".dropdown-menu",function(d){d.stopPropagation()});this.$newElement.on("click",function(){c.setSize()});this.$menu.on("click","li a",function(k){var f=b(this).parent().index(),j=b(this).parent(),i=c.$element.val();if(c.multiple){k.stopPropagation()}k.preventDefault();if(!c.isDisabled()&&!b(this).parent().hasClass("disabled")){var d=c.$element.find("option");var h=d.eq(f);if(!c.multiple){d.prop("selected",false);h.prop("selected",true)}else{var g=h.prop("selected");h.prop("selected",!g)}c.$button.focus();if(i!=c.$element.val()){c.$element.change()}}});this.$menu.on("click","li.disabled a, li dt, li .div-contain, h3.popover-title",function(d){if(d.target==this){d.preventDefault();d.stopPropagation();c.$button.focus()}});this.$searchbox.on("click",function(d){d.stopPropagation()});this.$element.change(function(){c.render()})},liveSearchListener:function(){var c=this;this.$newElement.on("click.dropdown.data-api",function(d){if(c.options.liveSearch){setTimeout(function(){c.$searchbox.focus()},10)}});this.$searchbox.on("input",function(){if(c.$searchbox.val()){c.$menu.find("li").show().not(":icontains("+c.$searchbox.val()+")").hide()}else{c.$menu.find("li").show()}})},val:function(c){if(c!=undefined){this.$element.val(c);this.$element.change();return this.$element}else{return this.$element.val()}},selectAll:function(){this.$element.find("option").prop("selected",true).attr("selected","selected");this.render()},deselectAll:function(){this.$element.find("option").prop("selected",false).removeAttr("selected");this.render()},keydown:function(o){var p,n,h,m,j,i,q,d,g,l;p=b(this);h=p.parent();l=h.data("this");if(l.options.container){h=l.$menu}n=b("[role=menu] li:not(.divider):visible a",h);if(!n.length){return}if(/(38|40)/.test(o.keyCode)){m=n.index(n.filter(":focus"));i=n.parent(":not(.disabled)").first().index();q=n.parent(":not(.disabled)").last().index();j=n.eq(m).parent().nextAll(":not(.disabled)").eq(0).index();d=n.eq(m).parent().prevAll(":not(.disabled)").eq(0).index();g=n.eq(j).parent().prevAll(":not(.disabled)").eq(0).index();if(o.keyCode==38){if(m!=g&&m>d){m=d}if(mq){m=q}if(m==-1){m=0}}n.eq(m).focus()}else{var f={48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"};var c=[];n.each(function(){if(b(this).parent().is(":not(.disabled)")){if(b.trim(b(this).text().toLowerCase()).substring(0,1)==f[o.keyCode]){c.push(b(this).parent().index())}}});var k=b(document).data("keycount");k++;b(document).data("keycount",k);var r=b.trim(b(":focus").text().toLowerCase()).substring(0,1);if(r!=f[o.keyCode]){k=1;b(document).data("keycount",k)}else{if(k>=c.length){b(document).data("keycount",0)}}n.eq(c[k-1]).focus()}if(/(13|32)/.test(o.keyCode)){o.preventDefault();b(":focus").click();b(document).data("keycount",0)}},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},destroy:function(){this.$newElement.remove();this.$element.remove()}};b.fn.selectpicker=function(e,f){var c=arguments;var g;var d=this.each(function(){if(b(this).is("select")){var m=b(this),l=m.data("selectpicker"),h=typeof e=="object"&&e;if(!l){m.data("selectpicker",(l=new a(this,h,f)))}else{if(h){for(var j in h){l.options[j]=h[j]}}}if(typeof e=="string"){var k=e;if(l[k] instanceof Function){[].shift.apply(c);g=l[k].apply(l,c)}else{g=l.options[k]}}}});if(g!=undefined){return g}else{return d}};b.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Nothing selected",countSelectedText:"{0} of {1} selected",width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false};b(document).data("keycount",0).on("keydown","[data-toggle=dropdown], [role=menu]",a.prototype.keydown)}(window.jQuery); 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . --------------------------------------------------------------------------------