From 4f656d827e62b2999b76faad2a05e1831b92a8ec Mon Sep 17 00:00:00 2001 From: David Mc Ken Date: Fri, 9 Dec 2022 10:56:08 -0400 Subject: [PATCH 01/14] Move DB directions to that section of docs. --- .../database-setup/Setup-MySQL-or-MariaDB.md | 5 ++ docs/wiki/database-setup/Setup-PostgreSQL.md | 22 +++++++- .../Running-PowerDNS-Admin-on-Centos-7.md | 53 +++++++------------ .../Running-PowerDNS-Admin-on-Fedora-30.md | 7 --- 4 files changed, 44 insertions(+), 43 deletions(-) diff --git a/docs/wiki/database-setup/Setup-MySQL-or-MariaDB.md b/docs/wiki/database-setup/Setup-MySQL-or-MariaDB.md index 246a0a5..00586a5 100644 --- a/docs/wiki/database-setup/Setup-MySQL-or-MariaDB.md +++ b/docs/wiki/database-setup/Setup-MySQL-or-MariaDB.md @@ -18,6 +18,11 @@ quit ## Install required packages: ### 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: ``` diff --git a/docs/wiki/database-setup/Setup-PostgreSQL.md b/docs/wiki/database-setup/Setup-PostgreSQL.md index 40c1287..74af46f 100644 --- a/docs/wiki/database-setup/Setup-PostgreSQL.md +++ b/docs/wiki/database-setup/Setup-PostgreSQL.md @@ -53,4 +53,24 @@ docker run --name pdnsadmin-test -e BIND_ADDRESS=0.0.0.0 -e SQLA_DB_HOST='192.168.0.100' -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 -``` \ No newline at end of file +``` + +## 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 ** diff --git a/docs/wiki/install/Running-PowerDNS-Admin-on-Centos-7.md b/docs/wiki/install/Running-PowerDNS-Admin-on-Centos-7.md index 18d57f6..cee272c 100644 --- a/docs/wiki/install/Running-PowerDNS-Admin-on-Centos-7.md +++ b/docs/wiki/install/Running-PowerDNS-Admin-on-Centos-7.md @@ -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. ``` -
-**Remove old Python 3.4**
-If you had it installed because of older instructions
-``` -yum remove python34* -yum autoremove -``` -
+## Install required packages: +### Install needed repositories: -## Install required packages -**Install needed repositories:** -
``` 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 ``` -**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 pip3.6 install -U pip 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. - So `mysql-community-devel` is required. For MariaDB, - and PostgreSQL the required package will be different. +yum install gcc openldap-devel xmlsec1-devel xmlsec1-openssl libtool-ltdl-devel ``` -If you use MariaDB ( from [MariaDB repositories](https://mariadb.com/resources/blog/installing-mariadb-10-on-centos-7-rhel-7/) ) - -``` -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** +### Install yarn to build asset files + Nodejs 14: ``` 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 yum install yarn ``` -
-## 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 ``` @@ -68,15 +52,14 @@ Activate your python3 environment and install libraries: pip install python-dotenv pip install -r requirements.txt ``` -
-## 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. ```bash export FLASK_CONF=../configs/development.py ``` -**Then create the database schema by running:** +### Create the database schema: ``` export FLASK_APP=powerdnsadmin/__init__.py flask db upgrade @@ -97,4 +80,4 @@ Open your web browser and access to `http://localhost:9191` to visit PowerDNS-Ad At the first time you login into the PDA UI, you will be redirected to setting page to configure the PDNS API information. -_**Note:**_ For production environment, i would recommend you to run PowerDNS-Admin with gunicorn or uwsgi instead of flask's built-in web server, take a look at WIKI page to see how to configure them. \ No newline at end of file +_**Note:**_ For production environment, i would recommend you to run PowerDNS-Admin with gunicorn or uwsgi instead of flask's built-in web server, take a look at WIKI page to see how to configure them. diff --git a/docs/wiki/install/Running-PowerDNS-Admin-on-Fedora-30.md b/docs/wiki/install/Running-PowerDNS-Admin-on-Fedora-30.md index bbd9f03..53f1c7c 100644 --- a/docs/wiki/install/Running-PowerDNS-Admin-on-Fedora-30.md +++ b/docs/wiki/install/Running-PowerDNS-Admin-on-Fedora-30.md @@ -14,11 +14,6 @@ dnf install python37 python3-devel python3-pip ```bash 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** ```bash dnf install gcc gc make @@ -31,8 +26,6 @@ pip3.7 install -U pip ```bash pip install -U virtualenv ``` - - **Install Yarn for building NodeJS asset files:** ```bash dnf install npm From 54775e6c6907e44995a1667a1bcc44b834314907 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 11:41:38 -0500 Subject: [PATCH 02/14] Working on updated workflow for Docker image publishing. --- .github/workflows/build-and-publish.yml | 20 ++++++++++---------- docker/Dockerfile | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 4b103f8..1f56da7 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -11,41 +11,41 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Repository Checkout uses: actions/checkout@v2 - - name: Docker meta + - name: Docker Image Metadata id: meta uses: docker/metadata-action@v3 with: images: | - ngoduykhanh/powerdns-admin + powerdnsadmin/pda-legacy tags: | type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - - name: Set up Docker Buildx + - name: Docker Buildx Setup id: buildx uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub + - name: Docker Hub Authentication uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: ${{ secrets.DOCKERHUB_USERNAME_V2 }} + password: ${{ secrets.DOCKERHUB_TOKEN_V2 }} - - name: Build latest image + - name: Docker Image Build uses: docker/build-push-action@v2 if: github.ref == 'refs/heads/master' with: context: ./ file: ./docker/Dockerfile 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 if: ${{ startsWith(github.ref, 'refs/tags/v') }} with: diff --git a/docker/Dockerfile b/docker/Dockerfile index 5296e02..f0a0731 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,4 @@ FROM alpine:3.13 AS builder -LABEL maintainer="k@ndk.name" ARG BUILD_DEPENDENCIES="build-base \ libffi-dev \ From 58d0d6b71d1e07105fe35292aa9d481c0e0ff803 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 12:30:18 -0500 Subject: [PATCH 03/14] Updated Docker image publish workflow to enable manual dispatch of the workflow. --- .github/workflows/build-and-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 1f56da7..bb93258 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -1,4 +1,5 @@ on: + workflow_dispatch: push: branches: - 'master' From 3889ceaf4c4a9df90858dfc6d431275ab5ab38fb Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 12:55:45 -0500 Subject: [PATCH 04/14] Updated documentation to reflect the new Docker Hub home of the project's Docker images. --- README.md | 2 +- docs/wiki/install/Running-PowerDNS-Admin-on-Docker.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8067855..af25413 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ $ docker run -d \ -e SECRET_KEY='a-very-secret-key' \ -v pda-data:/data \ -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. diff --git a/docs/wiki/install/Running-PowerDNS-Admin-on-Docker.md b/docs/wiki/install/Running-PowerDNS-Admin-on-Docker.md index 2f23845..1e3ef50 100644 --- a/docs/wiki/install/Running-PowerDNS-Admin-on-Docker.md +++ b/docs/wiki/install/Running-PowerDNS-Admin-on-Docker.md @@ -1,6 +1,6 @@ # 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). @@ -10,5 +10,5 @@ docker run -d \ -e SECRET_KEY='a-very-secret-key' \ -v pda-data:/data \ -p 9191:80 \ - ngoduykhanh/powerdns-admin:latest + powerdnsadmin/pda-legacy:latest ``` From c90592e039ac2b9da9ecc08dce477b188763d530 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 15:58:55 -0500 Subject: [PATCH 05/14] Updated build/deploy workflow to include updated naming. --- .github/workflows/build-and-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index bb93258..8de2410 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -1,3 +1,5 @@ +name: 'Docker Image Publish' + on: workflow_dispatch: push: @@ -8,7 +10,7 @@ on: jobs: build-and-push-docker-image: - name: Build Docker image and push to repositories + name: Build / Publish Docker Image runs-on: ubuntu-latest steps: From 45071c3a9f69eed7fe3987eaf1beb780023fa1e5 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 16:40:39 -0500 Subject: [PATCH 06/14] Updated CodeQL workflow to support manual dispatch. --- .github/workflows/codeql-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ad59382..bba8c1f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,6 +12,7 @@ name: "CodeQL" on: + workflow_dispatch: push: branches: [ master ] pull_request: From 02e4fcc20a65b7a1c107c50b62385aab7e91be57 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 16:42:53 -0500 Subject: [PATCH 07/14] Updating project README to include updated status badges since LGTM is shutting down soon. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af25413..71461be 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # PowerDNS-Admin 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) -[![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) +[![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) +[![Docker Image Publish](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: - Multiple domain management From 56ee0d674ec0ec6aacf1e652450d0c6b9d9ad389 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 16:56:03 -0500 Subject: [PATCH 08/14] Added very basic Docker Compose / Portainer template for the current project. --- deploy/docker/portainer.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 deploy/docker/portainer.yaml diff --git a/deploy/docker/portainer.yaml b/deploy/docker/portainer.yaml new file mode 100644 index 0000000..84402ef --- /dev/null +++ b/deploy/docker/portainer.yaml @@ -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: From 81020fe2b5c008ea1f423b53100d37b66e2b75d7 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 16:57:13 -0500 Subject: [PATCH 09/14] Tweaked Docker status badge text in project README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71461be..82f15cc 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A PowerDNS web interface with advanced features. [![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) -[![Docker Image Publish](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) +[![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: - Multiple domain management From 4940e280bb1fdd0690eb52ceca04ea48352a9fc1 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 16:58:40 -0500 Subject: [PATCH 10/14] Tweaked name of Docker image build workflow for Docker image status updates. --- .github/workflows/build-and-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 8de2410..0e1f2d3 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -1,4 +1,4 @@ -name: 'Docker Image Publish' +name: 'Docker Image' on: workflow_dispatch: From dec457e2ea0dcba65c936abd003e5d1dcbd33a84 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 17:02:36 -0500 Subject: [PATCH 11/14] Tweaked job name of the Docker Image workflow. --- .github/workflows/build-and-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 0e1f2d3..52649e6 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -10,7 +10,7 @@ on: jobs: build-and-push-docker-image: - name: Build / Publish Docker Image + name: Build Docker Image runs-on: ubuntu-latest steps: From 48c303dd84ebd3f01f13b2f32f69d4afedcac050 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Fri, 9 Dec 2022 17:03:46 -0500 Subject: [PATCH 12/14] Corrected typo / instructions related to Docker in the project README file. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82f15cc..ce12f62 100644 --- a/README.md +++ b/README.md @@ -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. ### Docker -This 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. +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. #### Option 1: From Docker Hub The easiest is to just run the latest Docker image from Docker Hub: From dfdb0dca173c7bc2b95bbdefb8525fe5e2601a97 Mon Sep 17 00:00:00 2001 From: Bernward Sanchez <109844019+pneb@users.noreply.github.com> Date: Sat, 10 Dec 2022 10:37:06 +0800 Subject: [PATCH 13/14] Update domain.py --- powerdnsadmin/models/domain.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/powerdnsadmin/models/domain.py b/powerdnsadmin/models/domain.py index bbd71e1..09b697e 100644 --- a/powerdnsadmin/models/domain.py +++ b/powerdnsadmin/models/domain.py @@ -110,6 +110,22 @@ class Domain(db.Model): 'Domain does not exist. ERROR: {0}'.format(e)) 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): """ Fetch zones (domains) from PowerDNS and update into DB @@ -906,4 +922,4 @@ class Domain(db.Model): current_app.logger.error('Domain already exists as a record: {} under domain: {}'.format(r['name'].rstrip('.'), upper_domain_name)) return upper_domain_name upper_domain_name = '.'.join(upper_domain_name.split('.')[1:]) - return None \ No newline at end of file + return None From 4e2ea4bc5eaee11042fa9a75ea224947a45d60ac Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Sun, 11 Dec 2022 17:43:02 -0500 Subject: [PATCH 14/14] Revert "Removed mysqlclient requirement based on issue 1305. Wiki documentation has already been updated to reflect this change." This reverts commit 542af959e17f57af44a1395c7f7cbbed8aab0d07. --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 29f62d7..1fc2864 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ Flask-Login==0.5.0 Flask-SQLAlchemy==2.4.4 Flask-Migrate==2.5.3 SQLAlchemy==1.3.19 +mysqlclient==2.0.1 configobj==5.0.6 bcrypt>=3.1.7 requests==2.24.0