From: "selvanair (Code Review)" Date: Sun, 23 Nov 2025 18:35:48 +0000 References: Reply-To: selva.nair@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <03f74554af5caef6f620c2c0bcabc6dc17b0d225-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="+vGBvyQ7hhw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Restrict access to the service pipe to SYSTEM and owner List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --+vGBvyQ7hhw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1397?usp=3Demail to review the following change. Change subject: Restrict access to the service pipe to SYSTEM and owner ...................................................................... Restrict access to the service pipe to SYSTEM and owner Access is restrcted to SYSTEM and pipe client user (the user starting openvpn.exe). The default is full access to Administrtors, owner, and read access to everyone. This hardens the pipe further. Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e Signed-off-by: Selva Nair --- M src/openvpnserv/interactive.c 1 file changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/97/1397/1 diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 7a0a075..521ffff 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -3418,9 +3418,26 @@ GetCurrentThreadId(), pipe_uuid_str); RpcStringFree(&pipe_uuid_str); + /* make a security descriptor for the named pipe with access + * restrcted to the user and SYSTEM + */ + + SECURITY_ATTRIBUTES sa; + PSECURITY_DESCRIPTOR pSD =3D NULL; + LPCWSTR szSDDL =3D L"D:(A;;GA;;;SY)(A;;GA;;;OW)"; + if (!ConvertStringSecurityDescriptorToSecurityDescriptorW( + szSDDL, SDDL_REVISION_1, &pSD, NULL)) + { + ReturnLastError(pipe, L"ConvertSDDL"); + goto out; + } + sa.nLength =3D sizeof(sa); + sa.lpSecurityDescriptor =3D pSD; + sa.bInheritHandle =3D FALSE; + ovpn_pipe =3D CreateNamedPipe( ovpn_pipe_name, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE= | FILE_FLAG_OVERLAPPED, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT | PIPE_REJEC= T_REMOTE_CLIENTS, 1, 128, 128, 0, NULL); + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT | PIPE_REJEC= T_REMOTE_CLIENTS, 1, 128, 128, 0, &sa); if (ovpn_pipe =3D=3D INVALID_HANDLE_VALUE) { ReturnLastError(pipe, L"CreateNamedPipe"); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1397?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e Gerrit-Change-Number: 1397 Gerrit-PatchSet: 1 Gerrit-Owner: selvanair Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --+vGBvyQ7hhw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

selvanair would like plaisthos to review this change.

V= iew Change

Restrict access to the service pipe to SYST=
EM and owner

Access is restrcted to SYSTEM and pipe client user
(= the user starting openvpn.exe). The default is
full access to Administrt= ors, owner, and read access
to everyone. This hardens the pipe further.<= br>
Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e
Signed-off-b= y: Selva Nair <selva.nair@...277...>
---
M src/openvpnserv/inte= ractive.c
1 file changed, 18 insertions(+), 1 deletion(-)

<= pre class=3D"blocks" style=3D"font-family: monospace,monospace; white-space= : pre-wrap;">git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/9= 7/1397/1
diff --git a/src/openvpnserv/interactive.c b/src/openvpnse=
rv/interactive.c
index 7a0a075..521ffff 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnse= rv/interactive.c
@@ -3418,9 +3418,26 @@
= GetCurrentThreadId(), pipe_uuid_str);
RpcSt= ringFree(&pipe_uuid_str);

+ /* make a security descriptor for the named= pipe with access
+ = * restrcted to the user and SYSTEM
+ */
+
+ SECURITY_= ATTRIBUTES sa;
+ P= SECURITY_DESCRIPTOR pSD =3D NULL;
+ LPCWSTR szSDDL =3D L"D:(A;;GA;;;SY)(A;;GA;;;OW)"= ;;
+ if (!ConvertS= tringSecurityDescriptorToSecurityDescriptorW(
+ szSDDL, SDDL_REVISION_1, &pSD, NU= LL))
+ {+ ReturnLastError(pipe,= L"ConvertSDDL");
+ goto out;
+ }
+ sa.n= Length =3D sizeof(sa);
+ sa.bInheritHandle =3D FALSE;
+
ovpn_pipe =3D Creat= eNamedPipe(
ovpn_pipe_name, PIPE_ACCESS_DUPLEX | F= ILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_MESSAGE | PIPE_READMODE_M= ESSAGE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, 1, 128, 128, 0, NULL);
+ PIPE_TYPE_MESSA= GE | PIPE_READMODE_MESSAGE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, 1, 128= , 128, 0, &sa);
if (ovpn_pipe =3D=3D INVALID_HANDL= E_VALUE)
{
ReturnLastError(pi= pe, L"CreateNamedPipe");

To v= iew, visit change 1397. To unsubscribe, or for help writing mail filters, visit= settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8aa1cf1585e2320fca9329bdd02= 27976606fe71e
Gerrit-Change-Number: 1397
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <selva.nair@...1354...= ..>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --+vGBvyQ7hhw=--