1 |
# use fakeroot -ba sudo.spec to build! |
2 |
|
3 |
Name: sudo |
4 |
Version: 1.8.7 |
5 |
Release: %mkrel 1 |
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 |
Patch4: sudo-1.8.5-pipelist.patch |
18 |
BuildRequires: audit-devel |
19 |
BuildRequires: bison |
20 |
BuildRequires: groff-for-man |
21 |
BuildRequires: libcap-devel |
22 |
BuildRequires: openldap-devel |
23 |
BuildRequires: pam-devel |
24 |
Requires(pre): openldap |
25 |
|
26 |
%description |
27 |
Sudo (superuser do) allows a system administrator to give certain users (or |
28 |
groups of users) the ability to run some (or all) commands as root while |
29 |
logging all commands and arguments. Sudo operates on a per-command basis. |
30 |
It is not a replacement for the shell. Features include: the ability to |
31 |
restrict what commands a user may run on a per-host basis, copious logging |
32 |
of each command (providing a clear audit trail of who did what), a |
33 |
configurable timeout of the sudo command, and the ability to use the same |
34 |
configuration file (sudoers) on many different machines. |
35 |
|
36 |
%package devel |
37 |
Summary: Development files for sudo plugins |
38 |
Group: Development/C |
39 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
40 |
|
41 |
%description devel |
42 |
Development files for compiling sudo plugins. |
43 |
|
44 |
%prep |
45 |
%setup -q -n %{name}-%{version}%{?pre} |
46 |
%patch1 -p1 -b .strip |
47 |
%patch2 -p1 -b .envdebug |
48 |
%patch4 -p1 -b .pipelist |
49 |
|
50 |
# fix attribs |
51 |
find -name "Makefile.*" | xargs perl -pi -e "s|-m 0444|-m 0644|g" |
52 |
|
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 |
--with-plugindir=%{_libdir}/sudo |
82 |
|
83 |
%make |
84 |
|
85 |
%install |
86 |
rm -rf %{buildroot} |
87 |
|
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 |
%find_lang sudo |
137 |
%find_lang sudoers |
138 |
|
139 |
cat sudo.lang sudoers.lang > sudo_all.lang |
140 |
rm sudo.lang sudoers.lang |
141 |
|
142 |
%check |
143 |
make check |
144 |
|
145 |
%post |
146 |
/bin/chmod 0440 %{_sysconfdir}/sudoers || : |
147 |
%create_ghostfile %{_logdir}/sudo.log root root 600 |
148 |
|
149 |
%files -f sudo_all.lang |
150 |
%doc doc/HISTORY README README.LDAP |
151 |
%doc doc/TROUBLESHOOTING doc/UPGRADE doc/sample.* doc/schema.* |
152 |
%attr(0440,root,root) %config(noreplace) %{_sysconfdir}/sudoers |
153 |
%attr(0750,root,root) %dir %{_sysconfdir}/sudoers.d/ |
154 |
%config(noreplace) %{_sysconfdir}/logrotate.d/sudo |
155 |
%config(noreplace) %{_sysconfdir}/pam.d/sudo |
156 |
%config(noreplace) %{_sysconfdir}/pam.d/sudo-i |
157 |
%attr(0755,root,root) %{_bindir}/sudoers2ldif |
158 |
%attr(4111,root,root) %{_bindir}/sudo |
159 |
%attr(4111,root,root) %{_bindir}/sudoedit |
160 |
%attr(0111,root,root) %{_bindir}/sudoreplay |
161 |
%attr(0755,root,root) %{_sbindir}/visudo |
162 |
%ghost %{_logdir}/sudo.log |
163 |
%{_mandir}/*/* |
164 |
%attr(0700,root,root) %dir %{_var}/db/sudo |
165 |
%attr(0750,root,root) %dir %{_logdir}/sudo-io |
166 |
%{_libdir}/sudo/group_file.so |
167 |
%{_libdir}/sudo/sudoers.so |
168 |
%{_libdir}/sudo/system_group.so |
169 |
|
170 |
%files devel |
171 |
%doc plugins/{group_file,sample} |
172 |
%{_includedir}/sudo_plugin.h |
173 |
%{_mandir}/man8/sudo_plugin.8* |