Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37570007
en ru br
ALT Linux repos
S:2.5.8-alt1
5.0: 2.0.9-alt1.M50.1
4.1: 2.0.9-alt1.M41.1
4.0: 2.0.9-alt1.M40.1
3.0: 2.0-alt1
+backports:2.0.8-alt0.M30.1

Group :: System/Servers
RPM: openvpn

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

# spec file for package openvpn (Version 2.5)
#
%define _unpackaged_files_terminate_build 1

%def_with systemd
%def_with plugins
%def_with devel
%def_with syslog

%def_with management
%def_with pkcs11
%def_with http_proxy
%def_with socks
%def_with multihome
%def_with port_share
%def_with x509_alt_username

Name: openvpn
Version: 2.5.8
Release: alt1

Summary: a full-featured SSL VPN solution
Summary(ru_RU.UTF-8): полнофункциональное решение VPN на базе SSL

License: %gpl2only with OpenSSL exception
Group: System/Servers
Url: http://www.openvpn.net

Packager: Nikolay A. Fetisov <naf at altlinux.org>

Source0: %name-%version.tar
Patch0:  %name-%version-%release.patch

Patch1:  %name-2.4.2-alt-pkcs11_pin_prompt.patch
Patch2:  %name-2.5.3-alt-python_docutils.patch

Source1: %name.init
Source2: %name-startup
Source3: %name.sysconfig
Source4: %name.chroot.lib
Source5: %name.chroot.conf
Source6: %name.chroot.all
Source7: %name-README.ALT.utf-8
Source8: %name-server.conf
Source9: %name-client.conf
Source10: %name.tmpfiles
Source11: %name.service
Source12: %name at .service
Source13: %name-server at .service
Source14: %name-client at .service

# Because of /etc/syslog.d/ feature

Conflicts: syslogd < 1.4.1-alt11

BuildRequires(pre): rpm-build-licenses
# Automatically added by buildreq on Tue Jun 29 2021
# optimized out: libgpg-error libpkcs11-helper libssl-devel perl pkg-config python-module-Pygments python-module-docutils python-modules python-modules-compiler python-modules-encodings python2-base python3 python3-base python3-module-paste ruby ruby-stdlibs sh4
BuildRequires: cmake git-core glibc-devel-static iproute2 liblz4-devel liblzo2-devel libselinux-devel net-tools time

BuildRequires: python3-module-docutils

%{?_with_systemd:BuildRequires: libsystemd-devel}
%{?_with_pkcs11:BuildRequires: libpkcs11-helper-devel}
%{?_with_plugins:BuildRequires: libpam-devel}


%description
OpenVPN is a full-featured SSL VPN solution which can accomodate
a wide range  of configurations,  including road warrior access,
home/office/campus  telecommuting,  WiFi security, secure branch
office  linking,  and enterprise-scale  remote access  solutions
with load balancing, failover, and fine-grained access-controls.

%description -l ru_RU.UTF-8
OpenVPN  -  полнофункциональное решение для VPN с использованием
SSL, с помощью которого можно решить широкий круг задач, включая
подключения  для удалённых  пользователей,  телекоммуникации для
дома и офиса,  безопасные  подключения  для  беспроводных сетей,
безопасную связь  с удалёнными офисами,  решения  для удалённого
доступа масштаба предприятий с поддержкой балансировки нагрузки,
отказоустойчивости и четко разграниченным контролем доступа.

%if_with plugins
%package plugins
Summary: external plugins for OpenVPN
Summary(ru_RU.UTF-8): внешние расширения для OpenVPN
Group: System/Servers
Requires: %name = %version-%release

%description plugins
OpenVPN is a full-featured SSL VPN solution.
This package contains OpenVPN plugins for user authentication
via PAM and to allow run a down script with root privileges.

%description plugins -l ru_RU.UTF-8
OpenVPN - полнофункциональное решение для VPN на базе SSL.
Данный пакет содержит расширения (plugins) для авторизации
пользователей через  PAM и  запуска при разрыве соединений
скрипта с привилегиями root.
%endif

%package docs
Summary: OpenVPN documentation
Summary(ru_RU.UTF-8): документация к OpenVPN
Group: System/Servers
Requires: %name = %version-%release
BuildArch: noarch

%description docs
OpenVPN is a full-featured SSL VPN solution.

This package contains OpenVPN documentation,
sample configs and scripts.

