]> TLD Linux GIT Repositories - packages/vsftpd.git/blob - vsftpd.spec
- migrated config to /etc/vsftpd, cleanup
[packages/vsftpd.git] / vsftpd.spec
1 # TODO:
2 # - default config does not work with inetd configuration
3 #
4 # Conditional build:
5 %bcond_with     clamav  # ClamAV scanning support
6
7 %define         _ftpdir /home/services/ftp
8
9 Summary:        vsftpd - Very Secure FTP Daemon
10 Summary(pl.UTF-8):      Bardzo Bezpieczny Demon FTP
11 Summary(pt_BR.UTF-8):   vsftpd - Daemon FTP Muito Seguro
12 Name:           vsftpd
13 Version:        3.0.3
14 Release:        2
15 License:        GPL v2
16 Group:          Daemons
17 Source0:        https://security.appspot.com/downloads/%{name}-%{version}.tar.gz
18 # Source0-md5:  da119d084bd3f98664636ea05b5bb398
19 Source1:        %{name}.inetd
20 Source2:        %{name}.pamd
21 Source3:        %{name}-ftpusers
22 Source4:        ftpusers.tar.bz2
23 # Source4-md5:  76c80b6ec9f4d079a1e27316edddbe16
24 Source5:        %{name}.init
25 Patch0:         %{name}-builddefs.patch
26 Patch1:         %{name}-amd64-findlibs.patch
27 Patch2:         %{name}-clamav.patch
28 Patch3:         %{name}-findlibs-egrep.patch
29 Patch4:         %{name}-configdir.patch
30 URL:            https://security.appspot.com/vsftpd.html
31 BuildRequires:  libcap-devel
32 BuildRequires:  libwrap-devel
33 BuildRequires:  openssl-devel >= 0.9.8
34 BuildRequires:  rpmbuild(macros) >= 1.268
35 Requires:       %{name}-init = %{version}-%{release}
36 Requires:       filesystem >= 3.0-11
37 Requires:       pam >= 0.77.3
38 Provides:       ftpserver
39 Conflicts:      man-pages < 1.51
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %define specflags       -fpie -pipe -Wextra -Werror
43
44 %description
45 A Very Secure FTP Daemon - written from scratch - by Chris "One Man
46 Security Audit Team" Evans.
47
48 %description -l pl.UTF-8
49 Bardzo Bezpieczny Demon FTP - napisany od zera przez Chrisa "One Man
50 Security Audit Team" Evansa.
51
52 %description -l pt_BR.UTF-8
53 A Very Secure FTP Daemon (vsftpd) - escrito do zero - por Chris "One
54 Man Security Audit Team" Evans.
55
56 %package inetd
57 Summary:        vsftpd - Very Secure FTP Daemon
58 Summary(pl.UTF-8):      Bardzo Bezpieczny Demon FTP
59 Summary(pt_BR.UTF-8):   vsftpd - Daemon FTP Muito Seguro
60 Group:          Networking/Daemons
61 Requires:       %{name} = %{version}-%{release}
62 Requires:       rc-inetd
63 Provides:       %{name}-init = %{version}-%{release}
64 Obsoletes:      vsftpd-standalone
65 Conflicts:      %{name} <= 2.0.3-1
66
67 %description inetd
68 This package allows to start vsftpd as inetd service.
69
70 %description inetd -l pl.UTF-8
71 Ten pakiet pozwala na wystartowanie vsftpd jako usÅ‚ugi inetd.
72
73 %package standalone
74 Summary:        vsftpd - Very Secure FTP Daemon
75 Summary(pl.UTF-8):      Bardzo Bezpieczny Demon FTP
76 Summary(pt_BR.UTF-8):   vsftpd - Daemon FTP Muito Seguro
77 Group:          Networking/Daemons
78 Requires(post,preun):   /sbin/chkconfig
79 Requires:       %{name} = %{version}-%{release}
80 Requires:       rc-scripts
81 Provides:       %{name}-init = %{version}-%{release}
82 Obsoletes:      vsftpd-inetd
83 Conflicts:      %{name} <= 2.0.3-1
84
85 %description standalone
86 This package allows to start vsftpd as standalone daemon.
87
88 %description standalone -l pl.UTF-8
89 Ten pakiet pozwala na wystartowanie vsftpd jako samodzielnego demona.
90
91 %prep
92 %setup -q
93 %patch0 -p1
94 %patch1 -p1
95 %if %{with clamav}
96 %patch2 -p1
97 %endif
98 %patch3 -p1
99 %patch4 -p1
100
101 %build
102 %{__make} \
103         CC="%{__cc}" \
104         CFLAGS="%{rpmcflags}" \
105         LIBS="-lwrap -lpam -lcap -lssl -lcrypto" \
106         LINK="%{rpmldflags}"
107
108 %install
109 rm -rf $RPM_BUILD_ROOT
110 install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{5,8}} \
111         $RPM_BUILD_ROOT/etc/{pam.d,sysconfig/rc-inetd,logrotate.d,vsftpd,rc.d/init.d} \
112         $RPM_BUILD_ROOT{%{_ftpdir}/pub/incoming,/var/log}
113
114 install -p vsftpd $RPM_BUILD_ROOT%{_sbindir}/vsftpd
115 cp -p vsftpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/vsftpd.conf
116 cp -p vsftpd.conf.5 $RPM_BUILD_ROOT%{_mandir}/man5/vsftpd.conf.5
117 cp -p vsftpd.8 $RPM_BUILD_ROOT%{_mandir}/man8/vsftpd.8
118 cp -p RedHat/vsftpd.log $RPM_BUILD_ROOT/etc/logrotate.d/vsftpd
119
120 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/sysconfig/rc-inetd/vsftpd
121 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/pam.d/ftp
122 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/ftpusers
123 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/vsftpd
124
125 > $RPM_BUILD_ROOT/var/log/vsftpd.log
126
127 bzip2 -dc %{SOURCE4} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
128 %{__rm} $RPM_BUILD_ROOT%{_mandir}/ftpusers-path.diff
129
130 %clean
131 rm -rf $RPM_BUILD_ROOT
132
133 %post
134 touch /var/log/vsftpd.log
135 chmod 640 /var/log/vsftpd.log
136
137 %post inetd
138 %service -q rc-inetd reload
139
140 %postun inetd
141 if [ "$1" = "0" ]; then
142         %service -q rc-inetd reload
143 fi
144
145 %post standalone
146 /sbin/chkconfig --add %{name}
147 %service vsftpd restart "vsftpd server"
148
149 %preun standalone
150 if [ "$1" = "0" ]; then
151         %service vsftpd stop
152         /sbin/chkconfig --del %{name}
153 fi
154
155 %triggerin standalone -- glibc
156 # restart vsftpd if glibc is upgraded or downgraded
157 if [ "$2" != 1 ]; then
158         %service -q vsftpd restart
159 fi
160
161 %triggerun -- %{name} < 3.0.3-2
162 if [ $1 -le 1 ]; then
163         exit 0
164 fi
165 [ -d /etc/vsftpd ] || mkdir /etc/vsftpd 2>/dev/null || :
166 for f in /etc/{vsftpd.{conf,banned_emails,chroot_list,email_passwords,user_list},ftpd/ftpusers}; do
167         [ -f "$f" ] && mv "$f" /etc/vsftpd 2>/dev/null || :
168 done
169 find /etc/vsftpd -type f 2>/dev/null | xargs sed -i -e 's|/etc/ftpd|/etc/vsftpd|g' 2>/dev/null
170 [ -n "$(find /etc/ftpd -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || :
171
172 %triggerpostun -- %{name} < 3.0.3-2
173 echo
174 echo "Warning! Configuration has been migrated to /etc/vsftpd."
175 echo
176
177 %files
178 %defattr(644,root,root,755)
179 %doc AUDIT BENCHMARKS BUGS Changelog FAQ README README.ssl REWARD SIZE SPEED TODO TUNING EXAMPLE SECURITY
180 %attr(755,root,root) %{_sbindir}/vsftpd
181 %dir %attr(750,root,ftp) %dir %{_sysconfdir}/vsftpd
182 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/vsftpd/vsftpd.conf
183 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/vsftpd/ftpusers
184 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/ftp
185 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/vsftpd
186 %attr(640,root,root) %ghost /var/log/vsftpd.log
187 %{_mandir}/man5/vsftpd.conf.5*
188 %{_mandir}/man8/vsftpd.8*
189 %{_mandir}/man5/ftpusers.5*
190 %lang(ja) %{_mandir}/ja/man5/ftpusers*
191 %lang(pl) %{_mandir}/pl/man5/ftpusers*
192 %lang(pt_BR) %{_mandir}/pt_BR/man5/ftpusers*
193 %lang(ru) %{_mandir}/ru/man5/ftpusers*
194 %dir %{_ftpdir}
195 %dir %{_ftpdir}/pub
196 # it's safe - by default anon_upload_enable=NO, anon_world_readable_only=YES
197 %attr(775,root,ftp) %dir %{_ftpdir}/pub/incoming
198
199 %files inetd
200 %defattr(644,root,root,755)
201 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/rc-inetd/vsftpd
202
203 %files standalone
204 %defattr(644,root,root,755)
205 %attr(754,root,root) /etc/rc.d/init.d/vsftpd