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