%description docs -l ru_RU.UTF-8
OpenVPN - полнофункциональное решение для VPN на базе SSL.

Данный пакет содержит документацию, примеры конфигурации и
скриптов для OpenVPN.

%if_with devel
%package devel
Summary: Headers for OpenVPN plugins
Group: Development/C
Requires: %name = %version-%release
BuildArch: noarch

%description devel
OpenVPN is a full-featured SSL VPN solution.

This package contains OpenVPN header file
for third-party plugin development.
%endif


%define openvpn_root   %_localstatedir/%name
%define openvpn_cache  %openvpn_root/cache
%define ovpn_user      openvpn
%define ovpn_group     openvpn

%prep
%setup -n %name-%version
%patch0 -p1

%patch1 -p1
%patch2

cp -- %SOURCE7 README.ALT.utf-8
cp -- %SOURCE8 server.conf
cp -- %SOURCE9 client.conf

%build
%autoreconf

# Systemd password request utility and systemd directories:

%if_with systemd
export SYSTEMD_ASK_PASSWORD=/sbin/systemd-ask-password
export TMPFILES_DIR=%_tmpfilesdir
export SYSTEMD_UNIT_DIR=%_unitdir
cp -f -- %SOURCE10 distro/systemd/tmpfiles-openvpn.conf
%endif

%configure \
   --enable-iproute2 \
   --with-iproute-path=/sbin/ip \
   --enable-password-save \
   --enable-lzo \
   %{?_with_plugins:--enable-plugins --enable-plugin-auth-pam --enable-plugin-down-root} \
   %{?_with_management:--enable-management} \
   %{?_with_pkcs11:--enable-pkcs11} \
   %{?_with_socks:--enable-socks} \
   %{?_with_http_proxy:--enable-http-proxy} \
   %{?_with_multihome:--enable-multihome} \
   %{?_with_port_share:--enable-port-share} \
   %{?_with_x509_alt_username:--enable-x509-alt-username} \
   %{?_with_systemd:--enable-systemd} \
   %nil

