Commit c831f3c6 authored by Franco Fichtner's avatar Franco Fichtner

openvpn: remove pbi remnants and add proper 7z package

PR: https://forum.opnsense.org/index.php?topic=2273.0
parent 8353aea4
......@@ -85,6 +85,7 @@ CORE_DEPENDS?= apinger \
openssh-portable \
openvpn \
opnsense-update \
p7zip \
pecl-radius \
pftop \
phalcon \
......
......@@ -474,21 +474,20 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
$client_install_exe = "openvpn-install-{$current_openvpn_version}-I6{$current_openvpn_version_rev}-x86_64.exe";
break;
default:
$client_install_exe = "openvpn-install-{$current_openvpn_version}-I0{$current_openvpn_version_rev}-i686.exe";
$input_errors[] = gettext("Could not find matching OpenVPN architecture.");
return false;
}
$ovpndir = "/usr/local/opnsense/contrib/openvpn";
$workdir = "{$ovpndir}/client-export";
$validconfig = openvpn_client_export_validate_config($srvid, $usrid, $crtid);
if (!$validconfig) {
$input_errors[] = gettext("Could not validate OpenVPN config.");
return false;
}
list($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys) = $validconfig;
// create template directory
$tempdir = "/tmp//openvpn-export-".uniqid();
$tempdir = '/tmp/openvpn-export-' . uniqid();
mkdir($tempdir, 0700, true);
// create config directory
......@@ -498,7 +497,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
}
// copy the template directory
exec("cp -r {$workdir}/template/* {$tempdir}");
exec("cp -r /usr/local/opnsense/contrib/openvpn/client-export/template/* {$tempdir}");
// and put the required installer exe in place
exec("/bin/cp {$tempdir}/{$client_install_exe} {$tempdir}/openvpn-install.exe");
if (stristr($openvpn_version, "x64")) {
......@@ -565,11 +564,7 @@ RunProgram="openvpn-postinstall.exe"
}
file_put_contents("{$tempdir}/7zipConfig",$procchain);
if (file_exists("/usr/pbi/p7zip-{$uname_p}/bin/7z")) {
exec("/usr/pbi/p7zip-{$uname_p}/bin/7z -y a archive.7z {$files}");
} else {
exec("/usr/local/libexec/p7zip/7z -y a archive.7z {$files}");
}
exec("/usr/local/bin/7z -y a archive.7z {$files}");
// create the final installer
$outfile = "{$tempdir}-install.exe";
......@@ -587,8 +582,6 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
global $config;
$uname_p = trim(exec("uname -p"));
$ovpndir = "/usr/local/opnsense/contrib/openvpn/";
$uniq = uniqid();
$tempdir = "/tmp/openvpn-export-{$uniq}";
$zipfile = "/tmp/{$uniq}-Viscosity.visc.zip";
......@@ -687,11 +680,7 @@ EOF;
}
// Zip Viscosity file
if (file_exists("/usr/pbi/zip-{$uname_p}/bin/zip")) {
exec("cd {$tempdir}/.. && /usr/pbi/zip-{$uname_p}/bin/zip -r {$zipfile} Viscosity.visc");
} else {
exec("cd {$tempdir}/.. && /usr/local/bin/zip -r {$zipfile} Viscosity.visc");
}
// Remove temporary directory
exec("rm -rf {$tempdir}");
......@@ -818,11 +807,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
$shkeyfile = "{$tempdir}/{$shkeyfile}";
file_put_contents("{$shkeyfile}", base64_decode($settings['shared_key']));
if (file_exists("/usr/pbi/zip-{$uname_p}/bin/zip")) {
exec("cd {$tempdir}/.. && /usr/pbi/zip-{$uname_p}/bin/zip -r /tmp/{$prefix}-config.zip {$prefix}");
} else {
exec("cd {$tempdir}/.. && /usr/local/bin/zip -r /tmp/{$prefix}-config.zip {$prefix}");
}
// Remove temporary directory
exec("rm -rf {$tempdir}");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment