Adding vpn file download protection.

This commit is contained in:
sergiotarxz 2024-07-17 01:21:21 +02:00
parent e772475345
commit ac0b003c57
1 changed files with 3 additions and 0 deletions

View File

@ -86,6 +86,9 @@ sub download_file($self) {
if ( !defined $user ) { if ( !defined $user ) {
return $self->render( text => 'No such user', status => 400 ); return $self->render( text => 'No such user', status => 400 );
} }
if ($user->is_protected) {
return $self->render( text => 'This user is protected', status => 400 );
}
my $private_key = `wg genkey`; my $private_key = `wg genkey`;
my $public_key = capture_stdout sub { my $public_key = capture_stdout sub {
open my $fh, '|-', 'wg', 'pubkey'; open my $fh, '|-', 'wg', 'pubkey';