%make_build
subst 's|nobody|%ovpn_user|' sample/sample-config-files/*

%if_with plugins
# Prepare build:
pushd sample/sample-plugins/
%make all
%endif

%ifndef __BTE
  # make check hangs inside hasher
  make check
%endif

%install
%make_install DESTDIR=%buildroot install

# Removing automatically installed docs

rm -rf -- %buildroot%_datadir/doc/%name

# Gzip ChangeLog

gzip ChangeLog

# Configuration

install -m 0750 -d -- %buildroot%_sysconfdir/%name
install -m 0750 -d -- %buildroot%_sysconfdir/%name/keys
install -m 0750 -d -- %buildroot%_sysconfdir/%name/client
install -m 0750 -d -- %buildroot%_sysconfdir/%name/server
ln -s -- ../..%openvpn_root%_sysconfdir/%name/ccd  %buildroot%_sysconfdir/%name/ccd

# Chroot environment

install -m 0755 -d -- %buildroot%openvpn_root
install -m 0755 -d -- %buildroot%openvpn_root%_sysconfdir
install -m 0755 -d -- %buildroot%openvpn_root/%_lib
install -m 0755 -d -- %buildroot%openvpn_root%_sysconfdir/%name
install -m 0755 -d -- %buildroot%openvpn_root%_sysconfdir/%name/ccd
install -m 0755 -d -- %buildroot%openvpn_root/tmp
install -m 0755 -d -- %buildroot%openvpn_cache

# SysInit and systemd startup scripts

mkdir -p -- %buildroot/%_initdir
mkdir -p -- %buildroot/%_sysconfdir/sysconfig
install -m 0755 -- %SOURCE1 %buildroot%_initdir/%name
install -m 0750 -- %SOURCE2 %buildroot%_sysconfdir/%name
install -m 0640 -- %SOURCE3 %buildroot%_sysconfdir/sysconfig/%name

%if_with systemd
rm -f -- %buildroot%_unitdir/*
install -m 0644 -- %SOURCE11 %buildroot%_unitdir/%name.service
install -m 0644 -- %SOURCE12 %buildroot%_unitdir/%name at .service
install -m 0644 -- %SOURCE13 %buildroot%_unitdir/%name-server at .service
install -m 0644 -- %SOURCE14 %buildroot%_unitdir/%name-client at .service
%endif


# update_chrooted files

install -p -m 0750 -D -- %SOURCE4 %buildroot%_sysconfdir/chroot.d/%name.lib
install -p -m 0750 -D -- %SOURCE5 %buildroot%_sysconfdir/chroot.d/%name.conf
install -p -m 0750 -D -- %SOURCE6 %buildroot%_sysconfdir/chroot.d/%name.all

mv -f -- COPYRIGHT.GPL COPYRIGHT.GPL.orig
ln -s -- $(relative %_licensedir/GPL-2 %_docdir/%name/COPYRIGHT.GPL) COPYRIGHT.GPL

%if_with plugins
# Install plugins
for pi in defer log simple; do
   [ -f sample/sample-plugins/$pi/README ] && \
       mv -f -- sample/sample-plugins/$pi/README sample/sample-plugins/README.$pi
   [ -x sample/sample-plugins/$pi/%name-plugin-$pi.so ] && \
       install -c -m 0755 -- sample/sample-plugins/$pi/%name-plugin-$pi.so %buildroot%_libdir/%name/plugins/%name-plugin-$pi.so
done

mkdir -- plugins
mv -f -- doc/README.plugins  plugins/README.plugins
mv -f -- sample/sample-plugins/README* plugins/
%endif

%if_with syslog
# Make use of syslogd-1.4.1-alt11 /etc/syslog.d/ feature.
mkdir -p -- %buildroot%openvpn_root/dev
/usr/bin/mksock %buildroot%openvpn_root/dev/log
mkdir -p -m700 -- %buildroot%_sysconfdir/syslog.d
ln -s -- %openvpn_root/dev/log %buildroot%_sysconfdir/syslog.d/%name
%endif

%pre
# Add the "openvpn" user
%_sbindir/groupadd -r -f %ovpn_group 2>/dev/null ||:
%_sbindir/useradd  -r -g %ovpn_group -c 'OpenVPN daemon' \
       -s /dev/null -d /dev/null %ovpn_user 2>/dev/null ||:

%post
%_sysconfdir/chroot.d/%name.all
%post_service %name

%preun
%preun_service %name


%files
%doc AUTHORS CONTRIBUTING.rst ChangeLog.gz PORTS README COPYING
%doc README.IPv6 TODO.IPv6
%doc --no-dereference COPYRIGHT.GPL
%doc README.ALT.utf-8 server.conf client.conf
%if_with management
%doc doc/management-notes.txt
%endif

%_sbindir/%name
%_mandir/man?/*

%attr(0750,root,%ovpn_group) %dir %_sysconfdir/%name
%attr(0750,root,%ovpn_group) %dir %_sysconfdir/%name/keys
                                 %_sysconfdir/%name/ccd
%attr(0750,root,%ovpn_group) %dir %_sysconfdir/%name/client
%attr(0750,root,%ovpn_group) %dir %_sysconfdir/%name/server
%attr(0750,root,%ovpn_group) %dir %openvpn_root
                            %dir %openvpn_root/etc
                            %dir %openvpn_root/etc/openvpn
                            %dir %openvpn_root/etc/openvpn/ccd
%attr(0770,root,%ovpn_group) %dir %openvpn_root/tmp
                            %dir %openvpn_root/%_lib
%attr(0750,%ovpn_user,%ovpn_group) %dir %openvpn_cache

%config(noreplace)  %_sysconfdir/%name/%name-startup
%config(noreplace)  %_sysconfdir/sysconfig/%name
%config             %_sysconfdir/chroot.d/%name.*
%config             %_initdir/%name

%if_with systemd
%_unitdir/%{name}*.service
%_tmpfilesdir/%name.conf
%endif

%if_with syslog
%attr(0710,root,%ovpn_group) %dir %openvpn_root/dev
%ghost %attr(0666,root,root)      %openvpn_root/dev/log

%_sysconfdir/syslog.d/%name
%endif


%if_with plugins
%files plugins
%doc plugins/*
%doc src/plugins/*/README.*
%dir %_libdir/%name
%dir %_libdir/%name/plugins
    %_libdir/%name/plugins/%name-*.so
%exclude %_libdir/%name/plugins/%name-*.la
%endif

%files docs
%doc INSTALL
%doc sample/sample-config-files*
%doc sample/sample-keys*
%doc sample/sample-scripts*

%if_with devel
%files devel

%_includedir/openvpn-plugin.h
%_includedir/openvpn-msg.h
%endif

%changelog

Full changelog you can see here

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin