From 2bdefae726902cba39ff07c06ff88b718c61dc30 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Mon, 2 Feb 2026 22:07:23 +0100 Subject: [PATCH] Add debian PowerDNS --- ct/powerdns.sh | 44 ++++++++++++++ install/powerdns-install.sh | 113 ++++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 ct/powerdns.sh create mode 100644 install/powerdns-install.sh diff --git a/ct/powerdns.sh b/ct/powerdns.sh new file mode 100644 index 000000000..888c6fc2d --- /dev/null +++ b/ct/powerdns.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://www.powerdns.com/ + +APP="PowerDNS" +var_tags="${var_tags:-dns}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/poweradmin ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Updating Debian LXC" + $STD apt update + $STD apt upgrade -y + msg_ok "Updated Debian LXC" + cleanup_lxc + exit +} + +start +build_container +description + +msg_ok "Completed successfully!" +msg_custom "🚀" "${GN}" "${APP} setup has been successfully initialized!" diff --git a/install/powerdns-install.sh b/install/powerdns-install.sh new file mode 100644 index 000000000..53c951bd3 --- /dev/null +++ b/install/powerdns-install.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://www.powerdns.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os +setup_hwaccel + +msg_info "Installing Dependencies" +$STD apt install -y sqlite3 +msg_ok "Installed Dependencies" + +PHP_VERSION="8.3" PHP_APACHE="YES" PHP_FPM="YES" PHP_MODULE="gettext,openssl,tokenizer,pdo,sqlite3,ldap" setup_php +setup_deb822_repo \ + "pdns" \ + "https://repo.powerdns.com/FD380FBB-pub.asc" \ + "http://repo.powerdns.com/debian" \ + "trixie-auth-50" + +cat </etc/apt/preferences.d/auth-50 +Package: pdns-* +Pin: origin repo.powerdns.com +Pin-Priority: 600 +EOF + +msg_info "Setting up PowerDNS" +$STD apt install -y pdns \ + pdns-backend-sqlite3 +msg_ok "Setup PowerDNS" + +fetch_and_deploy_gh_release "poweradmin" "poweradmin/poweradmin" "tarball" + +msg_info "Setting up Poweradmin" +sqlite3 /opt/poweradmin/powerdns.db < /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql +cat </opt/poweradmin/config/settings.php + [ + 'type' => 'sqlite', + 'file' => '/opt/poweradmin/powerdns.db', + ], + + /** + * Security Settings + */ + 'security' => [ + 'session_key' => '5c\$^vK#l!*@mj4Id(WWzsosruN\$fkhaqLQo@i-s6ZBV)8C', + ], + + /** + * Interface Settings + */ + 'interface' => [ + 'language' => 'en_EN', + ], + + /** + * DNS Settings + */ + 'dns' => [ + 'hostmaster' => 'localhost.lan', + 'ns1' => '8.8.8.8', + 'ns2' => '9.9.9.9', + ] +]; +EOF +msg_ok "Setup Poweradmin" + +msg_info "Creating Service" +rm /etc/apache2/sites-enabled/000-default.conf +cat </etc/apache2/sites-enabled/poweradmin.conf + + ServerName $HOSTNAME + DocumentRoot /opt/poweradmin + + + Options -Indexes +FollowSymLinks + AllowOverride All + Require all granted + + + # For DDNS update functionality + RewriteEngine On + RewriteRule ^/update(.*)$ /dynamic_update.php [L] + RewriteRule ^/nic/update(.*)$ /dynamic_update.php [L] + +EOF +$STD a2enmod rewrite headers +chown -R www-data:www-data /opt/poweradmin +$STD systemctl restart apache2 +msg_info "Created Service" + +motd_ssh +customize +cleanup_lxc