Merge branch 'PowerDNS-Admin:master' into docs-updates

This commit is contained in:
David Mc Ken 2022-12-12 13:51:59 -04:00 committed by GitHub
commit 12892d70a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 99 additions and 63 deletions

View File

@ -1,4 +1,7 @@
name: 'Docker Image'
on: on:
workflow_dispatch:
push: push:
branches: branches:
- 'master' - 'master'
@ -7,45 +10,45 @@ on:
jobs: jobs:
build-and-push-docker-image: build-and-push-docker-image:
name: Build Docker image and push to repositories name: Build Docker Image
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Repository Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Docker meta - name: Docker Image Metadata
id: meta id: meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
with: with:
images: | images: |
ngoduykhanh/powerdns-admin powerdnsadmin/pda-legacy
tags: | tags: |
type=ref,event=tag type=ref,event=tag
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}} type=semver,pattern={{major}}
- name: Set up Docker Buildx - name: Docker Buildx Setup
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Login to DockerHub - name: Docker Hub Authentication
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME_V2 }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN_V2 }}
- name: Build latest image - name: Docker Image Build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
with: with:
context: ./ context: ./
file: ./docker/Dockerfile file: ./docker/Dockerfile
push: true push: true
tags: ngoduykhanh/powerdns-admin:latest tags: powerdnsadmin/pda-legacy:latest
- name: Build release image - name: Docker Image Release Tagging
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/v') }} if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with: with:

View File

@ -12,6 +12,7 @@
name: "CodeQL" name: "CodeQL"
on: on:
workflow_dispatch:
push: push:
branches: [ master ] branches: [ master ]
pull_request: pull_request:

View File

