Skip to content

Instantly share code, notes, and snippets.

@syntaxerrormmm
Created May 12, 2018 15:52
Show Gist options
  • Save syntaxerrormmm/17991751e781cd83d5b0380f4b7bb61c to your computer and use it in GitHub Desktop.
Save syntaxerrormmm/17991751e781cd83d5b0380f4b7bb61c to your computer and use it in GitHub Desktop.
#!/bin/bash
clientname=$1; shift
# Generate certificates
./easyrsa build-client-full ${clientname} nopass
# Generating all-in-one configuration
cat > configs/${clientname}.ovpn<<EOC
client
pull
dev tun
proto udp
remote sys42.eu 1194
resolv-retry infinite
nobind
persist-key
persist-tun
key-direction 1
<ca>
`cat pki/ca.crt`
</ca>
<cert>
`cat pki/issued/${clientname}.crt`
</cert>
<key>
`cat pki/private/${clientname}.key`
</key>
<tls-auth>
`cat pki/private/ta.key`
</tls-auth>
remote-cert-tls server
comp-lzo
verb 3
mssfix 1428
fragment 1428
EOC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment