Skip to content

Commit

Permalink
Optimized ovpn_copy_server_files script. No need to copy the config f…
Browse files Browse the repository at this point in the history
…iles.

* rsync can copy the actual files.
* This change makes it easier to modifier the configuration and sync it
  to the server. You only have to execute the ovpn_copy_server_files
  once.
  • Loading branch information
ypid committed May 30, 2015
1 parent 5e4bad7 commit 362875c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions bin/ovpn_copy_server_files
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ else
TARGET="$OPENVPN/server"
fi

rsync --recursive --verbose --prune-empty-dirs \
--exclude="clients" \
--exclude="server" \
--include "*/" \
--include "/pki/private/${OVPN_CN}.key" \
--include "/pki/ca.crt" \
--include "/pki/issued/${OVPN_CN}.crt" \
--include "/pki/dh.pem" \
--include "ta.key" \
--include "/openvpn.conf" \
--include "/ovpn_env.sh" \
--exclude="*" \
echo "
pki/private/${OVPN_CN}.key
pki/issued/${OVPN_CN}.crt
pki/dh.pem
pki/ta.key
" | rsync --recursive --verbose \
--files-from - \
"$OPENVPN/" "$TARGET"
ln --symbolic --force ../openvpn.conf ../ovpn_env.sh "$TARGET"

echo "Created the openvpn configuration for the server: $TARGET"

0 comments on commit 362875c

Please sign in to comment.