]> git.pld-linux.org Git - packages/pure-ftpd.git/blob - pure-ftpd.spec
d59ae942b560ed2695a61420e9796c49942ac758
[packages/pure-ftpd.git] / pure-ftpd.spec
1 #
2 # Conditional build:
3 %bcond_with     extra           # with additional, maybe useful, but unmaintained features
4 %bcond_without  ldap            # disable LDAP auth
5 %bcond_without  longusername    # with username length = 128 (default 32)
6 %bcond_without  mysql           # disable MySQL auth but disables PAM auth
7 %bcond_without  pgsql           # disable PostgreSQL support
8 %bcond_without  puredb          # disable pure-db support
9 %bcond_without  tls             # disable SSL/TLS support
10 %bcond_without  cap             # disable capabilities
11
12 %define rel     4
13 Summary:        Small, fast and secure FTP server
14 Summary(pl.UTF-8):      Mały, szybki i bezpieczny serwer FTP
15 Name:           pure-ftpd
16 Version:        1.0.49
17 Release:        %{rel}%{?with_extra:extra}
18 License:        BSD-like%{?with_extra:, GLPv2 for pure-config due to libcfg+ license}
19 Group:          Daemons
20 Source0:        http://download.pureftpd.org/pub/pure-ftpd/releases/%{name}-%{version}.tar.bz2
21 # Source0-md5:  b7025f469711d88bd84a3518f67c1470
22 Source1:        %{name}.pamd
23 Source2:        %{name}.init
24 Source3:        %{name}.sysconfig
25 Source4:        ftpusers.tar.bz2
26 # Source4-md5:  76c80b6ec9f4d079a1e27316edddbe16
27 Source5:        http://twittner.host.sk/files/pure-config/pure-config-20041201.tar.gz
28 # Source5-md5:  3f2ff6b00b5c38ee11ce588ee5af6cf6
29 Patch0:         %{name}-config.patch
30 Patch1:         %{name}-allauth.patch
31 Patch2:         %{name}-pure-pw_passwd.patch
32 Patch3:         %{name}-mysql_config.patch
33 # from Fedora
34 Patch4:         0003-Allow-having-both-options-and-config-file-on-command.patch
35 Patch5:         paths.patch
36 Patch6:         %{name}-apparmor.patch
37 Patch7:         %{name}-mysql-utf8.patch
38 Patch8:         caps.patch
39 Patch9:         pure-ftpd-1.0.49-diraliases_uninitialized_pointer.patch
40 Patch10:        pure-ftpd-1.0.49-pure_strcmp_OOB_read.patch
41 URL:            http://www.pureftpd.org/
42 %{?with_extra:BuildRequires:    autoconf}
43 %{?with_extra:BuildRequires:    automake}
44 BuildRequires:  libapparmor-devel
45 %{?with_cap:BuildRequires:      libcap-devel}
46 %{?with_extra:BuildRequires:    libcfg+-devel >= 0.6.2}
47 BuildRequires:  libsodium-devel
48 %{?with_mysql:BuildRequires:    mysql-devel}
49 %{?with_ldap:BuildRequires:     openldap-devel >= 2.3.0}
50 %{?with_tls:BuildRequires:      openssl-devel}
51 BuildRequires:  pam-devel
52 %{?with_pgsql:BuildRequires:    postgresql-devel}
53 BuildRequires:  rpmbuild(macros) >= 1.304
54 Requires(post):         /usr/bin/openssl
55 Requires(post,preun):   /sbin/chkconfig
56 Requires(postun):       /usr/sbin/groupdel
57 Requires(postun):       /usr/sbin/userdel
58 Requires(pre):  /bin/id
59 Requires(pre):  /usr/bin/getgid
60 Requires(pre):  /usr/sbin/groupadd
61 Requires(pre):  /usr/sbin/useradd
62 Requires:       pam >= 0.79.0
63 %{!?with_extra:Requires:        perl-base}
64 Requires:       rc-scripts
65 Provides:       ftpserver
66 Provides:       user(ftpauth)
67 Provides:       group(ftpauth)
68 Provides:       user(ftpcert)
69 Provides:       group(ftpcert)
70 Conflicts:      man-pages < 1.51
71 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
72
73 %define         _sysconfdir     /etc/ftpd
74 %define         _ftpdir         /home/services/ftp
75 %define         schemadir       /usr/share/openldap/schema
76
77 %description
78 Pure-FTPd is a fast, production-quality, standard-comformant FTP
79 server, based upon Troll-FTPd. Unlike other popular FTP servers, it
80 has no known security flaw, it is really trivial to set up and it is
81 especially designed for modern Linux kernels (setfsuid, sendfile,
82 capabilities) . Features include PAM support, IPv6, chroot()ed home
83 directories, virtual domains, built-in LS, anti-warez system, bounded
84 ports for passive downloads...
85
86 %description -l pl.UTF-8
87 Pure-FTPD to szybki, wysokiej jakości, odpowiadający standardom serwer
88 FTP bazujący na Troll-FTPd. W przeciwieństwie do innych serwerów FTP
89 nie ma znanych luk w bezpieczeństwie. Ponadto jest trywialny w
90 konfiguracji i specjalnie zaprojektowany dla nowych kerneli Linuksa
91 (setfsuid, sendfile, capabilibies). Możliwości to wsparcie dla PAM-a,
92 IPv6, chroot()owanych katalogów domowych, virtualne domeny, wbudowany
93 LS, system anty-warezowy, ograniczanie portów dla pasywnych
94 połączeń...
95
96 %package -n openldap-schema-pureftpd
97 Summary:        Pure-FTPd LDAP schema
98 Summary(pl.UTF-8):      Schemat LDAP dla Pure-FTPd
99 Group:          Networking/Daemons
100 Requires(post,postun):  sed >= 4.0
101 Requires:       openldap-servers
102 Requires:       sed >= 4.0
103 %if "%{_rpmversion}" >= "5"
104 BuildArch:      noarch
105 %endif
106
107 %description -n openldap-schema-pureftpd
108 This package contains an Pure-FTPd openldap schema.
109
110 %description -n openldap-schema-pureftpd -l pl.UTF-8
111 Ten pakiet zawiera schemat Pure-FTPd pureftpd.schema dla openldapa.
112
113 %prep
114 %setup -q -a 5
115 %patch0 -p0
116 %patch1 -p1
117 %patch3 -p1
118 %patch4 -p1
119 %patch5 -p1
120 %patch6 -p1
121 %patch7 -p1
122 %patch8 -p1
123 %patch9 -p1
124 %patch10 -p1
125
126 %{?with_extra:%patch2 -p1}
127
128 %build
129 %{__aclocal} -Im4
130 %{__autoconf}
131 %{__autoheader}
132 %{__automake}
133 %configure \
134         CFLAGS="%{rpmcflags} %{rpmcppflags} -DALLOW_DELETION_OF_TEMPORARY_FILES=1 -DALWAYS_SHOW_RESOLVED_SYMLINKS=1" \
135         --disable-silent-rules \
136         --with-boring \
137         --with-altlog \
138         --with-cookie \
139         --with-diraliases \
140         --with-extauth \
141         --with-ftpwho \
142         --with-language=english \
143         %{!?with_cap:--without-capabilities} \
144         %{?with_ldap:--with-ldap} \
145         %{?with_mysql:CPPFLAGS="-I%{_includedir}/mysql" --with-mysql} \
146         --with-pam \
147         --with-peruserlimits \
148         %{?with_pgsql:--with-pgsql} \
149         --with-privsep \
150         %{?with_puredb:--with-puredb} \
151         --with-quotas \
152         --with-ratios \
153         --with-throttling \
154         %{?with_tls:--with-tls --with-certfile=/etc/pure-ftpd/ssl/pure-ftpd.pem} \
155         --with-uploadscript \
156         --with-virtualchroot \
157         --with-virtualhosts \
158         --with-apparmor
159
160 %if %{with extra}
161 cd pure-config
162 %{__aclocal}
163 %{__autoconf}
164 %{__autoheader}
165 %{__automake}
166 %configure
167 %{__make}
168 %endif
169
170 %install
171 rm -rf $RPM_BUILD_ROOT
172 install -d $RPM_BUILD_ROOT/etc/{pam.d,sysconfig,security,rc.d/init.d,%{name}/{certd,authd,conf,ssl}} \
173         $RPM_BUILD_ROOT{%{_sysconfdir}/vhosts,%{_ftpdir},%{schemadir}}
174
175 %{__make} install \
176         DESTDIR=$RPM_BUILD_ROOT
177
178 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/pam.d/%{name}
179 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
180 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
181
182 %{?with_ldap:install pureftpd-ldap.conf $RPM_BUILD_ROOT%{_sysconfdir}/pureftpd-ldap.conf}
183 %{?with_mysql:install pureftpd-mysql.conf $RPM_BUILD_ROOT%{_sysconfdir}/pureftpd-mysql.conf}
184 %{?with_pgsql:install pureftpd-pgsql.conf $RPM_BUILD_ROOT%{_sysconfdir}/pureftpd-pgsql.conf}
185 cp -p pureftpd.schema $RPM_BUILD_ROOT%{schemadir}/pureftpd.schema
186
187 mv $RPM_BUILD_ROOT%{_sysconfdir}/{pure-ftpd,pureftpd}.conf
188
189 touch $RPM_BUILD_ROOT%{_sysconfdir}/{ftpusers,pureftpd-dir-aliases}
190 :> $RPM_BUILD_ROOT/etc/pure-ftpd/ssl/dhparams.pem
191
192 ln -s vhosts $RPM_BUILD_ROOT%{_sysconfdir}/pure-ftpd
193
194 bzip2 -dc %{SOURCE4} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
195 rm -f $RPM_BUILD_ROOT%{_mandir}/ftpusers-path.diff
196
197 %if %{with extra}
198 %{__make} -C pure-config install \
199         DESTDIR=$RPM_BUILD_ROOT
200 %endif
201
202 %clean
203 rm -rf $RPM_BUILD_ROOT
204
205 %post
206 if [ ! -s /etc/pure-ftpd/ssl/dhparams.pem ]; then
207         umask 027
208         %{_bindir}/openssl dhparam -out /etc/pure-ftpd/ssl/dhparams.pem 2048 || :
209 fi
210
211 /sbin/chkconfig --add %{name}
212 %service %{name} restart "PureFTPD daemon"
213
214 %pre
215 %groupadd -g 326 ftpauth
216 %useradd -u 326 -d %{_ftpdir} -s /bin/false -c "FTP Auth daemon" -g ftpauth ftpauth
217 %groupadd -g 335 ftpcert
218 %useradd -u 335 -d %{_ftpdir} -s /bin/false -c "FTP Cert daemon" -g ftpcert ftpcert
219
220 %preun
221 if [ "$1" = "0" ]; then
222         %service %{name} stop
223         /sbin/chkconfig --del %{name}
224 fi
225
226 %postun
227 if [ "$1" = "0" ]; then
228         %userremove ftpauth
229         %groupremove ftpauth
230         %userremove ftpcert
231         %groupremove ftpcert
232 fi
233
234 %post -n openldap-schema-pureftpd
235 %openldap_schema_register %{schemadir}/pureftpd.schema -d core
236 %service -q ldap restart
237
238 %postun -n openldap-schema-pureftpd
239 if [ "$1" = "0" ]; then
240         %openldap_schema_unregister %{schemadir}/pureftpd.schema
241         %service -q ldap restart
242 fi
243
244 %triggerpostun -- %{name} < 1.0.41-2
245 %{?with_mysql:sed -i -e 's#MYSQLCrypt[\t ]\+all#MYSQLCrypt    any#gi' $RPM_BUILD_ROOT%{_sysconfdir}/pureftpd-mysql.conf}
246 %{?with_pgsql:sed -i -e 's#PgSQLCrypt[\t ]\+all#PgSQLCrypt    any#gi' $RPM_BUILD_ROOT%{_sysconfdir}/pureftpd-pgsql.conf}
247 sed -i -e 's#SSLCertFile#CertFile#gi' $RPM_BUILD_ROOT%{_sysconfdir}/pureftpd.conf
248 exit 0
249
250 %files
251 %defattr(644,root,root,755)
252 %doc AUTHORS ChangeLog COPYING FAQ HISTORY NEWS README* THANKS pure*.conf pureftpd.schema
253 %attr(755,root,root) %{_bindir}/*
254 %attr(755,root,root) %{_sbindir}/*
255 %attr(754,root,root) /etc/rc.d/init.d/%{name}
256 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/*
257 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/*
258 %attr(751,root,root) %config(noreplace) %verify(not md5 mtime size) %dir /etc/%{name}
259 %attr(750,root,ftpauth) %config(noreplace) %verify(not md5 mtime size) %dir /etc/%{name}/authd
260 %attr(750,root,ftpcert) %config(noreplace) %verify(not md5 mtime size) %dir /etc/%{name}/certd
261 # for future /etc/ftpd -> /etc/pure-ftpd/conf migration
262 # %attr(750,root,root) %config(noreplace) %verify(not md5 mtime size) %dir /etc/%{name}/conf
263 %attr(750,root,root) %config(noreplace) %verify(not md5 mtime size) %dir /etc/%{name}/ssl
264 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %ghost /etc/%{name}/ssl/dhparams.pem
265 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ftpusers
266 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pureftpd-dir-aliases
267 %{?with_ldap:%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pureftpd-ldap.conf}
268 %{?with_mysql:%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pureftpd-mysql.conf}
269 %{?with_pgsql:%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pureftpd-pgsql.conf}
270 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pureftpd.conf
271 %attr(710,root,ftp) %dir %{_sysconfdir}
272 %dir %{_sysconfdir}/vhosts
273 %dir %{_sysconfdir}/pure-ftpd
274 %dir %{_ftpdir}
275 %{_mandir}/man?/*
276 %lang(ja) %{_mandir}/ja/man5/ftpusers*
277 %lang(pl) %{_mandir}/pl/man5/ftpusers*
278 %lang(pt_BR) %{_mandir}/pt_BR/man5/ftpusers*
279 %lang(ru) %{_mandir}/ru/man5/ftpusers*
280
281 %files -n openldap-schema-pureftpd
282 %defattr(644,root,root,755)
283 %{schemadir}/pureftpd.schema
This page took 0.067666 seconds and 2 git commands to generate.