Skip to content

Commit ef36799

Browse files
committed
Custom ovpn, pkg template
1 parent 14ddcf2 commit ef36799

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

root/usr/local/bin/ovpn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function usage() {
1818
echo ' rm|del # Remove PKI'
1919
echo ' restore [file] # Restore config'
2020
echo ' subject add NAME {client|server} [nopass] [easy-rsa args]'
21-
echo ' gen-ovpn SUBNAME [file] # Generate .ovpn file'
22-
echo ' gen-pkg SUBNAME [file] # Generate config package'
21+
echo ' gen-ovpn SUBNAME [file] # Generate .ovpn file (TEMPLATE=<custom template in openvpn dir)'
22+
echo ' gen-pkg SUBNAME [file] # Generate config package (TEMPLATE=<custom template in openvpn dir)'
2323
echo ' import-req FILE # Import signing request'
2424
echo ' renew SUBNAME {client|server} [easy-rsa args]'
2525
echo ' revoke SUBNAME'

root/usr/local/bin/ovpn-subject

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ function generate_ovpn() {
3636
fi
3737

3838
# Start with client config template if it exist
39-
if [ -f "$OPENVPN_DIR/openvpn-template.conf" ]; then
40-
$RUNCMD bash -c "cat $OPENVPN_DIR/openvpn-template.conf > $OVPN_FILE"
39+
TEMPLATE=${TEMPLATE:='openvpn-template.conf'}
40+
if [ -f "$OPENVPN_DIR/$TEMPLATE" ]; then
41+
$RUNCMD bash -c "cat $OPENVPN_DIR/$TEMPLATE > $OVPN_FILE"
4142
else
4243
$RUNCMD touch $OVPN_FILE
4344
fi
@@ -122,8 +123,9 @@ function generate_pkg() {
122123
$RUNCMD mkdir -p $TMP_DIR/openvpn
123124

124125
# Start with client config template if it exist
125-
if [ -f "$OPENVPN_DIR/openvpn-template.conf" ]; then
126-
$RUNCMD bash -c "cat $OPENVPN_DIR/openvpn-template.conf > $TMP_CONFIG"
126+
TEMPLATE=${TEMPLATE:='openvpn-template.conf'}
127+
if [ -f "$OPENVPN_DIR/$TEMPLATE" ]; then
128+
$RUNCMD bash -c "cat $OPENVPN_DIR/$TEMPLATE > $TMP_CONFIG"
127129
else
128130
$RUNCMD touch $TMP_CONFIG
129131
fi

0 commit comments

Comments
 (0)