git: fc2975175297 - main - dns/poweradmin: New port
Muhammad Moinur Rahman <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.ports |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by bofh: URL: https://cgit.FreeBSD.org/ports/commit/?id=fc29751752973a11aaeca8793ce5e749c6465b71 commit fc29751752973a11aaeca8793ce5e749c6465b71 Author: Muhammad Moinur Rahman <[email protected]> AuthorDate: 2026-07-31 19:08:03 +0000 Commit: Muhammad Moinur Rahman <[email protected]> CommitDate: 2026-07-31 20:19:17 +0000 dns/poweradmin: New port Poweradmin is a friendly web-based DNS administration tool for PowerDNS server. The interface supports most of the features of PowerDNS. It can work directly against the PowerDNS database (with API-assisted DNSSEC) or run entirely through the PowerDNS API in API backend mode. WWW: https://www.poweradmin.org/ --- dns/Makefile | 1 + dns/poweradmin/Makefile | 88 +++++++++ dns/poweradmin/distinfo | 3 + dns/poweradmin/files/patch-caddy.conf.example | 245 ++++++++++++++++++++++++++ dns/poweradmin/files/patch-nginx.conf.example | 174 ++++++++++++++++++ dns/poweradmin/pkg-descr | 4 + 6 files changed, 515 insertions(+) diff --git a/dns/Makefile b/dns/Makefile index b6e34ca4e65e..ece237e73024 100644 --- a/dns/Makefile +++ b/dns/Makefile @@ -174,6 +174,7 @@ SUBDIR += pear-Horde_Idna SUBDIR += pear-Net_DNS2 SUBDIR += pear-Net_DNS21 + SUBDIR += poweradmin SUBDIR += powerdns SUBDIR += powerdns-recursor SUBDIR += prometheus-dnssec-exporter diff --git a/dns/poweradmin/Makefile b/dns/poweradmin/Makefile new file mode 100644 index 000000000000..83001ad63b87 --- /dev/null +++ b/dns/poweradmin/Makefile @@ -0,0 +1,88 @@ +PORTNAME= poweradmin +DISTVERSIONPREFIX= v +DISTVERSION= 4.4.0 +PORTREVISION= 2 +CATEGORIES= dns +PKGNAMEPREFIX= ${PHP_PKGNAMEPREFIX} + +MAINTAINER= [email protected] +COMMENT= Web-based control panel for PowerDNS +WWW= https://www.poweradmin.org/ + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +FLAVORS= sqlite3 mysql pgsql +FLAVOR?= ${FLAVORS:[1]} +mysql_PKGNAMESUFFIX= -mysql +pgsql_PKGNAMESUFFIX= -pgsql +sqlite3_PKGNAMESUFFIX= -sqlite3 + +USES= php +USE_GITHUB= yes +USE_PHP= filter gettext intl mbstring session tokenizer xml +.if ${FLAVOR} == mysql +USES+= mysql +USE_PHP+= pdo_mysql +.endif +.if ${FLAVOR} == pgsql +USES+= pgsql +USE_PHP+= pdo_pgsql +.endif +.if ${FLAVOR} == sqlite3 +USES+= sqlite +USE_PHP+= pdo_sqlite +.endif + +NO_ARCH= yes +NO_BUILD= yes + +PORTDOCS= README.md + +OPTIONS_DEFINE= DOCS LDAP + +LDAP_USES= ldap +LDAP_USE= PHP=ldap + +post-extract: + @${RM} ${WRKSRC}/docker-entrypoint.sh + @${RM} ${WRKSRC}/DOCKER-SECRETS.md + @${RM} ${WRKSRC}/DOCKER.md + @${RM} ${WRKSRC}/Dockerfile + +post-extract-DOCS-off: + @${RM} ${WRKSRC}/README.md + +post-patch: + @${REINPLACE_CMD} -e 's|%%WWWDIR%%|${WWWDIR}|g; s|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/caddy.conf.example + @${REINPLACE_CMD} -e 's|%%WWWDIR%%|${WWWDIR}|g; s|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/nginx.conf.example + +pre-install: + @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + ${INSTALL_DATA} ${WRKSRC}/caddy.conf.example ${STAGEDIR}${EXAMPLESDIR}/caddy.conf.example + ${INSTALL_DATA} ${WRKSRC}/nginx.conf.example ${STAGEDIR}${EXAMPLESDIR}/nginx.conf.example + @${RM} ${WRKSRC}/caddy.conf.example + @${RM} ${WRKSRC}/nginx.conf.example + +pre-install-DOCS-on: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} + @${RM} ${WRKSRC}/README.md + +do-install: + @${MKDIR} ${STAGEDIR}${WWWSDIR} + ${FIND} ${WRKSRC} -name '*.orig' -delete -o -name '*.bak' -delete + (cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}) + +post-install: + @${ECHO_CMD} "@owner www" >> ${TMPPLIST} + @${ECHO_CMD} "@group www" >> ${TMPPLIST} + ${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \ + ${SED} -e 's#^${STAGEDIR}${PREFIX}/##' | \ + ${SED} -E -e '/sample$$/ s#^#@sample #' >> ${TMPPLIST} + ${ECHO_CMD} share/examples/${PORTNAME}/caddy.conf.example >> ${TMPPLIST} + ${ECHO_CMD} share/examples/${PORTNAME}/nginx.conf.example >> ${TMPPLIST} + ${FIND} -s ${STAGEDIR}${WWWDIR} -type d | ${SORT} | \ + ${SED} -e 's#^${STAGEDIR}${PREFIX}/#@dir #' >> ${TMPPLIST} + +.include <bsd.port.mk> diff --git a/dns/poweradmin/distinfo b/dns/poweradmin/distinfo new file mode 100644 index 000000000000..7d3370889a8d --- /dev/null +++ b/dns/poweradmin/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1785316490 +SHA256 (poweradmin-poweradmin-v4.4.0_GH0.tar.gz) = e167f8c9ae61cb6fe5546b4ce0a94c27961135bdee89c032ae106c9891fc0ddf +SIZE (poweradmin-poweradmin-v4.4.0_GH0.tar.gz) = 14902575 diff --git a/dns/poweradmin/files/patch-caddy.conf.example b/dns/poweradmin/files/patch-caddy.conf.example new file mode 100644 index 000000000000..62d5806abb1f --- /dev/null +++ b/dns/poweradmin/files/patch-caddy.conf.example @@ -0,0 +1,245 @@ +--- caddy.conf.example.orig 2026-07-23 10:41:21 UTC ++++ caddy.conf.example +@@ -1,12 +1,13 @@ + # Caddy configuration for Poweradmin +-# This configuration is used in the production Docker image and provides +-# comprehensive security, API support, and performance optimizations. ++# This configuration provides comprehensive security, API support, and ++# performance optimizations. + # + # Usage: +-# 1. Copy this file to your desired location (e.g., /etc/caddy/Caddyfile) ++# 1. Copy this file to your desired location (%%PREFIX%%/etc/caddy/Caddyfile) + # 2. Adjust the following settings for your environment: + # - server_name: Set to your domain name (replace :80 with your-domain.com) +-# - root: Set to your Poweradmin installation path (default: /srv/www) ++# - root: Set to your Poweradmin installation path (default: ++# %%WWWDIR%%) + # - php_fastcgi: Adjust PHP-FPM socket/TCP configuration as needed + # + # For HTTPS, replace :80 with your domain name and Caddy will automatically +@@ -20,91 +21,91 @@ + # ROOT FOLDER DEPLOYMENT (Default) + # ============================================================================ + :80 { +- # Set this path to your Poweradmin installation directory +- root * /srv/www ++ # Set this path to your Poweradmin installation directory ++ root * %%WWWDIR%% + +- # Enable access logs +- log { +- output file /var/log/caddy/poweradmin.log { +- roll_size 100mb +- roll_keep 5 +- roll_keep_for 720h +- } +- format console +- level INFO +- } ++ # Enable access logs ++ log { ++ output file /var/log/caddy/poweradmin.log { ++ roll_size 100mb ++ roll_keep 5 ++ roll_keep_for 720h ++ } ++ format console ++ level INFO ++ } + +- # Enable gzip compression +- encode gzip ++ # Enable gzip compression ++ encode gzip + +- # Security: Deny access to sensitive directories +- @denied path /config* /lib* /tests* /vendor* +- @bootstrap path /vendor/twbs/bootstrap* /vendor/twbs/bootstrap-icons* ++ # Security: Deny access to sensitive directories ++ @denied path /config* /lib* /tests* /vendor* ++ @bootstrap path /vendor/twbs/bootstrap* /vendor/twbs/bootstrap-icons* + +- # Allow Bootstrap files (override general vendor blocking) +- handle @bootstrap { +- file_server +- } ++ # Allow Bootstrap files (override general vendor blocking) ++ handle @bootstrap { ++ file_server ++ } + +- # Block sensitive directories (excluding bootstrap) +- handle @denied { +- respond "Forbidden" 403 +- } ++ # Block sensitive directories (excluding bootstrap) ++ handle @denied { ++ respond "Forbidden" 403 ++ } + +- # Security: Deny access to hidden files and sensitive file types +- @hidden path .* *.sql *.md *.log *.yaml *.yml +- handle @hidden { +- respond "Forbidden" 403 +- } ++ # Security: Deny access to hidden files and sensitive file types ++ @hidden path .* *.sql *.md *.log *.yaml *.yml ++ handle @hidden { ++ respond "Forbidden" 403 ++ } + +- # Static assets with caching +- @static path *.js *.css *.png *.jpg *.jpeg *.gif *.ico *.svg *.woff *.woff2 *.ttf *.eot +- handle @static { +- header Cache-Control "public, max-age=31536000" +- file_server +- } ++ # Static assets with caching ++ @static path *.js *.css *.png *.jpg *.jpeg *.gif *.ico *.svg *.woff *.woff2 *.ttf *.eot ++ handle @static { ++ header Cache-Control "public, max-age=31536000" ++ file_server ++ } + +- # Handle OPTIONS preflight requests for CORS +- @options method OPTIONS +- handle @options { +- header Access-Control-Allow-Origin "*" +- header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" +- header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" +- header Access-Control-Max-Age "3600" +- respond "" 204 +- } ++ # Handle OPTIONS preflight requests for CORS ++ @options method OPTIONS ++ handle @options { ++ header Access-Control-Allow-Origin "*" ++ header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" ++ header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" ++ header Access-Control-Max-Age "3600" ++ respond "" 204 ++ } + +- # API endpoints with CORS +- @api path /api* +- handle @api { +- header Access-Control-Allow-Origin "*" +- header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" +- header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" +- header Access-Control-Max-Age "3600" ++ # API endpoints with CORS ++ @api path /api* ++ handle @api { ++ header Access-Control-Allow-Origin "*" ++ header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" ++ header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" ++ header Access-Control-Max-Age "3600" + +- # Forward all API requests to index.php with proper query handling +- rewrite * /index.php{uri} +- php_fastcgi unix//run/php/php-fpm.sock { +- read_timeout 180s +- env HTTP_AUTHORIZATION {http.request.header.Authorization} +- } +- } ++ # Forward all API requests to index.php with proper query handling ++ rewrite * /index.php{uri} ++ php_fastcgi localhost:9000 { ++ read_timeout 180s ++ env HTTP_AUTHORIZATION {http.request.header.Authorization} ++ } ++ } + +- # DDNS update endpoints (for dynamic DNS functionality) +- rewrite /update /dynamic_update.php +- rewrite /nic/update /dynamic_update.php ++ # DDNS update endpoints (for dynamic DNS functionality) ++ rewrite /update /dynamic_update.php ++ rewrite /nic/update /dynamic_update.php + +- # Clean URL routing - let Symfony Router handle all routing +- try_files {path} {path}/ /index.php{uri} ++ # Clean URL routing - let Symfony Router handle all routing ++ try_files {path} {path}/ /index.php{uri} + +- # PHP handling +- php_fastcgi unix//run/php/php-fpm.sock { +- read_timeout 180s +- env HTTP_AUTHORIZATION {http.request.header.Authorization} +- } ++ # PHP handling ++ php_fastcgi localhost:9000 { ++ read_timeout 180s ++ env HTTP_AUTHORIZATION {http.request.header.Authorization} ++ } + +- # Enable file server for static content +- file_server ++ # Enable file server for static content ++ file_server + } + + # ============================================================================ +@@ -117,7 +118,7 @@ + # Uncomment and adjust the configuration below: + + # :80 { +-# root * /srv/www ++# root * %%WWWDIR%% + # + # # Enable access logs + # log { +@@ -140,7 +141,7 @@ + # + # handle @bootstrap { + # file_server { +-# root /srv/www/poweradmin ++# root %%WWWDIR%% + # } + # } + # +@@ -159,7 +160,7 @@ + # handle @static { + # header Cache-Control "public, max-age=31536000" + # file_server { +-# root /srv/www/poweradmin ++# root %%WWWDIR%% + # } + # } + # +@@ -182,8 +183,8 @@ + # header Access-Control-Max-Age "3600" + # + # rewrite * /index.php{uri} +-# php_fastcgi unix//run/php/php-fpm.sock { +-# root /srv/www/poweradmin ++# php_fastcgi localhost:9000 { ++# root %%WWWDIR%% + # read_timeout 180s + # env HTTP_AUTHORIZATION {http.request.header.Authorization} + # } +@@ -197,18 +198,18 @@ + # try_files {path} {path}/ /index.php{uri} + # + # # PHP handling +-# php_fastcgi unix//run/php/php-fpm.sock { +-# root /srv/www/poweradmin ++# php_fastcgi localhost:9000 { ++# root %%WWWDIR%% + # read_timeout 180s + # env HTTP_AUTHORIZATION {http.request.header.Authorization} + # } + # + # # Enable file server + # file_server { +-# root /srv/www/poweradmin ++# root %%WWWDIR%% + # } + # } + # + # # Serve other content from root if needed + # file_server +-# } +\ No newline at end of file ++# } diff --git a/dns/poweradmin/files/patch-nginx.conf.example b/dns/poweradmin/files/patch-nginx.conf.example new file mode 100644 index 000000000000..21d438b05211 --- /dev/null +++ b/dns/poweradmin/files/patch-nginx.conf.example @@ -0,0 +1,174 @@ +--- nginx.conf.example.orig 2026-07-30 02:02:57 UTC ++++ nginx.conf.example +@@ -7,8 +7,8 @@ server { + # ============================================================================ + server { + listen 80; +- server_name your-domain.com; +- root /path/to/poweradmin; ++ server_name example.com; ++ root %%WWWDIR%%; + index index.php index.html; + + # Static assets (caching) +@@ -41,9 +41,9 @@ server { + # Handle PHP files + location ~ \.php$ { + # Adjust the fastcgi_pass directive based on your PHP-FPM configuration +- # For socket: fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; ++ # For socket: fastcgi_pass unix:/var/run/php/php-fpm.sock; + # For TCP: fastcgi_pass 127.0.0.1:9000; +- fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; ++ fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_read_timeout 180; +@@ -83,75 +83,75 @@ server { + # Use this configuration when Poweradmin is installed in a subfolder + # Remember to also set 'base_url_prefix' => '/poweradmin' in config/settings.php + +-server { +- listen 80; +- server_name your-domain.com; +- root /var/www/html; +- index index.php index.html; +- +- # Poweradmin subfolder location +- location /poweradmin { +- # Try to serve the file directly, fallback to index.php +- try_files $uri $uri/ /poweradmin/index.php$is_args$args; +- +- # Static assets (caching) +- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { +- expires max; +- log_not_found off; +- access_log off; +- } +- +- # API handling with CORS +- location ~ ^/poweradmin/api { +- add_header Access-Control-Allow-Origin "*" always; +- add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; +- add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" always; +- add_header Access-Control-Max-Age "3600" always; +- +- # Handle OPTIONS pre-flight requests +- if ($request_method = 'OPTIONS') { +- return 204; +- } +- +- try_files $uri $uri/ /poweradmin/index.php$is_args$args; +- } +- +- # Handle PHP files within the poweradmin subfolder +- location ~ ^/poweradmin/.*\.php$ { +- # Adjust the fastcgi_pass directive based on your PHP-FPM configuration +- # For socket: fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; +- # For TCP: fastcgi_pass 127.0.0.1:9000; +- fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; +- fastcgi_index index.php; +- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; +- fastcgi_read_timeout 180; +- include fastcgi_params; +- +- # Ensure HTTP Authorization header is forwarded for API authentication +- fastcgi_param HTTP_AUTHORIZATION $http_authorization; +- } +- +- # Security: Deny access to sensitive files and directories +- location ~ ^/poweradmin/\. { +- deny all; +- } +- +- # Allow access to Bootstrap CSS/JS and Bootstrap Icons in vendor/twbs/ +- location ~ ^/poweradmin/vendor/twbs/(bootstrap|bootstrap-icons)/ { +- allow all; +- } +- +- location ~ ^/poweradmin/(config|lib|tests|vendor)/ { +- deny all; +- } +- +- location ~ ^/poweradmin/.*\.(sql|md|log)$ { +- deny all; +- } +- } +- +- # Optional: Enable logging for debugging +- # rewrite_log on; +- # error_log /var/log/nginx/poweradmin_error.log notice; +- # access_log /var/log/nginx/poweradmin_access.log; +-} +\ No newline at end of file ++#server { ++# listen 80; ++# server_name example.com; ++# root %%WWWDIR%%; ++# index index.php index.html; ++# ++# # Poweradmin subfolder location ++# location /poweradmin { ++# # Try to serve the file directly, fallback to index.php ++# try_files $uri $uri/ /poweradmin/index.php$is_args$args; ++# ++# # Static assets (caching) ++# location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { ++# expires max; ++# log_not_found off; ++# access_log off; ++# } ++# ++# # API handling with CORS ++# location ~ ^/poweradmin/api { ++# add_header Access-Control-Allow-Origin "*" always; ++# add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; ++# add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" always; ++# add_header Access-Control-Max-Age "3600" always; ++# ++# # Handle OPTIONS pre-flight requests ++# if ($request_method = 'OPTIONS') { ++# return 204; ++# } ++# ++# try_files $uri $uri/ /poweradmin/index.php$is_args$args; ++# } ++# ++# # Handle PHP files within the poweradmin subfolder ++# location ~ ^/poweradmin/.*\.php$ { ++# # Adjust the fastcgi_pass directive based on your PHP-FPM configuration ++# # For socket: fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; ++# # For TCP: fastcgi_pass 127.0.0.1:9000; ++# fastcgi_pass 127.0.0.1:9000; ++# fastcgi_index index.php; ++# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; ++# fastcgi_read_timeout 180; ++# include fastcgi_params; ++# ++# # Ensure HTTP Authorization header is forwarded for API authentication ++# fastcgi_param HTTP_AUTHORIZATION $http_authorization; ++# } ++# ++# # Security: Deny access to sensitive files and directories ++# location ~ ^/poweradmin/\. { ++# deny all; ++# } ++# ++# # Allow access to Bootstrap CSS/JS and Bootstrap Icons in vendor/twbs/ ++# location ~ ^/poweradmin/vendor/twbs/(bootstrap|bootstrap-icons)/ { ++# allow all; ++# } ++# ++# location ~ ^/poweradmin/(config|lib|tests|vendor)/ { ++# deny all; ++# } ++# ++# location ~ ^/poweradmin/.*\.(sql|md|log)$ { ++# deny all; ++# } ++# } ++# ++# # Optional: Enable logging for debugging ++# # rewrite_log on; ++# # error_log /var/log/nginx/poweradmin_error.log notice; ++# # access_log /var/log/nginx/poweradmin_access.log; ++#} diff --git a/dns/poweradmin/pkg-descr b/dns/poweradmin/pkg-descr new file mode 100644 index 000000000000..1d70eef303bc --- /dev/null +++ b/dns/poweradmin/pkg-descr @@ -0,0 +1,4 @@ +Poweradmin is a friendly web-based DNS administration tool for PowerDNS +server. The interface supports most of the features of PowerDNS. It can +work directly against the PowerDNS database (with API-assisted DNSSEC) +or run entirely through the PowerDNS API in API backend mode.