# HG changeset patch # User holger@hoho.dyndns.org # Date 1231018500 -3600 # Node ID d8386b80776e9aeaffcd52755005e5d4ca15723f # Parent e5aa50bd679457bc616b44ab6aff0ae05283f483 openvpn 2.1-rc15 is in portage diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/Manifest --- a/net-misc/openvpn/Manifest Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -AUX down.sh 943 RMD160 db43a525c9eb2ccb538e938e0b7f4359af22e4de SHA1 261acc68a24108526345a7d117bba15dbcebaa6e SHA256 39debebcd8c899f20e6d355cbc8eaab46e28b83a9f6c33a94c065688a4f3d2c7 -AUX openvpn-2.1.conf 892 RMD160 687a747ed2f801b051438d02da8fcd44c6954484 SHA1 e65db7d972483c9391ef92d2931d9db7b69e4329 SHA256 330149a83684ddabe413d134d4c8efad4c88b18c2ab67165014deff5f7fffad2 -AUX openvpn-2.1.init 4207 RMD160 07da4fa43c55f4096c3a59a8229ec0a790da1fa8 SHA1 22fab45a9c14ee6aabe96f060d14c0940f3fe94b SHA256 a0cc87fdb10928c9c6b820482a2551ee17599253cb43186dd4ea47f55f0dab06 -AUX openvpn-2.1_rc13-peercred.patch 251 RMD160 26123eedc9b685fb01de93c1141588f8008562f5 SHA1 8132510ebbd891ec55ef36d0cb8a86cb64a0145f SHA256 e7c2025ec49d3a5c2d95d80ee3c26ed9ccd0587d1664860b3a1eceb2bb7c778f -AUX openvpn.init 1488 RMD160 be34debb55b6c3e2453946a290da2650ca3baa72 SHA1 48aabadee2cbb6ce9c4196b2730922491a96f003 SHA256 c074126c90d35c04a7316f4533cd00e9e14849e4e222ca5b87e6172f401ec95d -AUX up.sh 2560 RMD160 34c2f0845a2c3b2eebb20da5a5c316e81cd1ef5a SHA1 d7026eeb7586fb931e5f938ca00fcc63c63923ad SHA256 3a7cedba5909fa06d0eb36b3426f0e5bc21bdc28943beaaa241ab651b4388218 -DIST openvpn-2.1_rc15.tar.gz 833429 RMD160 90333139815a1681ab7a6aeba9bc5a005c5a9713 SHA1 a07f9b24947428e905d0c41339b9ed522358c672 SHA256 66cfe347da6ab29ae39c80527714079cdb5699fdf453f7e031dd2ec0172d13a5 -EBUILD openvpn-2.1_rc15.ebuild 4384 RMD160 e686d85920f59e76250e49d9f69defbce70bd3d2 SHA1 8b89ad6c1d6a5379e77068d9d80bfcfb6f7f0e25 SHA256 6861b013b94d17f75dd0676f3075b3f5ca3703f3b3f5a978d22243bad843ac3f -MISC metadata.xml 681 RMD160 38d44e8ca26011bef8b9072c41b7797dd32184bf SHA1 304f109764fe69865bf4ea490b8d3a6839a5ab9e SHA256 6f6898ac4534eeed083629ee9c581da086a65b728af16306d3a39edf100e7911 diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/files/down.sh --- a/net-misc/openvpn/files/down.sh Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#!/bin/sh -# Copyright (c) 2006-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# Contributed by Roy Marples (uberlord@gentoo.org) - -# If we have a service specific script, run this now -if [ -x /etc/openvpn/"${SVCNAME}"-down.sh ] ; then - /etc/openvpn/"${SVCNAME}"-down.sh "$@" -fi - -# Restore resolv.conf to how it was -if [ "${PEER_DNS}" != "no" ]; then - if [ -x /sbin/resolvconf ] ; then - /sbin/resolvconf -d "${dev}" - elif [ -e /etc/resolv.conf-"${dev}".sv ] ; then - # Important that we copy instead of move incase resolv.conf is - # a symlink and not an actual file - cp /etc/resolv.conf-"${dev}".sv /etc/resolv.conf - rm -f /etc/resolv.conf-"${dev}".sv - fi -fi - -if [ -n "${SVCNAME}" ]; then - # Re-enter the init script to start any dependant services - if /etc/init.d/"${SVCNAME}" --quiet status ; then - export IN_BACKGROUND=true - /etc/init.d/"${SVCNAME}" --quiet stop - fi -fi - -exit 0 - -# vim: ts=4 : diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/files/openvpn-2.1.conf --- a/net-misc/openvpn/files/openvpn-2.1.conf Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -# OpenVPN automatically creates an /etc/resolv.conf (or sends it to -# resolvconf) if given DNS information by the OpenVPN server. -# Set PEER_DNS="no" to stop this. -PEER_DNS="yes" - -# OpenVPN can run in many modes. Most people will want the init script -# to automatically detect the mode and try and apply a good default -# configuration and setup scripts. However, there are cases where the -# OpenVPN configuration looks like a client, but it's really a peer or -# something else. DETECT_CLIENT controls this behaviour. -DETECT_CLIENT="yes" - -# If DETECT_CLIENT is no and you have your own scripts to re-enter the openvpn -# init script (ie, it first becomes "inactive" and the script then starts the -# script again to make it "started") then you can state this below. -# In other words, unless you understand service dependencies and are a -# competent shell scripter, don't set this. -RE_ENTER="no" diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/files/openvpn-2.1.init --- a/net-misc/openvpn/files/openvpn-2.1.init Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -VPNDIR=${VPNDIR:-/etc/openvpn} -VPN=${SVCNAME#*.} -if [ -n "${VPN}" ] && [ ${SVCNAME} != "openvpn" ]; then - VPNPID="/var/run/openvpn.${VPN}.pid" -else - VPNPID="/var/run/openvpn.pid" -fi -VPNCONF="${VPNDIR}/${VPN}.conf" - -depend() { - need localmount net - use dns - after bootmisc -} - -checkconfig() { - # Linux has good dynamic tun/tap creation - if [ $(uname -s) = "Linux" ] ; then - if [ ! -e /dev/net/tun ]; then - if ! modprobe tun ; then - eerror "TUN/TAP support is not available" \ - "in this kernel" - return 1 - fi - fi - if [ -h /dev/net/tun ] && [ -c /dev/misc/net/tun ]; then - ebegin "Detected broken /dev/net/tun symlink, fixing..." - rm -f /dev/net/tun - ln -s /dev/misc/net/tun /dev/net/tun - eend $? - fi - return 0 - fi - - # Other OS's don't, so we rely on a pre-configured interface - # per vpn instance - local ifname=$(sed -n -e 's/[[:space:]]*dev[[:space:]][[:space:]]*\([^[:space:]]*\).*/\1/p' "${VPNCONF}") - if [ -z ${ifname} ] ; then - eerror "You need to specify the interface that this openvpn" \ - "instance should use" \ - "by using the dev option in ${VPNCONF}" - return 1 - fi - - if ! ifconfig "${ifname}" >/dev/null 2>/dev/null ; then - # Try and create it - echo > /dev/"${ifname}" >/dev/null - fi - if ! ifconfig "${ifname}" >/dev/null 2>/dev/null ; then - eerror "${VPNCONF} requires interface ${ifname}" \ - "but that does not exist" - return 1 - fi -} - -start() { - # If we are re-called by the openvpn gentoo-up.sh script - # then we don't actually want to start openvpn - [ "${IN_BACKGROUND}" = "true" ] && return 0 - - ebegin "Starting ${SVCNAME}" - - checkconfig || return 1 - - local args="" reenter=${RE_ENTER:-no} - # If the config file does not specify the cd option, we do - # But if we specify it, we override the config option which we do not want - if ! grep -q "^[ \t]*cd[ \t].*" "${VPNCONF}" ; then - args="${args} --cd ${VPNDIR}" - fi - - # We mark the service as inactive and then start it. - # When we get an authenticated packet from the peer then we run our script - # which configures our DNS if any and marks us as up. - if [ "${DETECT_CLIENT:-yes}" = "yes" ] && \ - grep -q "^[ \t]*remote[ \t].*" "${VPNCONF}" ; then - reenter="yes" - args="${args} --nobind --up-delay --up-restart" - args="${args} --script-security 2" - args="${args} --up /etc/openvpn/up.sh" - args="${args} --down-pre --down /etc/openvpn/down.sh" - - # Warn about setting scripts as we override them - if grep -Eq "^[ \t]*(up|down)[ \t].*" "${VPNCONF}" ; then - ewarn "WARNING: You have defined your own up/down scripts" - ewarn "As you're running as a client, we now force Gentoo specific" - ewarn "scripts to be run for up and down events." - ewarn "These scripts will call /etc/openvpn/${SVCNAME}-{up,down}.sh" - ewarn "where you can put your own code." - fi - - # Warn about the inability to change ip/route/dns information when - # dropping privs - if grep -q "^[ \t]*user[ \t].*" "${VPNCONF}" ; then - ewarn "WARNING: You are dropping root privileges!" - ewarn "As such openvpn may not be able to change ip, routing" - ewarn "or DNS configuration." - fi - else - # So we're a server. Run as openvpn unless otherwise specified - grep -q "^[ \t]*user[ \t].*" "${VPNCONF}" || args="${args} --user openvpn" - grep -q "^[ \t]*group[ \t].*" "${VPNCONF}" || args="${args} --group openvpn" - fi - - # Ensure that our scripts get the PEER_DNS variable - [ -n "${PEER_DNS}" ] && args="${args} --setenv PEER_DNS ${PEER_DNS}" - - [ "${reenter}" = "yes" ] && mark_service_inactive "${SVCNAME}" - start-stop-daemon --start --exec /usr/sbin/openvpn --pidfile "${VPNPID}" \ - -- --config "${VPNCONF}" --writepid "${VPNPID}" --daemon \ - --setenv SVCNAME "${SVCNAME}" ${args} - eend $? "Check your logs to see why startup failed" -} - -stop() { - # If we are re-called by the openvpn gentoo-down.sh script - # then we don't actually want to stop openvpn - if [ "${IN_BACKGROUND}" = "true" ] ; then - mark_service_inactive "${SVCNAME}" - return 0 - fi - - ebegin "Stopping ${SVCNAME}" - start-stop-daemon --stop --quiet \ - --exec /usr/sbin/openvpn --pidfile "${VPNPID}" - eend $? -} - -# vim: set ts=4 : diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/files/openvpn-2.1_rc13-peercred.patch --- a/net-misc/openvpn/files/openvpn-2.1_rc13-peercred.patch Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ ---- socket.c~ 2008-11-02 01:39:00.406009999 +0100 -+++ socket.c 2008-11-02 01:39:00.406009999 +0100 -@@ -22,6 +22,7 @@ - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#define _GNU_SOURCE - #include "syshead.h" - - #include "socket.h" diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/files/openvpn.init --- a/net-misc/openvpn/files/openvpn.init Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -VPNDIR="/etc/openvpn" -VPN="${SVCNAME#*.}" -if [ -n "${VPN}" ] && [ "${SVCNAME}" != "openvpn" ]; then - VPNPID="/var/run/openvpn.${VPN}.pid" -else - VPNPID="/var/run/openvpn.pid" -fi -VPNCONF="${VPNDIR}/${VPN}.conf" - -depend() { - need localmount net - before netmount - after bootmisc -} - -checktundevice() { - if [ ! -e /dev/net/tun ]; then - if ! modprobe tun ; then - eerror "TUN/TAP support is not available in this kernel" - return 1 - fi - fi - if [ -h /dev/net/tun ] && [ -c /dev/misc/net/tun ]; then - ebegin "Detected broken /dev/net/tun symlink, fixing..." - rm -f /dev/net/tun - ln -s /dev/misc/net/tun /dev/net/tun - eend $? - fi -} - -start() { - ebegin "Starting ${SVCNAME}" - - checktundevice || return 1 - - if [ ! -e "${VPNCONF}" ]; then - eend 1 "${VPNCONF} does not exist" - return 1 - fi - - local args="" - # If the config file does not specify the cd option, we do - # But if we specify it, we override the config option which we do not want - if ! grep -q "^[ \t]*cd[ \t].*" "${VPNCONF}" ; then - args="${args} --cd ${VPNDIR}" - fi - - start-stop-daemon --start --exec /usr/sbin/openvpn --pidfile "${VPNPID}" \ - -- --config "${VPNCONF}" --writepid "${VPNPID}" --daemon ${args} - eend $? "Check your logs to see why startup failed" -} - -stop() { - ebegin "Stopping ${SVCNAME}" - start-stop-daemon --stop --exec /usr/sbin/openvpn --pidfile "${VPNPID}" - eend $? -} - -# vim: ts=4 diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/files/up.sh --- a/net-misc/openvpn/files/up.sh Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -#!/bin/sh -# Copyright (c) 2006-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# Contributed by Roy Marples (uberlord@gentoo.org) - -# Setup our resolv.conf -# Vitally important that we use the domain entry in resolv.conf so we -# can setup the nameservers are for the domain ONLY in resolvconf if -# we're using a decent dns cache/forwarder like dnsmasq and NOT nscd/libc. -# nscd/libc users will get the VPN nameservers before their other ones -# and will use the first one that responds - maybe the LAN ones? -# non resolvconf users just the the VPN resolv.conf - -# FIXME:- if we have >1 domain, then we have to use search :/ -# We need to add a flag to resolvconf to say -# "these nameservers should only be used for the listed search domains -# if other global nameservers are present on other interfaces" -# This however, will break compatibility with Debians resolvconf -# A possible workaround would be to just list multiple domain lines -# and try and let resolvconf handle it - -if [ "${PEER_DNS}" != "no" ]; then - NS= - DOMAIN= - SEARCH= - i=1 - while true ; do - eval opt=\$foreign_option_${i} - [ -z "${opt}" ] && break - if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then - if [ -z "${DOMAIN}" ] ; then - DOMAIN="${opt#dhcp-option DOMAIN *}" - else - SEARCH="${SEARCH:+ }${opt#dhcp-option DOMAIN *}" - fi - elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then - NS="${NS}nameserver ${opt#dhcp-option DNS *}\n" - fi - i=$((${i} + 1)) - done - - if [ -n "${NS}" ] ; then - DNS="# Generated by openvpn for interface ${dev}\n" - if [ -n "${SEARCH}" ] ; then - DNS="${DNS}search ${DOMAIN} ${SEARCH}\n" - else - DNS="${DNS}domain ${DOMAIN}\n" - fi - DNS="${DNS}${NS}" - if [ -x /sbin/resolvconf ] ; then - printf "${DNS}" | /sbin/resolvconf -a "${dev}" - else - # Preserve the existing resolv.conf - if [ -e /etc/resolv.conf ] ; then - cp /etc/resolv.conf /etc/resolv.conf-"${dev}".sv - fi - printf "${DNS}" > /etc/resolv.conf - chmod 644 /etc/resolv.conf - fi - fi -fi - -# Below section is Gentoo specific -# Quick summary - our init scripts are re-entrant and set the SVCNAME env var -# as we could have >1 openvpn service - -if [ -n "${SVCNAME}" ]; then - # If we have a service specific script, run this now - if [ -x /etc/openvpn/"${SVCNAME}"-up.sh ] ; then - /etc/openvpn/"${SVCNAME}"-up.sh "$@" - fi - - # Re-enter the init script to start any dependant services - if ! /etc/init.d/"${SVCNAME}" --quiet status ; then - export IN_BACKGROUND=true - /etc/init.d/${SVCNAME} --quiet start - fi -fi - -exit 0 - -# vim: ts=4 : diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/metadata.xml --- a/net-misc/openvpn/metadata.xml Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - no-herd - - cedk@gentoo.org - Cédric Krier - - OpenVPN is an easy-to-use, robust and highly -configurable VPN daemon which can be used to securely link two or more -networks using an encrypted tunnel. - - Enabled iproute2 support instead of net-tools - Enables openvpn to save passwords - Enable PKCS#11 smartcard support - - diff -r e5aa50bd6794 -r d8386b80776e net-misc/openvpn/openvpn-2.1_rc15.ebuild --- a/net-misc/openvpn/openvpn-2.1_rc15.ebuild Fri Jan 02 15:35:37 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -# Copyright 1999-2008 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/openvpn-2.1_rc13.ebuild,v 1.3 2008/11/06 02:47:44 vapier Exp $ - -inherit eutils multilib - -DESCRIPTION="OpenVPN is a robust and highly flexible tunneling application compatible with many OSes." -SRC_URI="http://openvpn.net/release/${P}.tar.gz" -HOMEPAGE="http://openvpn.net/" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" -IUSE="examples iproute2 minimal pam passwordsave selinux ssl static pkcs11 threads userland_BSD" - -DEPEND=">=dev-libs/lzo-1.07 - kernel_linux? ( - iproute2? ( sys-apps/iproute2 ) !iproute2? ( sys-apps/net-tools ) - ) - !minimal? ( pam? ( virtual/pam ) ) - selinux? ( sec-policy/selinux-openvpn ) - ssl? ( >=dev-libs/openssl-0.9.6 ) - pkcs11? ( >=dev-libs/pkcs11-helper-1.05 )" - -pkg_setup() { - if use iproute2 ; then - if built_with_use sys-apps/iproute2 minimal ; then - eerror "iproute2 support requires that sys-apps/iproute2 was not" - eerror "built with the minimal USE flag" - die "iproute2 support not available" - fi - fi -} - -src_compile() { - local myconf="" - - if use minimal ; then - myconf="${myconf} --disable-plugins" - myconf="${myconf} --disable-pkcs11" - else - myconf="$(use_enable pkcs11)" - fi - - epatch "${FILESDIR}/${P}-peercred.patch" - econf ${myconf} \ - $(use_enable passwordsave password-save) \ - $(use_enable ssl) \ - $(use_enable ssl crypto) \ - $(use_enable threads pthread) \ - $(use_enable iproute2) \ - || die "configure failed" - - use static && sed -i -e '/^LIBS/s/LIBS = /LIBS = -static /' Makefile - - emake || die "make failed" - - if ! use minimal ; then - cd plugin - for i in $( ls 2>/dev/null ); do - [[ ${i} == "README" || ${i} == "examples" || ${i} == "defer" ]] && continue - [[ ${i} == "auth-pam" ]] && ! use pam && continue - einfo "Building ${i} plugin" - cd "${i}" - emake || die "make failed" - cd .. - done - cd .. - fi -} - -src_install() { - make DESTDIR="${D}" install || die "make install failed" - - # install documentation - dodoc AUTHORS ChangeLog PORTS README - - # Empty dir - dodir /etc/openvpn - keepdir /etc/openvpn - - # Install some helper scripts - exeinto /etc/openvpn - doexe "${FILESDIR}/up.sh" - doexe "${FILESDIR}/down.sh" - - # Install the init script and config file - newinitd "${FILESDIR}/${PN}-2.1.init" openvpn - newconfd "${FILESDIR}/${PN}-2.1.conf" openvpn - - # install examples, controlled by the respective useflag - if use examples ; then - # dodoc does not supportly support directory traversal, #15193 - insinto /usr/share/doc/${PF}/examples - doins -r sample-{config-files,keys,scripts} contrib - prepalldocs - fi - - # Install plugins and easy-rsa - if ! use minimal ; then - cd easy-rsa/2.0 - make install "DESTDIR=${D}/usr/share/${PN}/easy-rsa" - cd ../.. - - exeinto "/usr/$(get_libdir)/${PN}" - doexe plugin/*/*.so - fi -} - -pkg_postinst() { - # Add openvpn user so openvpn servers can drop privs - # Clients should run as root so they can change ip addresses, - # dns information and other such things. - enewgroup openvpn - enewuser openvpn "" "" "" openvpn - - if [[ -n $(ls /etc/openvpn/*/local.conf 2>/dev/null) ]] ; then - ewarn "WARNING: The openvpn init script has changed" - ewarn "" - fi - - einfo "The openvpn init script expects to find the configuration file" - einfo "openvpn.conf in /etc/openvpn along with any extra files it may need." - einfo "" - einfo "To create more VPNs, simply create a new .conf file for it and" - einfo "then create a symlink to the openvpn init script from a link called" - einfo "openvpn.newconfname - like so" - einfo " cd /etc/openvpn" - einfo " ${EDITOR##*/} foo.conf" - einfo " cd /etc/init.d" - einfo " ln -s openvpn openvpn.foo" - einfo "" - einfo "You can then treat openvpn.foo as any other service, so you can" - einfo "stop one vpn and start another if you need to." - - if grep -Eq "^[ \t]*(up|down)[ \t].*" "${ROOT}/etc/openvpn"/*.conf 2>/dev/null ; then - ewarn "" - ewarn "WARNING: If you use the remote keyword then you are deemed to be" - ewarn "a client by our init script and as such we force up,down scripts." - ewarn "These scripts call /etc/openvpn/\$SVCNAME-{up,down}.sh where you" - ewarn "can move your scripts to." - fi - - if ! use minimal ; then - einfo "" - einfo "plugins have been installed into /usr/$(get_libdir)/${PN}" - fi -}