Merge f9a7d1cf91 into 40a9fb975a
This commit is contained in:
commit
1c6b39cb56
2 changed files with 35 additions and 17 deletions
|
|
@ -61,6 +61,7 @@ If you want to customise your installation, you can export them or specify them
|
||||||
- `DNS=1`
|
- `DNS=1`
|
||||||
- `COMPRESSION_ENABLED=n`
|
- `COMPRESSION_ENABLED=n`
|
||||||
- `CUSTOMIZE_ENC=n`
|
- `CUSTOMIZE_ENC=n`
|
||||||
|
- `CREATE_CLIENT=y`
|
||||||
- `CLIENT=clientname`
|
- `CLIENT=clientname`
|
||||||
- `PASS=1`
|
- `PASS=1`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -588,6 +588,7 @@ function installOpenVPN () {
|
||||||
DNS=${DNS:-1}
|
DNS=${DNS:-1}
|
||||||
COMPRESSION_ENABLED=${COMPRESSION_ENABLED:-n}
|
COMPRESSION_ENABLED=${COMPRESSION_ENABLED:-n}
|
||||||
CUSTOMIZE_ENC=${CUSTOMIZE_ENC:-n}
|
CUSTOMIZE_ENC=${CUSTOMIZE_ENC:-n}
|
||||||
|
CREATE_CLIENT=${CREATE_CLIENT:-n}
|
||||||
CLIENT=${CLIENT:-client}
|
CLIENT=${CLIENT:-client}
|
||||||
PASS=${PASS:-1}
|
PASS=${PASS:-1}
|
||||||
CONTINUE=${CONTINUE:-y}
|
CONTINUE=${CONTINUE:-y}
|
||||||
|
|
@ -977,8 +978,19 @@ if [[ $COMPRESSION_ENABLED == "y" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate the custom client.ovpn
|
# Generate the custom client.ovpn
|
||||||
|
until [[ $CREATE_CLIENT =~ (y|n) ]]; do
|
||||||
|
read -rp"Create a new client? [y/n]: " -e -i n CREATE_CLIENT
|
||||||
|
done
|
||||||
|
if [[ $CREATE_CLIENT == "y" ]];then
|
||||||
newClient
|
newClient
|
||||||
echo "If you want to add more clients, you simply need to run this script another time!"
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "If you want to add more clients, you simply need to run this script another time!"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function newClient () {
|
function newClient () {
|
||||||
|
|
@ -1065,6 +1077,7 @@ function newClient () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function revokeClient () {
|
function revokeClient () {
|
||||||
|
until [[ "$CLIENT" =~ ^[a-zA-Z0-9_]+$ ]]; do
|
||||||
NUMBEROFCLIENTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c "^V")
|
NUMBEROFCLIENTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c "^V")
|
||||||
if [[ "$NUMBEROFCLIENTS" = '0' ]]; then
|
if [[ "$NUMBEROFCLIENTS" = '0' ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -1082,6 +1095,8 @@ function revokeClient () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p)
|
CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p)
|
||||||
|
done
|
||||||
|
|
||||||
cd /etc/openvpn/easy-rsa/
|
cd /etc/openvpn/easy-rsa/
|
||||||
./easyrsa --batch revoke "$CLIENT"
|
./easyrsa --batch revoke "$CLIENT"
|
||||||
EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
|
EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
|
||||||
|
|
@ -1138,7 +1153,9 @@ function removeUnbound () {
|
||||||
|
|
||||||
function removeOpenVPN () {
|
function removeOpenVPN () {
|
||||||
echo ""
|
echo ""
|
||||||
|
until [[ $REMOVE =~ (y|n) ]]; do
|
||||||
read -rp "Do you really want to remove OpenVPN? [y/n]: " -e -i n REMOVE
|
read -rp "Do you really want to remove OpenVPN? [y/n]: " -e -i n REMOVE
|
||||||
|
done
|
||||||
if [[ "$REMOVE" = 'y' ]]; then
|
if [[ "$REMOVE" = 'y' ]]; then
|
||||||
# Get OpenVPN port from the configuration
|
# Get OpenVPN port from the configuration
|
||||||
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue