-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Advanced client management #36
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ cn="$1" | |
parm="$2" | ||
|
||
if [ ! -f "$EASYRSA_PKI/private/${cn}.key" ]; then | ||
>&2 "Unable to find \"${cn}\", please try again or generate the key first" 1>&2 | ||
echo "Unable to find \"${cn}\", please try again or generate the key first" >&2 | ||
exit 1 | ||
fi | ||
|
||
|
@@ -39,8 +39,8 @@ remote-cert-tls server | |
|
||
remote $OVPN_CN $OVPN_PORT $OVPN_PROTO | ||
" | ||
if [ "$mode" == "combined" ]; then | ||
echo " | ||
if [ "$mode" == "combined" ]; then | ||
echo " | ||
<key> | ||
$(cat $EASYRSA_PKI/private/${cn}.key) | ||
</key> | ||
|
@@ -58,23 +58,23 @@ $(cat $EASYRSA_PKI/ta.key) | |
</tls-auth> | ||
key-direction 1 | ||
" | ||
else | ||
echo " | ||
elif [ "$mode" == "separated" ]; then | ||
echo " | ||
key ${cn}.key | ||
ca ca.crt | ||
cert ${cn}.crt | ||
dh dh.pem | ||
tls-auth ta.key 1 | ||
" | ||
fi | ||
fi | ||
|
||
if [ "$OVPN_DEFROUTE" != "0" ];then | ||
echo "redirect-gateway def1" | ||
fi | ||
if [ "$OVPN_DEFROUTE" != "0" ];then | ||
echo "redirect-gateway def1" | ||
fi | ||
|
||
if [ -n "$OVPN_MTU" ]; then | ||
echo "tun-mtu $OVPN_MTU" | ||
fi | ||
if [ -n "$OVPN_MTU" ]; then | ||
echo "tun-mtu $OVPN_MTU" | ||
fi | ||
} | ||
|
||
dir="$OPENVPN/clients/$cn" | ||
|
@@ -88,16 +88,16 @@ case "$parm" in | |
cp "$EASYRSA_PKI/dh.pem" "$dir/dh.pem" | ||
cp "$EASYRSA_PKI/ta.key" "$dir/ta.key" | ||
;; | ||
"combined") | ||
"" | "combined") | ||
get_client_config "combined" | ||
;; | ||
"combined-save") | ||
get_client_config "combined" > "$dir/${cn}-combined.ovpn" | ||
;; | ||
*) | ||
>&2 echo "This script can produce the client configuration in to formats." | ||
>&2 echo " 1. combined: All needed configuration and cryptographic material is in one file (Use \"combined-save\" to write the configuration file in the same path as the separated parameter does)." | ||
>&2 echo " 2. separated: Separated files." | ||
>&2 echo "Please specific one of those options as second parameter." | ||
echo "This script can produce the client configuration in to formats:" >&2 | ||
echo " 1. combined (default): All needed configuration and cryptographic material is in one file (Use \"combined-save\" to write the configuration file in the same path as the separated parameter does)." >&2 | ||
echo " 2. separated: Separated files." >&2 | ||
echo "Please specific one of those options as second parameter." >&2 | ||
;; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with redirecting stderr, but putting the redirection at the beginning of the line feels strange. Most people expect IO redirection at the end of lines by convention. Approach of least astonishment is preferred here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, redirection at the end of the line is probably more common. Changed it. |
||
esac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default case should be combined as mentioned above to not break existing tutorials.