VPN: OpenVPN: Instances - add basic http client option, closes https://github.com/opnsense/core/issues/8342

This commit is contained in:
Ad Schellevis 2025-03-05 20:58:19 +01:00
parent e7ad0a4fcb
commit eb6e9a9fcf
3 changed files with 18 additions and 0 deletions

View File

@ -670,4 +670,14 @@ Set to 0 to disable, remember to change your client as well.
<formatter>boolean</formatter>
</grid_view>
</field>
<field>
<id>instance.http-proxy</id>
<label>HTTP Proxy</label>
<type>text</type>
<style>role role_client</style>
<help>Use a http proxy to connect to the selected server, define as host:port.</help>
<grid_view>
<visible>false</visible>
</grid_view>
</field>
</fields>

View File

@ -548,6 +548,11 @@ class OpenVPN extends BaseModel
if (!empty((string)$node->remote_cert_tls)) {
$options['remote-cert-tls'] = 'server';
}
if (strrpos($node->{'http-proxy'}, ':') > 0) {
$tmp = substr_replace($node->{'http-proxy'}, ' ', strrpos($node->{'http-proxy'}, ':'), 1);
$options['http-proxy'] = $tmp;
}
// XXX: In some cases it might be practical to drop privileges, for server mode this will be
// more difficult due to the associated script actions (and their requirements).
//$options['user'] = 'openvpn';

View File

@ -382,6 +382,9 @@
<description type="DescriptionField"/>
<compress_migrate type="BooleanField"/>
<ifconfig-pool-persist type="BooleanField"/>
<http-proxy type="IPPortField">
<HostnameAllowed>Y</HostnameAllowed>
</http-proxy>
</Instance>
</Instances>
<StaticKeys>