hdknr’s posterous

 
Filed under

poweradmin

 

poweradmin: いい加減なTDLのゾーンを作れるようにする。$dns_strict_tld_check = 0

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3$ find . -name "*.php" -exec grep -H "You are using an invalid top level domain" {} \;
./inc/error.inc.php:define("ERR_DNS_INV_TLD", _('You are using an invalid top level domain.'));

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3$ find . -name "*.php" -exec grep -H "ERR_DNS_INV_TLD" {} \;./inc/error.inc.php:define("ERR_DNS_INV_TLD", _('You are using an invalid top level domain.'));
./inc/dns.inc.php:        error(ERR_DNS_INV_TLD); return false;

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3$ vi inc/dns.inc.php

function is_valid_hostname_fqdn($hostname, $wildcard) {

        global $dns_strict_tld_check;
        global $valid_tlds;

        $hostname = ereg_replace("\.$","",$hostname);

        if (strlen($hostname) > 255) {
                error(ERR_DNS_HN_TOO_LONG);
                return false;
        }

        $hostname_labels = explode ('.', $hostname);
        $label_count = count($hostname_labels);

        foreach ($hostname_labels as $hostname_label) {
                if ($wildcard == 1 && !isset($first)) {                        if (!preg_match('/^(\*|[\w-\/]+)$/',$hostname_label)) { error(ERR_DNS_HN_INV_CHARS); return false; }
                        $first = 1;
                } else {
                        if (!preg_match('/^[\w-\/]+$/',$hostname_label)) { error(ERR_DNS_HN_INV_CHARS); return false; }
                }
                if (substr($hostname_label, 0, 1) == "-") { error(ERR_DNS_HN_DASH); return false; }
                if (substr($hostname_label, -1, 1) == "-") { error(ERR_DNS_HN_DASH); return false; }
                if (strlen($hostname_label) < 1 || strlen($hostname_label) > 63) { error(ERR_DNS_HN_LENGTH); return false; }
        }

        if ($hostname_labels[$label_count-1] == "arpa" && (substr_count($hostname_labels[0], "/") == 1 XOR substr_count($hostname_lab
els[1], "/") == 1)) {
                if (substr_count($hostname_labels[0], "/") == 1) {
                        $array = explode ("/", $hostname_labels[0]);
                } else {
                        $array = explode ("/", $hostname_labels[1]);
                }
                if (count($array) != 2) { error(ERR_DNS_HOSTNAME) ; return false; }
                if (!is_numeric($array[0]) || $array[0] < 0 || $array[0] > 255) { error(ERR_DNS_HOSTNAME) ; return false; }
                if (!is_numeric($array[1]) || $array[1] < 25 || $array[1] > 31) { error(ERR_DNS_HOSTNAME) ; return false; }
        } else {
                if (substr_count($hostname, "/") > 0) { error(ERR_DNS_HN_SLASH) ; return false; }
        }


        if ($dns_strict_tld_check == "1" && !in_array($hostname_labels[$label_count-1], $valid_tlds)) {
                error(ERR_DNS_INV_TLD); return false;
        }

        return true;
}

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3$ sudo vim inc/config.inc.php

$dns_strict_tld_check   = 0 ;

   
Click here to download:
poweradmin_TDLdns_strict_tld_c.zip (149 KB)

Filed under  //   poweradmin   powerdns  

Comments [0]

powerdns: prepare database tables for mysql backend

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/sql$ cat
mysql.sql
CREATE TABLE domains (
id INT auto_increment,
name VARCHAR(255) NOT NULL,
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
account VARCHAR(40) DEFAULT NULL,
primary key (id)
);

 CREATE UNIQUE INDEX name_index ON domains(name);

 CREATE TABLE records (
id INT auto_increment,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(6) DEFAULT NULL,
content VARCHAR(255) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
primary key(id)
);

 CREATE INDEX rec_name_index ON records(name);
CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);

 CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);
hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/sql$ cat
mysql.sql | mysql -u powerdns --password=powerdns powerdns

Filed under  //   poweradmin   powerdns  

Comments [0]

powerdns: poweradmin install on Squeeze.

hdknr@mailjail:~$ wget https://www.poweradmin.org/download/poweradmin-2.1.3.tgz
--2009-08-16 08:44:52--  https://www.poweradmin.org/download/poweradmin-2.1.3.tgz
www.poweradmin.org をDNSに問いあわせています... 94.142.245.87
www.poweradmin.org|94.142.245.87|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 93541 (91K) [application/x-tar]
`poweradmin-2.1.3.tgz' に保存中

100%[===========================================================================================>] 93,541      74.2K/s 時間 1.2s    

2009-08-16 08:44:55 (74.2 KB/s) - `poweradmin-2.1.3.tgz' へ保存完了 [93541/93541]

hdknr@mailjail:~$ tar xfz poweradmin-2.1.3.tgz
hdknr@mailjail:~$ cd poweradmin-2.1.3/
hdknr@mailjail:~/poweradmin-2.1.3$ cd docs/
hdknr@mailjail:~/poweradmin-2.1.3/docs$

hdknr@mailjail:~/poweradmin-2.1.3$ find . -name "config*"  -print
./inc/config-me.inc.php

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc$ cat ../docs/poweradmin-mysql-db-structure.sql | mysql -u powerdns --password=powerdns powerdns

DBエラー。PEARかな。
Error: You have to create a config.inc.php!

