mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-07-03 21:14:23 +02:00
fix bug:add client error
This commit is contained in:
parent
2e0e816fcc
commit
390df65aa6
@ -23,11 +23,13 @@ fi
|
|||||||
dir_openvpn='/etc/openvpn'
|
dir_openvpn='/etc/openvpn'
|
||||||
dir_easy="${dir_openvpn}/easy-rsa"
|
dir_easy="${dir_openvpn}/easy-rsa"
|
||||||
dir_pki="${dir_easy}/pki"
|
dir_pki="${dir_easy}/pki"
|
||||||
|
file_index="${dir_pki}/index.txt"
|
||||||
bin_easy="${dir_easy}/easyrsa"
|
bin_easy="${dir_easy}/easyrsa"
|
||||||
conf_client_tpl="${dir_openvpn}/client-template.txt"
|
conf_client_tpl="${dir_openvpn}/client-template.txt"
|
||||||
conf_server="${dir_openvpn}/server.conf"
|
conf_server="${dir_openvpn}/server.conf"
|
||||||
conf_iptables='/etc/sysconfig/iptables.rules'
|
conf_iptables='/etc/sysconfig/iptables.rules'
|
||||||
|
|
||||||
|
|
||||||
## function: config the firewall
|
## function: config the firewall
|
||||||
set_firewall(){
|
set_firewall(){
|
||||||
|
|
||||||
@ -83,15 +85,6 @@ fi
|
|||||||
## function: generate the new client??.ovpn
|
## function: generate the new client??.ovpn
|
||||||
generate_newclient() {
|
generate_newclient() {
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Tell me a name for the client cert"
|
|
||||||
echo "Please, use one word only, no special characters"
|
|
||||||
echo "Here are the files that already exist,do not repeat that"
|
|
||||||
tail -n +2 ${file_index} | grep "^V" | cut -d '=' -f 2 | nl -s ') '
|
|
||||||
read -p "Client name: " -e -i client CLIENT
|
|
||||||
cd ${dir_easy}
|
|
||||||
${bin_easy} build-client-full $CLIENT nopass
|
|
||||||
|
|
||||||
# Generates the custom client.ovpn
|
# Generates the custom client.ovpn
|
||||||
# Where to write the custom client.ovpn?
|
# Where to write the custom client.ovpn?
|
||||||
if [ -e /home/$CLIENT ]; then # if $CLIENT is a user name
|
if [ -e /home/$CLIENT ]; then # if $CLIENT is a user name
|
||||||
@ -634,9 +627,16 @@ if [[ 'y' = "$REMOVE" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ "$OS" = 'debian' ]]; then
|
if [[ "$OS" = 'debian' ]]; then
|
||||||
|
systemctl stop openvpn@server
|
||||||
apt-get autoremove --purge -y openvpn
|
apt-get autoremove --purge -y openvpn
|
||||||
elif [[ "$OS" = 'arch' ]]; then
|
elif [[ "$OS" = 'arch' ]]; then
|
||||||
pacman -R openvpn --noconfirm
|
pacman -R openvpn --noconfirm
|
||||||
|
elif [[ "$OS" = 'centos7' ]]; then
|
||||||
|
systemctl stop openvpn@server
|
||||||
|
yum remove openvpn -y
|
||||||
|
elif [[ "$OS" = 'centos6' ]]; then
|
||||||
|
/etc/init.d/openvpn stop
|
||||||
|
yum remove openvpn -y
|
||||||
else
|
else
|
||||||
yum remove openvpn -y
|
yum remove openvpn -y
|
||||||
fi
|
fi
|
||||||
@ -673,10 +673,18 @@ What do you want to do?
|
|||||||
3) Remove OpenVPN
|
3) Remove OpenVPN
|
||||||
4) Exit
|
4) Exit
|
||||||
EOF
|
EOF
|
||||||
file_index="${dir_pki}/index.txt"
|
|
||||||
read -p 'Select an option [1-4]: ' option
|
read -p 'Select an option [1-4]: ' option
|
||||||
case $option in
|
case $option in
|
||||||
1)
|
1)
|
||||||
|
echo ""
|
||||||
|
echo "Tell me a name for the client cert"
|
||||||
|
echo "Please, use one word only, no special characters"
|
||||||
|
echo "Here are the files that already exist,do not repeat that"
|
||||||
|
tail -n +2 ${file_index} | grep "^V" | cut -d '=' -f 2 | nl -s ') '
|
||||||
|
read -p "Client name: " -e -i client CLIENT
|
||||||
|
cd ${dir_easy}
|
||||||
|
${bin_easy} build-client-full $CLIENT nopass
|
||||||
generate_newclient
|
generate_newclient
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user