Skip to content

Commit 24f1d05

Browse files
committed
openvpn: p2p_tls is also used by client so treat all of it accordingly
PR: https://forum.opnsense.org/index.php?topic=9133.0
1 parent 69fef9c commit 24f1d05

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/etc/inc/plugins.inc.d/openvpn.inc

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -615,21 +615,6 @@ function openvpn_reconfigure($mode, $settings, $device_only = false)
615615
$conf .= "up /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup\n";
616616
$conf .= "down /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown\n";
617617

618-
switch ($settings['mode']) {
619-
case 'server_user':
620-
case 'server_tls_user':
621-
$conf .= "client-disconnect \"/usr/local/etc/inc/plugins.inc.d/openvpn/attributes.sh {$mode_id} \"\n";
622-
break;
623-
case 'server_tls':
624-
case 'p2p_tls':
625-
// For non user auth types setup client specific overrides, user authenticated ones are commissioned
626-
// using the auth script in option auth-user-pass-verify
627-
$conf .= "client-connect \"/usr/local/etc/inc/plugins.inc.d/openvpn/ovpn_setup_cso.php {$mode_id}\"\n";
628-
break;
629-
default:
630-
break;
631-
}
632-
633618
if (!empty($iface_ip)) {
634619
$conf .= "local {$iface_ip}\n";
635620
}
@@ -644,6 +629,23 @@ function openvpn_reconfigure($mode, $settings, $device_only = false)
644629
list($ipv6, $prefix) = explode('/', $settings['tunnel_networkv6']);
645630
$mask = gen_subnet_mask($cidr);
646631

632+
// client connect and disconnect handling
633+
switch ($settings['mode']) {
634+
case 'server_user':
635+
case 'server_tls_user':
636+
$conf .= "client-disconnect \"/usr/local/etc/inc/plugins.inc.d/openvpn/attributes.sh {$mode_id}\"\n";
637+
break;
638+
case 'server_tls':
639+
case 'p2p_tls':
640+
// For non user auth types setup client specific overrides,
641+
// user authenticated ones are commissioned using the auth
642+
// script in option auth-user-pass-verify.
643+
$conf .= "client-connect \"/usr/local/etc/inc/plugins.inc.d/openvpn/ovpn_setup_cso.php {$mode_id}\"\n";
644+
break;
645+
default:
646+
break;
647+
}
648+
647649
// configure tls modes
648650
switch ($settings['mode']) {
649651
case 'p2p_tls':

0 commit comments

Comments
 (0)