diff --git a/README.md b/README.md index 0f3a539..b0beb63 100644 --- a/README.md +++ b/README.md @@ -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. +## 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. **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. diff --git a/openvpn-install.sh b/openvpn-install.sh index a0e04a4..f612554 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1137,13 +1137,13 @@ function newClient() { # if not, use SUDO_USER if [ "${SUDO_USER}" == "root" ]; then # If running sudo as root - homeDir="/root" + homeDir="/etc/openvpn/client/" else homeDir="/home/${SUDO_USER}" fi else # if not SUDO_USER, use /root - homeDir="/root" + homeDir="/etc/openvpn/client" fi # Determine if we use tls-auth or tls-crypt @@ -1181,9 +1181,11 @@ function newClient() { echo "" ;; esac + # $homeDir } >>"$homeDir/$CLIENT.ovpn" echo "" + # $homeDir echo "The configuration file has been written to $homeDir/$CLIENT.ovpn." echo "Download the .ovpn file and import it in your OpenVPN client." diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl new file mode 100644 index 0000000..ff00c1c --- /dev/null +++ b/revoke-cleaner.pl @@ -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 = ); + 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; diff --git a/share-client-config.pl b/share-client-config.pl new file mode 100644 index 0000000..84df0fe --- /dev/null +++ b/share-client-config.pl @@ -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"