// @copyright (c) 2010 Filipp Lepalaan session_start(); // Set some defaults $port = ($_SESSION['port']) ? $_SESSION['port'] : '1194'; $name = ($_SESSION['name']) ? $_SESSION['name'] : 'example.com'; $remote = ($_SESSION['remote']) ? $_SESSION['remote'] : 'vpn.example.com'; if ($_POST['reset']) { session_destroy(); } if (!empty($_POST['cert']) && !$_POST['reset']) { // Save some settings for later use $_SESSION['ca'] = $_POST['ca']; $_SESSION['port'] = $_POST['port']; $_SESSION['name'] = $_POST['name']; $_SESSION['remote'] = $_POST['remote']; $_SESSION['advanced'] = $_POST['advanced']; $tmpdir = '/tmp/'.uniqid(); mkdir($tmpdir); file_put_contents("$tmpdir/ca.crt", $_POST['ca']); file_put_contents("$tmpdir/cert.crt", $_POST['cert']); file_put_contents("$tmpdir/key.key", $_POST['key']); $dns_support = ($_POST['use_dns']) ? 'true' : 'false'; $config =<< '_', '/' => '_', ' ' => ''); $cf = strtr($_POST['name'], $trans); } file_put_contents("${tmpdir}/{$cf}.conf", $config); $filename = ($_POST['user'] != 'username') ? $_POST['user'] : time(); $outfile = '/tmp/openvpn_'.$filename.'.tgz'; // "Pack it up, pack it in..." `tar -czvf {$outfile} {$tmpdir}`; // "... let me begin" header('Expires: 0'); header('Pragma: public'); header('Content-Transfer-Encoding: binary'); header('Content-Description: File Transfer'); header('Content-Length: '.filesize($outfile)); header('Content-Type: application/octet-stream'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Disposition: attachment; filename='.basename($outfile)); ob_clean(); flush(); readfile($outfile); `srm -rs $tmpdir $outfile`; exit(); } ?> vpn_config - Define OpenVPN Connection
General  
:
Certificates

Options
 enable LZO compression  enable DNS support