Advertisement
Guest User

ovpn-writer.sh

a guest
Apr 30th, 2016
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ##
  4. ## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
  5. ##
  6.  
  7. server=${1?"The server address is required"}
  8. cacert=${2?"The path to the ca certificate file is required"}
  9. client_cert=${3?"The path to the client certificate file is required"}
  10. client_key=${4?"The path to the client private key file is required"}
  11. tls_key=${5?"The path to the TLS shared secret file is required"}
  12.  
  13. cat << EOF
  14. client
  15. dev tun
  16. remote ${server}
  17. resolv-retry infinite
  18. nobind
  19. persist-key
  20. persist-tun
  21. verb 1
  22. keepalive 10 120
  23. port 1194
  24. proto udp
  25. cipher AES-128-CBC
  26. comp-lzo
  27. remote-cert-tls server
  28. redirect-gateway def1
  29. key-direction 1
  30. <ca>
  31. EOF
  32. cat ${cacert}
  33. cat << EOF
  34. </ca>
  35. <cert>
  36. EOF
  37. cat ${client_cert}
  38. cat << EOF
  39. </cert>
  40. <key>
  41. EOF
  42. cat ${client_key}
  43. cat << EOF
  44. </key>
  45. <tls-auth>
  46. EOF
  47. cat ${tls_key}
  48. cat << EOF
  49. </tls-auth>
  50. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement