[Openvpn-devel,v1] Remove contrib/pull-resolv-conf

Message ID 20250528191126.25707-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] Remove contrib/pull-resolv-conf | expand

Commit Message

Gert Doering May 28, 2025, 7:11 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

We have an official solution for this now.

Change-Id: Ic30f8514b50f561e7ea8f1ce12d740ac53f202e5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1034
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering May 28, 2025, 7:19 p.m. UTC | #1
Indeed - "because why ship something which is not doing a good job when
we have something new that does a better job" ;-) - and out it goes.

Your patch has been applied to the master branch.

commit 26a5c094bddbf528be4f6f2f26d9831717d5139d
Author: Frank Lichtenheld
Date:   Wed May 28 21:11:20 2025 +0200

     Remove contrib/pull-resolv-conf

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20250528191126.25707-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31820.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/contrib/pull-resolv-conf/client.down b/contrib/pull-resolv-conf/client.down
deleted file mode 100644
index 0cbb476..0000000
--- a/contrib/pull-resolv-conf/client.down
+++ /dev/null
@@ -1,51 +0,0 @@ 
-#!/bin/sh
-
-# Copyright (c) 2005-2018 OpenVPN Inc
-# Licensed under the GPL version 2
-
-# First version by Jesse Adelman
-# someone at boldandbusted dink com
-# http://www.boldandbusted.com/
-
-# PURPOSE: This script automatically removes the /etc/resolv.conf entries previously
-# set by the companion script "client.up".
-
-# INSTALL NOTES:
-# Place this in /etc/openvpn/client.down
-# Then, add the following to your /etc/openvpn/<clientconfig>.conf:
-#   client
-#   up /etc/openvpn/client.up
-#   down /etc/openvpn/client.down
-# Next, "chmod a+x /etc/openvpn/client.down"
-
-# USAGE NOTES:
-# Note that this script is best served with the companion "client.up"
-# script.
-
-# Tested under Debian lenny with OpenVPN 2.1_rc11
-# It should work with any UNIX with a POSIX sh, /etc/resolv.conf or resolvconf
-
-# This runs with the context of the OpenVPN UID/GID 
-# at the time of execution. This generally means that
-# the client "up" script will run fine, but the "down" script
-# will require the use of the OpenVPN "down-root" plugin
-# which is in the plugins/ directory of the OpenVPN source tree
-# The config example above would have to be changed to:
-#   client
-#   up /etc/openvpn/client.up
-#   plugin openvpn-plugin-down-root.so "/etc/openvpn/client.down"
-
-# A horrid work around, from a security perspective,
-# is to run OpenVPN as root. THIS IS NOT RECOMMENDED. You have
-# been WARNED.
-PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
-
-if type resolvconf >/dev/null 2>&1; then
-  resolvconf -d "${dev}" -f
-elif [ -e /etc/resolv.conf.ovpnsave ] ; then
-  # cp + rm rather than mv in case it's a symlink
-  cp /etc/resolv.conf.ovpnsave /etc/resolv.conf
-  rm -f /etc/resolv.conf.ovpnsave
-fi
-
-exit 0
diff --git a/contrib/pull-resolv-conf/client.up b/contrib/pull-resolv-conf/client.up
deleted file mode 100644
index 220aeb7..0000000
--- a/contrib/pull-resolv-conf/client.up
+++ /dev/null
@@ -1,104 +0,0 @@ 
-#!/bin/sh
-
-# Copyright (c) 2005-2018 OpenVPN Inc
-# Licensed under the GPL version 2
-
-# First version by Jesse Adelman
-# someone at boldandbusted dink com
-# http://www.boldandbusted.com/
-
-# PURPOSE: This script automatically sets the proper /etc/resolv.conf entries
-# as pulled down from an OpenVPN server.
-
-# INSTALL NOTES:
-# Place this in /etc/openvpn/client.up
-# Then, add the following to your /etc/openvpn/<clientconfig>.conf:
-#   client
-#   up /etc/openvpn/client.up
-# Next, "chmod a+x /etc/openvpn/client.up"
-
-# USAGE NOTES:
-# Note that this script is best served with the companion "client.down"
-# script.
-
-# Tested under Debian lenny with OpenVPN 2.1_rc11
-# It should work with any UNIX with a POSIX sh, /etc/resolv.conf or resolvconf
-
-# This runs with the context of the OpenVPN UID/GID 
-# at the time of execution. This generally means that
-# the client "up" script will run fine, but the "down" script
-# will require the use of the OpenVPN "down-root" plugin
-# which is in the plugins/ directory of the OpenVPN source tree
-
-# A horrid work around, from a security perspective,
-# is to run OpenVPN as root. THIS IS NOT RECOMMENDED. You have
-# been WARNED.
-PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
-
-# init variables
-
-i=1
-domains=
-fopt=
-ndoms=0
-nns=0
-nl='
-'
-
-# $foreign_option_<n> is something like
-# "dhcp-option DOMAIN example.com" (multiple allowed)
-# or
-# "dhcp-option DNS 10.10.10.10" (multiple allowed)
-
-# each DNS option becomes a "nameserver" option in resolv.conf
-# if we get one DOMAIN, that becomes "domain" in resolv.conf
-# if we get multiple DOMAINS, those become "search" lines in resolv.conf
-# if we get no DOMAINS, then don't use either domain or search.
-
-while true; do
-  eval fopt=\$foreign_option_${i}
-  [ -z "${fopt}" ] && break
-
-  case ${fopt} in
-		dhcp-option\ DOMAIN\ *)
-           ndoms=$((ndoms + 1))
-           domains="${domains} ${fopt#dhcp-option DOMAIN }"
-           ;;
-		dhcp-option\ DNS\ *)
-           nns=$((nns + 1))
-           if [ $nns -le 3 ]; then
-             dns="${dns}${dns:+$nl}nameserver ${fopt#dhcp-option DNS }"
-           else
-             printf "%s\n" "Too many nameservers - ignoring after third" >&2
-           fi
-           ;;
-        *)
-           printf "%s\n" "Unknown option \"${fopt}\" - ignored" >&2
-           ;;
-	esac
-  i=$((i + 1))
-done
-
-ds=""
-if [ $ndoms -eq 1 ]; then
-  ds="${nl}domain"
-elif [ $ndoms -gt 1 ]; then
-  ds="${nl}search"
-fi
-
-# This is the complete file - "$domains" has a leading space already
-out="# resolv.conf autogenerated by ${0} (${dev})${nl}${dns}${ds}${domains}"
-
-# use resolvconf if it's available
-if type resolvconf >/dev/null 2>&1; then
-  printf "%s\n" "${out}" | resolvconf -a "${dev}"
-else
-  # Preserve the existing resolv.conf
-  if [ -e /etc/resolv.conf ] ; then
-    cp /etc/resolv.conf /etc/resolv.conf.ovpnsave
-  fi
-  printf "%s\n" "${out}" > /etc/resolv.conf
-  chmod 644 /etc/resolv.conf
-fi
-
-exit 0