1 |
# use fakeroot -ba sudo.spec to build! |
2 |
|
3 |
Name: sudo |
4 |
Version: 1.8.0 |
5 |
Release: %mkrel 2 |
6 |
Epoch: 1 |
7 |
Summary: Allows command execution as root for specified users |
8 |
License: GPLv2+ |
9 |
Group: System/Base |
10 |
URL: http://www.sudo.ws/sudo |
11 |
Source0: http://www.sudo.ws/sudo/dist/%name-%version%{?pre}.tar.gz |
12 |
Source1: http://www.sudo.ws/sudo/dist/%name-%version%{?pre}.tar.gz.sig |
13 |
Source2: sudo.pamd |
14 |
Source3: sudo-1.7.2p2-sudoers |
15 |
Patch1: sudo-1.6.7p5-strip.patch |
16 |
Patch2: sudo-1.7.2p1-envdebug.patch |
17 |
Patch3: sudo-1.7.4p3-m4path.patch |
18 |
# http://www.sudo.ws/repos/sudo/rev/172f29597bd2 |
19 |
Patch4: sudo-1.8.0-fix-n-option.patch |
20 |
# http://www.sudo.ws/repos/sudo/rev/4a05d6019b3d |
21 |
Patch5: sudo-1.8.0-fix-l-return-status.patch |
22 |
BuildRequires: audit-devel |
23 |
BuildRequires: bison |
24 |
BuildRequires: groff-for-man |
25 |
BuildRequires: libcap-devel |
26 |
BuildRequires: openldap-devel |
27 |
BuildRequires: pam-devel |
28 |
Requires(pre): openldap |
29 |
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root |
30 |
|
31 |
%description |
32 |
Sudo is a program designed to allow a sysadmin to give limited root |
33 |
privileges to users and log root activity. The basic philosophy is |
34 |
to give as few privileges as possible but still allow people to get |
35 |
their work done. |
36 |
|
37 |
%package devel |
38 |
Summary: Development files for sudo plugins |
39 |
Group: Development/C |
40 |
Requires: %{name} = %{version}-%{release} |
41 |
|
42 |
%description devel |
43 |
Development files for compiling sudo plugins. |
44 |
|
45 |
%prep |
46 |
|
47 |
%setup -q -n %{name}-%{version}%{?pre} |
48 |
%patch1 -p1 -b .strip |
49 |
%patch2 -p1 -b .envdebug |
50 |
%patch3 -p1 -b .m4path |
51 |
%patch4 -p0 -b .fix-n-option |
52 |
%patch5 -p1 -b .fix-l-return-status |
53 |
|
54 |
%build |
55 |
# handle newer autoconf |
56 |
rm -f acsite.m4 |
57 |
mv aclocal.m4 acinclude.m4 |
58 |
autoreconf -fv --install |
59 |
|
60 |
%serverbuild |
61 |
export CFLAGS="%{optflags} -D_GNU_SOURCE" |
62 |
|
63 |
%configure2_5x \ |
64 |
--without-rpath \ |
65 |
--with-logging=both \ |
66 |
--with-logfac=authpriv \ |
67 |
--with-logpath=%{_logdir}/sudo.log \ |
68 |
--with-editor=/bin/vi \ |
69 |
--enable-log-host \ |
70 |
--with-pam \ |
71 |
--with-pam-login \ |
72 |
--with-env-editor \ |
73 |
--with-noexec=no \ |
74 |
--with-linux-audit \ |
75 |
--with-ignore-dot \ |
76 |
--with-tty-tickets \ |
77 |
--with-ldap \ |
78 |
--with-ldap-conf-file=%{_sysconfdir}/ldap.conf \ |
79 |
--with-secure-path="/sbin:%{_sbindir}:/bin:%{_bindir}:/usr/local/bin:/usr/local/sbin" \ |
80 |
--with-passprompt="[sudo] password for %p: " |
81 |
|
82 |
%make |
83 |
|
84 |
%install |
85 |
rm -rf %{buildroot} |
86 |
|
87 |
install -d %{buildroot}/usr |
88 |
install -d %{buildroot}%{_sysconfdir}/logrotate.d |
89 |
install -d %{buildroot}%{_sysconfdir}/sudoers.d |
90 |
install -d %{buildroot}%{_sysconfdir}/pam.d |
91 |
install -d %{buildroot}%{_var}/db/sudo |
92 |
install -d %{buildroot}%{_logdir}/sudo |
93 |
install -d %{buildroot}%{_logdir}/sudo-io |
94 |
|
95 |
%makeinstall_std install_uid=$UID install_gid=$(id -g) sudoers=uid=$UID sudoers_gid=$(id -g) |
96 |
|
97 |
install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/sudo |
98 |
install -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers |
99 |
install -m0755 plugins/sudoers/sudoers2ldif %{buildroot}%{_bindir} |
100 |
|
101 |
# Installing logrotated file |
102 |
cat <<END >%{buildroot}%{_sysconfdir}/logrotate.d/sudo |
103 |
%{_logdir}/sudo.log { |
104 |
missingok |
105 |
monthly |
106 |
compress |
107 |
} |
108 |
END |
109 |
|
110 |
cat > %{buildroot}%{_sysconfdir}/pam.d/sudo << EOF |
111 |
#%PAM-1.0 |
112 |
auth include system-auth |
113 |
account include system-auth |
114 |
password include system-auth |
115 |
session optional pam_keyinit.so revoke |
116 |
session required pam_limits.so |
117 |
EOF |
118 |
|
119 |
cat > %{buildroot}%{_sysconfdir}/pam.d/sudo-i << EOF |
120 |
#%PAM-1.0 |
121 |
auth include sudo |
122 |
account include sudo |
123 |
password include sudo |
124 |
session optional pam_keyinit.so force revoke |
125 |
session required pam_limits.so |
126 |
EOF |
127 |
|
128 |
# so that strip can touch it... |
129 |
chmod 755 %{buildroot}%{_bindir}/* |
130 |
chmod 755 %{buildroot}%{_sbindir}/* |
131 |
|
132 |
# (tpg) create the missing log file |
133 |
touch %{buildroot}%{_logdir}/sudo.log |
134 |
|
135 |
%post |
136 |
/bin/chmod 0440 %{_sysconfdir}/sudoers || : |
137 |
%create_ghostfile %{_logdir}/sudo.log root root 600 |
138 |
|
139 |
%clean |
140 |
rm -rf %{buildroot} |
141 |
|
142 |
%files |
143 |
%defattr(-,root,root) |
144 |
%doc doc/HISTORY README README.LDAP |
145 |
%doc doc/TROUBLESHOOTING doc/UPGRADE doc/sample.sudoers |
146 |
%attr(0440,root,root) %config(noreplace) %{_sysconfdir}/sudoers |
147 |
%attr(0750,root,root) %dir %{_sysconfdir}/sudoers.d/ |
148 |
%config(noreplace) %{_sysconfdir}/logrotate.d/sudo |
149 |
%config(noreplace) %{_sysconfdir}/pam.d/sudo |
150 |
%config(noreplace) %{_sysconfdir}/pam.d/sudo-i |
151 |
%attr(0755,root,root) %{_bindir}/sudoers2ldif |
152 |
%attr(4111,root,root) %{_bindir}/sudo |
153 |
%attr(4111,root,root) %{_bindir}/sudoedit |
154 |
%attr(0111,root,root) %{_bindir}/sudoreplay |
155 |
%attr(0755,root,root) %{_sbindir}/visudo |
156 |
%ghost %{_logdir}/sudo.log |
157 |
%{_mandir}/*/* |
158 |
%attr(0700,root,root) %dir %{_var}/db/sudo |
159 |
%attr(0750,root,root) %dir %{_logdir}/sudo-io |
160 |
%{_libdir}/sudoers.so |
161 |
|
162 |
%files devel |
163 |
%defattr(-,root,root) |
164 |
%{_includedir}/sudo_plugin.h |
165 |
%{_libdir}/sudoers.la |
166 |
|