Merge 4e61e4bad8de3a43d1e7192e097c58286f80ae97 into e1f19e0f246c4e429dbf32bdf0a0a507d8ac194b

This commit is contained in:
nu11secur1ty 2024-11-13 23:39:39 -05:00 committed by GitHub
commit 7f83b6773a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 77 additions and 2 deletions

View File

@ -37,6 +37,18 @@ When OpenVPN is installed, you can run the script again, and you will get the ch
In your home directory, you will have `.ovpn` files. These are the client configuration files. Download them from your server and connect using your favorite OpenVPN client. In your home directory, you will have `.ovpn` files. These are the client configuration files. Download them from your server and connect using your favorite OpenVPN client.
## Cleaning of revoked users:
## NOTE:
For your safety, please run every time when you want to clean an already revoked user!
This program is only for `REVOKED` users!
- Usage:
```perl
perl revoke-cleaner.pl
# follow the steps...
```
If you have any question, head to the [FAQ](#faq) first. Please read everything before opening an issue. If you have any question, head to the [FAQ](#faq) first. Please read everything before opening an issue.
**PLEASE do not send me emails or private messages asking for help.** The only place to get help is the issues. Other people may be able to help and in the future, other users may also run into the same issue as you. My time is not available for free just for you, you're not special. **PLEASE do not send me emails or private messages asking for help.** The only place to get help is the issues. Other people may be able to help and in the future, other users may also run into the same issue as you. My time is not available for free just for you, you're not special.

View File

@ -1137,13 +1137,13 @@ function newClient() {
# if not, use SUDO_USER # if not, use SUDO_USER
if [ "${SUDO_USER}" == "root" ]; then if [ "${SUDO_USER}" == "root" ]; then
# If running sudo as root # If running sudo as root
homeDir="/root" homeDir="/etc/openvpn/client/"
else else
homeDir="/home/${SUDO_USER}" homeDir="/home/${SUDO_USER}"
fi fi
else else
# if not SUDO_USER, use /root # if not SUDO_USER, use /root
homeDir="/root" homeDir="/etc/openvpn/client"
fi fi
# Determine if we use tls-auth or tls-crypt # Determine if we use tls-auth or tls-crypt
@ -1181,9 +1181,11 @@ function newClient() {
echo "</tls-auth>" echo "</tls-auth>"
;; ;;
esac esac
# $homeDir
} >>"$homeDir/$CLIENT.ovpn" } >>"$homeDir/$CLIENT.ovpn"
echo "" echo ""
# $homeDir
echo "The configuration file has been written to $homeDir/$CLIENT.ovpn." echo "The configuration file has been written to $homeDir/$CLIENT.ovpn."
echo "Download the .ovpn file and import it in your OpenVPN client." echo "Download the .ovpn file and import it in your OpenVPN client."

54
revoke-cleaner.pl Normal file
View File

@ -0,0 +1,54 @@
#!/usr/bin/perl
# Author @nu11secur1ty
use strict;
use warnings;
use diagnostics;
use Term::ANSIColor;
print color('GREEN');
print "You should remove all lines which you see on this print with the path";
print color('RESET');
print color('BLUE');
print " (/etc/openvpn/easy-rsa/pki/index.txt)\n";
print color('RESET');
print color('GREEN');
print "because these users are already";
print color('RESET');
print color('RED');
print " revoked!\n";
print color('RESET');
print color('GREEN');
print "If you do not see lines with (R) in the beginning, you will have nothing to clean!\n\n\n";
print color('RESET');
my $ENV = `cat /etc/openvpn/easy-rsa/pki/index.txt | grep R`;
print "$ENV";
print color('Yellow');
print "This is your issued crt's\n";
print color('RESET');
my $issued = `ls -all /etc/openvpn/easy-rsa/pki/issued/`;
print "$issued";
## Cleaning
my $ENVPKI = "/etc/openvpn/easy-rsa/pki/index.txt";
print "Preparing for cleaning...\n";
print color('RED');
print "Please, choose the username, or if you are not really sure, just press Enter to exit the cleaner...\n";
print color('RESET');
chomp (my $username = <STDIN>);
my $cleaner = `sed -i '/$username/d' $ENVPKI`;
print color('YELLOW');
print"Your client configurations in /etc/openvpn/client/ are...\n";
print color('RESET');
my $configs = `ls -all /etc/openvpn/client/`;
print"$configs";
exit 0;

7
share-client-config.pl Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $clents = `cp -avr /etc/openvpn/client/* /var/www/html/`;
print "$client"