Attention is currently required from: Arne Schwabe, Răzvan Cojocaru.

Deri Haerudi has posted comments on this change by Deri Haerudi. ( 
https://gerrit.openvpn.net/c/openvpn/+/2341?usp=email )

Change subject: dns-scripts: parse dns_vars_file as data instead of sourcing it
......................................................................


Patch Set 2:

(2 comments)

Commit Message:

https://gerrit.openvpn.net/c/openvpn/+/2341/comment/8ce168d7_3139dc37?usp=email 
:
PS1, Line 19: the unprivileged process controls a file root will execute.
> (b) is not really achieved. […]
You're right, thanks. dev went into the dns-down sed program unchecked, so a 
crafted vars file could still run commands through sed's "e".

I took your first option. In PS2 the reader only accepts a dev that starts with 
a letter or digit, contains only [A-Za-z0-9_./-] and no "..", and otherwise 
exits with an error. '/' has to stay allowed because Haiku names its devices 
tun/N (tun.c), so the three dns-down sed calls now use \%...% addresses: with 
"/" as the delimiter, a dev like "x/r<file>" or "x/w<file>" would still have 
made sed read or write files as root without needing any other special 
character. As a side effect, dev=tun/0 no longer breaks that sed expression.

The message now says what is and isn't covered: root no longer executes the 
file, but the C side still trusts the path, and the values are still used as 
DNS configuration. One spot I left alone: unset_search_domains in the macOS 
script still uses search domains in a sed "s" expression. I'm happy to look at 
that in a separate change.


File distro/dns-scripts/haikuos_file-dns-updown.sh:

https://gerrit.openvpn.net/c/openvpn/+/2341/comment/94050c53_e53c2ca2?usp=email 
:
PS1, Line 53:     [ -r "$_f" ] || return 0
> This should be `|| exit 1` - otherwise we are letting the script carry on 
> with `script_type` unset.
Done, in all five scripts. The old ". $dns_vars_file" also made the /bin/sh 
scripts exit at that point, so "return 0" was a behaviour change in PS1: 
resolvconf_file and haikuos_file exited 0 without doing anything, and 
openresolv fell through to "resolvconf -d '' -f".



--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2341?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id05f3e4e32aeb806d762858e754adc82f42d4371
Gerrit-Change-Number: 2341
Gerrit-PatchSet: 2
Gerrit-Owner: Deri Haerudi <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Comment-Date: Wed, 25 Nov 2026 09:49:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Răzvan Cojocaru <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to