Advertisement
ecraiger

vpndvrproblem

Apr 3rd, 2015
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. Original from: https://stavrovski.net/blog/how-to-install-and-set-up-openvpn-in-debian-7-wheezy#system-update
  2. 1) apt-get update
  3. 2) apt-get install openvpn easy-rsa bridge-utils
  4. sudo ln -s $(which brctl) /usr/sbin/brctl
  5. 3) make sure tun is available
  6. test ! -c /dev/net/tun && echo openvpn requires tun support || echo tun is available
  7. 4) cd /usr/share/doc/easy-rsa/
  8. make-cadir /etc/openvpn/easy-rsa/
  9. cd /etc/openvpn/easy-rsa/
  10. cp vars{,.orig}
  11. source ./vars
  12. ./clean-all
  13. ./build-ca
  14. 6b) ./build-dh
  15. 7) ./build-key dvr
  16. 8) mkdir -p /etc/openvpn/easy-rsa/keys/
  17. openvpn --genkey --secret /etc/openvpn/easy-rsa/keys/ta.key
  18. 9) Deploy the certificates
  19. The public ca.crt certificate is needed on all servers and clients
  20. The private ca.key key is secret and only needed on the key generating machine
  21. A server needs server.crt, dh2048.pem (public), server.key and ta.key (private)
  22. A client needs client.crt (public), client.key and ta.key (private)
  23. 10) setup cert keys on server
  24. mkdir -p /etc/openvpn/certs
  25. mkdir -p /etc/openvpn/keys
  26. cd /etc/openvpn/easy-rsa/keys
  27. cp -pv /etc/openvpn/easy-rsa/keys/{ca.{crt,key},dvr.{crt,key},ta.key,dh2048.pem} /etc/openvpn/certs/
  28. 11) set-up OpenVPN server configuration file in /etc/openvpn/server.conf
  29. nano /etc/openvpn/server.conf
  30. port 1194
  31. proto udp
  32. dev tun
  33. ca /etc/openvpn/certs/ca.crt
  34. cert /etc/openvpn/certs/dvr.crt
  35. key /etc/openvpn/certs/dvr.key
  36. dh /etc/openvpn/certs/dh2048.pem
  37. tls-auth /etc/openvpn/certs/ta.key 0
  38. server 192.168.88.0 255.255.255.0
  39. ifconfig-pool-persist ipp.txt
  40. push "redirect-gateway def1 bypass-dhcp"
  41. push "dhcp-option DNS 8.8.8.8"
  42. push "dhcp-option DNS 8.8.4.4"
  43. client-to-client
  44. keepalive 1800 4000
  45. cipher DES-EDE3-CBC # Triple-DES
  46. comp-lzo
  47. max-clients 10
  48. user nobody
  49. group nogroup
  50. persist-key
  51. persist-tun
  52. #log openvpn.log
  53. #status openvpn-status.log
  54. verb 5
  55. mute 20
  56. #
  57. #
  58. 12) start openvpn
  59. service openvpn restart
  60. update-rc.d -f openvpn defaults
  61. 13) Enable forwarding and set-up iptables
  62. iptables -A INPUT -p udp -m state --state NEW -m udp --dport 1194 -j ACCEPT
  63. iptables -A FORWARD -s 192.168.88.0/24 -j ACCEPT
  64. iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
  65. iptables -t nat -A POSTROUTING -s 192.168.88.0/24 -o eth0 -j MASQUERADE
  66. ufw allow openvpn
  67. iptables-save > /etc/iptables.rules
  68. 14) for persistent firewall rules you may want to use the iptables-persistent package or just set-up a simple script in /etc/network/if-pre-up.d/ which will load the rules in /etc/iptables.rules using iptables-restore
  69. for example:
  70. cat /etc/network/if-pre-up.d/iptables
  71. #!/bin/bash
  72. test -e /etc/iptables.rules && iptables-restore -c /etc/iptables.rules
  73. 15) client config (copy ca.crt, dvr.crt, dvr.key, ta.key to c:\PROGRA~1\OpenVPN\config\dvr)
  74. client
  75. dev tun
  76. proto udp
  77. auth-user-pass
  78. ns-cert-type server
  79. remote dvr.owner.com 1194
  80. ca ca.crt
  81. cert dvr.crt
  82. key dvr.key
  83. tls-auth ta.key 1
  84. ca c:\\PROGRA~1\\OpenVPN\\config\\dvr\\ca.crt
  85. cert c:\\PROGRA~1\\OpenVPN\\config\\dvr\\dvr.crt
  86. key c:\\PROGRA~1\\OpenVPN\\config\\dvr\\dvr.key
  87. tls-auth c:\\PROGRA~1\\OpenVPN\\config\\dvr\\ta.key 1
  88. cipher DES-EDE3-CBC
  89. comp-lzo
  90. resolv-retry infinite
  91. nobind
  92. auth-nocache
  93. script-security 2
  94. persist-key
  95. persist-tun
  96. verb 2
  97.  
  98. remote dvr.owner.com
  99. ca /home/d/confs/certs/vpn/ca.crt
  100. cert /home/d/confs/certs/vpn/dvr.crt
  101. key /home/d/confs/certs/vpn/dvr.key
  102. tls-auth /home/d/confs/certs/vpn/ta.key 1
  103. cipher DES-EDE3-CBC
  104. comp-lzo yes
  105. dev tun
  106. proto udp
  107. nobind
  108. auth-nocache
  109. script-security 2
  110. persist-key
  111. persist-tun
  112. user nobody
  113. group nogroup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement