From 31c3b9fdebbb3c4255c62c411621014f68c144a2 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 17 Jan 2013 16:30:00 -0500 Subject: Fix up the inline config format a little to make Android and iOS both happy. --- .../openvpn-client-export.inc | 26 +++++++++------------- .../openvpn-client-export.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 710c5539..c2d3dd40 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -213,7 +213,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese $conf .= "client{$nl}"; $conf .= "resolv-retry infinite{$nl}"; $conf .= "remote {$server_host} {$server_port}{$nl}"; - if (!empty($servercn)) { + if (!empty($servercn) && ($expformat != "inline")) { $qw = ($quoteservercn) ? "\"" : ""; $conf .= "tls-remote {$qw}{$servercn}{$qw}{$nl}"; } @@ -244,11 +244,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese $prefix = openvpn_client_export_prefix($srvid, $usrid, $crtid); $cafile = "{$prefix}-ca.crt"; if($nokeys == false) { - if ($expformat == "inline") { - $conf .= "ca [inline]{$nl}"; - $conf .= "cert [inline]{$nl}"; - $conf .= "key [inline]{$nl}"; - } elseif ($expformat == "yealink_t28") { + if ($expformat == "yealink_t28") { $conf .= "ca /yealink/config/openvpn/keys/ca.crt{$nl}"; $conf .= "cert /yealink/config/openvpn/keys/client1.crt{$nl}"; $conf .= "key /yealink/config/openvpn/keys/client1.key{$nl}"; @@ -267,20 +263,16 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese } elseif ($usetoken) { $conf .= "ca {$cafile}{$nl}"; $conf .= "cryptoapicert \"SUBJ:{$user['name']}\"{$nl}"; - } else { + } elseif ($expformat != "inline") { $conf .= "pkcs12 {$prefix}.p12{$nl}"; } } else if ($settings['mode'] == "server_user") { - if ($expformat == "inline") - $conf .= "ca [inline]{$nl}"; - else + if ($expformat != "inline") $conf .= "ca {$cafile}{$nl}"; } if ($settings['tls'] && !$skiptls) { - if ($expformat == "inline") - $conf .= "tls-auth [inline] 1{$nl}"; - elseif ($expformat == "yealink_t28") + if ($expformat == "yealink_t28") $conf .= "tls-auth /yealink/config/openvpn/keys/ta.key 1{$nl}"; elseif ($expformat == "yealink_t38g") $conf .= "tls-auth /phone/config/openvpn/keys/ta.key 1{$nl}"; @@ -288,7 +280,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese $conf .= "tls-auth /config/openvpn/keys/ta.key 1{$nl}"; elseif ($expformat == "snom") $conf .= "tls-auth /openvpn/ta.key 1{$nl}"; - else + elseif ($expformat != "inline") $conf .= "tls-auth {$prefix}-tls.key 1{$nl}"; } @@ -716,7 +708,8 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco $cipher = $settings['crypto']; // add basic settings - $conf = "dev tun\n"; + if ($expformat != "inline") + $conf = "dev tun\n"; if(! empty($settings['tunnel_networkv6'])) { $conf .= "tun-ipv6\n"; } @@ -725,7 +718,8 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco $conf .= "proto {$proto}\n"; $conf .= "cipher {$cipher}\n"; $conf .= "client\n"; - $conf .= "resolv-retry infinite\n"; + if ($expformat != "inline") + $conf .= "resolv-retry infinite\n"; $conf .= "remote {$server_host} {$server_port}\n"; if ($settings['local_network']) { list($ip, $mask) = explode('/', $settings['local_network']); diff --git a/config/openvpn-client-export/openvpn-client-export.xml b/config/openvpn-client-export/openvpn-client-export.xml index 02949cbd..9f3d7376 100755 --- a/config/openvpn-client-export/openvpn-client-export.xml +++ b/config/openvpn-client-export/openvpn-client-export.xml @@ -1,7 +1,7 @@ OpenVPN Client Export - 0.24 + 0.29 OpenVPN Client Export /usr/local/pkg/openvpn-client-export.inc diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 4541f8d7..c78eabbe 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1391,7 +1391,7 @@ zip-3.0-i386.pbi p7zip-9.20.1-i386.pbi /usr/ports/archivers/p7zip /usr/ports/archivers/zip - 0.28 + 0.29 BETA 2.0 http://www.pfsense.com/packages/config/openvpn-client-export/openvpn-client-export.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index d67d8b40..ece44158 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1378,7 +1378,7 @@ p7zip-9.20.1-amd64.pbi zip-3.0-amd64.pbi /usr/ports/archivers/p7zip /usr/ports/archivers/zip - 0.28 + 0.29 BETA 2.0 http://www.pfsense.com/packages/config/openvpn-client-export/openvpn-client-export.xml -- cgit v1.2.3