1 |
# use fakeroot -ba sudo.spec to build! |
2 |
|
3 |
Name: sudo |
4 |
Version: 1.8.12 |
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.8.12-sudo_util-linking.patch |
18 |
Patch4: sudo-1.8.12-crypt-null.patch |
19 |
BuildRequires: audit-devel |
20 |
BuildRequires: bison |
21 |
BuildRequires: groff-for-man |
22 |
BuildRequires: libcap-devel |
23 |
BuildRequires: openldap-devel |
24 |
BuildRequires: pam-devel |
25 |
Requires(pre): openldap |
26 |
|
27 |
%description |
28 |
Sudo (superuser do) allows a system administrator to give certain users (or |
29 |
groups of users) the ability to run some (or all) commands as root while |
30 |
logging all commands and arguments. Sudo operates on a per-command basis. |
31 |
It is not a replacement for the shell. Features include: the ability to |
32 |
restrict what commands a user may run on a per-host basis, copious logging |
33 |
of each command (providing a clear audit trail of who did what), a |
34 |
configurable timeout of the sudo command, and the ability to use the same |
35 |
configuration file (sudoers) on many different machines. |
36 |
|
37 |
%package devel |
38 |
Summary: Development files for sudo plugins |
39 |
Group: Development/C |
40 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
41 |
|
42 |
%description devel |
43 |
Development files for compiling sudo plugins. |
44 |
|
45 |
%prep |
46 |
%setup -q -n %{name}-%{version}%{?pre} |
47 |
%patch1 -p1 -b .strip |
48 |
%patch2 -p1 -b .envdebug |
49 |
%patch3 -p1 -b .linking |
50 |
%patch4 -p1 -b .crypt |
51 |
|
52 |
# fix attribs |
53 |
find -name "Makefile.*" | xargs perl -pi -e "s|-m 0444|-m 0644|g" |
54 |
|
55 |
|
56 |
%build |
57 |
# handle newer autoconf |
58 |
rm -f acsite.m4 |
59 |
mv aclocal.m4 acinclude.m4 |
60 |
autoreconf -fv --install |
61 |
|
62 |
%serverbuild |
63 |
export CFLAGS="%{optflags} -D_GNU_SOURCE" |
64 |
|
65 |
%configure2_5x \ |
66 |
--without-rpath \ |
67 |
--with-logging=both \ |
68 |
--with-logfac=authpriv \ |
69 |
--with-logpath=%{_logdir}/sudo.log \ |
70 |
--with-editor=/bin/vi \ |
71 |
--enable-log-host \ |
72 |
--with-pam \ |
73 |
--with-pam-login \ |
74 |
--with-env-editor \ |
75 |
--with-noexec=no \ |
76 |
--with-linux-audit \ |
77 |
--with-ignore-dot \ |
78 |
--with-tty-tickets \ |
79 |
--with-ldap \ |
80 |
--with-ldap-conf-file=%{_sysconfdir}/ldap.conf \ |
81 |
--with-secure-path="/sbin:%{_sbindir}:/bin:%{_bindir}:/usr/local/bin:/usr/local/sbin" \ |
82 |
--with-passprompt="[sudo] password for %p: " \ |
83 |
--with-plugindir=%{_libdir}/sudo |
84 |
|
85 |
%make |
86 |
|
87 |
%install |
88 |
install -d %{buildroot}/usr |
89 |
install -d %{buildroot}%{_sysconfdir}/logrotate.d |
90 |
install -d %{buildroot}%{_sysconfdir}/sudoers.d |
91 |
install -d %{buildroot}%{_sysconfdir}/pam.d |
92 |
install -d %{buildroot}%{_var}/db/sudo |
93 |
install -d %{buildroot}%{_logdir}/sudo |
94 |
install -d %{buildroot}%{_logdir}/sudo-io |
95 |
|
96 |
%makeinstall_std install_uid=$UID install_gid=$(id -g) sudoers=uid=$UID sudoers_gid=$(id -g) |
97 |
|
98 |
install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/sudo |
99 |
install -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers |
100 |
install -m0755 plugins/sudoers/sudoers2ldif %{buildroot}%{_bindir} |
101 |
|
102 |
# Installing logrotated file |
103 |
cat <<END >%{buildroot}%{_sysconfdir}/logrotate.d/sudo |
104 |
%{_logdir}/sudo.log { |
105 |
missingok |
106 |
monthly |
107 |
compress |
108 |
} |
109 |
END |
110 |
|
111 |
cat > %{buildroot}%{_sysconfdir}/pam.d/sudo << EOF |
112 |
#%PAM-1.0 |
113 |
auth include system-auth |
114 |
account include system-auth |
115 |
password include system-auth |
116 |
session optional pam_keyinit.so revoke |
117 |
session required pam_limits.so |
118 |
EOF |
119 |
|
120 |
cat > %{buildroot}%{_sysconfdir}/pam.d/sudo-i << EOF |
121 |
#%PAM-1.0 |
122 |
auth include sudo |
123 |
account include sudo |
124 |
password include sudo |
125 |
session optional pam_keyinit.so force revoke |
126 |
session required pam_limits.so |
127 |
EOF |
128 |
|
129 |
# so that strip can touch it... |
130 |
chmod 755 %{buildroot}%{_bindir}/* |
131 |
chmod 755 %{buildroot}%{_sbindir}/* |
132 |
|
133 |
# (tpg) create the missing log file |
134 |
touch %{buildroot}%{_logdir}/sudo.log |
135 |
|
136 |
# move the lib to a common place |
137 |
mv %{buildroot}%{_libexecdir}/sudo/* %{buildroot}%{_libdir}/ |
138 |
rm -rf %{buildroot}%{_libexecdir}/sudo |
139 |
|
140 |
# cleanup |
141 |
rm -rf %{buildroot}%{_datadir}/examples samples |
142 |
cp -rp examples samples |
143 |
rm -f samples/Makefile* |
144 |
|
145 |
find %{buildroot} -type f -name "*.la" | xargs rm |
146 |
|
147 |
%find_lang sudo |
148 |
%find_lang sudoers |
149 |
|
150 |
cat sudo.lang sudoers.lang > sudo_all.lang |
151 |
rm sudo.lang sudoers.lang |
152 |
|
153 |
%check |
154 |
make check |
155 |
|
156 |
%post |
157 |
/bin/chmod 0440 %{_sysconfdir}/sudoers || : |
158 |
%create_ghostfile %{_logdir}/sudo.log root root 600 |
159 |
|
160 |
%files -f sudo_all.lang |
161 |
%doc doc/HISTORY README README.LDAP samples |
162 |
%doc doc/TROUBLESHOOTING doc/UPGRADE doc/schema.* |
163 |
%attr(0440,root,root) %config(noreplace) %{_sysconfdir}/sudoers |
164 |
%attr(0750,root,root) %dir %{_sysconfdir}/sudoers.d/ |
165 |
%config(noreplace) %{_sysconfdir}/logrotate.d/sudo |
166 |
%config(noreplace) %{_sysconfdir}/pam.d/sudo |
167 |
%config(noreplace) %{_sysconfdir}/pam.d/sudo-i |
168 |
%attr(0755,root,root) %{_bindir}/sudoers2ldif |
169 |
%attr(4111,root,root) %{_bindir}/sudo |
170 |
%attr(4111,root,root) %{_bindir}/sudoedit |
171 |
%attr(0111,root,root) %{_bindir}/sudoreplay |
172 |
%attr(0755,root,root) %{_sbindir}/visudo |
173 |
%ghost %{_logdir}/sudo.log |
174 |
%{_mandir}/*/* |
175 |
%attr(0700,root,root) %dir %{_var}/db/sudo |
176 |
%attr(0750,root,root) %dir %{_logdir}/sudo-io |
177 |
%attr(0755,root,root) %{_libdir}/sudo/group_file.so |
178 |
%attr(0755,root,root) %{_libdir}/sudo/sudoers.so |
179 |
%attr(0755,root,root) %{_libdir}/sudo/system_group.so |
180 |
%attr(0755,root,root) %{_libdir}/libsudo_util.so.* |
181 |
|
182 |
%files devel |
183 |
%doc plugins/{group_file,sample} |
184 |
%{_includedir}/sudo_plugin.h |
185 |
%{_mandir}/man8/sudo_plugin.8* |
186 |
%{_libdir}/libsudo_util.so |