PowerDNS-Admin (Ubuntu): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(→Apache) |
(→Apache) |
||
Zeile 172: | Zeile 172: | ||
<pre> | <pre> | ||
sudo apt install apache2-dev | sudo apt install apache2-dev | ||
cd /opt/web/powerdns-admin/ | |||
virtualenv -p python3 flask | virtualenv -p python3 flask | ||
source ./flask/bin/activate 552 | source ./flask/bin/activate 552 |
Version vom 28. Januar 2020, 23:34 Uhr
Voraussetzungen
Git-Client siehe hier: Git
Sonstige benötigte Pakete:
Ob das Package ibmariadbclient-dev oder libmysqlclient-dev hängt von der verwendetetn Datenbank ab.
sudo apt-get install -y libmariadbclient-dev libsasl2-dev libldap2-dev libssl-dev libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev pkg-config apt-transport-https virtualenv build-essential
NodeJs:
sudo curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - sudo apt-get install -y nodejs
Yarn:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update -y sudo apt-get install -y yarn
Installation
Datenbank
create database if not exists powerdns_admin; grant all on powerdns_admin.* to 'powerdns'@'localhost';
Repository klonen
Um git nicht als root ausführen zu müssen, das Installationsverzeichnis vorab erstellen und dem eigenen Benutzer zuweisen:
sudo mkdir -p /opt/web/powerdns-admin sudo chown <user>:<user> /opt/web/powerdns-admin
git clone https://github.com/ngoduykhanh/PowerDNS-Admin.git /opt/web/powerdns-admin
Installieren
cd /opt/web/powerdns-admin/
virtualenv -p python3 flask
source ./flask/bin/activate pip install -r requirements.txt
vi /opt/web/powerdns-admin/powerdnsadmin/default_config.py
SQLA_DB_USER = 'powerdns' SQLA_DB_PASSWORD = '<password>' SQLA_DB_HOST = '127.0.0.1' SQLA_DB_NAME = 'powerdns_admin'
export FLASK_APP=powerdnsadmin/__init__.py flask db upgrade
yarn install --pure-lockfile flask assets build
./run.py
API-Key
Siehe dazu PowerDNS Authoritative Server (Ubuntu)#API für PowerDNS-Admin.
Konfiguration
systemd
sudo vi /etc/systemd/system/powerdns-admin.service
[Unit] Description=PowerDNS-Admin Requires=powerdns-admin.socket After=network.target [Service] PIDFile=/run/powerdns-admin/pid User=pdns Group=pdns WorkingDirectory=/opt/web/powerdns-admin ExecStart=/opt/web/powerdns-admin/flask/bin/gunicorn --pid /run/powerdns-admin/pid --bind unix:/run/powerdns-admin/socket 'powerdnsadmin:create_app()' ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
sudo vim /etc/systemd/system/powerdns-admin.socket
[Unit] Description=PowerDNS-Admin socket [Socket] ListenStream=/run/powerdns-admin/socket [Install] WantedBy=sockets.target
sudo vim /etc/tmpfiles.d/powerdns-admin.conf
d /run/powerdns-admin 0755 pdns pdns -
sudo systemctl daemon-reload; sudo systemctl restart powerdns-admin.socket; sudo systemctl restart powerdns-admin.service; \ sudo systemctl enable powerdns-admin.socket; sudo systemctl enable powerdns-admin.service;
Links
Apache
sudo touch /etc/apache2/mods-available/wsgi.load sudo chown pdnsadmin:pdnsadmin /etc/apache2/mods-available/wsgi.load sudo chown pdnsadmin:pdnsadmin /usr/lib/apache2/modules/mod_wsgi-py37.cpython-37m-arm-linux-gnueabihf.so
sudo apt install apache2-dev cd /opt/web/powerdns-admin/ virtualenv -p python3 flask source ./flask/bin/activate 552 pip3 install mod-wsgi mod_wsgi-express install-module > /etc/apache2/mods-available/wsgi.load sudo a2enmod wsgi sudo systemctl restart apache2
/etc/apache2/mods-available/wsgi.load
sudo addgroup pdnsadmin sudo adduser pdnsadmin --ingroup pdnsadmin
sudo vi /etc/apache2/sites-available/powerdns-ssl.conf
<VirtualHost *:443> ServerName powerdns1.kirner.or.at ServerAlias [fe80::1] ServerAdmin admin@kirner.or.at SSLEngine On SSLCertificateFile /etc/ssl/certs/powerdns.crt SSLCertificateKeyFile /etc/ssl/private/apache.key ErrorLog /var/log/apache2/error-powerdns1.kirner.or.at.log CustomLog /var/log/apache2/access-powerdns1.kirner.or.at.log combined DocumentRoot /srv/vhosts/powerdns1.kirner.or.at/ WSGIDaemonProcess pdnsadmin user=pdnsadmin group=pdnsadmin threads=5 WSGIScriptAlias / /srv/vhosts/powerdns1.kirner.or.at/powerdnsadmin.wsgi # pass BasicAuth on to the WSGI process WSGIPassAuthorization On <Directory "/srv/vhosts/powerdns1.kirner.or.at/"> WSGIProcessGroup pdnsadmin WSGIApplicationGroup %{GLOBAL} AllowOverride None Options +ExecCGI +FollowSymLinks SSLRequireSSL AllowOverride None Require all granted </Directory> </VirtualHost>
sudo mkdir -p /srv/vhosts/powerdns1.kirner.or.at sudo vi /srv/vhosts/powerdns1.kirner.or.at/powerdnsadmin.wsgi
#!/usr/bin/env python3 import sys sys.path.insert(0, '/srv/vhosts/powerdns1.kirner.or.at') from powerdnsadmin import create_app application = create_app()
sudo chown -R pdnsadmin:pdnsadmin /srv/vhosts/powerdns1.kirner.or.at/
Links
https://github.com/ngoduykhanh/PowerDNS-Admin/wiki/WSGI-Apache-example
Error
[Tue Jan 28 00:24:55.138644 2020] [wsgi:error] [pid 1474] [remote 10.0.0.60:42402] mod_wsgi (pid=1474): Failed to exec Python script file '/srv/vhosts/powerdns1.kirner.or.at/powerdnsadmin.wsgi'. [Tue Jan 28 00:24:55.138968 2020] [wsgi:error] [pid 1474] [remote 10.0.0.60:42402] mod_wsgi (pid=1474): Exception occurred processing WSGI script '/srv/vhosts/powerdns1.kirner.or.at/powerdnsadmin.wsgi'. [Tue Jan 28 00:24:55.168346 2020] [wsgi:error] [pid 1474] [remote 10.0.0.60:42402] Traceback (most recent call last): [Tue Jan 28 00:24:55.168527 2020] [wsgi:error] [pid 1474] [remote 10.0.0.60:42402] File "/srv/vhosts/powerdns1.kirner.or.at/powerdnsadmin.wsgi", line 5, in <module> [Tue Jan 28 00:24:55.168572 2020] [wsgi:error] [pid 1474] [remote 10.0.0.60:42402] from powerdnsadmin import create_app [Tue Jan 28 00:24:55.168679 2020] [wsgi:error] [pid 1474] [remote 10.0.0.60:42402] ModuleNotFoundError: No module named 'powerdnsadmin'
Links
https://github.com/ngoduykhanh/PowerDNS-Admin/wiki/Running-PowerDNS-Admin-on-Ubuntu-or-Debian
https://blog.jonaharagon.com/installing-powerdns-admin-on-ubuntu-18-04/
https://github.com/ngoduykhanh/PowerDNS-Admin
Zurück zu Domain selbst verwalten