From ac0b003c57284d167474f56411952d7aaf15dea7 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Wed, 17 Jul 2024 01:21:21 +0200 Subject: [PATCH] Adding vpn file download protection. --- lib/VPNManager/Controller/Main.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/VPNManager/Controller/Main.pm b/lib/VPNManager/Controller/Main.pm index cd98c06..afdd97b 100644 --- a/lib/VPNManager/Controller/Main.pm +++ b/lib/VPNManager/Controller/Main.pm @@ -86,6 +86,9 @@ sub download_file($self) { if ( !defined $user ) { 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 $public_key = capture_stdout sub { open my $fh, '|-', 'wg', 'pubkey';