Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask for how many days the new client should be valid in days. Defaults to 3650 days (10 years) #1250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions openvpn-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,10 @@ function newClient() {
read -rp "Client name: " -e CLIENT
done

echo ""
echo "How many days should the client be valid for?"
read -rp "Enter the number of days (default is 3650, which is about 10 years): " -e -i 3650 DAYS_VALID

echo ""
echo "Do you want to protect the configuration file with a password?"
echo "(e.g. encrypt the private key with a password)"
Expand All @@ -1085,14 +1089,14 @@ function newClient() {
cd /etc/openvpn/easy-rsa/ || return
case $PASS in
1)
EASYRSA_CERT_EXPIRE=3650 ./easyrsa --batch build-client-full "$CLIENT" nopass
EASYRSA_CERT_EXPIRE=$DAYS_VALID ./easyrsa --batch build-client-full "$CLIENT" nopass
;;
2)
echo "⚠️ You will be asked for the client password below ⚠️"
EASYRSA_CERT_EXPIRE=3650 ./easyrsa --batch build-client-full "$CLIENT"
EASYRSA_CERT_EXPIRE=$DAYS_VALID ./easyrsa --batch build-client-full "$CLIENT"
;;
esac
echo "Client $CLIENT added."
echo "Client $CLIENT added and is valid for $DAYS_VALID days."
fi

# Home directory of the user, where the client configuration will be written
Expand Down