Warning: require_once(MDB2.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc/database.inc.php on line 22

Fatal error: require_once() [function.require]: Failed opening required 'MDB2.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc/database.inc.php on line 22

hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc$ sudo aptitude install php-mdb2-driver-mysql
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています               
状態情報を読み取っています... 完了
拡張状態情報を読み込んでいます     
パッケージの状態を初期化しています... 完了
タスクの記述を読み込んでいます... 完了       
以下の新規パッケージがインストールされます:
  php-mdb2{a} php-mdb2-driver-mysql
更新: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。
122kB のアーカイブを取得する必要があります。展開後に 836kB のディスク領域が新たに消費されます。
先に進みますか? [Y/n/?] y
拡張状態情報を書き込んでいます... 完了
取得:1 http://ftp.jp.debian.org squeeze/main php-mdb2 2.5.0b2-1 [81.7kB]
取得:2 http://ftp.jp.debian.org squeeze/main php-mdb2-driver-mysql 1.5.0b2-1 [40.6kB]
122kB を 0s 秒でダウンロードしました (287kB/s)
未選択パッケージ php-mdb2 を選択しています。
(データベースを読み込んでいます ... 現在 46200 個のファイルとディレクトリがインストールされています。)
(.../php-mdb2_2.5.0b2-1_all.deb から) php-mdb2 を展開しています...
未選択パッケージ php-mdb2-driver-mysql を選択しています。
(.../php-mdb2-driver-mysql_1.5.0b2-1_all.deb から) php-mdb2-driver-mysql を展開しています...
php-mdb2 (2.5.0b2-1) を設定しています ...
php-mdb2-driver-mysql (1.5.0b2-1) を設定しています ...
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています               
状態情報を読み取っています... 完了
拡張状態情報を読み込んでいます     
パッケージの状態を初期化しています... 完了
拡張状態情報を書き込んでいます... 完了       
タスクの記述を読み込んでいます... 完了 

エラー。
Error: You have to create a config.inc.php!

Warning: include_once(inc/config.inc.php) [function.include-once]: failed to open stream: No such file or directory in /home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc/i18n.inc.php on line 22

Warning: include_once() [function.include]: Failed opening 'inc/config.inc.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc/i18n.inc.php on line 22

ファイル名が、config-inc.phpだった。
hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/inc$ sudo mv config-inc.php config.inc.php


Error: The install/ directory exists, you must remove it first before proceeding.

なので、mv install .installしたらログイン画面。

admin/admin でログインします。
hdknr@mailjail:/home/www/sites/jail.hdknr.deb/poweradmin-2.1.3/docs$ grep admin poweradmin-mysql-db-structure.sql
INSERT INTO `users` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3','Administrator','admin@example.net','Administrator with full rights.',1,1);

Filed under  //   poweradmin   powerdns  

Comments [0]

Documentation/ConfigurationFile – Poweradmin

Configuration file

Usage

With any new installation the file "inc/config-me.inc.php" is distributed. You should not edit this file. If you do, it is very likely your changes will be overwritten with an upgrade. Instead, create the file "inc/config.inc.php" and set the variables you want to set there. Your changes will overwrite the defaults provided by us. This way, we are able to add new configuration options, including a good working default, without immediatelly breaking your configuration or requiring manual intervention.

Variables

The following configuration variables are available:

db_host no default The host to connect to for access to the database.
db_user no default The username to use to access the database.
db_pass no default The password to use to access the database.
db_name no default The name of the database of PowerDNS.
db_type no default The type of the database of PowerDNS. Poweradmin currently has support for 'mysql' and 'pgsql'.
iface_lang en_EN The language for the interface. Currently "en_EN" and "nl_NL" are supported.
iface_style example The CSS template to use as skin of web interface. See "style/" directory.
iface_rowamount 50 The maximum number of rows that should be shown (usefull if you have a large number of zones or records).
iface_expire 1800 Session time-out in seconds. After this timeout, you are automagically logged out.
iface_zonelist_serial 0 Enable (1) or disable (0) display of zone's serial in the zone listing.
dns_hostmaster no default The default emailaddress to use for the RP in the SOA record. For example: "hostmaster.example.net".
dns_ns1 no default The default primary nameserver.
dns_ns2 no default The default secondary nameserver.
dns_ttl 86400 The default TTL for records (in seconds of course).
dns_fancy false Enable fancy records (true) or not (false).
dns_icann_tld 1 If enabled, allow official TLD's only. Possible values: "0" or "1".

Filed under  //   poweradmin   powerdns  

Comments [0]

Documentation/Install – Poweradmin

Installation steps (manually)

Doing a manual installation is not recommended.

  • Before actually installing Poweradmin, create a backup of your current PowerDNS database. Better safe than sorry.
  • After you have downloaded the Poweradmin package from the website, unpack it in the web directory you want it run it from.
  • Add a SQL user for the PowerDNS database that is granted SELECT, INSERT, DELETE, UPDATE and CREATE actions.
  • Import the Poweradmin database structure into the PowerDNS database. The database structure is available in the docs/ directory.
  • Create a configuration. Copy "inc/config-me.inc/php" to "inc/config.inc.php" and provide all required values.
  • Remove the "install/" directory from the Poweradmin direcory.
  • Point your browser to the web interface. You should be able to login using the username "admin" and password "admin".
  • First thing to do is to change the password of the user "admin".

DBを作って、config.inc.phpを設定する。(config-me.inc.phpからコピる)

Filed under  //   poweradmin   powerdns  

Comments [0]

Poweradmin

Welcome to Poweradmin!

A friendly web interface for PowerDNS

Poweradmin is a friendly web-based DNS administration tool for Bert Hubert's PowerDNS server. The interface has full support for most of the features of PowerDNS. It has full support for all zone types (master, native and slave), for supermasters for automatic provisioning of slave zones, full support for IPv6 and comes with multi-language support. See feature list for all features.

This version of Poweradmin is an adapation of the Poweradmin that was written by Jorn Ekkelenkamp and Roeland Nieuwenhuis a few years ago. The current version has been extended with numerous features that were missing in the original code and has considerable performance improvements. We also removed the "sequence updater" and replaced the database abstract layer code. We are now working hard in getting the basic setup right. As soon as all functionality is fixed, we will start working on the interface itself, improving it's useability and make it more attractive.

Poweradmin is released under a GPL license. Most recent stable version is 2.1.3.

News

Further reading

Filed under  //   poweradmin   powerdns  

Comments [0]