MIME-Version: 1.0 From: Ricardo Manriquez Date: Sun, 18 Sep 2022 10:23:14 +0900 Message-ID: Content-Type: multipart/alternative; boundary="0000000000001155eb05e8e97156" Subject: [Openvpn-devel] [PATCH] Allow DNS autoconf by passing hostname by IV variables when using push-peer-info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: openvpn-devel@lists.sourceforge.net --0000000000001155eb05e8e97156 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Author: Ricardo Manr=C3=ADquez To enable the possibility of DNS autoconfiguration the IP address and hostname of the client are needed to register at the DNS level, this patch adds this information when using push-peer-info. The motivation is that the domain name is as intrusive as the MAC address and DNS autoconfiguration is helpful to be able to communicate back to the clients, this generates a problem when the client connects to the network directly and then uses the VPN connection, now the DNS records do not match and when using remote assistance or remote management tools the benefits of DNS are negated. Signed-off-by: Ricardo Manr=C3=ADquez --- src/openvpn/ssl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 80e0d5acb4..3031566585 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2321,6 +2321,11 @@ push_peer_info(struct buffer *buf, struct tls_session *session) { buf_printf(&out, "IV_HWADDR=3D%s\n", format_hex_ex(rgi.hwaddr, 6, 0, 1, ":", &gc)); } + + char hostname[64]; + gethostname(hostname, 63); + buf_printf(&out, "IV_HOSTNAME=3D%s\n", hostname ); + buf_printf(&out, "IV_SSL=3D%s\n", get_ssl_library_version() ); #if defined(_WIN32) buf_printf(&out, "IV_PLAT_VER=3D%s\n", win32_version_string(&gc, false)); --0000000000001155eb05e8e97156 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Author: Ricardo Manr=C3=ADquez <ricardo.manriquez@...1664...= 7...>

To enable the possibility of DNS autoconfiguratio= n the IP address and hostname of the client are needed to register at the D= NS level, this patch adds this information when using push-peer-info.
=

The motivation is that the domain name is as intrusive = as the MAC address and DNS autoconfiguration is helpful to be able to commu= nicate back to the clients, this generates a problem when the client connec= ts to the network directly and then uses the VPN connection, now the DNS re= cords do not match and when using remote assistance or remote management to= ols the benefits of DNS are negated.

Signed-of= f-by: Ricardo Manr=C3=ADquez <ricardo.manriquez@...277...>
---
 src/openvpn/ssl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 80e0d5acb4..3031566585 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -2321,6 +2321,11 @@ push_peer_info(struct buffer *buf, struct tls_sessio=
n *session)
             {
                 buf_printf(&out, "IV_HWADDR=3D%s\n", format_=
hex_ex(rgi.hwaddr, 6, 0, 1, ":", &gc));
             }
+
+            char hostname[64];
+            gethostname(hostname, 63);
+            buf_printf(&out, "IV_HOSTNAME=3D%s\n", hostname =
);
+
             buf_printf(&out, "IV_SSL=3D%s\n", get_ssl_librar=
y_version() );
 #if defined(_WIN32)
             buf_printf(&out, "IV_PLAT_VER=3D%s\n", win32_ver=
sion_string(&gc, false));
--0000000000001155eb05e8e97156--