mirror of
				https://github.com/angristan/openvpn-install.git
				synced 2025-11-04 07:57:37 +01:00 
			
		
		
		
	Disable of creating first client during install openvpn, auto select client when revoke flow
This commit is contained in:
		@@ -1087,8 +1087,10 @@ verb 3" >>/etc/openvpn/client-template.txt
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Generate the custom client.ovpn
 | 
						# Generate the custom client.ovpn
 | 
				
			||||||
 | 
						if [[ -n "${CLIENT}" ]]; then
 | 
				
			||||||
		newClient
 | 
							newClient
 | 
				
			||||||
		echo "If you want to add more clients, you simply need to run this script another time!"
 | 
							echo "If you want to add more clients, you simply need to run this script another time!"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function newClient() {
 | 
					function newClient() {
 | 
				
			||||||
@@ -1114,7 +1116,7 @@ function newClient() {
 | 
				
			|||||||
	if [[ $CLIENTEXISTS == '1' ]]; then
 | 
						if [[ $CLIENTEXISTS == '1' ]]; then
 | 
				
			||||||
		echo ""
 | 
							echo ""
 | 
				
			||||||
		echo "The specified client CN was already found in easy-rsa, please choose another name."
 | 
							echo "The specified client CN was already found in easy-rsa, please choose another name."
 | 
				
			||||||
		exit
 | 
							exit 1
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		cd /etc/openvpn/easy-rsa/ || return
 | 
							cd /etc/openvpn/easy-rsa/ || return
 | 
				
			||||||
		case $PASS in
 | 
							case $PASS in
 | 
				
			||||||
@@ -1200,7 +1202,15 @@ function revokeClient() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	echo ""
 | 
						echo ""
 | 
				
			||||||
	echo "Select the existing client certificate you want to revoke"
 | 
						echo "Select the existing client certificate you want to revoke"
 | 
				
			||||||
	tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') '
 | 
						pki_clientnumbers="$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') ')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						echo "${pki_clientnumbers}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if [[ -n "${CLIENT}" ]]; then
 | 
				
			||||||
 | 
							# Get PKI client number
 | 
				
			||||||
 | 
							CLIENTNUMBER=$(echo "${pki_clientnumbers}" | grep "${CLIENT}" | cut -d')' -f1 | xargs)
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	until [[ $CLIENTNUMBER -ge 1 && $CLIENTNUMBER -le $NUMBEROFCLIENTS ]]; do
 | 
						until [[ $CLIENTNUMBER -ge 1 && $CLIENTNUMBER -le $NUMBEROFCLIENTS ]]; do
 | 
				
			||||||
		if [[ $CLIENTNUMBER == '1' ]]; then
 | 
							if [[ $CLIENTNUMBER == '1' ]]; then
 | 
				
			||||||
			read -rp "Select one client [1]: " CLIENTNUMBER
 | 
								read -rp "Select one client [1]: " CLIENTNUMBER
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user