From e3083b908a1f84a26a0f5e2e16a8e214d1ab2abd Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 11:27:14 +0200 Subject: [PATCH 01/20] Update openvpn-install.sh --- openvpn-install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 7c6f741a..332011a1 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1149,10 +1149,12 @@ function newClient() { echo "" ;; esac - } >>"$homeDir/$CLIENT.ovpn" + # $homeDir + } >>"/etc/openvpn/client/$CLIENT.ovpn" echo "" - echo "The configuration file has been written to $homeDir/$CLIENT.ovpn." + # $homeDir + echo "The configuration file has been written to /etc/openvpn/client/$CLIENT.ovpn." echo "Download the .ovpn file and import it in your OpenVPN client." exit 0 From 7b27acd69b0753eaeb1e663be83cbea29fd84c82 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 12:53:20 +0200 Subject: [PATCH 02/20] Create revoke-cleaner.pl --- revoke-cleaner.pl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 revoke-cleaner.pl diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl new file mode 100644 index 00000000..a7eede02 --- /dev/null +++ b/revoke-cleaner.pl @@ -0,0 +1,35 @@ +#!/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\n\n"; +print color('RESET'); + +my $ENV = `cat /etc/openvpn/easy-rsa/pki/index.txt | grep R`; +print "$ENV"; + +## Cleaning +my $ENVPKI = "/etc/openvpn/easy-rsa/pki/index.txt"; +print "Preparing for cleaning...\n"; +print "Please, choose the username...\n"; + +chomp (my $username = ); +my $cleaner = `sed -i '/$username/d' $ENVPKI`; + + exit 0; From b277bb84dbbb4a68e857a1a0894c231c21498146 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 13:30:31 +0200 Subject: [PATCH 03/20] Update openvpn-install.sh --- openvpn-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 332011a1..311a533f 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1150,11 +1150,11 @@ function newClient() { ;; esac # $homeDir - } >>"/etc/openvpn/client/$CLIENT.ovpn" + } >>"$homeDir/$CLIENT.ovpn" echo "" # $homeDir - echo "The configuration file has been written to /etc/openvpn/client/$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." exit 0 From 6e235f0bb4859905be6af3f794cb7677753214c0 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:20:47 +0200 Subject: [PATCH 04/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index a7eede02..ea70e461 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -24,6 +24,13 @@ 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 = `cat /etc/openvpn/easy-rsa/pki/issued/`; +print "$issued"; + ## Cleaning my $ENVPKI = "/etc/openvpn/easy-rsa/pki/index.txt"; print "Preparing for cleaning...\n"; From a5d1c80a9759cd079f4163a0a4d392f91e85c29b Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:22:01 +0200 Subject: [PATCH 05/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index ea70e461..de3753d9 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -28,7 +28,7 @@ print "This is your issued crt's\n"; print color('RESET'); -my $issued = `cat /etc/openvpn/easy-rsa/pki/issued/`; +my $issued = `ls -all /etc/openvpn/easy-rsa/pki/issued/`; print "$issued"; ## Cleaning From 437aea20822420148ac91c5686fed63d66bb0c24 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:24:48 +0200 Subject: [PATCH 06/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index de3753d9..5170d9cb 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -21,6 +21,10 @@ print " revoked!\n\n\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!"; +print color('RESET'); + my $ENV = `cat /etc/openvpn/easy-rsa/pki/index.txt | grep R`; print "$ENV"; From b8892759f76df49a64c0606b2bb0398f91519a89 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:25:45 +0200 Subject: [PATCH 07/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 5170d9cb..16635c7b 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -22,7 +22,7 @@ print color('RESET'); print color('GREEN'); -print "If you do not see lines with (R) in the beginning, you will have nothing to clean!"; +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`; From 296bcfbf3639c83a11bc154e35d85a44dfef1153 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:26:22 +0200 Subject: [PATCH 08/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 16635c7b..4cd1882a 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -18,7 +18,7 @@ print color('RESET'); print color('RED'); -print " revoked!\n\n\n"; +print " revoked!\n"; print color('RESET'); print color('GREEN'); From 9c39b4be451c33dace268e5113300f3f6c08cab0 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:28:38 +0200 Subject: [PATCH 09/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 4cd1882a..89aa97e6 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -38,7 +38,7 @@ ## Cleaning my $ENVPKI = "/etc/openvpn/easy-rsa/pki/index.txt"; print "Preparing for cleaning...\n"; -print "Please, choose the username...\n"; +print "Please, choose the username, or if you are not really sure, just press Enter to exit the cleaner...\n"; chomp (my $username = ); my $cleaner = `sed -i '/$username/d' $ENVPKI`; From f853ef2844633a727754e5f99ca68384d410149a Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:29:33 +0200 Subject: [PATCH 10/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 89aa97e6..440d436a 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -38,7 +38,10 @@ ## 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`; From 30f0b3e74d40b6a44610a1af2bfe9556ca57d4f2 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 14:38:48 +0200 Subject: [PATCH 11/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 440d436a..0504e095 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -45,5 +45,6 @@ chomp (my $username = ); my $cleaner = `sed -i '/$username/d' $ENVPKI`; +my $cleancobf1g = `rm -rf /etc/openvpn/client/$username`; exit 0; From 2eca32181240cbe52d253f591e1f5da89d4e96d2 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 15:04:58 +0200 Subject: [PATCH 12/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 0504e095..440d436a 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -45,6 +45,5 @@ chomp (my $username = ); my $cleaner = `sed -i '/$username/d' $ENVPKI`; -my $cleancobf1g = `rm -rf /etc/openvpn/client/$username`; exit 0; From 6becf7caa975b5e44d070d5294752d268ee8afcc Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 15:22:33 +0200 Subject: [PATCH 13/20] Update openvpn-install.sh --- openvpn-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 311a533f..5a969a15 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1105,13 +1105,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 From 1f6fd150a02aa1fb6ee0b3f863db2c4fcd8d9d2f Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 15:47:17 +0200 Subject: [PATCH 14/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index 440d436a..fe717385 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -26,24 +26,28 @@ print color('RESET'); my $ENV = `cat /etc/openvpn/easy-rsa/pki/index.txt | grep R`; -print "$ENV"; + 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"; + print "$issued"; ## Cleaning my $ENVPKI = "/etc/openvpn/easy-rsa/pki/index.txt"; -print "Preparing for cleaning...\n"; + 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`; + my $cleaner = `sed -i '/$username/d' $ENVPKI`; +print color('YELLOW') +print"You clint configurations are...\n"; +my $configs = `ls -all /etc/openvpn/client/`; + print"$configs"; exit 0; From 74538dc0beda0704d08138745b7cdb0a56c6faa3 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 15:48:32 +0200 Subject: [PATCH 15/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index fe717385..be6ce246 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -46,8 +46,9 @@ chomp (my $username = ); my $cleaner = `sed -i '/$username/d' $ENVPKI`; -print color('YELLOW') +print color('YELLOW'); print"You clint configurations are...\n"; +print color('RESET'); my $configs = `ls -all /etc/openvpn/client/`; print"$configs"; exit 0; From 1d03088f2dd45777549f458eda395ac7ca6a4427 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 15:54:11 +0200 Subject: [PATCH 16/20] Update revoke-cleaner.pl --- revoke-cleaner.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revoke-cleaner.pl b/revoke-cleaner.pl index be6ce246..ff00c1c9 100644 --- a/revoke-cleaner.pl +++ b/revoke-cleaner.pl @@ -47,7 +47,7 @@ my $cleaner = `sed -i '/$username/d' $ENVPKI`; print color('YELLOW'); -print"You clint configurations are...\n"; +print"Your client configurations in /etc/openvpn/client/ are...\n"; print color('RESET'); my $configs = `ls -all /etc/openvpn/client/`; print"$configs"; From 06dfd349c0035cb0e6ae18ee9da4938f515777a5 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 16:01:42 +0200 Subject: [PATCH 17/20] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 4e81f281..9b33fa73 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,16 @@ 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. From 052500f33cb7ba616d07cb4cacae0397dfee15c5 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 16:02:19 +0200 Subject: [PATCH 18/20] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b33fa73..c9efc364 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,9 @@ 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! +- - - ## 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 From 4f886d7e9844f73106fdbf9c8ac93c3c8b514564 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Tue, 17 Jan 2023 16:03:14 +0200 Subject: [PATCH 19/20] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c9efc364..34ad3ee3 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,10 @@ 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! +## 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 From 4e61e4bad8de3a43d1e7192e097c58286f80ae97 Mon Sep 17 00:00:00 2001 From: nu11secur1ty Date: Wed, 27 Mar 2024 10:12:07 +0200 Subject: [PATCH 20/20] Create share-client-config.pl --- share-client-config.pl | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 share-client-config.pl diff --git a/share-client-config.pl b/share-client-config.pl new file mode 100644 index 00000000..84df0fe6 --- /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"