mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Get/set pub+priv keys, create wg0.conf
This commit is contained in:
@@ -4,7 +4,7 @@ require '../../includes/csrf.php';
|
||||
require_once '../../includes/config.php';
|
||||
|
||||
$entity = $_POST['entity'];
|
||||
|
||||
|
||||
if (isset($entity)) {
|
||||
|
||||
// generate public/private key pairs for entity
|
||||
@@ -14,9 +14,10 @@ if (isset($entity)) {
|
||||
$privkey_tmp = '/tmp/'.$entity.'-private.key';
|
||||
|
||||
exec("sudo wg genkey | tee $privkey_tmp | wg pubkey > $pubkey_tmp", $return);
|
||||
$entity_pubkey = str_replace("\n",'',file_get_contents($pubkey_tmp));
|
||||
$wgdata['pubkey'] = str_replace("\n",'',file_get_contents($pubkey_tmp));
|
||||
$wgdata['privkey'] = str_replace("\n",'',file_get_contents($privkey_tmp));
|
||||
exec("sudo mv $privkey_tmp $privkey", $return);
|
||||
exec("sudo mv $pubkey_tmp $pubkey", $return);
|
||||
|
||||
echo json_encode($entity_pubkey);
|
||||
echo json_encode($wgdata);
|
||||
}
|
||||
|
Reference in New Issue
Block a user