Advertisement
Guest User

Untitled

a guest
Apr 12th, 2020
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.49 KB | None | 0 0
  1. openvpn.conf
  2.  
  3. port 1194
  4. proto udp4
  5. dev tun
  6. ca ######.crt
  7. cert ######.crt
  8. key ######.key
  9. dh ######.pem
  10. server 10.8.0.0 255.255.255.0
  11. ifconfig-pool-persist /root/openvpn-configs/server/ipp.txt
  12. push "route 192.168.1.0 255.255.255.0"
  13. keepalive 10 120
  14. tls-auth ######.key 0
  15. remote-cert-tls client
  16. cipher AES-256-CBC
  17. user nobody
  18. group nobody
  19. persist-key
  20. persist-tun
  21. status openvpn-status.log
  22. verb 3
  23. explicit-exit-notify 1
  24.  
  25. ====================================================================================
  26.  
  27. ipfw.rules
  28.  
  29. #!/bin/sh
  30. EPAIR=$(/sbin/ifconfig -l | tr " " "\n" | /usr/bin/grep epair)
  31. ipfw -q -f flush
  32. ipfw -q nat 1 config if ${EPAIR}
  33. ipfw -q add nat 1 all from 10.8.0.0/24 to any out via ${EPAIR}
  34. ipfw -q add nat 1 all from any to any in via ${EPAIR}
  35.  
  36. TUN=$(/sbin/ifconfig -l | tr " " "\n" | /usr/bin/grep tun)
  37. ifconfig ${TUN} name tun0
  38.  
  39. # Fix for:
  40. # OpenVPN openvpn[53987]: TUN/TAP device tun0 exists previously, keep at program end
  41. # OpenVPN openvpn[53987]: Cannot open TUN/TAP dev /dev/tun0: Device busy (errno=16)
  42. ifconfig tun create
  43. TUN1=$(/sbin/ifconfig -l | tr " " "\n" | /usr/bin/grep tun | tail -1)
  44. ifconfig ${TUN1} name tun1
  45.  
  46. ====================================================================================
  47.  
  48. rc.conf
  49.  
  50. hostname="OpenVPN"
  51. cron_flags="$cron_flags -J 15"
  52.  
  53. # Disable Sendmail by default
  54. sendmail_enable="NO"
  55. sendmail_submit_enable="NO"
  56. sendmail_outbound_enable="NO"
  57. sendmail_msp_queue_enable="NO"
  58.  
  59. # Run secure syslog
  60. syslogd_flags="-c -ss"
  61.  
  62. # Enable IPv6
  63. ipv6_activate_all_interfaces="NO"
  64.  
  65. openvpn_enable="YES"
  66. openvpn_if="tun"
  67. openvpn_configfile="######/openvpn.conf"
  68. openvpn_dir="######"
  69. cloned_interfaces="tun"
  70. gateway_enable="YES"
  71. firewall_enable="YES"
  72. firewall_script="######/ipfw.rules"
  73.  
  74. ====================================================================================
  75. openvpn client config
  76.  
  77. ##############################################
  78. # Sample client-side OpenVPN 2.0 config file #
  79. # for connecting to multi-client server. #
  80. # #
  81. # This configuration can be used by multiple #
  82. # clients, however each client should have #
  83. # its own cert and key files. #
  84. # #
  85. # On Windows, you might want to rename this #
  86. # file so it has a .ovpn extension #
  87. ##############################################
  88.  
  89. # Specify that we are a client and that we
  90. # will be pulling certain config file directives
  91. # from the server.
  92. client
  93.  
  94. # Use the same setting as you are using on
  95. # the server.
  96. # On most systems, the VPN will not function
  97. # unless you partially or fully disable
  98. # the firewall for the TUN/TAP interface.
  99. ;dev tap
  100. dev tun
  101.  
  102. # Windows needs the TAP-Win32 adapter name
  103. # from the Network Connections panel
  104. # if you have more than one. On XP SP2,
  105. # you may need to disable the firewall
  106. # for the TAP adapter.
  107. ;dev-node MyTap
  108.  
  109. # Are we connecting to a TCP or
  110. # UDP server? Use the same setting as
  111. # on the server.
  112. ;proto tcp
  113. proto udp
  114.  
  115. # The hostname/IP and port of the server.
  116. # You can have multiple remote entries
  117. # to load balance between the servers.
  118. remote my-server-1 1194
  119. ;remote my-server-2 1194
  120.  
  121. # Choose a random host from the remote
  122. # list for load-balancing. Otherwise
  123. # try hosts in the order specified.
  124. ;remote-random
  125.  
  126. # Keep trying indefinitely to resolve the
  127. # host name of the OpenVPN server. Very useful
  128. # on machines which are not permanently connected
  129. # to the internet such as laptops.
  130. resolv-retry infinite
  131.  
  132. # Most clients don't need to bind to
  133. # a specific local port number.
  134. nobind
  135.  
  136. # Downgrade privileges after initialization (non-Windows only)
  137. ;user nobody
  138. ;group nobody
  139.  
  140. # Try to preserve some state across restarts.
  141. persist-key
  142. persist-tun
  143.  
  144. # If you are connecting through an
  145. # HTTP proxy to reach the actual OpenVPN
  146. # server, put the proxy server/IP and
  147. # port number here. See the man page
  148. # if your proxy server requires
  149. # authentication.
  150. ;http-proxy-retry # retry on connection failures
  151. ;http-proxy [proxy server] [proxy port #]
  152.  
  153. # Wireless networks often produce a lot
  154. # of duplicate packets. Set this flag
  155. # to silence duplicate packet warnings.
  156. ;mute-replay-warnings
  157.  
  158. # SSL/TLS parms.
  159. # See the server config file for more
  160. # description. It's best to use
  161. # a separate .crt/.key file pair
  162. # for each client. A single ca
  163. # file can be used for all clients.
  164. ca ca.crt
  165. cert client.crt
  166. key client.key
  167.  
  168. # Verify server certificate by checking that the
  169. # certicate has the correct key usage set.
  170. # This is an important precaution to protect against
  171. # a potential attack discussed here:
  172. # http://openvpn.net/howto.html#mitm
  173. #
  174. # To use this feature, you will need to generate
  175. # your server certificates with the keyUsage set to
  176. # digitalSignature, keyEncipherment
  177. # and the extendedKeyUsage to
  178. # serverAuth
  179. # EasyRSA can do this for you.
  180. remote-cert-tls server
  181.  
  182. # If a tls-auth key is used on the server
  183. # then every client must also have the key.
  184. tls-auth ta.key 1
  185.  
  186. # Select a cryptographic cipher.
  187. # If the cipher option is used on the server
  188. # then you must also specify it here.
  189. # Note that v2.4 client/server will automatically
  190. # negotiate AES-256-GCM in TLS mode.
  191. # See also the ncp-cipher option in the manpage
  192. cipher AES-256-CBC
  193.  
  194. # Enable compression on the VPN link.
  195. # Don't enable this unless it is also
  196. # enabled in the server config file.
  197. #comp-lzo
  198.  
  199. # Set log file verbosity.
  200. verb 3
  201.  
  202. # Silence repeating messages
  203. ;mute 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement