mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
VPN: OpenVPN: Instances - add mode server and tls-server to tap servers and hide server fields. for https://github.com/opnsense/core/issues/7302
This commit is contained in:
parent
8fab0a77c6
commit
3d09a2cb60
@ -91,7 +91,7 @@
|
||||
<id>instance.server</id>
|
||||
<label>Server (IPv4)</label>
|
||||
<type>text</type>
|
||||
<style>role role_server</style>
|
||||
<style>role role_server_tun</style>
|
||||
<help>
|
||||
This directive will set up an OpenVPN server which will allocate addresses to clients out of the given network/netmask.
|
||||
The server itself will take the .1 address of the given network for use as the server-side endpoint of the local TUN/TAP interface
|
||||
@ -101,7 +101,7 @@
|
||||
<id>instance.server_ipv6</id>
|
||||
<label>Server (IPv6)</label>
|
||||
<type>text</type>
|
||||
<style>role role_server</style>
|
||||
<style>role role_server_tun</style>
|
||||
<help>
|
||||
This directive will set up an OpenVPN server which will allocate addresses to clients out of the given network/netmask.
|
||||
The server itself will take the next base address (+1) of the given network for use as the server-side endpoint of the local TUN/TAP interface
|
||||
|
||||
@ -485,10 +485,10 @@ class OpenVPN extends BaseModel
|
||||
$options['crl-verify'] = "/var/etc/openvpn/server-{$node_uuid}.crl-verify";
|
||||
}
|
||||
$options['verify-client-cert'] = (string)$node->verify_client_cert;
|
||||
if (!empty((string)$node->server)) {
|
||||
if ((string)$node->dev_type == 'tun' && !empty((string)$node->server)) {
|
||||
$parts = explode('/', (string)$node->server);
|
||||
$mask = Util::CIDRToMask($parts[1]);
|
||||
if ((string)$node->dev_type == 'tun' && (string)$node->topology == 'p2p' && $parts[1] > 29) {
|
||||
if ((string)$node->topology == 'p2p' && $parts[1] > 29) {
|
||||
/**
|
||||
* Workaround and backwards compatibility, the server directive doesn't support
|
||||
* networks smaller than /30, pushing ifconfig manually works in some cases.
|
||||
@ -505,6 +505,9 @@ class OpenVPN extends BaseModel
|
||||
} else {
|
||||
$options['server'] = $parts[0] . " " . $mask;
|
||||
}
|
||||
} elseif ((string)$node->dev_type == 'tap') {
|
||||
$options['mode'] = 'server';
|
||||
$options['tls-server'] = null;
|
||||
}
|
||||
if (!empty((string)$node->server_ipv6)) {
|
||||
$options['server-ipv6'] = (string)$node->server_ipv6;
|
||||
|
||||
@ -60,14 +60,15 @@
|
||||
del:'/api/openvpn/instances/del_static_key/'
|
||||
});
|
||||
|
||||
$("#instance\\.role").change(function(){
|
||||
$("#instance\\.role, #instance\\.dev_type").change(function(){
|
||||
let show_advanced = $("#show_advanced_formDialogDialogInstance").hasClass("fa-toggle-on");
|
||||
let this_role = $(this).val();
|
||||
let this_role = $("#instance\\.role").val();
|
||||
let this_dev_type = $("#instance\\.dev_type").val();
|
||||
$(".role").each(function(){
|
||||
let tr = $(this).closest("tr").hide();
|
||||
|
||||
if ((tr.data('advanced') === true && show_advanced) || !tr.data('advanced')) {
|
||||
if ($(this).hasClass('role_' + this_role)) {
|
||||
if ($(this).hasClass('role_' + this_role) || $(this).hasClass('role_' + this_role + '_' + this_dev_type)) {
|
||||
tr.show();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user