mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Save client.conf
This commit is contained in:
parent
3ec81ba085
commit
9eadd28df1
@ -47,6 +47,7 @@ function DisplayWireGuardConfig()
|
|||||||
}
|
}
|
||||||
// Save settings
|
// Save settings
|
||||||
if ($good_input) {
|
if ($good_input) {
|
||||||
|
// server (wg0.conf)
|
||||||
$config[] = '[Interface]';
|
$config[] = '[Interface]';
|
||||||
$config[] = 'Address = '.$_POST['wg_srvipaddress'];
|
$config[] = 'Address = '.$_POST['wg_srvipaddress'];
|
||||||
$config[] = 'ListenPort = '.$_POST['wg_srvport'];
|
$config[] = 'ListenPort = '.$_POST['wg_srvport'];
|
||||||
@ -68,7 +69,23 @@ function DisplayWireGuardConfig()
|
|||||||
|
|
||||||
file_put_contents("/tmp/wgdata", $config);
|
file_put_contents("/tmp/wgdata", $config);
|
||||||
system('sudo cp /tmp/wgdata '.RASPI_WIREGUARD_CONFIG, $return);
|
system('sudo cp /tmp/wgdata '.RASPI_WIREGUARD_CONFIG, $return);
|
||||||
|
|
||||||
|
// client1 (client.conf)
|
||||||
|
$config = [];
|
||||||
|
$config[] = '[Interface]';
|
||||||
|
$config[] = 'Address = ';
|
||||||
|
$config[] = 'PrivateKey = ';
|
||||||
|
$config[] = '';
|
||||||
|
$config[] = '[Peer]';
|
||||||
|
$config[] = 'PublicKey = ';
|
||||||
|
$config[] = 'AllowedIPs = ';
|
||||||
|
$config[] = 'Endpoint = ';
|
||||||
|
$config[] = '';
|
||||||
|
$config = join(PHP_EOL, $config);
|
||||||
|
|
||||||
|
file_put_contents("/tmp/wgdata", $config);
|
||||||
|
system('sudo cp /tmp/wgdata '.RASPI_WIREGUARD_PATH.'client.conf', $return);
|
||||||
|
|
||||||
// handle log option
|
// handle log option
|
||||||
if ($_POST['wg_log'] == "1") {
|
if ($_POST['wg_log'] == "1") {
|
||||||
exec("sudo /bin/systemctl status wg-quick@wg0 | sudo tee /tmp/wireguard.log > /dev/null");
|
exec("sudo /bin/systemctl status wg-quick@wg0 | sudo tee /tmp/wireguard.log > /dev/null");
|
||||||
|
Loading…
Reference in New Issue
Block a user