Wrote script to copy only the needed files to the docker host which runs the docker openvpn server.

* For the truly paranoid users, never keep any keys (i.e. client and
  certificate authority) in the docker container to begin with :).
This commit is contained in:
Robin Schneider 2015-03-08 22:40:08 +01:00
parent 8d8f19d951
commit 3d2d839d0b
No known key found for this signature in database
GPG Key ID: 489A4D5EC353C98A
2 changed files with 25 additions and 1 deletions

View File

@ -105,7 +105,7 @@ packets, etc).
simplicity. It's highly recommended to secure the CA key with some simplicity. It's highly recommended to secure the CA key with some
passphrase to protect against a filesystem compromise. A more secure system passphrase to protect against a filesystem compromise. A more secure system
would put the EasyRSA PKI CA on an offline system (can use the same Docker would put the EasyRSA PKI CA on an offline system (can use the same Docker
image to accomplish this). image and the script ovpn_copy_server_files to accomplish this).
* It would be impossible for an adversary to sign bad or forged certificates * It would be impossible for an adversary to sign bad or forged certificates
without first cracking the key's passphase should the adversary have root without first cracking the key's passphase should the adversary have root
access to the filesystem. access to the filesystem.

24
bin/ovpn_copy_server_files Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
## @licence AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
## @author Copyright (C) 2015 Robin Schneider <ypid@riseup.net>
source "$OPENVPN/ovpn_env.sh"
TARGET="/tmp/openvpn_${OVPN_CN}"
if [ -n "$1" ]; then
TARGET="$1"
fi
rsync --recursive --verbose --prune-empty-dirs \
--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="*" \
"$OPENVPN/" "$TARGET"
echo "Created the openvpn configuration for the server: $TARGET"