@ -1,8 +1,8 @@
# PowerDNS-Admin # PowerDNS-Admin
A PowerDNS web interface with advanced features. A PowerDNS web interface with advanced features.
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/PowerDNS-Admin/PowerDNS-Admin.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/PowerDNS-Admin/PowerDNS-Admin/context:python) [![CodeQL](https://github.com/PowerDNS-Admin/PowerDNS-Admin/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/PowerDNS-Admin/PowerDNS-Admin/actions/workflows/codeql-analysis.yml)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/PowerDNS-Admin/PowerDNS-Admin.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/PowerDNS-Admin/PowerDNS-Admin/context:javascript) [![Docker Image](https://github.com/PowerDNS-Admin/PowerDNS-Admin/actions/workflows/build-and-publish.yml/badge.svg?branch=master)](https://github.com/PowerDNS-Admin/PowerDNS-Admin/actions/workflows/build-and-publish.yml)
#### Features: #### Features:
- Multiple domain management - Multiple domain management
@ -24,8 +24,8 @@ There are several ways to run PowerDNS-Admin. The easiest way is to use Docker.
If you are looking to install and run PowerDNS-Admin directly onto your system check out the [Wiki](https://github.com/PowerDNS-Admin/PowerDNS-Admin/wiki#installation-guides) for ways to do that. If you are looking to install and run PowerDNS-Admin directly onto your system check out the [Wiki](https://github.com/PowerDNS-Admin/PowerDNS-Admin/wiki#installation-guides) for ways to do that.
### Docker ### Docker
This are two options to run PowerDNS-Admin using Docker. Here are two options to run PowerDNS-Admin using Docker.
To get started as quickly as possible try option 1. If you want to make modifications to the configuration option 2 may be cleaner. To get started as quickly as possible, try option 1. If you want to make modifications to the configuration option 2 may be cleaner.
#### Option 1: From Docker Hub #### Option 1: From Docker Hub
The easiest is to just run the latest Docker image from Docker Hub: The easiest is to just run the latest Docker image from Docker Hub:
@ -34,7 +34,7 @@ $ docker run -d \
-e SECRET_KEY='a-very-secret-key' \ -e SECRET_KEY='a-very-secret-key' \
-v pda-data:/data \ -v pda-data:/data \
-p 9191:80 \ -p 9191:80 \
ngoduykhanh/powerdns-admin:latest powerdnsadmin/pda-legacy:latest
``` ```
This creates a volume called `pda-data` to persist the SQLite database with the configuration. This creates a volume called `pda-data` to persist the SQLite database with the configuration.

View File

@ -0,0 +1,15 @@
version: '3.3'
services:
core:
image: powerdnsadmin/pda-legacy:latest
restart: unless-stopped
environment:
- SECRET_KEY=INSECURE-CHANGE-ME-9I0DAtfkfj5JmBkPSaHah3ECAa8Df5KK
ports:
- "12000:9191"
volumes:
- "core_data:/data"
volumes:
core_data:

View File

@ -1,5 +1,4 @@
FROM alpine:3.13 AS builder FROM alpine:3.13 AS builder
LABEL maintainer="k@ndk.name"
ARG BUILD_DEPENDENCIES="build-base \ ARG BUILD_DEPENDENCIES="build-base \
libffi-dev \ libffi-dev \

View File

@ -18,6 +18,11 @@ quit
## Install required packages: ## Install required packages:
### Red-hat based systems: ### Red-hat based systems:
```
yum install MariaDB-shared mariadb-devel mysql-community-devel
```
If you use MariaDB ( from [MariaDB repositories](https://mariadb.com/resources/blog/installing-mariadb-10-on-centos-7-rhel-7/) )
### Debian based systems: ### Debian based systems:
``` ```

View File

@ -54,3 +54,23 @@ docker run --name pdnsadmin-test -e BIND_ADDRESS=0.0.0.0
-e SQLA_DB_NAME='powerdns_admin_test' -e SQLA_DB_NAME='powerdns_admin_test'
-v /data/node_modules:/var/www/powerdns-admin/node_modules -d -p 9191:9191 ixpict/powerdns-admin-pgsql:latest -v /data/node_modules:/var/www/powerdns-admin/node_modules -d -p 9191:9191 ixpict/powerdns-admin-pgsql:latest
``` ```
## Install required packages:
### Red-hat based systems:
```
sudo yum install postgresql-libs
```
### Debian based systems:
```
apt install libpq-dev python-dev
```
### Install python packages:
```
pip3 install psycopg2
```
## Known Issues:
** To fill in **

View File

@ -1,59 +1,43 @@
# Installing PowerDNS-Admin on CentOS 7
``` ```
NOTE: If you are logged in as User and not root, add "sudo", or get root by sudo -i. NOTE: If you are logged in as User and not root, add "sudo", or get root by sudo -i.
``` ```
<br>
**Remove old Python 3.4**<br> ## Install required packages:
If you had it installed because of older instructions<br> ### Install needed repositories:
```
yum remove python34*
yum autoremove
```
<br>
## Install required packages
**Install needed repositories:**
<br>
``` ```
yum install epel-release yum install epel-release
yum install https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
``` ```
**Install Python 3.6 and tools** ### Install Python 3.6 and tools:
First remove python 3.4 if installed
```
yum remove python34*
yum autoremove
```
``` ```
yum install python3 python3-devel python3-pip yum install python3 python3-devel python3-pip
pip3.6 install -U pip pip3.6 install -U pip
pip install -U virtualenv pip install -U virtualenv
``` ```
**Install required packages for building python libraries from requirements.txt file** ### Install required packages for building python libraries from requirements.txt file:
``` ```
--> NOTE: I am using MySQL Community server as the database backend. yum install gcc openldap-devel xmlsec1-devel xmlsec1-openssl libtool-ltdl-devel
So `mysql-community-devel` is required. For MariaDB,
and PostgreSQL the required package will be different.
``` ```
If you use MariaDB ( from [MariaDB repositories](https://mariadb.com/resources/blog/installing-mariadb-10-on-centos-7-rhel-7/) ) ### Install yarn to build asset files + Nodejs 14:
```
yum install gcc MariaDB-devel MariaDB-shared openldap-devel xmlsec1-devel xmlsec1-openssl libtool-ltdl-devel
```
If you use default Centos mariadb (5.5)
```
yum install gcc mariadb-devel openldap-devel xmlsec1-devel xmlsec1-openssl libtool-ltdl-devel
```
**Install yarn to build asset files + Nodejs 14**
``` ```
curl -sL https://rpm.nodesource.com/setup_14.x | bash - curl -sL https://rpm.nodesource.com/setup_14.x | bash -
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
yum install yarn yum install yarn
``` ```
<br>
## Checkout source code and create virtualenv ### Checkout source code and create virtualenv:
NOTE: Please adjust `/opt/web/powerdns-admin` to your local web application directory NOTE: Please adjust `/opt/web/powerdns-admin` to your local web application directory
``` ```
@ -68,15 +52,14 @@ Activate your python3 environment and install libraries:
pip install python-dotenv pip install python-dotenv
pip install -r requirements.txt pip install -r requirements.txt
``` ```
<br>
## Running PowerDNS-Admin ## Running PowerDNS-Admin:
NOTE: The default config file is located at `./powerdnsadmin/default_config.py`. If you want to load another one, please set the `FLASK_CONF` environment variable. E.g. NOTE: The default config file is located at `./powerdnsadmin/default_config.py`. If you want to load another one, please set the `FLASK_CONF` environment variable. E.g.
```bash ```bash
export FLASK_CONF=../configs/development.py export FLASK_CONF=../configs/development.py
``` ```
**Then create the database schema by running:** ### Create the database schema:
``` ```
export FLASK_APP=powerdnsadmin/__init__.py export FLASK_APP=powerdnsadmin/__init__.py
flask db upgrade flask db upgrade

View File

@ -1,6 +1,6 @@
# Installation on docker # Installation on docker
The Docker image is ngoduykhanh/powerdns-admin available on [DockerHub](https://hub.docker.com/r/ngoduykhanh/powerdns-admin) The Docker image is powerdnsadmin/pda-legacy available on [DockerHub](https://hub.docker.com/r/powerdnsadmin/pda-legacy)
The supported environment variables to configure the container are located [here](../configuration/Environment-variables.md). The supported environment variables to configure the container are located [here](../configuration/Environment-variables.md).
@ -10,5 +10,5 @@ docker run -d \
-e SECRET_KEY='a-very-secret-key' \ -e SECRET_KEY='a-very-secret-key' \
-v pda-data:/data \ -v pda-data:/data \
-p 9191:80 \ -p 9191:80 \
ngoduykhanh/powerdns-admin:latest powerdnsadmin/pda-legacy:latest
``` ```

View File

@ -14,11 +14,6 @@ dnf install python37 python3-devel python3-pip
```bash ```bash
dnf install mariadb-devel mariadb-common openldap-devel xmlsec1-devel xmlsec1-openssl libtool-ltdl-devel dnf install mariadb-devel mariadb-common openldap-devel xmlsec1-devel xmlsec1-openssl libtool-ltdl-devel
``` ```
**Install Postgres dependencies**
```bash
$ sudo yum install postgresql-libs
$ pip3 install psycopg2
```
**Install Development tools** **Install Development tools**
```bash ```bash
dnf install gcc gc make dnf install gcc gc make
@ -31,8 +26,6 @@ pip3.7 install -U pip
```bash ```bash
pip install -U virtualenv pip install -U virtualenv
``` ```
**Install Yarn for building NodeJS asset files:** **Install Yarn for building NodeJS asset files:**
```bash ```bash
dnf install npm dnf install npm

View File

@ -110,6 +110,22 @@ class Domain(db.Model):
'Domain does not exist. ERROR: {0}'.format(e)) 'Domain does not exist. ERROR: {0}'.format(e))
return None return None
def search_idn_domains(self, search_string):
"""
Search for IDN domains using the provided search string.
"""
# Compile the regular expression pattern for matching IDN domain names
idn_pattern = re.compile(r'^xn--')
# Search for domain names that match the IDN pattern
idn_domains = [
domain for domain in self.get_domains() if idn_pattern.match(domain)
]
# Filter the search results based on the provided search string
return [domain for domain in idn_domains if search_string in domain]
def update(self): def update(self):
""" """
Fetch zones (domains) from PowerDNS and update into DB Fetch zones (domains) from PowerDNS and update into DB

View File

@ -4,6 +4,7 @@ Flask-Login==0.5.0
Flask-SQLAlchemy==2.4.4 Flask-SQLAlchemy==2.4.4
Flask-Migrate==2.5.3 Flask-Migrate==2.5.3
SQLAlchemy==1.3.19 SQLAlchemy==1.3.19
mysqlclient==2.0.1
configobj==5.0.6 configobj==5.0.6
bcrypt>=3.1.7 bcrypt>=3.1.7
requests==2.24.0 requests==2.24.0