$ovpncapath/$caname/serial \n"); fwrite($fd, "source $ovpncapath/$caname/vars \n"); //fwrite($fd, "echo \"Creating Shared Key...\" \n"); //fwrite($fd, "openvpn --genkey --secret $ovpncapath/$caname/shared.key \n"); fwrite($fd, "echo \"Creating CA...\" \n"); fwrite($fd, "$easyrsapath/pkitool --batch --initca $ovpncapath/$caname/ca.crt \n"); fwrite($fd, "echo \"Creating Server Certificate...\" \n"); fwrite($fd, "$easyrsapath/pkitool --batch --server server \n"); fwrite($fd, "echo \"Creating DH Parms...\" \n"); fwrite($fd, "openssl dhparam -out $ovpncapath/$caname/dh_params.dh $cakeysize \n"); fwrite($fd, "echo \"Done!\" \n"); fclose($fd); } } else { $input_errors[] = "You should specify a name."; } if (!is_array($config['openvpn']['keys'])) $config['openvpn']['keys'] = array(); $ovpnkeys =& $config['openvpn']['keys']; if (!is_array($ovpnkeys[$caname])) $ovpnkeys[$caname] = array(); if ($caname && $authmode == 'shared_key') { execute_command_return_output("openvpn --genkey --secret $ovpncapath/$caname/shared.key"); $ovpnkeys[$caname]['existing'] = "yes"; $ovpnkeys[$caname]['shared.key'] = file_get_contents("$ovpncapath/$caname/shared.key"); write_config(); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"shared.key\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$ovpncapath/$caname/shared.key"); } } include("head.inc"); ?>