]>
Commit | Line | Data |
---|---|---|
968e651b PL |
1 | %global _hardened_build 1 |
2 | %global backends %{nil} | |
3 | ||
4 | Name: pdns | |
8ceb365e PL |
5 | Version: %{getenv:BUILDER_RPM_VERSION} |
6 | Release: %{getenv:BUILDER_RPM_RELEASE}%{dist} | |
968e651b PL |
7 | Summary: A modern, advanced and high performance authoritative-only nameserver |
8 | Group: System Environment/Daemons | |
9 | License: GPLv2 | |
10 | URL: https://powerdns.com | |
8ceb365e | 11 | Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2 |
968e651b | 12 | |
4a3fe2fc GP |
13 | Requires(post): systemd |
14 | Requires(preun): systemd | |
15 | Requires(postun): systemd | |
b4d8324b | 16 | BuildRequires: systemd |
968e651b PL |
17 | BuildRequires: systemd-units |
18 | BuildRequires: systemd-devel | |
19 | ||
4728ab89 | 20 | BuildRequires: krb5-devel |
968e651b | 21 | BuildRequires: p11-kit-devel |
17477d10 | 22 | BuildRequires: libcurl-devel |
6dac9c74 | 23 | %if 0%{?rhel} < 8 && 0%{?amzn} != 2023 |
6f7f89d9 PD |
24 | BuildRequires: boost169-devel |
25 | %else | |
38affa7f | 26 | BuildRequires: boost-devel |
6f7f89d9 | 27 | %endif |
bce81446 PL |
28 | BuildRequires: bison |
29 | BuildRequires: openssl-devel | |
968e651b | 30 | |
6dac9c74 PD |
31 | %if 0%{?amzn} != 2023 |
32 | BuildRequires: libsodium-devel | |
33 | %endif | |
34 | ||
968e651b | 35 | Requires(pre): shadow-utils |
bce81446 | 36 | |
60ebc45e PD |
37 | %ifarch aarch64 |
38 | BuildRequires: lua-devel | |
92aa72d1 | 39 | %define lua_implementation lua |
60ebc45e | 40 | %else |
968e651b | 41 | BuildRequires: luajit-devel |
92aa72d1 | 42 | %define lua_implementation luajit |
60ebc45e | 43 | %endif |
968e651b PL |
44 | |
45 | Provides: powerdns = %{version}-%{release} | |
46 | %global backends %{backends} bind | |
47 | ||
48 | %description | |
49 | The PowerDNS Nameserver is a modern, advanced and high performance | |
50 | authoritative-only nameserver. It is written from scratch and conforms | |
51 | to all relevant DNS standards documents. | |
52 | Furthermore, PowerDNS interfaces with almost any database. | |
53 | ||
54 | %package tools | |
55 | Summary: Extra tools for %{name} | |
56 | Group: System Environment/Daemons | |
57 | ||
58 | %description tools | |
59 | This package contains the extra tools for %{name} | |
60 | ||
61 | %package backend-mysql | |
62 | Summary: MySQL backend for %{name} | |
63 | Group: System Environment/Daemons | |
64 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
6dac9c74 | 65 | %if 0%{?rhel} < 8 && 0%{?amzn} != 2023 |
968e651b | 66 | BuildRequires: mysql-devel |
fd0a94e9 PL |
67 | %else |
68 | BuildRequires: mariadb-connector-c-devel | |
69 | %endif | |
968e651b PL |
70 | %global backends %{backends} gmysql |
71 | ||
72 | %description backend-mysql | |
73 | This package contains the gmysql backend for %{name} | |
74 | ||
75 | %package backend-postgresql | |
76 | Summary: PostgreSQL backend for %{name} | |
77 | Group: System Environment/Daemons | |
78 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
79 | BuildRequires: postgresql-devel | |
80 | %global backends %{backends} gpgsql | |
81 | ||
82 | %description backend-postgresql | |
83 | This package contains the gpgsql backend for %{name} | |
84 | ||
85 | %package backend-pipe | |
86 | Summary: Pipe backend for %{name} | |
87 | Group: System Environment/Daemons | |
88 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
89 | %global backends %{backends} pipe | |
90 | ||
91 | %description backend-pipe | |
92 | This package contains the pipe backend for %{name} | |
93 | ||
94 | %package backend-remote | |
95 | Summary: Remote backend for %{name} | |
96 | Group: System Environment/Daemons | |
97 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
98 | %global backends %{backends} remote | |
99 | ||
100 | %description backend-remote | |
101 | This package contains the remote backend for %{name} | |
102 | ||
103 | %package backend-ldap | |
104 | Summary: LDAP backend for %{name} | |
105 | Group: System Environment/Daemons | |
106 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
107 | BuildRequires: openldap-devel | |
108 | %global backends %{backends} ldap | |
109 | ||
110 | %description backend-ldap | |
111 | This package contains the LDAP backend for %{name} | |
112 | ||
578ed45d PL |
113 | %package backend-lua2 |
114 | Summary: Lua backend for %{name} | |
115 | Group: System Environment/Daemons | |
116 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
117 | %global backends %{backends} lua2 | |
118 | ||
119 | %description backend-lua2 | |
120 | This package contains the lua2 backend for %{name} | |
121 | ||
968e651b PL |
122 | %package backend-sqlite |
123 | Summary: SQLite backend for %{name} | |
124 | Group: System Environment/Daemons | |
125 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
126 | BuildRequires: sqlite-devel | |
127 | %global backends %{backends} gsqlite3 | |
128 | ||
129 | %description backend-sqlite | |
130 | This package contains the SQLite backend for %{name} | |
131 | ||
968e651b PL |
132 | %package backend-odbc |
133 | Summary: UnixODBC backend for %{name} | |
134 | Group: System Environment/Daemons | |
135 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
136 | BuildRequires: unixODBC-devel | |
137 | %global backends %{backends} godbc | |
138 | ||
139 | %description backend-odbc | |
140 | This package contains the godbc backend for %{name} | |
141 | ||
142 | %package backend-geoip | |
143 | Summary: Geo backend for %{name} | |
144 | Group: System Environment/Daemons | |
145 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
146 | BuildRequires: yaml-cpp-devel | |
6dac9c74 | 147 | %if 0%{?rhel} < 9 && 0%{?amzn} != 2023 |
968e651b | 148 | BuildRequires: geoip-devel |
4728ab89 | 149 | %endif |
c7e6c74d | 150 | BuildRequires: libmaxminddb-devel |
968e651b PL |
151 | %global backends %{backends} geoip |
152 | ||
153 | %description backend-geoip | |
154 | This package contains the geoip backend for %{name} | |
155 | It allows different answers to DNS queries coming from different | |
156 | IP address ranges or based on the geoipgraphic location | |
157 | ||
d0d9195b PL |
158 | %package backend-lmdb |
159 | Summary: LMDB backend for %{name} | |
160 | Group: System Environment/Daemons | |
161 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
162 | BuildRequires: lmdb-devel | |
163 | %global backends %{backends} lmdb | |
164 | ||
165 | %description backend-lmdb | |
166 | This package contains the lmdb backend for %{name} | |
167 | ||
968e651b PL |
168 | %package backend-tinydns |
169 | Summary: TinyDNS backend for %{name} | |
170 | Group: System Environment/Daemons | |
171 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
172 | BuildRequires: tinycdb-devel | |
173 | %global backends %{backends} tinydns | |
174 | ||
175 | %description backend-tinydns | |
176 | This package contains the TinyDNS backend for %{name} | |
17477d10 | 177 | |
d72871c6 | 178 | %if 0%{?amzn} != 2 |
17477d10 PL |
179 | %package ixfrdist |
180 | BuildRequires: yaml-cpp-devel | |
a71347a9 | 181 | Summary: A program to redistribute zones over AXFR and IXFR |
17477d10 PL |
182 | Group: System Environment/Daemons |
183 | ||
184 | %description ixfrdist | |
185 | This package contains the ixfrdist program. | |
d72871c6 | 186 | %endif |
968e651b PL |
187 | |
188 | %prep | |
c7e6c74d | 189 | %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION} |
968e651b PL |
190 | |
191 | %build | |
192 | export CPPFLAGS="-DLDAP_DEPRECATED" | |
193 | ||
6f7f89d9 PD |
194 | %if 0%{?rhel} < 8 |
195 | export CPPFLAGS=-I/usr/include/boost169 | |
196 | export LDFLAGS=-L/usr/lib64/boost169 | |
197 | %endif | |
198 | ||
968e651b | 199 | %configure \ |
e5d38a0f | 200 | --enable-option-checking=fatal \ |
968e651b PL |
201 | --sysconfdir=%{_sysconfdir}/%{name} \ |
202 | --disable-static \ | |
203 | --disable-dependency-tracking \ | |
204 | --disable-silent-rules \ | |
205 | --with-modules='' \ | |
92aa72d1 | 206 | --with-lua=%{lua_implementation} \ |
9a205757 | 207 | --with-dynmodules='%{backends}' \ |
968e651b | 208 | --enable-tools \ |
6dac9c74 | 209 | %if 0%{?amzn} != 2023 |
cb264691 | 210 | --with-libsodium \ |
6dac9c74 | 211 | %endif |
d72871c6 PD |
212 | %if 0%{?amzn} != 2 |
213 | --enable-ixfrdist \ | |
214 | %endif | |
968e651b | 215 | --enable-unit-tests \ |
17477d10 | 216 | --enable-lua-records \ |
968e651b | 217 | --enable-experimental-pkcs11 \ |
c70977c9 | 218 | --enable-dns-over-tls \ |
d72871c6 | 219 | --enable-systemd |
968e651b | 220 | |
968e651b PL |
221 | make %{?_smp_mflags} |
222 | ||
223 | %install | |
224 | make install DESTDIR=%{buildroot} | |
225 | ||
226 | %{__rm} -f %{buildroot}%{_libdir}/%{name}/*.la | |
227 | %{__rm} -rf %{buildroot}%{_docdir} | |
228 | ||
c3892519 | 229 | %{buildroot}/usr/sbin/pdns_server --config=default | sed \ |
968e651b PL |
230 | -e 's!# daemon=.*!daemon=no!' \ |
231 | -e 's!# guardian=.*!guardian=no!' \ | |
232 | -e 's!# launch=.*!&\\nlaunch=!' \ | |
233 | -e 's!# setgid=.*!setgid=pdns!' \ | |
234 | -e 's!# setuid=.*!setuid=pdns!' \ | |
235 | > %{buildroot}%{_sysconfdir}/%{name}/pdns.conf | |
236 | %{__rm} %{buildroot}%{_sysconfdir}/%{name}/pdns.conf-dist | |
237 | %{__rm} %{buildroot}/usr/bin/stubquery | |
238 | ||
239 | chmod 600 %{buildroot}%{_sysconfdir}/%{name}/pdns.conf | |
240 | ||
968e651b PL |
241 | # rename zone2ldap to pdns-zone2ldap (#1193116) |
242 | %{__mv} %{buildroot}/%{_bindir}/zone2ldap %{buildroot}/%{_bindir}/pdns-zone2ldap | |
243 | %{__mv} %{buildroot}/%{_mandir}/man1/zone2ldap.1 %{buildroot}/%{_mandir}/man1/pdns-zone2ldap.1 | |
968e651b | 244 | |
fac31e76 MS |
245 | %{__install } -d %{buildroot}/%{_sharedstatedir}/%{name} |
246 | ||
42bc9fae O |
247 | # The EL7 and 8 systemd actually supports %t, but its version number is older than that, so we do use seperate runtime dirs, but don't rely on RUNTIME_DIRECTORY |
248 | %if 0%{?rhel} < 9 | |
249 | sed -e 's!/pdns_server!& --socket-dir=%t/pdns!' -i %{buildroot}/%{_unitdir}/pdns.service | |
250 | %if 0%{?rhel} < 8 | |
251 | sed -e 's!/pdns_server!& --socket-dir=%t/pdns-%i!' -e 's!RuntimeDirectory=pdns!&-%i!' -i %{buildroot}/%{_unitdir}/pdns@.service | |
252 | %endif | |
253 | %endif | |
254 | ||
968e651b PL |
255 | %check |
256 | PDNS_TEST_NO_IPV6=1 make %{?_smp_mflags} -C pdns check || (cat pdns/test-suite.log && false) | |
64229532 | 257 | |
968e651b PL |
258 | %pre |
259 | getent group pdns >/dev/null || groupadd -r pdns | |
260 | getent passwd pdns >/dev/null || \ | |
fac31e76 MS |
261 | useradd -r -g pdns -d /var/lib/pdns -s /sbin/nologin \ |
262 | -c "PowerDNS Authoritative Server" pdns | |
263 | # Change home directory to /var/lib/pdns | |
264 | if [[ $(getent passwd pdns | cut -d: -f6) == "/" ]]; then | |
265 | usermod -d /var/lib/pdns pdns | |
266 | fi | |
968e651b PL |
267 | exit 0 |
268 | ||
593eb1e6 PL |
269 | %if 0%{?rhel} >= 7 |
270 | if [ "`stat -c '%U:%G' %{_sysconfdir}/%{name}`" = "root:root" ]; then | |
271 | chown -R root:pdns /etc/powerdns | |
272 | # Make sure that pdns can read it; the default used to be 0600 | |
273 | chmod g+r /etc/powerdns/pdns.conf | |
274 | fi | |
275 | chown -R pdns:pdns /var/lib/powerdns || : | |
276 | %endif | |
277 | ||
968e651b | 278 | %post |
b5179dca | 279 | systemctl daemon-reload ||: |
968e651b | 280 | %systemd_post pdns.service |
968e651b PL |
281 | |
282 | %preun | |
968e651b | 283 | %systemd_preun pdns.service |
968e651b PL |
284 | |
285 | %postun | |
968e651b | 286 | %systemd_postun_with_restart pdns.service |
968e651b PL |
287 | |
288 | %files | |
bce81446 | 289 | %doc COPYING README |
41d10782 | 290 | %doc pdns/bind-dnssec.4.2.0_to_4.3.0_schema.sqlite3.sql pdns/bind-dnssec.schema.sqlite3.sql |
bce81446 PL |
291 | %config(noreplace) %{_sysconfdir}/%{name}/pdns.conf |
292 | %dir %{_libdir}/%{name}/ | |
fac31e76 | 293 | %dir %attr(-,pdns,pdns) %{_sharedstatedir}/%{name} |
bce81446 | 294 | %{_bindir}/pdns-zone2ldap |
968e651b PL |
295 | %{_bindir}/pdns_control |
296 | %{_bindir}/pdnsutil | |
968e651b | 297 | %{_bindir}/zone2json |
bce81446 | 298 | %{_bindir}/zone2sql |
968e651b | 299 | %{_libdir}/%{name}/libbindbackend.so |
bce81446 | 300 | %{_mandir}/man1/pdns-zone2ldap.1.gz |
968e651b PL |
301 | %{_mandir}/man1/pdns_control.1.gz |
302 | %{_mandir}/man1/pdns_server.1.gz | |
968e651b | 303 | %{_mandir}/man1/pdnsutil.1.gz |
bce81446 PL |
304 | %{_mandir}/man1/zone2json.1.gz |
305 | %{_mandir}/man1/zone2sql.1.gz | |
306 | %{_sbindir}/pdns_server | |
968e651b PL |
307 | %{_unitdir}/pdns.service |
308 | %{_unitdir}/pdns@.service | |
968e651b PL |
309 | |
310 | %files tools | |
311 | %{_bindir}/calidns | |
bce81446 | 312 | %{_bindir}/dnsbulktest |
968e651b | 313 | %{_bindir}/dnsgram |
bce81446 PL |
314 | %{_bindir}/dnspcap2calidns |
315 | %{_bindir}/dnspcap2protobuf | |
968e651b PL |
316 | %{_bindir}/dnsreplay |
317 | %{_bindir}/dnsscan | |
318 | %{_bindir}/dnsscope | |
bce81446 | 319 | %{_bindir}/dnstcpbench |
968e651b PL |
320 | %{_bindir}/dnswasher |
321 | %{_bindir}/dumresp | |
322 | %{_bindir}/ixplore | |
968e651b PL |
323 | %{_bindir}/nproxy |
324 | %{_bindir}/nsec3dig | |
bce81446 | 325 | %{_bindir}/pdns_notify |
968e651b PL |
326 | %{_bindir}/saxfr |
327 | %{_bindir}/sdig | |
328 | %{_mandir}/man1/calidns.1.gz | |
bce81446 | 329 | %{_mandir}/man1/dnsbulktest.1.gz |
968e651b | 330 | %{_mandir}/man1/dnsgram.1.gz |
bce81446 PL |
331 | %{_mandir}/man1/dnspcap2calidns.1.gz |
332 | %{_mandir}/man1/dnspcap2protobuf.1.gz | |
968e651b PL |
333 | %{_mandir}/man1/dnsreplay.1.gz |
334 | %{_mandir}/man1/dnsscan.1.gz | |
335 | %{_mandir}/man1/dnsscope.1.gz | |
bce81446 | 336 | %{_mandir}/man1/dnstcpbench.1.gz |
968e651b PL |
337 | %{_mandir}/man1/dnswasher.1.gz |
338 | %{_mandir}/man1/dumresp.1.gz | |
339 | %{_mandir}/man1/ixplore.1.gz | |
968e651b PL |
340 | %{_mandir}/man1/nproxy.1.gz |
341 | %{_mandir}/man1/nsec3dig.1.gz | |
bce81446 | 342 | %{_mandir}/man1/pdns_notify.1.gz |
968e651b PL |
343 | %{_mandir}/man1/saxfr.1.gz |
344 | %{_mandir}/man1/sdig.1.gz | |
3e862940 | 345 | |
968e651b PL |
346 | %files backend-mysql |
347 | %doc modules/gmysqlbackend/schema.mysql.sql | |
348 | %doc modules/gmysqlbackend/dnssec-3.x_to_3.4.0_schema.mysql.sql | |
349 | %doc modules/gmysqlbackend/nodnssec-3.x_to_3.4.0_schema.mysql.sql | |
ce5b05d9 MN |
350 | %doc modules/gmysqlbackend/3.4.0_to_4.1.0_schema.mysql.sql |
351 | %doc modules/gmysqlbackend/4.1.0_to_4.2.0_schema.mysql.sql | |
352 | %doc modules/gmysqlbackend/4.2.0_to_4.3.0_schema.mysql.sql | |
20ad6428 | 353 | %doc modules/gmysqlbackend/4.3.0_to_4.7.0_schema.mysql.sql |
96d5d109 | 354 | %doc modules/gmysqlbackend/enable-foreign-keys.mysql.sql |
968e651b PL |
355 | %{_libdir}/%{name}/libgmysqlbackend.so |
356 | ||
357 | %files backend-postgresql | |
358 | %doc modules/gpgsqlbackend/schema.pgsql.sql | |
359 | %doc modules/gpgsqlbackend/dnssec-3.x_to_3.4.0_schema.pgsql.sql | |
360 | %doc modules/gpgsqlbackend/nodnssec-3.x_to_3.4.0_schema.pgsql.sql | |
ce5b05d9 MN |
361 | %doc modules/gpgsqlbackend/3.4.0_to_4.1.0_schema.pgsql.sql |
362 | %doc modules/gpgsqlbackend/4.1.0_to_4.2.0_schema.pgsql.sql | |
363 | %doc modules/gpgsqlbackend/4.2.0_to_4.3.0_schema.pgsql.sql | |
20ad6428 | 364 | %doc modules/gpgsqlbackend/4.3.0_to_4.7.0_schema.pgsql.sql |
968e651b PL |
365 | %{_libdir}/%{name}/libgpgsqlbackend.so |
366 | ||
367 | %files backend-pipe | |
368 | %{_libdir}/%{name}/libpipebackend.so | |
369 | ||
370 | %files backend-remote | |
371 | %{_libdir}/%{name}/libremotebackend.so | |
372 | ||
373 | %files backend-ldap | |
374 | %{_libdir}/%{name}/libldapbackend.so | |
375 | ||
376 | %doc modules/ldapbackend/dnsdomain2.schema | |
377 | %doc modules/ldapbackend/pdns-domaininfo.schema | |
378 | ||
578ed45d PL |
379 | %files backend-lua2 |
380 | %{_libdir}/%{name}/liblua2backend.so | |
381 | ||
968e651b PL |
382 | %files backend-sqlite |
383 | %doc modules/gsqlite3backend/schema.sqlite3.sql | |
384 | %doc modules/gsqlite3backend/dnssec-3.x_to_3.4.0_schema.sqlite3.sql | |
385 | %doc modules/gsqlite3backend/nodnssec-3.x_to_3.4.0_schema.sqlite3.sql | |
ce5b05d9 MN |
386 | %doc modules/gsqlite3backend/3.4.0_to_4.0.0_schema.sqlite3.sql |
387 | %doc modules/gsqlite3backend/4.0.0_to_4.2.0_schema.sqlite3.sql | |
388 | %doc modules/gsqlite3backend/4.2.0_to_4.3.0_schema.sqlite3.sql | |
7c9d0206 | 389 | %doc modules/gsqlite3backend/4.3.0_to_4.3.1_schema.sqlite3.sql |
20ad6428 | 390 | %doc modules/gsqlite3backend/4.3.1_to_4.7.0_schema.sqlite3.sql |
968e651b PL |
391 | %{_libdir}/%{name}/libgsqlite3backend.so |
392 | ||
968e651b PL |
393 | %files backend-odbc |
394 | %doc modules/godbcbackend/schema.mssql.sql | |
ce5b05d9 MN |
395 | %doc modules/godbcbackend/4.0.0_to_4.2.0_schema.mssql.sql |
396 | %doc modules/godbcbackend/4.2.0_to_4.3.0_schema.mssql.sql | |
20ad6428 | 397 | %doc modules/godbcbackend/4.3.0_to_4.7.0_schema.mssql.sql |
968e651b PL |
398 | %{_libdir}/%{name}/libgodbcbackend.so |
399 | ||
400 | %files backend-geoip | |
401 | %{_libdir}/%{name}/libgeoipbackend.so | |
402 | ||
d0d9195b PL |
403 | %files backend-lmdb |
404 | %{_libdir}/%{name}/liblmdbbackend.so | |
405 | ||
968e651b PL |
406 | %files backend-tinydns |
407 | %{_libdir}/%{name}/libtinydnsbackend.so | |
17477d10 | 408 | |
d72871c6 | 409 | %if 0%{?amzn} != 2 |
17477d10 PL |
410 | %files ixfrdist |
411 | %{_bindir}/ixfrdist | |
412 | %{_mandir}/man1/ixfrdist.1.gz | |
413 | %{_mandir}/man5/ixfrdist.yml.5.gz | |
414 | %{_sysconfdir}/%{name}/ixfrdist.example.yml | |
415 | %{_unitdir}/ixfrdist.service | |
416 | %{_unitdir}/ixfrdist@.service | |
42bc9fae | 417 | %endif |