& $server) {
$ras_user = array();
if (stripos($server['mode'], "server") === false)
continue;
foreach($a_user as $uindex => & $user) {
if (!is_array($user['cert']))
continue;
foreach($user['cert'] as $cindex => & $cert) {
if ($cert['caref'] != $server['caref'])
continue;
$ras_userent = array();
$ras_userent['uindex'] = $uindex;
$ras_userent['cindex'] = $cindex;
$ras_userent['name'] = $user['name'];
$ras_userent['certname'] = $cert['name'];
$ras_user[] = $ras_userent;
}
}
if (!count($ras_user))
continue;
$ras_serverent = array();
$prot = $server['protocol'];
$port = $server['local_port'];
if ($server['description'])
$name = "{$server['description']} {$prot}:{$port}";
else
$name = "Server {$prot}:{$port}";
$ras_serverent['index'] = $sindex;
$ras_serverent['name'] = $name;
$ras_serverent['users'] = $ras_user;
$ras_server[] = $ras_serverent;
}
$id = $_GET['id'];
if (isset($_POST['id']))
$id = $_POST['id'];
$act = $_GET['act'];
if (isset($_POST['act']))
$act = $_POST['act'];
if($act == "conf") {
$srvid = $_GET['srvid'];
$usrid = $_GET['usrid'];
$crtid = $_GET['crtid'];
if (($srvid === false) || ($usrid === false) || ($crtid === false)) {
pfSenseHeader("vpn_openvpn_export.php");
exit;
}
$useaddr = $_GET['useaddr'];
$usetoken = $_GET['usetoken'];
$exp_name = openvpn_client_export_prefix($srvid);
$exp_name = urlencode($exp_name."-config.ovpn");
$exp_data = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken);
$exp_size = strlen($exp_data);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$exp_name}");
header("Content-Length: $exp_size");
echo $exp_data;
exit;
}
if($act == "visc") {
$srvid = $_GET['srvid'];
$usrid = $_GET['usrid'];
$crtid = $_GET['crtid'];
if (($srvid === false) || ($usrid === false) || ($crtid === false)) {
pfSenseHeader("vpn_openvpn_export.php");
exit;
}
$useaddr = $_GET['useaddr'];
$usetoken = $_GET['usetoken'];
$password = "";
if ($_GET['password'])
$password = $_GET['password']; ;
$exp_name = openvpn_client_export_prefix($srvid);
$exp_name = urlencode($exp_name."-Viscosity.visc.zip");
$exp_path = viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $useaddr, $usetoken, $password);
$exp_size = filesize($exp_path);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$exp_name}");
header("Content-Length: $exp_size");
readfile($exp_path);
//unlink($exp_path);
exit;
}
if($act == "inst") {
$srvid = $_GET['srvid'];
$usrid = $_GET['usrid'];
$crtid = $_GET['crtid'];
if (($srvid === false) || ($usrid === false) || ($crtid === false)) {
pfSenseHeader("vpn_openvpn_export.php");
exit;
}
$useaddr = $_GET['useaddr'];
$usetoken = $_GET['usetoken'];
$password = "";
if ($_GET['password'])
$password = $_GET['password']; ;
$exp_name = openvpn_client_export_prefix($srvid);
$exp_name = urlencode($exp_name."-install.exe");
$exp_path = openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $usetoken, $password);
$exp_size = filesize($exp_path);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$exp_name}");
header("Content-Length: $exp_size");
readfile($exp_path);
unlink($exp_path);
exit;
}
include("head.inc");
?>
|
Remote Access Server |
|
Host Name Resolution |
|
Certificate Export Options |
|
|
Client Install Packages |
=gettext("User");?> |
=gettext("Certificate Name");?> |
=gettext("Export");?> |
|