1 # TODO: compare PLD vs upstream provided systemd support, maybe we can switch?
4 %bcond_without pkcs11 # PKCS#11 support
7 Summary(pl.UTF-8): Serwer VPN
12 Group: Networking/Daemons
13 Source0: http://swupdate.openvpn.net/community/releases/%{name}-%{version}.tar.xz
14 # Source0-md5: 7a2002aad1671b24457bc9432a0c5c52
16 Source2: %{name}.sysconfig
17 Source3: %{name}.tmpfiles
18 Source4: %{name}-service-generator
19 Source5: %{name}.target
20 Source6: %{name}@.service
21 Source7: %{name}-update-resolv-conf
22 Patch0: %{name}-pam.patch
23 URL: http://www.openvpn.net/
24 BuildRequires: autoconf >= 2.59
25 BuildRequires: automake >= 1:1.9
26 BuildRequires: libselinux-devel
27 BuildRequires: libtool
28 BuildRequires: lz4-devel >= 1:1.7
29 BuildRequires: lzo-devel
30 BuildRequires: openssl-devel >= 0.9.8
31 %{?with_pkcs11:BuildRequires: p11-kit-devel}
32 BuildRequires: pam-devel
33 %{?with_pkcs11:BuildRequires: pkcs11-helper-devel >= 1.11}
34 BuildRequires: pkgconfig
35 BuildRequires: rpmbuild(macros) >= 1.671
36 BuildRequires: systemd-devel
37 BuildRequires: tar >= 1:1.22
39 Requires(post,preun): /sbin/chkconfig
40 Requires(post,preun,postun): systemd-units >= 38
42 Requires: openssl >= 0.9.8
43 %{?with_pkcs11:Requires: pkcs11-helper >= 1.11}
44 Requires: rc-scripts >= 0.4.3.0
45 Requires: systemd-units >= 38
46 Requires: uname(release) >= 2.4
47 Suggests: %{name}-plugin-auth-pam
48 Suggests: %{name}-plugin-down-root
49 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51 %define _localstatedir /var
54 OpenVPN is a robust and highly configurable VPN (Virtual Private
55 Network) daemon which can be used to securely link two or more private
56 networks using an encrypted tunnel over the internet.
58 %description -l pl.UTF-8
59 OpenVPN jest mocnym i silnie konfigurowalnym serwerem VPN (Wirtualne
60 Sieci Prywatne), który może być użyty do bezpiecznego łączenia dwóch
61 lub więcej prywatnych sieci używając zaszyfrowanego tunelu poprzez
64 %package plugin-auth-pam
65 Summary: Plugin for username/password authentication via PAM
66 Summary(pl.UTF-8): Wtyczka do uwierzytelniania nazwą użytkownika i hasłem poprzez PAM
68 Requires: %{name} = %{version}-%{release}
70 %description plugin-auth-pam
71 The openvpn-auth-pam module implements username/password
72 authentication via PAM, and essentially allows any authentication
73 method supported by PAM (such as LDAP, RADIUS, or Linux Shadow
74 passwords) to be used with OpenVPN. While PAM supports
75 username/password authentication, this can be combined with X509
76 certificates to provide two indepedent levels of authentication.
78 This module uses a split privilege execution model which will function
79 even if you drop openvpn daemon privileges using the user, group, or
82 %description plugin-auth-pam -l pl.UTF-8
83 Moduł openvpn-auth-pam implementuje uwierzytelnianie nazwą użytkownika
84 i hasłem poprzez PAM, zasadniczo pozwalając na korzystanie z dowolnej
85 metody uwierzytelniania obsługiwanej przez PAM (np. LDAP, RADIUS,
86 hasła shadow) z OpenVPN. Jako że PAM obsługuje uwierzytelnianie nazwą
87 użytkownika i hasłem, to można je łączyć z certyfikatami X509 w celu
88 zapewniania dwóch różnych poziomów uwierzytelnienia.
90 Ten moduł wykorzystuje model wykonywania z podziałem uprawnień, co
91 działa nawet przy odrzuceniu uprawnień demona openvpn przy użyciu
92 dyrektyw user, group lub chroot.
94 %package plugin-down-root
95 Summary: Plugin to allow root after privilege drop
96 Summary(pl.UTF-8): Wtyczka pozwalająca na wykorzystanie uprawnień roota po odrzuceniu uprawnień
98 Requires: %{name} = %{version}-%{release}
100 %description plugin-down-root
101 The down-root module allows an OpenVPN configuration to call a down
102 script with root privileges, even when privileges have been dropped
103 using --user/--group/--chroot.
105 This module uses a split privilege execution model which will fork()
106 before OpenVPN drops root privileges, at the point where the --up
107 script is usually called. The module will then remain in a wait state
108 until it receives a message from OpenVPN via pipe to execute the down
109 script. Thus, the down script will be run in the same execution
110 environment as the up script.
112 %description plugin-down-root -l pl.UTF-8
113 Moduł down-root pozwala na wywołanie skryptu down z uprawnieniami
114 roota z poziomu konfiguracji OpenVPN-a nawet w przypadku odrzucenia
115 uprawnień przy użyciu opcji --user/--group/--chroot.
117 Ten moduł wykorzystuje model wykonywania z podziałem uprawnień, który
118 wykonuje fork() przed odrzuceniem uprawnień roota, w miejscu, gdzie
119 zwykle jest wywoływany skrypt --up. Moduł pozostaje w stanie
120 oczekiwania do odebrania przez potok od OpenVPN-a komunikatu, aby
121 wykonać skrypt down. Dzięki temu skrypt down zostanie uruchomiony w
122 tym samym środowisku, co skrypt up.
125 Summary: Header files for OpenVPN plugins development
126 Summary(pl.UTF-8): Pliki nagłówkowe do tworzenia wtyczek OpenVPN
127 Group: Development/Libraries
130 This is the package containing the header files for OpenVPN plugins
133 %description devel -l pl.UTF-8
134 Ten pakiet zawiera pliki nagłówkowe do tworzenia wtyczek OpenVPN.
140 sed -e 's,/''usr/lib/openvpn,%{_libdir}/%{name},' %{SOURCE7} > contrib/update-resolv-conf
148 CPPFLAGS="%{rpmcppflags} $(pkg-config --cflags liblz4)"
150 IFCONFIG=/sbin/ifconfig \
152 NETSTAT=/bin/netstat \
154 SYSTEMD_UNIT_DIR=%{systemdunitdir} \
155 ac_cv_nsl_inet_ntoa=no \
156 ac_cv_socket_socket=no \
157 ac_cv_resolv_gethostbyname=no \
159 --enable-password-save \
160 %{?with_pkcs11:--enable-pkcs11} \
167 rm -rf $RPM_BUILD_ROOT
168 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/openvpn,%{_sbindir},%{_mandir}/man8} \
169 $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},/var/run/openvpn,%{_includedir}} \
170 $RPM_BUILD_ROOT{%{_libdir}/%{name}/plugins,%{systemdtmpfilesdir},%{systemdunitdir}} \
171 $RPM_BUILD_ROOT%{systemdunitdir}-generators
174 DESTDIR=$RPM_BUILD_ROOT
176 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
177 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
178 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
180 install -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}-generators/openvpn-service-generator
181 install -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/openvpn.target
182 install -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdunitdir}/openvpn@.service
183 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/openvpn.service
185 # we use "cp", not "install", not to pull /bin/bash dependency
186 cp -p contrib/pull-resolv-conf/client.down $RPM_BUILD_ROOT%{_libdir}/%{name}
187 cp -p contrib/pull-resolv-conf/client.up $RPM_BUILD_ROOT%{_libdir}/%{name}
188 cp -p contrib/update-resolv-conf $RPM_BUILD_ROOT%{_libdir}/%{name}
190 %{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/*.la
191 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
194 rm -rf $RPM_BUILD_ROOT
197 /sbin/chkconfig --add openvpn
198 %service openvpn restart "OpenVPN"
199 %systemd_post openvpn.target
202 if [ "$1" = "0" ]; then
203 %service openvpn stop
204 /sbin/chkconfig --del openvpn
206 %systemd_preun openvpn.target
211 %triggerpostun -- openvpn < 2.3.2-2
212 [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
213 [ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && exit 0
214 [ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]openvpn)" = "/etc/rc.d/rc[0-6].d/S[0-9][0-9]openvpn" ] && exit 0
215 export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
216 /bin/systemctl --quiet enable openvpn.target || :
220 %defattr(644,root,root,755)
221 %doc AUTHORS README* ChangeLog sample/sample-{config-files,keys,scripts} doc/management-notes.txt
223 %dir %{_sysconfdir}/openvpn
224 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
225 %attr(755,root,root) %{_sbindir}/openvpn
226 %attr(754,root,root) /etc/rc.d/init.d/%{name}
227 %attr(755,root,root) %{systemdunitdir}-generators/openvpn-service-generator
229 %{systemdunitdir}/openvpn.service
230 %{systemdunitdir}/openvpn.target
231 %{systemdunitdir}/openvpn@.service
233 #%{systemdunitdir}/openvpn-client@.service
234 #%{systemdunitdir}/openvpn-server@.service
235 %dir %{_libdir}/%{name}
236 %attr(755,root,root) %{_libdir}/%{name}/client.down
237 %attr(755,root,root) %{_libdir}/%{name}/client.up
238 %attr(755,root,root) %{_libdir}/%{name}/update-resolv-conf
239 %dir %{_libdir}/%{name}/plugins
240 %{_mandir}/man8/openvpn.8*
241 %dir /var/run/openvpn
242 %{systemdtmpfilesdir}/%{name}.conf
244 %files plugin-auth-pam
245 %defattr(644,root,root,755)
246 %doc src/plugins/auth-pam/README.auth-pam
247 %attr(755,root,root) %{_libdir}/%{name}/plugins/openvpn-plugin-auth-pam.so
249 %files plugin-down-root
250 %defattr(644,root,root,755)
251 %doc src/plugins/down-root/README.down-root
252 %attr(755,root,root) %{_libdir}/%{name}/plugins/openvpn-plugin-down-root.so
255 %defattr(644,root,root,755)
256 %doc doc/README.plugins sample/sample-plugins
257 %{_includedir}/openvpn-msg.h
258 %{_includedir}/openvpn-plugin.h