for Bug 13967 - OpenVPN is missing a way to use "block-outside-dns"

Message ID 1778240422246.3723185779.1317300897@web.de
State New
Headers
Series for Bug 13967 - OpenVPN is missing a way to use "block-outside-dns" |

Commit Message

Larsen 8 May 2026, 11:44 a.m. UTC
@@ -, +, @@ 
  html/cgi-bin/ovpnmain.cgi | 13 +++++++++++++
  langs/en/cgi-bin/en.pl    |  1 +
  2 files changed, 14 insertions(+)
  

Comments

Michael Tremer 9 May 2026, 8:53 a.m. UTC | #1
Hello Larsen,

Thank you for your email.

Please read through the guide on how to submit a patch:

 https://www.ipfire.org/docs/devel/submit-patches

This patch has been mangled, you are missing a proper sender and Git tags.

Regrading the contents of this, you are implementing this as a global option for all clients. All other options are implemented globally as well as on a per-client basis so that they can be enabled only where they are actually needed. Would you be able to add this?

All the best,
-Michael

> On 8 May 2026, at 12:44, Larsen <larsen007@web.de> wrote:
> 
> 
> 
> @@ -, +, @@  html/cgi-bin/ovpnmain.cgi | 13 +++++++++++++
> langs/en/cgi-bin/en.pl    |  1 +
> 2 files changed, 14 insertions(+)
> --- a/html/cgi-bin/ovpnmain.cgi 
> +++ a/html/cgi-bin/ovpnmain.cgi 
> @@ -388,6 +388,9 @@ sub writeserverconf {
>         print CONF "push \"dhcp-option WINS $wins_server\"\n";
>     }
> +    if ($vpnsettings{BLOCK_OUTSIDE_DNS} eq 'on') {
> +        print CONF "push \"block-outside-dns\"\n";
> +    }
>     if ($vpnsettings{MAX_CLIENTS} eq '') {
> print CONF "max-clients 100\n";
>     }
> @@ -1098,6 +1101,7 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save-adv-options'}) {
>     $vpnsettings{'DHCP_DOMAIN'} = $cgiparams{'DHCP_DOMAIN'};
>     $vpnsettings{'DHCP_DNS'} = $cgiparams{'DHCP_DNS'};
>     $vpnsettings{'DHCP_WINS'} = $cgiparams{'DHCP_WINS'};
> +    $vpnsettings{'BLOCK_OUTSIDE_DNS'} = $cgiparams{'BLOCK_OUTSIDE_DNS'};
>     $vpnsettings{'ROUTES_PUSH'} = $cgiparams{'ROUTES_PUSH'};
>     $vpnsettings{'DATACIPHERS'} = $cgiparams{'DATACIPHERS'};
>     $vpnsettings{'DCIPHER'} = $cgiparams{'DCIPHER'};
> @@ -2722,6 +2726,9 @@ ADV_ERROR:
>     $selected{'DPROTOCOL'}{'tcp'} = '';
>     $selected{'DPROTOCOL'}{$vpnsettings{'DPROTOCOL'}} = 'SELECTED';
> +    $checked{'BLOCK_OUTSIDE_DNS'}{'off'} = '';
> +    $checked{'BLOCK_OUTSIDE_DNS'}{'on'} = '';
> +    $checked{'BLOCK_OUTSIDE_DNS'}{$vpnsettings{'BLOCK_OUTSIDE_DNS'}} = 'CHECKED';
>     $checked{'REDIRECT_GW_DEF1'}{'off'} = '';
>     $checked{'REDIRECT_GW_DEF1'}{'on'} = '';
>     $checked{'REDIRECT_GW_DEF1'}{$vpnsettings{'REDIRECT_GW_DEF1'}} = 'CHECKED';
> @@ -2936,6 +2943,12 @@ END
> <input type='TEXT' name='DHCP_WINS' value='$wins_servers' size='30' />
> </td>
> </tr>
> + <tr>
> + <td>$Lang::tr{'ovpn block outside dns'}</td>
> + <td>
> + <input type='checkbox' name='BLOCK_OUTSIDE_DNS' $checked{'BLOCK_OUTSIDE_DNS'}{'on'} />
> + </td>
> + </tr>
> </table>
>   <h6>$Lang::tr{'ovpn routing settings'}</h6>
> --- a/langs/en/cgi-bin/en.pl 
> +++ a/langs/en/cgi-bin/en.pl 
> @@ -2068,6 +2068,7 @@  'override mtu' => 'Override default MTU',
> 'ovpn' => 'OpenVPN',
> 'ovpn add conf' => 'Additional configuration',
> +'ovpn block outside dns' => 'Block outside DNS',
> 'ovpn ciphers' => 'Ciphers',
> 'ovpn con stat' => 'OpenVPN Connection Statistics',
> 'ovpn config' => 'OVPN-Config',
>
  

Patch

--- a/html/cgi-bin/ovpnmain.cgi	
+++ a/html/cgi-bin/ovpnmain.cgi	
@@ -388,6 +388,9 @@  sub writeserverconf {
          print CONF "push \"dhcp-option WINS $wins_server\"\n";
      }
  
+    if ($vpnsettings{BLOCK_OUTSIDE_DNS} eq 'on') {
+        print CONF "push \"block-outside-dns\"\n";
+    }
      if ($vpnsettings{MAX_CLIENTS} eq '') {
  	print CONF "max-clients 100\n";
      }
@@ -1098,6 +1101,7 @@  if ($cgiparams{'ACTION'} eq 
$Lang::tr{'save-adv-options'}) {
      $vpnsettings{'DHCP_DOMAIN'} = $cgiparams{'DHCP_DOMAIN'};
      $vpnsettings{'DHCP_DNS'} = $cgiparams{'DHCP_DNS'};
      $vpnsettings{'DHCP_WINS'} = $cgiparams{'DHCP_WINS'};
+    $vpnsettings{'BLOCK_OUTSIDE_DNS'} = $cgiparams{'BLOCK_OUTSIDE_DNS'};
      $vpnsettings{'ROUTES_PUSH'} = $cgiparams{'ROUTES_PUSH'};
      $vpnsettings{'DATACIPHERS'} = $cgiparams{'DATACIPHERS'};
      $vpnsettings{'DCIPHER'} = $cgiparams{'DCIPHER'};
@@ -2722,6 +2726,9 @@  ADV_ERROR:
      $selected{'DPROTOCOL'}{'tcp'} = '';
      $selected{'DPROTOCOL'}{$vpnsettings{'DPROTOCOL'}} = 'SELECTED';
  
+    $checked{'BLOCK_OUTSIDE_DNS'}{'off'} = '';
+    $checked{'BLOCK_OUTSIDE_DNS'}{'on'} = '';
+    $checked{'BLOCK_OUTSIDE_DNS'}{$vpnsettings{'BLOCK_OUTSIDE_DNS'}} = 
'CHECKED';
      $checked{'REDIRECT_GW_DEF1'}{'off'} = '';
      $checked{'REDIRECT_GW_DEF1'}{'on'} = '';
      $checked{'REDIRECT_GW_DEF1'}{$vpnsettings{'REDIRECT_GW_DEF1'}} = 
'CHECKED';
@@ -2936,6 +2943,12 @@  END
  						<input type='TEXT' name='DHCP_WINS' value='$wins_servers' size='30' 
/>
  					</td>
  				</tr>
+				<tr>
+					<td>$Lang::tr{'ovpn block outside dns'}</td>
+					<td>
+						<input type='checkbox' name='BLOCK_OUTSIDE_DNS' 
$checked{'BLOCK_OUTSIDE_DNS'}{'on'} />
+					</td>
+				</tr>
  			</table>
  
  			<h6>$Lang::tr{'ovpn routing settings'}</h6>
--- a/langs/en/cgi-bin/en.pl	
+++ a/langs/en/cgi-bin/en.pl	
@@ -2068,6 +2068,7 @@  
  'override mtu' => 'Override default MTU',
  'ovpn' => 'OpenVPN',
  'ovpn add conf' => 'Additional configuration',
+'ovpn block outside dns' => 'Block outside DNS',
  'ovpn ciphers' => 'Ciphers',
  'ovpn con stat' => 'OpenVPN Connection Statistics',
  'ovpn config' => 'OVPN-Config',