Skip to content

Instantly share code, notes, and snippets.

@raghur
Created May 9, 2017 07:16
Show Gist options
  • Select an option

  • Save raghur/25fa6a46a2ba041447dca4413aa5b01d to your computer and use it in GitHub Desktop.

Select an option

Save raghur/25fa6a46a2ba041447dca4413aa5b01d to your computer and use it in GitHub Desktop.
Generate ovpn file using .crt and .key
#!/bin/bash
export OVPN_CLIENT=$1
perl -pe 's#;cert;#open+F,"$ENV{'OVPN_CLIENT'}.crt";join"",<F>#ge' client.conf.template > $1.ovpn
perl -pe 's#;key;#open+F,"$ENV{'OVPN_CLIENT'}.key";join"",<F>#ge' -i $1.ovpn
export OVPN_CLIENT=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment