. All rights reserved. */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ========================================================================== */ ]]> Describe your package here Describe your package requirements here Currently there are no FAQ items provided. powerdns 2.9.16_4 Services: PowerDNS true yes PowerDNS
Services
powerdns.xml
pgsql Password password Enter the pgsql users password. password pgsql Password AGAIN passwordagain password IP Address ipaddress input 0.0.0.0 (0.0.0.0 to bind to all) Cache Time to Live cachettl input 20 Recommended value: 20 Master master select Slave slave select system("/usr/local/bin/pg_ctl -m immediate"); rmdir_recursive("/usr/local/pgsql"); system("/usr/sbin/pw userdel pgsql"); system("/usr/bin/killall -9 postgres"); echo "<p>"; echo "Reboot required... One moment..."; echo "<p>"; /* system("/sbin/shutdown -r now"); */ echo "<pre>"; echo "Creating DB..."; system("/usr/bin/su -l pgsql -c initdb"); system("/usr/local/etc/rc.d/010.pgsql.sh start"); system("/usr/bin/su -l pgsql -c \"dropdb powerdns\" "); system("/usr/bin/su -l pgsql -c \"createdb powerdns\" "); $fout = fopen("/usr/local/pkg/powerdns.schema","w"); /* DATABASE SCHEMA */ fwrite($fout, "create table domains (\n"); fwrite($fout, "id SERIAL PRIMARY KEY,\n"); fwrite($fout, "name VARCHAR(255) NOT NULL,\n"); fwrite($fout, "master VARCHAR(20) DEFAULT NULL,\n"); fwrite($fout, "last_check INT DEFAULT NULL,\n"); fwrite($fout, "type VARCHAR(6) NOT NULL,\n"); fwrite($fout, "notified_serial INT DEFAULT NULL,\n"); fwrite($fout, "account VARCHAR(40) DEFAULT NULL\n"); fwrite($fout, ");\n"); fwrite($fout, "CREATE UNIQUE INDEX name_index ON domains(name);\n"); fwrite($fout, "CREATE TABLE records (\n"); fwrite($fout, " id SERIAL PRIMARY KEY,\n"); fwrite($fout, " domain_id INT DEFAULT NULL,\n"); fwrite($fout, " name VARCHAR(255) DEFAULT NULL,\n"); fwrite($fout, " type VARCHAR(6) DEFAULT NULL,\n"); fwrite($fout, " content VARCHAR(255) DEFAULT NULL,\n"); fwrite($fout, " ttl INT DEFAULT NULL,\n"); fwrite($fout, " prio INT DEFAULT NULL,\n"); fwrite($fout, " change_date INT DEFAULT NULL,\n"); fwrite($fout, " CONSTRAINT domain_exists\n"); fwrite($fout, " FOREIGN KEY(domain_id) REFERENCES domains(id)\n"); fwrite($fout, " ON DELETE CASCADE\n"); fwrite($fout, ");\n"); fwrite($fout, "CREATE INDEX rec_name_index ON records(name);\n"); fwrite($fout, "CREATE INDEX nametype_index ON records(name,type);\n"); fwrite($fout, "CREATE INDEX domain_id ON records(domain_id);\n"); fwrite($fout, "create table supermasters (\n"); fwrite($fout, " ip VARCHAR(25) NOT NULL,\n"); fwrite($fout, " nameserver VARCHAR(255) NOT NULL,\n"); fwrite($fout, " account VARCHAR(40) DEFAULT NULL\n"); fwrite($fout, ");\n"); fwrite($fout, "GRANT SELECT ON supermasters TO pgsql;\n"); fwrite($fout, "GRANT ALL ON domains TO pgsql;\n"); fwrite($fout, "GRANT ALL ON domains_id_seq TO pgsql;\n"); fwrite($fout, "GRANT ALL ON records TO pgsql;\n"); fwrite($fout, "GRANT ALL ON records_id_seq TO pgsql;\n"); fclose($fout); system("cat /usr/local/pkg/powerdns.schema | /usr/bin/su -l pgsql -c \"psql powerdns\" "); echo "Installation completed!"; if($password == $passwordagain) { conf_mount_rw(); config_lock(); $fd = popen("/usr/sbin/pw usermod -n pgsql -H 0", "w"); $salt = md5(time()); $crypted_pw = crypt($_POST['password'],$salt); fwrite($fd, $crypted_pw); pclose($fd); $fout = fopen("/usr/local/etc/pdns.conf","w"); fwrite($fout, "launch=gpgsql\n"); fwrite($fout, "gpgsql-host=127.0.0.1\n"); fwrite($fout, "gpgsql-dbname=powerdns\n"); fwrite($fout, "gpgsql-user=pgsql\n"); fwrite($fout, "gpgsql-password=" . $_POST['password'] . "\n"); fwrite($fout, "chroot=/var/empty\n"); fwrite($fout, "disable-tcp=no\n"); fwrite($fout, "guardian=yes\n"); fwrite($fout, "webserver=yes\n"); fwrite($fout, "webserver-address=127.0.0.1\n"); fwrite($fout, "webserver-port=8081\n"); fwrite($fout, "local-address=" . $_POST['ipaddress'] . "\n"); fwrite($fout, "master=" . $_POST['master'] . "\n"); fwrite($fout, "slave=" . $_POST['slave'] . "\n"); fwrite($fout, "cache-ttl=" . $_POST['cachettl'] . "\n"); /* XXX: TODO */ fwrite($fout, "# allow-axfr-ips=\n"); fwrite($fout, "# allow-recursion=\n"); fwrite($fout, "# config-dir=/etc\n"); fwrite($fout, "# config-name=\n"); fwrite($fout, "# control-console=no\n"); fwrite($fout, "# default-soa-name=ns.example.com\n"); fwrite($fout, "# disable-axfr=no\n"); fwrite($fout, "# distributor-threads=3\n"); fwrite($fout, "# fancy-records=no\n"); fwrite($fout, "# launch=\n"); fwrite($fout, "# lazy-recursion=yes\n"); fwrite($fout, "# load-modules=\n"); fwrite($fout, "# local-ipv6=\n"); fwrite($fout, "# local-port=53\n"); fwrite($fout, "# log-dns-details=\n"); fwrite($fout, "# log-failed-updates=\n"); fwrite($fout, "# logfile=pdns.log\n"); fwrite($fout, "# logging-facility=\n"); fwrite($fout, "# loglevel=4\n"); fwrite($fout, "# max-queue-length=5000\n"); fwrite($fout, "# max-tcp-connections=10\n"); fwrite($fout, "# module-dir=/usr/local/bin/../lib\n"); fwrite($fout, "# negquery-cache-ttl=60\n"); fwrite($fout, "# only-soa=org\n"); fwrite($fout, "# out-of-zone-additional-processing=no\n"); fwrite($fout, "# query-cache-ttl=20\n"); fwrite($fout, "# query-logging=no\n"); fwrite($fout, "# queue-limit=1500\n"); fwrite($fout, "# receiver-threads=1\n"); fwrite($fout, "# recursive-cache-ttl=10\n"); fwrite($fout, "# recursor=no\n"); fwrite($fout, "# setgid=\n"); fwrite($fout, "# setuid=\n"); fwrite($fout, "# skip-cname=no\n"); fwrite($fout, "# slave=no\n"); fwrite($fout, "# slave-cycle-interval=60\n"); fwrite($fout, "# soa-minimum-ttl=3600\n"); fwrite($fout, "# soa-serial-offset=0\n"); fwrite($fout, "# socket-dir=/var/run\n"); fwrite($fout, "# strict-rfc-axfrs=no\n"); fwrite($fout, "# urlredirector=127.0.0.1\n"); fwrite($fout, "# use-logfile=no\n"); fwrite($fout, "# webserver-password=\n"); fwrite($fout, "# webserver-print-arguments=no\n"); fwrite($fout, "# wildcard-url=no\n"); fwrite($fout, "# wildcards=\n"); fclose($fout); conf_mount_ro(); config_unlock(); system("/usr/local/bin/pg_ctl -m smart 2>/dev/null"); system("/usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start 2>/dev/null"); } else { echo "Passwords do not much!"; exit; }