Fixing privatekey leak.

This commit is contained in:
sergiotarxz 2024-07-17 00:53:28 +02:00
parent c0086ca46d
commit 9fa1365092

View File

@ -95,6 +95,10 @@ sub download_file($self) {
$user->update( { publickey => $public_key } );
my $config = $self->config;
my $ip = $user->ip_to_text;
my ($publickey) = capture_stdout sub {
open my $fh, '|-', 'wg', 'pubkey';
print $fh $config->{vpn}{privkey};
};
my $vpn_file = <<"EOF";
[Interface]
PrivateKey = $private_key
@ -102,7 +106,7 @@ Address = $ip/32
DNS = @{[$config->{vpn}{host}]}
[Peer]
PublicKey = @{[$config->{vpn}{privkey}]}
PublicKey = $publickey
AllowedIPs = @{[$config->{vpnclients}{allowedips}]}
Endpoint = @{[$config->{vpnclients}{endpoint}]}:@{[$config->{vpnclients}{server_port}]}
EOF