2015-02-16 23:18:22 +01:00
|
|
|
# pdns-console
|
2015-02-18 13:53:21 +01:00
|
|
|
|
2015-02-23 22:00:18 +01:00
|
|
|
PDNS-Console provided a CLI to manage PowerDNS application and improved it by adding a powerfull DNS zone versionning.
|
2015-02-23 01:08:46 +01:00
|
|
|
|
2015-02-23 21:45:19 +01:00
|
|
|
# Commands
|
|
|
|
|
|
|
|
## Available commands
|
|
|
|
|
|
|
|
### Helpers
|
|
|
|
|
|
|
|
```
|
|
|
|
about Show information about pdns-console
|
|
|
|
help Displays help for a command
|
|
|
|
list Lists commands
|
|
|
|
```
|
|
|
|
|
|
|
|
### Manage domains
|
|
|
|
|
|
|
|
```
|
|
|
|
domain:add Add a domain
|
|
|
|
domain:list List domains
|
|
|
|
domain:remove Remove a domain
|
|
|
|
```
|
|
|
|
|
|
|
|
### Manage zones
|
|
|
|
|
|
|
|
```
|
|
|
|
zone:add Add a zone
|
|
|
|
zone:assign Assign a zone to a domain.
|
|
|
|
zone:list List DNS zones
|
|
|
|
zone:push Push activated zones to PowerDNS tables
|
|
|
|
zone:record:add Add a zone record
|
|
|
|
zone:record:remove Remove a zone record
|
|
|
|
zone:remove Remove a zone
|
|
|
|
zone:unassign Unassign the domain zone
|
|
|
|
zone:version:active Active a zone version
|
|
|
|
zone:version:add Add a zone version
|
|
|
|
zone:version:copy Copy a zone version
|
|
|
|
zone:version:remove Remove an unactivated zone version
|
|
|
|
zone:version:unactive Active a zone version
|
|
|
|
```
|
|
|
|
|
2015-02-23 22:00:18 +01:00
|
|
|
### Example
|
|
|
|
|
|
|
|
#### Specifications
|
|
|
|
|
|
|
|
* We want to mange the domain *example.com*
|
2015-02-23 22:54:06 +01:00
|
|
|
* We need 3 records:
|
|
|
|
* *example.tld* -> 1.2.3.4
|
2015-02-23 22:00:18 +01:00
|
|
|
* *www.example.com* -> same as *example.com*
|
2015-02-23 22:54:06 +01:00
|
|
|
* *example.tld* MX is mail.foo.net
|
2015-02-23 22:00:18 +01:00
|
|
|
|
|
|
|
#### Add the domain
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console domain:add
|
2015-02-23 22:54:06 +01:00
|
|
|
Name: example.tld
|
2015-02-23 22:00:18 +01:00
|
|
|
MASTER [null]:
|
|
|
|
Type [NATIVE]:
|
|
|
|
Domain added
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console domain:list
|
2015-02-23 22:54:06 +01:00
|
|
|
DOMAIN: example.tld
|
2015-02-23 22:00:18 +01:00
|
|
|
ID : 5
|
|
|
|
TYPE : NATIVE
|
|
|
|
MASTER:
|
|
|
|
```
|
|
|
|
|
|
|
|
### Create a zone
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console zone:add
|
|
|
|
Name: Example zone
|
|
|
|
Description: My example zone
|
|
|
|
Zone added.
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console zone:list
|
|
|
|
Example zone
|
|
|
|
------------
|
|
|
|
My example zone
|
|
|
|
ID: 4
|
|
|
|
|
|
|
|
No version found
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console zone:version:add 4
|
|
|
|
Zone version added.
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console zone:list
|
|
|
|
Example zone
|
|
|
|
------------
|
|
|
|
My example zone
|
|
|
|
ID: 4
|
|
|
|
|
|
|
|
Version: 1 - Active: No
|
|
|
|
|
|
|
|
No record found.
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
2015-02-23 22:54:06 +01:00
|
|
|
$ ./app/console zone:record:add 4 1 --name @ --type SOA --content "localhost. postmaster@localhost 0 10800 3600 604800 3600" --ttl 3600 --prio null
|
|
|
|
```
|
|
|
|
|
2015-02-23 22:00:18 +01:00
|
|
|
$ ./app/console zone:record:add 4 1
|
|
|
|
Name: @
|
|
|
|
Content: 1.2.3.4
|
|
|
|
|
|
|
|
Available types: A AAAA CNAME MX NS TXT SPF WKS SRV LOC SOA
|
|
|
|
Type: A
|
|
|
|
TTL: 3600
|
|
|
|
Prio [null]:
|
|
|
|
Zone record added.
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
2015-02-23 22:54:06 +01:00
|
|
|
$ ./app/console zone:record:add 4 1 --name www --type CNAME --content example.com. --prio null
|
|
|
|
TTL: 3600
|
2015-02-23 22:00:18 +01:00
|
|
|
Zone record added.
|
2015-02-23 22:54:06 +01:00
|
|
|
$ ./app/console zone:record:add 4 1 --name @ --type MX --content mail.foo.net. --ttl 3600 --prio badValue
|
|
|
|
Prio [null]: badValueAgain
|
|
|
|
Prio [null]: 10
|
2015-02-23 22:00:18 +01:00
|
|
|
Zone record added.
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ./app/console zone:list
|
|
|
|
Example zone
|
|
|
|
------------
|
|
|
|
My example zone
|
|
|
|
ID: 4
|
|
|
|
|
|
|
|
Version: 1 - Active: No
|
|
|
|
|
|
|
|
ID | NAME | TYPE | TTL | PRIO | CONTENT
|
|
|
|
----------------------------------------------------------------------
|
2015-02-23 22:54:06 +01:00
|
|
|
13 | @ | SOA | 3600 | | localhost postmaster@localhost 0 10800 3600 604800 3600
|
2015-02-23 22:00:18 +01:00
|
|
|
14 | @ | A | 3600 | | 1.2.3.4
|
2015-02-23 22:54:06 +01:00
|
|
|
15 | www | CNAME | 3600 | | example.tld.
|
|
|
|
16 | @ | MX | 3600 | 10 | mail.foo.net.
|
|
|
|
```
|
|
|
|
|
|
|
|
### Active and assign the new zone
|
|
|
|
|
2015-02-23 22:00:18 +01:00
|
|
|
```
|
2015-02-23 22:54:06 +01:00
|
|
|
$ ./app/console zone:version:active 4 1
|
|
|
|
Zone version activated.
|
|
|
|
$ ./app/console zone:assign 4 5
|
|
|
|
Domain zone updated.
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
./app/console domain:list --zone
|
|
|
|
DOMAIN: example.tld
|
|
|
|
ID : 5
|
|
|
|
TYPE : NATIVE
|
|
|
|
MASTER:
|
2015-02-23 22:00:18 +01:00
|
|
|
|
|
|
|
|
2015-02-23 22:54:06 +01:00
|
|
|
> Example zone
|
|
|
|
> ------------
|
|
|
|
> My example zone
|
|
|
|
> ID: 4
|
|
|
|
>
|
|
|
|
> Version: 1 - Active: Yes
|
|
|
|
>
|
|
|
|
> ID | NAME | TYPE | TTL | PRIO | CONTENT
|
|
|
|
> ----------------------------------------------------------------------
|
|
|
|
> 13 | @ | SOA | 3600 | | localhost postmaster@localhost 0 10800 3600 604800 3600
|
|
|
|
> 14 | @ | A | 3600 | | 1.2.3.4
|
|
|
|
> 15 | www | CNAME | 3600 | | example.tld.
|
|
|
|
> 16 | @ | MX | 3600 | 10 | mail.foo.net.
|
|
|
|
>
|
|
|
|
```
|
|
|
|
|
|
|
|
### Push modifications
|
|
|
|
|
|
|
|
```
|
|
|
|
./app/console zone:push
|
|
|
|
```
|
|
|
|
|
|
|
|
### Test :)
|
|
|
|
|
|
|
|
```
|
|
|
|
$ dig +short -t A @localhost example.tld
|
|
|
|
1.2.3.4
|
|
|
|
$ dig +short -t CNAME @localhost www.example.tld
|
|
|
|
example.tld.
|
|
|
|
$ dig +short -t MX @localhost example.tld
|
|
|
|
10 mail.foo.net.
|
|
|
|
```
|
|
|
|
|
2015-02-23 01:08:46 +01:00
|
|
|
# Installation
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
* PHP >= 5.4
|
2015-02-23 01:42:56 +01:00
|
|
|
* PDO with module for database connection
|
2015-02-23 01:08:46 +01:00
|
|
|
* Instance of PDNS (Powerdns) >= 3.1 with MySQL/PostgreSQL/SQLite backend
|
|
|
|
|
|
|
|
## Downloading sources
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cd /usr/local/src/
|
|
|
|
git clone https://github.com/simmstein/pdns-console.git
|
|
|
|
cd pdns-console
|
|
|
|
```
|
|
|
|
|
2015-02-23 01:20:16 +01:00
|
|
|
### Dependances
|
2015-02-23 01:08:46 +01:00
|
|
|
|
2015-02-23 01:20:16 +01:00
|
|
|
```
|
|
|
|
curl -sS https://getcomposer.org/installer | php
|
|
|
|
./composer.phar install
|
|
|
|
```
|
|
|
|
|
|
|
|
### Database
|
|
|
|
|
|
|
|
#### Edit *propel.yaml*
|
2015-02-23 01:08:46 +01:00
|
|
|
|
|
|
|
* ```dsn: "mysql:host=localhost;dbname=pdns"```
|
2015-02-23 01:23:45 +01:00
|
|
|
* Change *localhost* with the database server name
|
2015-02-23 22:00:18 +01:00
|
|
|
* Change *pdns* with the database name
|
2015-02-23 01:08:46 +01:00
|
|
|
|
2015-02-23 01:23:45 +01:00
|
|
|
* Change user and password values with your pdsn database login
|
2015-02-23 01:20:16 +01:00
|
|
|
|
|
|
|
Run `./app/propel/console config:convert`
|
|
|
|
|
|
|
|
#### Models
|
|
|
|
|
|
|
|
The sources does not contain all application models. You have to generate them:
|
|
|
|
|
|
|
|
Run `./app/propel/console --recursive model:build`
|
|
|
|
|
|
|
|
#### Database updates
|
|
|
|
|
2015-02-23 01:23:45 +01:00
|
|
|
pdns-console needs to update pdns original tables and uses 3 more.
|
2015-02-23 01:20:16 +01:00
|
|
|
|
|
|
|
```shell
|
|
|
|
./app/propel/console --recursive migration:diff
|
|
|
|
./app/propel/console --recursive migration:migrate
|
|
|
|
```
|
|
|
|
|
|
|
|
## Symlink
|
|
|
|
|
2015-02-23 01:21:17 +01:00
|
|
|
To access the console without using the full path of `app/console`, make a symlink:
|
2015-02-23 01:20:16 +01:00
|
|
|
|
2015-02-23 01:25:04 +01:00
|
|
|
```ln -s $PWD/app/console /usr/local/bin/pdns-console```
|