From: "cron2 (Code Review)" Date: Wed, 28 May 2025 19:19:53 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <8ad319a84cecb38242fd16fb51be276401b50154-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Y79h/LKxmhE="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Remove contrib/pull-resolv-conf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --Y79h/LKxmhE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/10= 34?usp=3Demail ) Change subject: Remove contrib/pull-resolv-conf ...................................................................... Remove contrib/pull-resolv-conf We have an official solution for this now. Change-Id: Ic30f8514b50f561e7ea8f1ce12d740ac53f202e5 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250528191126.25707-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 820.html Signed-off-by: Gert Doering --- D contrib/pull-resolv-conf/client.down D contrib/pull-resolv-conf/client.up 2 files changed, 0 insertions(+), 155 deletions(-) diff --git a/contrib/pull-resolv-conf/client.down b/contrib/pull-resolv-con= f/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/.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 resolv= conf - -# 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=3D/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 entr= ies -# as pulled down from an OpenVPN server. - -# INSTALL NOTES: -# Place this in /etc/openvpn/client.up -# Then, add the following to your /etc/openvpn/.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 resolv= conf - -# 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=3D/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin - -# init variables - -i=3D1 -domains=3D -fopt=3D -ndoms=3D0 -nns=3D0 -nl=3D' -' - -# $foreign_option_ 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=3D\$foreign_option_${i} - [ -z "${fopt}" ] && break - - case ${fopt} in - dhcp-option\ DOMAIN\ *) - ndoms=3D$((ndoms + 1)) - domains=3D"${domains} ${fopt#dhcp-option DOMAIN }" - ;; - dhcp-option\ DNS\ *) - nns=3D$((nns + 1)) - if [ $nns -le 3 ]; then - dns=3D"${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=3D$((i + 1)) -done - -ds=3D"" -if [ $ndoms -eq 1 ]; then - ds=3D"${nl}domain" -elif [ $ndoms -gt 1 ]; then - ds=3D"${nl}search" -fi - -# This is the complete file - "$domains" has a leading space already -out=3D"# resolv.conf autogenerated by ${0} (${dev})${nl}${dns}${ds}${domai= ns}" - -# 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 -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1034?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ic30f8514b50f561e7ea8f1ce12d740ac53f202e5 Gerrit-Change-Number: 1034 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --Y79h/LKxmhE= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Remove contrib/pull-resolv-conf

We hav= e an official solution for this now.

Change-Id: Ic30f8514b50f561e7ea= 8f1ce12d740ac53f202e5
Signed-off-by: Frank Lichtenheld <frank@...2746...= ...>
Acked-by: Gert Doering <gert@...1296...>
Message-Id: &l= t;20250528191126.25707-1-gert@...1296...>
URL: https://www.mail-archi= ve.com/openvpn-devel@lists.sourceforge.net/msg31820.html
Signed-off-by: = Gert Doering <gert@...1296...>
---
D contrib/pull-resolv-conf/c= lient.down
D contrib/pull-resolv-conf/client.up
2 files changed, 0 in= sertions(+), 155 deletions(-)

diff --git a/contrib/pull-resolv-conf/client.down b/contrib/pull-resolv-=
conf/client.down
deleted file mode 100644
i= ndex 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&quo= t;.
-
-# INSTALL NOTES:
-# Place this in /etc/openvpn/client.down
-# Then, add the followin= g to your /etc/openvpn/<clientconfig>.conf:
-# client
-# up /etc/openvpn/client.up
-# down /etc/openvpn/client.down
-# Next, "chmod a+x /etc/openvpn/c= lient.down"
-
-# USAGE NOTES:
<= span style=3D"color: hsl(0, 100%, 40%);">-# Note that this script is best s= erved 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/re= solv.conf or resolvconf
-
-# This runs with th= e context of the OpenVPN UID/GID
-# at the time of execution. This generally means that-# the client "up" scr= ipt will run fine, but the "down" script
-# will require the use of the OpenVPN "do= wn-root" plugin
-#= which is in the plugins/ directory of the OpenVPN source tree
-# The config example above would h= ave 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 per= spective,
-# is to run = OpenVPN as root. THIS IS NOT RECOMMENDED. You have
-# been WARNED.
-PATH=3D/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

- c= p /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<= /span>
-
-# First version by Jesse Adelman
= -# someone at boldandbusted dink = com
-# http://www.bolda= ndbusted.com/
-<= br>-# PURPOSE: This script automa= tically sets the proper /etc/resolv.conf entries
-# as pulled down from an OpenVPN server.<= br>-
-# INSTALL NOTES:
-# Place this in /etc/openvpn/client.up
-# Then, add the following to your /etc= /openvpn/<clientconfig>.conf:
-# client
-# Next, "chmod a+x /etc/openvpn/client.up"
<= span style=3D"color: hsl(0, 100%, 40%);">-
-# USAGE NOTES:
-# Note that this script is best served with the companion &qu= ot;client.down"
-#= script.
-
-# Tested under Debian lenny with O= penVPN 2.1_rc11
-# It s= hould 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 tim= e of execution. This generally means that
-# the client "up" script will run fine, but t= he "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 RECOMME= NDED. You have
-# been = WARNED.
-PATH=3D/bin:/u= sr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
-
-# init variables
-
-i=3D1-domains=3D
-fopt=3D
-ndoms=3D0
-nns=3D0
-nl=3D&#= 39;
-'
-
-# $foreign_option_<n> is something like-# "dhcp-option DOMAIN exam= ple.com" (multiple allowed)
-# or
-# &quo= t;dhcp-option DNS 10.10.10.10" (multiple allowed)
-
-# each DNS option becomes a "nameserver" option in re= solv.conf
-# if we get = one DOMAIN, that becomes "domain" in resolv.conf
-# if we get multiple DOMAINS, those be= come "search" lines in resolv.conf
-# if we get no DOMAINS, then don't use either do= main or search.
-
-while true; do
- eval fopt=3D\$foreign_option_${i= }

- [ -z "${fopt}= " ] && break
-
- case ${fopt} in=
- dhcp-option\ DOMAIN= \ *)
- ndoms= =3D$((ndoms + 1))
- = domains=3D"${domains} ${fopt#dhcp-option DOMAIN }"<= br>- ;;
- dhcp-option\ DNS\ *)
- nns=3D$((nns + 1))=
- if [ $nns -le 3 ]= ; then
- dn= s=3D"${dns}${dns:+$nl}nameserver ${fopt#dhcp-option DNS }"=
- else
- printf "%s\n&quo= t; "Too many nameservers - ignoring after third" >&2

- fi
- ;;
- *)
- printf "%s\n" "Unknown optio= n \"${fopt}\" - ignored" >&2
- ;;
- esac
- i=3D$((i + 1))
-= done
-
-ds=3D""
-if [ $ndoms -eq 1 ]; then
- ds=3D"${nl}domain"<= br>-elif [ $ndoms -gt 1 ]; then
- ds=3D"${nl}searc= h"
-fi
<= span style=3D"color: hsl(0, 100%, 40%);">-

-# This is the complete file - "$domains" has= a leading space already
-
-# use resolvconf if it'= ;s available
-if type r= esolvconf >/dev/null 2>&1; then
- printf "%s\n" "${out}" | resolvco= nf -a "${dev}"
- # Preserve t= he 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
- c= hmod 644 /etc/resolv.conf
-fi
-
-exit 0


To view, visit change 1034. To unsubscribe, or for help writing mail fil= ters, visit settings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic30f8514b50f561e7ea8f1ce12d= 740ac53f202e5
Gerrit-Change-Number: 1034
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--Y79h/LKxmhE=--