Skip to content

Commit 0a2e42c

Browse files
dnssec
1 parent e61c2bc commit 0a2e42c

File tree

5 files changed

+72
-38
lines changed

5 files changed

+72
-38
lines changed

Dockerfile

+15-9
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ RUN set -eux; \
102102
mariadb-connector-c \
103103
yaml-cpp \
104104
zeromq \
105+
openssl \
105106
\
106107
pwgen \
107108
supervisor \
@@ -118,6 +119,9 @@ RUN set -eux; \
118119
php81-openssl \
119120
php81-session \
120121
php81-tokenizer \
122+
php81-mbstring \
123+
php81-xml \
124+
composer \
121125
musl musl-utils musl-locales tzdata \
122126
; \
123127
true "Setup user and group"; \
@@ -131,30 +135,32 @@ RUN set -eux; \
131135
true "Cleanup"; \
132136
rm -f /var/cache/apk/*
133137

138+
RUN set -eux; \
139+
mkdir -p /var/www/html; \
140+
cd /var/www/html; \
141+
wget https://github.com/poweradmin/poweradmin/archive/refs/tags/v${POWERADMIN_VER}.tar.gz; \
142+
tar -xf v${POWERADMIN_VER}.tar.gz && rm -f v${POWERADMIN_VER}.tar.gz; \
143+
mv poweradmin-${POWERADMIN_VER} poweradmin; \
144+
rm -rf /var/www/html/poweradmin/install/
145+
134146
COPY --from=builder /build/powerdns-root /
135147
COPY supervisor /etc/supervisor
136148
COPY powerdns /etc/powerdns
137149
COPY entrypoint /usr/bin
138150
COPY nginx /etc/nginx
139151
COPY php81 /etc/php81
152+
COPY poweradmin /var/www/html/poweradmin/inc
140153

141154
RUN set -eux; \
142-
mkdir -p /var/www/html; \
143-
cd /var/www/html; \
144-
wget https://github.com/poweradmin/poweradmin/archive/refs/tags/v${POWERADMIN_VER}.tar.gz; \
145-
tar -xf v${POWERADMIN_VER}.tar.gz && rm -f v${POWERADMIN_VER}.tar.gz; \
146-
mv poweradmin-${POWERADMIN_VER} poweradmin; \
147-
rm -rf /var/www/html/poweradmin/install/; \
148-
\
149155
chmod 0750 /etc/powerdns; \
150156
chmod 0640 /etc/powerdns/pdns.conf; \
151157
chown -R root:powerdns /etc/powerdns; \
152158
chown -R nginx:nginx /var/www/html; \
153159
chmod +x /usr/bin/entrypoint; \
154160
cp /usr/share/zoneinfo/${TZ} /etc/localtime
155161

156-
COPY poweradmin /var/www/html/poweradmin
162+
EXPOSE 53 8081 80
163+
EXPOSE 53/UDP
157164

158-
EXPOSE 53/TCP 53/UDP 8081/TCP 80/TCP
159165
ENTRYPOINT [ "entrypoint" ]
160166
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

entrypoint

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
#!/bin/sh
22

3+
#Defaults
4+
# mysql
5+
MYSQL_HOST=${MYSQL_HOST:-localhost}
6+
MYSQL_PORT=${MYSQL_PORT:-3306}
7+
MYSQL_DATABASE=${MYSQL_DATABASE:-pdns}
8+
MYSQL_USER=${MYSQL_USER:-pdns}
9+
MYSQL_PASSWORD=${MYSQL_PASSWORD:-pdns}
10+
11+
#php
12+
SESSION_KEY=`pwgen 32 1`
13+
14+
15+
PDNS_ALLOW_AXFR_IPS=${PDNS_ALLOW_AXFR_IPS:-127.0.0.1}
16+
PDNS_MASTER=${PDNS_MASTER:-yes}
17+
PDNS_SLAVE=${PDNS_SLAVE:-no}
18+
PDNS_CACHE_TTL=${PDNS_CACHE_TTL:-20}
19+
PDNS_DISTRIBUTOR_THREADS=${PDNS_DISTRIBUTOR_THREADS:-3}
20+
PDNS_RECURSIVE_CACHE_TTL=${PDNS_RECURSIVE_CACHE_TTL:-10}
21+
PDNS_ALLOW_RECURSION=${PDNS_ALLOW_RECURSION:-127.0.0.1}
22+
PDNS_RECURSOR=${PDNS_RECURSOR:-no}
23+
POWERADMIN_HOSTMASTER=${POWERADMIN_HOSTMASTER:-}
24+
POWERADMIN_NS1=${POWERADMIN_NS1:-}
25+
POWERADMIN_NS2=${POWERADMIN_NS2:-}
26+
327
# Setup run directory
428
if [ ! -d /run/powerdns ]; then
529
mkdir -p /run/powerdns
@@ -11,27 +35,26 @@ chmod 0755 /run/powerdns
1135

1236
if [ -n "$MYSQL_HOST" ]; then
1337
sed -i "s!MYSQL_HOST!${MYSQL_HOST}!" /etc/powerdns/conf.d/gmysql.conf
14-
sed -i "s!{{MYSQL_HOST}}!${MYSQL_HOST}!" /var/www/html/poweradmin/config.inc.php
38+
sed -i "s!{{MYSQL_HOST}}!${MYSQL_HOST}!" /var/www/html/poweradmin/inc/config.inc.php
1539
fi
1640
if [ -n "$MYSQL_PORT" ]; then
1741
sed -i "s!MYSQL_PORT!${MYSQL_PORT}!" /etc/powerdns/conf.d/gmysql.conf
18-
sed -i "s!{{MYSQL_PORT}}!${MYSQL_PORT}!" /var/www/html/poweradmin/config.inc.php
42+
sed -i "s!{{MYSQL_PORT}}!${MYSQL_PORT}!" /var/www/html/poweradmin/inc/config.inc.php
1943
fi
2044
if [ -n "$MYSQL_DATABASE" ]; then
2145
sed -i "s!MYSQL_DATABASE!${MYSQL_DATABASE}!" /etc/powerdns/conf.d/gmysql.conf
22-
sed -i "s!{{MYSQL_DB}}!${MYSQL_DATABASE}!" /var/www/html/poweradmin/config.inc.php
46+
sed -i "s!{{MYSQL_DB}}!${MYSQL_DATABASE}!" /var/www/html/poweradmin/inc/config.inc.php
2347
fi
2448
if [ -n "$MYSQL_USER" ]; then
2549
sed -i "s!MYSQL_USER!${MYSQL_USER}!" /etc/powerdns/conf.d/gmysql.conf
26-
sed -i "s!{{MYSQL_USER}}!${MYSQL_USER}!" /var/www/html/poweradmin/config.inc.php
50+
sed -i "s!{{MYSQL_USER}}!${MYSQL_USER}!" /var/www/html/poweradmin/inc/config.inc.php
2751
fi
2852
if [ -n "$MYSQL_PASSWORD" ]; then
2953
sed -i "s!MYSQL_PASSWORD!${MYSQL_PASSWORD}!" /etc/powerdns/conf.d/gmysql.conf
30-
sed -i "s!{{MYSQL_PASSWORD}}!${MYSQL_PASSWORD}!" /var/www/html/poweradmin/config.inc.php
54+
sed -i "s!{{MYSQL_PASSWORD}}!${MYSQL_PASSWORD}!" /var/www/html/poweradmin/inc/config.inc.php
3155
fi
3256

33-
SESSION_KEY=`pwgen 32 1`
34-
sed -i "s!{{SESSION_KEY}}!${SESSION_KEY}!" /var/www/html/poweradmin/config.inc.php
57+
sed -i "s!{{SESSION_KEY}}!${SESSION_KEY}!" /var/www/html/poweradmin/inc/config.inc.php
3558

3659
# Setup web access
3760
if [ ! -f /etc/powerdns/conf.d/webserver.conf ] && [ -n "$POWERDNS_WEBSERVER_ALLOW_FROM" ]; then

nginx/http.d/default.conf

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# This is a default site configuration which will simply return 404, preventing
2-
# chance access to any other virtualhost.
31
upstream php {
42
server 127.0.0.1:9000;
53
}
@@ -10,34 +8,41 @@ server {
108
root /var/www/html/;
119
index index.html index.php;
1210

11+
location ~ /\. {
12+
deny all;
13+
log_not_found off;
14+
}
15+
16+
location ~* /\.(ht|svn|hg) {
17+
deny all;
18+
access_log off;
19+
log_not_found off;
20+
}
21+
22+
location ~ (/\.gitignore|/\.git) {
23+
deny all;
24+
access_log off;
25+
log_not_found off;
26+
}
27+
28+
location ~* \.(?:jpe?g|gif|png|ico|swf|svg|eot|ttf|otf|woff|htc|css|js)$ {
29+
expires max;
30+
}
31+
1332
location / {
14-
# First attempt to serve request as file, then
15-
# as directory, then fall back to displaying a 404.
16-
try_files $uri $uri/ =404;
33+
try_files $uri $uri/ /index.php;
1734
}
1835

1936
location ~ \.php$ {
37+
try_files $uri = 404;
2038
include fastcgi_params;
2139
fastcgi_pass php;
2240
fastcgi_index index.php;
2341
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
42+
include /etc/nginx/fastcgi_params;
2443

2544
fastcgi_buffer_size 32k;
2645
fastcgi_buffers 4 32k;
2746
fastcgi_cache_valid 200 60m;
2847
}
29-
30-
location ~ /\. {
31-
deny all;
32-
log_not_found off;
33-
}
34-
35-
location ~* \.(?:jpe?g|gif|png|ico|swf|svg|eot|ttf|otf|woff|htc|css|js)$ {
36-
expires max;
37-
}
38-
39-
# You may need this to prevent return 404 recursion.
40-
location = /404.html {
41-
internal;
42-
}
4348
}

php81/php-fpm.d/www.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
; Unix user/group of processes
2121
; Note: The user is mandatory. If the group is not set, the default user's group
2222
; will be used.
23-
user = nginx
24-
group = nginx
23+
user = powerdns
24+
group = powerdns
2525

2626
; The address on which to accept FastCGI requests.
2727
; Valid syntaxes are:

poweradmin/config.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
$timezone = 'Europe/Moscow';
1818

19-
$pdnssec_use = false;
19+
$pdnssec_use = true;
2020
$pdnssec_debug = false;
2121
$pdnssec_command = '/usr/bin/pdnsutil';
2222

0 commit comments

Comments
 (0)