]> eyrie.org Git - kerberos/remctl.git/blob - remctl.spec
Ignore ignored attributes for Ruby
[kerberos/remctl.git] / remctl.spec
1 # RPM spec file for remctl.
2 #
3 # Written by Russ Allbery <eagle@eyrie.org>
4 # Improvements by Thomas Kula and Darren Patterson
5 # Copyright 2018, 2020, 2022 Russ Allbery <eagle@eyrie.org>
6 # Copyright 2006-2007, 2012-2013
7 #     The Board of Trustees of the Leland Stanford Junior University
8 #
9 # SPDX-License-Identifier: MIT
10
11 %if 0%{?sles_version:1}
12 %define relsuffix sles%{sles_version}
13 %if %{sles_version} >= 12
14 %define with_systemd 1
15 %endif
16 %else
17 %define rel %(cat /etc/redhat-release | cut -d ' ' -f 7 | cut -d'.' -f1)
18 %define relsuffix EL%{rel}
19 %if %{rel} >= 7
20 %define with_systemd 1
21 %endif
22 %endif
23
24 # this is needed for Stanford packaging automation
25 %define vers 3.18
26
27 # Use rpmbuild option "--define 'buildperl 0'" to not build the Perl module.
28 %{!?buildperl:%define buildperl 1}
29 # Use rpmbuild option "--define 'buildperl 0'" to not build the php bindings.
30 %{!?buildphp:%define buildphp 1}
31 # Use rpmbuild option "--define 'buildperl 0'" to not build the ruby bindings.
32 %{!?buildruby:%define buildruby 1}
33
34 # Use rpmbuild option "--define 'buildpython 0'" to not build the Python module.
35 %{!?buildpython:%define buildpython 1}
36 %if %{buildpython}
37 %define py_version %(python -c "from distutils.sysconfig import get_python_version; print(get_python_version())" )
38 %define py_libdest %(python -c "from distutils.sysconfig import get_config_vars; print(get_config_vars()[ 'LIBDEST' ])")
39 %define py_binlibdest %(python -c "from distutils.sysconfig import get_config_vars; print(get_config_vars()[ 'BINLIBDEST' ])")
40 %endif
41
42 Name: remctl
43 Summary: Client/server for Kerberos-authenticated command execution
44 Version: %{vers}
45 Release: 1.%{relsuffix}
46 %if 0%{?rel} >= 4 || 0%{?sles_version:1}
47 License: MIT
48 %else
49 Copyright: MIT
50 %endif
51 URL: https://www.eyrie.org/~eagle/software/remctl/
52 Source: https://archives.eyrie.org/software/kerberos/%{name}-%{version}.tar.gz
53 Group: System Environment/Daemons
54 Vendor: Stanford University
55 Packager: Russ Allbery <eagle@eyrie.org>
56 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
57 BuildRequires: krb5-devel, libgcrypt, libevent-devel
58 %if %{buildperl}
59 BuildRequires: perl(Module::Build)
60 %endif
61 %if %{buildpython}
62 BuildRequires: python-devel, python
63 %endif
64 %if %{buildphp}
65 BuildRequires: php-devel
66 %endif
67 %if %{buildruby}
68 BuildRequires: ruby, ruby-devel
69 %endif
70 %if 0%{?sles_version:1}
71 %if 0%{?with_systemd:1}
72 BuildRequires: systemd-rpm-macros
73 %endif
74 Distribution: SUSE Linux Enterprise %{sles_version}
75 %else
76 %if 0%{?with_systemd:1}
77 BuildRequires: systemd-units
78 %endif
79 Distribution: EL
80 %endif
81
82 %ifarch i386
83 BuildArch: i686
84 %endif
85
86 %if %{buildphp}
87 # RHEL 5/6 compatibility for PHP
88 %if 0%{?rel} == 5
89 %global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
90 %{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}}
91 %endif
92 %if 0%{?rel} == 5 || 0%{?rel} == 6
93 %{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d }}
94 %endif
95 %endif
96
97 %if %{buildpython}
98 # RHEL 5 compatibility for Python
99 %if 0%{?rel} == 5
100 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
101 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
102 %endif
103 %endif
104
105 %if %{buildruby}
106 # RHEL 5/6 compatibility for Ruby
107 %if 0%{?rel} == 5
108 %{!?ruby_vendorarchdir: %global ruby_vendorarchdir %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')}
109 %endif
110 %if 0%{?rel} == 6
111 %{!?ruby_vendorarchdir: %global ruby_vendorarchdir %(ruby -rrbconfig -e 'puts Config::CONFIG["vendorarchdir"] ')}
112 %endif
113 %endif
114
115
116 %description
117 remctl is a client/server protocol for executing specific commands on a
118 remote system with Kerberos authentication.  The allowable commands must
119 be listed in a server configuration file, and the executable run on the
120 server may be mapped to any command name.  Each command is also associated
121 with an ACL containing a list of Kerberos principals authorized to run
122 that command.
123
124 %package server
125 Summary: Server for Kerberos-authenticated command execution
126 Group: System Environment/Daemons
127 %{?systemd_requires}
128
129 %description server
130 remctl is a client/server protocol for executing specific commands on a
131 remote system with Kerberos authentication.  The allowable commands must
132 be listed in a server configuration file, and the executable run on the
133 server may be mapped to any command name.  Each command is also associated
134 with an ACL containing a list of Kerberos principals authorized to run
135 that command.
136
137 This package contains the server (remctld).
138
139 %package devel
140 Summary: Development files for remctl
141 Group: Applications/Internet
142 Requires: %{name}-client = %{version}-%{release}
143
144 %description devel
145 remctl is a client/server protocol for executing specific commands on a
146 remote system with Kerberos authentication.  The allowable commands must
147 be listed in a server configuration file, and the executable run on the
148 server may be mapped to any command name.  Each command is also associated
149 with an ACL containing a list of Kerberos principals authorized to run
150 that command.
151
152 This package contains the development files.
153
154 %package client
155 Summary: Client for Kerberos-authenticated command execution
156 Group: Applications/Internet
157
158 %description client
159 remctl is a client/server protocol for executing specific commands on a
160 remote system with Kerberos authentication.  The allowable commands must
161 be listed in a server configuration file, and the executable run on the
162 server may be mapped to any command name.  Each command is also associated
163 with an ACL containing a list of Kerberos principals authorized to run
164 that command.
165
166 This package contains the client program (remctl) and the client libraries.
167
168 %if %{buildphp}
169 %package php
170 Summary: PHP interface to remctl
171 Group: Development/Libraries
172 Requires: %{name}-client = %{version}-%{release}
173 %if 0%{?rel} == 5
174 Requires:     php-api = %{php_apiver}
175 %else
176 Requires:     php(zend-abi) = %{php_zend_api}
177 Requires:     php(api) = %{php_core_api}
178 %endif
179
180 %description php
181 remctl is a client/server protocol for executing specific commands on a
182 remote system with Kerberos authentication.  The allowable commands must
183 be listed in a server configuration file, and the executable run on the
184 server may be mapped to any command name.  Each command is also associated
185 with an ACL containing a list of Kerberos principals authorized to run
186 that command.
187
188 This package contains the PHP remctl client library.
189 %endif
190
191 %if %{buildpython}
192 %package python
193 Summary: Python library for Kerberos-authenticated command execution
194 Group: Applications/Internet
195 Requires: %{name}-client = %{version}-%{release}
196
197 %description python
198 remctl is a client/server protocol for executing specific commands on a
199 remote system with Kerberos authentication.  The allowable commands must
200 be listed in a server configuration file, and the executable run on the
201 server may be mapped to any command name.  Each command is also associated
202 with an ACL containing a list of Kerberos principals authorized to run
203 that command.
204
205 This package contains the Python remctl client library.
206 %endif
207
208 %if %{buildruby}
209 %package ruby
210 Summary: Ruby interface to remctl
211 Group: Development/Libraries
212 Requires: %{name}-client = %{version}-%{release}
213 %if 0%{?rel} <= 6
214 Requires: ruby(abi) = 1.8
215 %else
216 Requires: ruby(abi) = 1.9.1
217 %endif
218 Provides: ruby(remctl) = %{version}-%{release}
219
220 %description ruby
221 remctl is a client/server protocol for executing specific commands on a
222 remote system with Kerberos authentication.  The allowable commands must
223 be listed in a server configuration file, and the executable run on the
224 server may be mapped to any command name.  Each command is also associated
225 with an ACL containing a list of Kerberos principals authorized to run
226 that command.
227
228 This package contains the Ruby remctl client library.
229 %endif
230
231 %if %{buildperl}
232 %package perl
233 Summary: Perl library for Kerberos-authenticated command execution
234 Group: Applications/Internet
235 %if 0%{?sles_version:1} == 0
236 Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
237 %endif
238 Requires: %{name}-client = %{version}-%{release}
239
240 %description perl
241 remctl is a client/server protocol for executing specific commands on a
242 remote system with Kerberos authentication.  The allowable commands must
243 be listed in a server configuration file, and the executable run on the
244 server may be mapped to any command name.  Each command is also associated
245 with an ACL containing a list of Kerberos principals authorized to run
246 that command.
247
248 This package contains the Perl remctl client library.
249 %endif
250
251 %prep
252 %setup -q -n remctl-%{version}
253
254 %build
255 options="--disable-static --libdir=%{_libdir} --sysconfdir=/etc/remctl"
256 %if %{buildruby}
257 options="$options --enable-ruby"
258 %endif
259 %if %{buildphp}
260 options="$options --enable-php"
261 %endif
262 %if %{buildperl}
263 options="$options --enable-perl"
264 %endif
265 %if %{buildpython}
266 options="$options --enable-python"
267 %endif
268 %if %{buildperl}
269 export PATH="/usr/kerberos/bin:/sbin:/bin:/usr/sbin:$PATH"
270 export REMCTL_PERL_FLAGS="--installdirs=vendor"
271 %if 0%{?rel} >= 6
272 export REMCTL_PERL_FLAGS="$REMCTL_PERL_FLAGS --prefix=/usr"
273 %endif
274 %endif
275 %configure $options
276 %{__make}
277
278 %install
279 %{__rm} -rf %{buildroot}
280 options=''
281 %if %{buildruby}
282 options="$options RUBYARCHDIR=%{buildroot}%{ruby_vendorarchdir}"
283 %endif
284 make install DESTDIR=%{buildroot} INSTALL="install -p" \
285     INSTALLDIRS=vendor $options
286 %if !0%{?with_systemd:1}
287 mkdir -p %{buildroot}/etc/xinetd.d
288 install -c -m 0644 examples/xinetd %{buildroot}/etc/xinetd.d/remctl
289 %endif
290 mkdir -p %{buildroot}/etc/remctl/acl
291 mkdir -p %{buildroot}/etc/remctl/conf.d
292 mkdir -p %{buildroot}/usr/share/doc/remctl-{server,client}-%{vers}
293 chmod 755 %{buildroot}/usr/share/doc/remctl-{server,client}-%{vers}
294 install -c -m 0644 examples/remctl.conf %{buildroot}/etc/remctl/remctl.conf
295 %if %{buildperl}
296 find %{buildroot} -type f -name perllocal.pod -exec rm -f {} \;
297 find %{buildroot} -type f -name .packlist -exec rm -f {} \;
298 find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \;
299 find %{buildroot} -type f -name Remctl.so -exec chmod 755 {} \;
300 mkdir -p %{buildroot}/usr/share/doc/remctl-perl-%{vers}
301 chmod 755 %{buildroot}/usr/share/doc/remctl-perl-%{vers}
302 %endif
303 %if %{buildpython}
304 mkdir -p %{buildroot}/usr/share/doc/remctl-python-%{vers}
305 chmod 755 %{buildroot}/usr/share/doc/remctl-python-%{vers}
306 find %{buildroot} -name _remctl.so -exec chmod 755 {} \;
307 %endif
308 %if %{buildruby}
309 mkdir -p %{buildroot}/usr/share/doc/remctl-ruby-%{vers}
310 chmod 755 %{buildroot}/usr/share/doc/remctl-ruby-%{vers}
311 %endif
312 %if %{buildphp}
313 mkdir -p %{buildroot}/usr/share/doc/remctl-php-%{vers}
314 chmod 755 %{buildroot}/usr/share/doc/remctl-php-%{vers}
315 # PHP configuration
316 mkdir -p %{buildroot}%{php_inidir}
317 install -m 0644 -p php/remctl.ini %{buildroot}%{php_inidir}
318 %endif
319 %if 0%{?sles_version:1}
320 mkdir -p %{buildroot}/etc/sysconfig/SuSEfirewall2.d/services
321 cat <<EOF >%{buildroot}/etc/sysconfig/SuSEfirewall2.d/services/remctld
322 ## Name: Remctl Server
323 ## Description: Open ports for Kerberos-authenticated command execution
324
325 TCP="remctl"
326 EOF
327 %endif
328
329 %files devel
330 %defattr(-, root, root)
331 /usr/include/remctl.h
332 %doc %{_mandir}/man3/remctl*
333 %{_libdir}/pkgconfig/libremctl.pc
334
335 %files client
336 %defattr(-, root, root)
337 %{_bindir}/*
338 %doc NEWS README TODO
339 %{_libdir}/libremctl.la
340 %{_libdir}/libremctl.so
341 %{_libdir}/libremctl.so.*
342 %doc %{_mandir}/man1/remctl.*
343
344 %files server
345 %defattr(-, root, root)
346 %dir /etc/remctl
347 %{_sbindir}/*
348 %doc NEWS README TODO
349 %doc %{_mandir}/*/remctld.*
350 %if !0%{?with_systemd:1}
351 %config /etc/xinetd.d/remctl
352 %endif
353 %config(noreplace) /etc/remctl/remctl.conf
354 %dir /etc/remctl/acl/
355 %dir /etc/remctl/conf.d/
356 %if 0%{?sles_version:1}
357 /etc/sysconfig/SuSEfirewall2.d/services/remctld
358 %endif
359 %if 0%{?with_systemd:1}
360 %{_unitdir}/remctld.service
361 %{_unitdir}/remctld.socket
362 %endif
363
364 %if %{buildpython}
365 %files python
366 %defattr(-, root, root)
367 %{python_sitearch}/_remctl.so
368 %{python_sitearch}/remctl.py*
369 %if 0%{?rel} != 5
370 %{python_sitearch}/pyremctl-%{version}-*.egg-info
371 %endif
372 %doc NEWS TODO
373 %doc python/README
374 %endif
375
376 %if %{buildperl}
377 %files perl
378 %defattr(-,root,root,-)
379 %{perl_vendorarch}/Net
380 %{perl_vendorarch}/auto/Net
381 %doc %{_mandir}/man3/Net::Remctl*
382 %doc NEWS TODO
383 %endif
384
385 %if %{buildphp}
386 %files php
387 %defattr(-,root,root,-)
388 %doc NEWS TODO
389 %doc php/README
390 %{php_extdir}/remctl.so
391 %config(noreplace) %{php_inidir}/remctl.ini
392 %endif
393
394 %if %{buildruby}
395 %defattr(-,root,root,-)
396 %files ruby
397 %defattr(-,root,root,-)
398 %doc NEWS TODO
399 %doc ruby/README
400 %{ruby_vendorarchdir}/remctl.so
401 %endif
402
403 %if 0%{?with_systemd:1} && 0%{?rel:1}
404 %preun server
405 %systemd_preun remctld.service
406 %endif
407 %if 0%{?with_systemd:1} && 0%{?sles_version:1}
408 %pre server
409 %service_add_pre remctld.service
410 %preun server
411 %service_del_preun remctld.service
412 %endif
413
414 %post client -p /sbin/ldconfig
415
416 %post server 
417 # If this is the first remctl install, add remctl to /etc/services and
418 # restart xinetd to pick up its new configuration.
419 if [ "$1" = 1 ] ; then
420     if grep -q '^remctl' /etc/services ; then
421         :
422     else
423         echo 'remctl    4373/tcp' >> /etc/services
424     fi
425 %if !0%{?with_systemd:1}
426     if [ -f /var/run/xinetd.pid ] ; then
427         kill -HUP `cat /var/run/xinetd.pid`
428     fi
429 %endif
430 fi
431 %if 0%{?with_systemd:1} && 0%{?rel:1}
432 %systemd_post remctld.service
433 %endif
434 %if 0%{?with_systemd:1} && 0%{?sles_version:1}
435 %service_add_post remctld.service
436 %endif
437
438 %postun client -p /sbin/ldconfig
439
440 %postun server
441 # If we're the last remctl package, remove the /etc/services line and
442 # restart xinetd to reflect its new configuration.
443 if [ "$1" = 0 ] ; then
444     if [ ! -f /usr/sbin/remctld ] ; then
445         if grep -q "^remctl" /etc/services ; then
446             grep -v "^remctl" /etc/services > /etc/services.tmp
447             mv -f /etc/services.tmp /etc/services
448         fi
449 %if !0%{?with_systemd:1}
450         if [ -f /var/run/xinetd.pid ] ; then
451             kill -HUP `cat /var/run/xinetd.pid`
452         fi
453 %endif
454     fi
455 fi
456 %if 0%{?with_systemd:1} && 0%{?rel:1}
457 %systemd_postun_with_restart remctld.service
458 %endif
459 %if 0%{?with_systemd:1} && 0%{?sles_version:1}
460 %service_del_postun remctld.service
461 %endif
462
463
464 %clean
465 %{__rm} -rf %{buildroot}
466
467 %changelog
468 * Sun May 8 2022 Russ Allbery <eagle@eyrie.org> 3.18-1
469 - update to 3.18
470
471 * Sun Dec 13 2020 Russ Allbery <eagle@eyrie.org> 3.17-1
472 - update to 3.17
473
474 * Sat May 5 2018 Russ Allbery <eagle@eyrie.org> 3.15-1
475 - update to 3.15
476
477 * Sat Mar 31 2018 Russ Allbery <eagle@eyrie.org> 3.14-1
478 - update to 3.14
479
480 * Sat May 7 2016 Russ Allbery <eagle@eyrie.org> 3.11-1
481 - update to 3.11
482 - add systemd support
483 - support SLES
484 - add libevent dependency
485
486 * Thu Apr 11 2013 Darren Patterson <darrenp1@stanford.edu> 3.4-1
487 - update to 3.4, and merged some changes from ktdreyer in EPEL spec
488 - split out perl, php, ruby
489
490 * Tue Jul 17 2012 Darren Patterson <darrenp1@stanford.edu> 3.2-2
491 - spec fixes for build issues around perl and lib dirs
492 - move perl to vendor_perl on EL6
493 - re-add missing devel package
494 - change arch to i686 from i386 (if 32bit build)
495 - added missing/required doc to python package
496 - general cleanup for rpmlint
497
498 * Tue Jun 19 2012 Russ Allbery <eagle@eyrie.org> 3.2-1
499 * Update for 3.2.
500
501 * Thu Feb 23 2012 Russ Allbery <eagle@eyrie.org> 3.1-1
502 - Update for 3.1.
503
504 * Wed Feb 15 2012 Thomas L. Kula <tlk2126@columbia.edu> 3.0-1
505 - Update for 3.0
506 - Add support for Python bindings, building as a sub-package
507
508 * Sun May 2 2010 Russ Allbery <eagle@eyrie.org> 2.16-1
509 - Update for 2.16.
510 - Ruby bindings also not yet supported.
511
512 * Fri Nov 14 2008 Russ Allbery <eagle@eyrie.org> 2.13-1
513 - Update for 2.13.
514 - PHP and Python bindings not yet supported.
515
516 * Fri Apr 4 2008 Russ Allbery <eagle@eyrie.org> 2.12-1
517 - Update for 2.12.
518
519 * Fri Nov 9 2007 Russ Allbery <eagle@eyrie.org> 2.11-1
520 - Update for 2.11.
521 - Change port configuration to 4373.
522
523 * Sun Aug 26 2007 Russ Allbery <eagle@eyrie.org> 2.10-1
524 - Update for 2.10.
525 - Incorporate changes by Darren Patterson to install the Perl module.
526
527 * Sun Mar 25 2007 Russ Allbery <eagle@eyrie.org> 2.7-1
528 - Update for 2.7.
529
530 * Sat Feb 3 2007 Russ Allbery <eagle@eyrie.org> 2.6-1
531 - Update for 2.6.
532
533 * Sat Feb 3 2007 Russ Allbery <eagle@eyrie.org> 2.5-1
534 - Update for 2.5.
535 - Incorporate changes by Darren Patterson to split into subpackages for
536   client and server and remove krb5-workstation requirement.
537
538 * Wed Jan 17 2007 Russ Allbery <eagle@eyrie.org> 2.4-1
539 - Update for 2.4.
540 - Changed permissions on the ACL directory to allow any user read.
541 - Added fix for /usr/lib64 directory on x86_64.
542
543 * Tue Aug 22 2006 Russ Allbery <eagle@eyrie.org> 2.1-1
544 - Update for 2.1.
545 - Incorporate changes by Digant Kasundra and Darren Patterson to the
546   Stanford-local RPM spec file, including looking for libraries in the
547   correct path, creating the /etc/remctl structure, running ldconfig,
548   and handling library installation properly.
549 - Build remctl to look in /etc/remctl/remctl.conf for its config.
550 - Install the examples/remctl.conf file as /etc/remctl/remctl.conf.
551
552 * Mon Aug  7 2006 Russ Allbery <eagle@eyrie.org> 2.0-1
553 - New upstream release that now provides a library as well.
554 - Add TODO to documentation files.
555
556 * Fri Mar 24 2006 Russ Allbery <eagle@eyrie.org> 1.12-3
557 - Lots of modifications based on the contributed kstart spec file.
558 - Use more internal RPM variables.
559 - Borrow the description from the Debian packages.
560
561 * Sun Feb 19 2006 Digant C Kasundra <digant@stanford.edu> 1.12-2
562 - Initial version.