mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
OpenVPN export, inline cert+key for https://github.com/opnsense/core/issues/2787
This commit is contained in:
parent
0b028c1799
commit
811d9efd65
@ -118,12 +118,36 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
|
||||
return $conf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array inline OpenVPN files
|
||||
*/
|
||||
protected function openvpnInlineFiles()
|
||||
{
|
||||
$conf = array();
|
||||
if ($this->config['mode'] !== "server_user") {
|
||||
$conf[] = "<cert>";
|
||||
$conf = array_merge($conf, explode("\n", trim($this->config['client_crt'])));
|
||||
$conf[] = "</cert>";
|
||||
|
||||
$conf[] = "<key>";
|
||||
$conf = array_merge($conf, explode("\n", trim($this->config['client_prv'])));
|
||||
$conf[] = "</key>";
|
||||
}
|
||||
if (!empty($this->config['tls'])) {
|
||||
$conf[] = "<tls-auth>";
|
||||
$conf = array_merge($conf, explode("\n", trim(base64_decode($this->config['tls']))));
|
||||
$conf[] = "</tls-auth>";
|
||||
}
|
||||
|
||||
return $conf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string content
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
|
||||
return implode("\n", $this->openvpnConfParts());
|
||||
return implode("\n", array_merge($this->openvpnConfParts(), $this->openvpnInlineFiles()));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user