Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 16.09 KB | None | 0 0
  1. При подключении клиента в консоли:
  2. root@prxzm-laptop:/home/prxzm# openvpn --config client1.ovpn
  3. Wed Mar 29 03:04:36 2017 OpenVPN 2.3.10 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Feb  2 2016
  4. Wed Mar 29 03:04:36 2017 library versions: OpenSSL 1.0.2g  1 Mar 2016, LZO 2.08
  5. Wed Mar 29 03:04:36 2017 Control Channel Authentication: tls-auth using INLINE static key file
  6. Wed Mar 29 03:04:36 2017 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
  7. Wed Mar 29 03:04:36 2017 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
  8. Wed Mar 29 03:04:36 2017 Socket Buffers: R=[212992->212992] S=[212992->212992]
  9. Wed Mar 29 03:04:36 2017 NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
  10. Wed Mar 29 03:04:36 2017 UDPv4 link local: [undef]
  11. Wed Mar 29 03:04:36 2017 UDPv4 link remote: [AF_INET]138.68.xxx.140:443
  12. Wed Mar 29 03:04:36 2017 TLS: Initial packet from [AF_INET]138.68.xxx.140:443, sid=7907816e 3e1f15fc
  13. Wed Mar 29 03:04:36 2017 VERIFY OK: depth=1, C=GB, ST=LN, L=London, O=DigitalOcean, OU=MyOrg, CN=DigitalOcean CA, name=server, emailAddress=me@me.me
  14. Wed Mar 29 03:04:36 2017 Validating certificate key usage
  15. Wed Mar 29 03:04:36 2017 ++ Certificate has key usage  00a0, expects 00a0
  16. Wed Mar 29 03:04:36 2017 VERIFY KU OK
  17. Wed Mar 29 03:04:36 2017 Validating certificate extended key usage
  18. Wed Mar 29 03:04:36 2017 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
  19. Wed Mar 29 03:04:36 2017 VERIFY EKU OK
  20. Wed Mar 29 03:04:36 2017 VERIFY OK: depth=0, C=GB, ST=LN, L=London, O=DigitalOcean, OU=MyOrg, CN=server, name=server, emailAddress=me@me.me
  21. Wed Mar 29 03:04:37 2017 Data Channel Encrypt: Cipher 'AES-128-CBC' initialized with 128 bit key
  22. Wed Mar 29 03:04:37 2017 Data Channel Encrypt: Using 256 bit message hash 'SHA256' for HMAC authentication
  23. Wed Mar 29 03:04:37 2017 Data Channel Decrypt: Cipher 'AES-128-CBC' initialized with 128 bit key
  24. Wed Mar 29 03:04:37 2017 Data Channel Decrypt: Using 256 bit message hash 'SHA256' for HMAC authentication
  25. Wed Mar 29 03:04:37 2017 Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384, 2048 bit RSA
  26. Wed Mar 29 03:04:37 2017 [server] Peer Connection Initiated with [AF_INET]138.68.134.140:443
  27. Wed Mar 29 03:04:39 2017 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
  28. Wed Mar 29 03:04:39 2017 PUSH: Received control message: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'
  29. Wed Mar 29 03:04:39 2017 OPTIONS IMPORT: timers and/or timeouts modified
  30. Wed Mar 29 03:04:39 2017 OPTIONS IMPORT: --ifconfig/up options modified
  31. Wed Mar 29 03:04:39 2017 OPTIONS IMPORT: route options modified
  32. Wed Mar 29 03:04:39 2017 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=enp2s0 HWADDR=00:26:2d:78:93:db
  33. Wed Mar 29 03:04:39 2017 TUN/TAP device tun0 opened
  34. Wed Mar 29 03:04:39 2017 TUN/TAP TX queue length set to 100
  35. Wed Mar 29 03:04:39 2017 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
  36. Wed Mar 29 03:04:39 2017 /sbin/ip link set dev tun0 up mtu 1500
  37. Wed Mar 29 03:04:39 2017 /sbin/ip addr add dev tun0 local 10.8.0.6 peer 10.8.0.5
  38. Wed Mar 29 03:04:39 2017 /sbin/ip route add 10.8.0.1/32 via 10.8.0.5
  39. Wed Mar 29 03:04:39 2017 GID set to nogroup
  40. Wed Mar 29 03:04:39 2017 UID set to nobody
  41. Wed Mar 29 03:04:39 2017 Initialization Sequence Completed
  42.  
  43.  
  44. Вывод с сервера:
  45. sudo systemctl status openvpn@server
  46. ● openvpn@server.service - OpenVPN connection to server
  47.    Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled; vendor preset: enabled)
  48.    Active: active (running) since Tue 2017-03-28 21:56:33 UTC; 13min ago
  49.      Docs: man:openvpn(8)
  50.            https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
  51.            https://community.openvpn.net/openvpn/wiki/HOWTO
  52.   Process: 5518 ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --script-security 2 --conf
  53.  Main PID: 5521 (openvpn)
  54.    CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
  55.            └─5521 /usr/sbin/openvpn --daemon ovpn-server --status /run/openvpn/server.status 10 --cd /etc/openvpn --script-security 2 --conf
  56.  
  57. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: 94.51.xxx.240:35352 Data Channel Decrypt: Using 256 bit message hash 'SHA256' for HMAC
  58. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: 94.51.xxx.240:35352 Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA
  59. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: 94.51.xxx.240:35352 [client1] Peer Connection Initiated with [AF_INET]94.51.75.240:3535
  60. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: MULTI: new connection by client 'client1' will cause previous active sessions by this
  61. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
  62. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: MULTI: Learn: 10.8.0.6 -> client1/94.51.75.240:35352
  63. Mar 28 22:09:49 ubuntu-1gb-lon1-01 ovpn-server[5521]: MULTI: primary virtual IP for client1/94.51.75.240:35352: 10.8.0.6
  64. Mar 28 22:09:51 ubuntu-1gb-lon1-01 ovpn-server[5521]: client1/94.51.xxx.240:35352 PUSH: Received control message: 'PUSH_REQUEST'
  65. Mar 28 22:09:51 ubuntu-1gb-lon1-01 ovpn-server[5521]: client1/94.51.xxx.240:35352 send_push_reply(): safe_cap=940
  66. Mar 28 22:09:51 ubuntu-1gb-lon1-01 ovpn-server[5521]: client1/94.51.xxx.240:35352 SENT CONTROL [client1]: 'PUSH_REPLY,route 10.8.0.1,topology
  67.  
  68.  
  69. Файл конфига:
  70. #################################################
  71. # Sample OpenVPN 2.0 config file for            #
  72. # multi-client server.                          #
  73. #                                               #
  74. # This file is for the server side              #
  75. # of a many-clients <-> one-server              #
  76. # OpenVPN configuration.                        #
  77. #                                               #
  78. # OpenVPN also supports                         #
  79. # single-machine <-> single-machine             #
  80. # configurations (See the Examples page         #
  81. # on the web site for more info).               #
  82. #                                               #
  83. # This config should work on Windows            #
  84. # or Linux/BSD systems.  Remember on            #
  85. # Windows to quote pathnames and use            #
  86. # double backslashes, e.g.:                     #
  87. # "C:\\Program Files\\OpenVPN\\config\\foo.key" #
  88. #                                               #
  89. # Comments are preceded with '#' or ';'         #
  90. #################################################
  91.  
  92. # Which local IP address should OpenVPN
  93. # listen on? (optional)
  94. ;local a.b.c.d
  95.  
  96. # Which TCP/UDP port should OpenVPN listen on?
  97. # If you want to run multiple OpenVPN instances
  98. # on the same machine, use a different port
  99. # number for each one.  You will need to
  100. # open up this port on your firewall.
  101. port 443
  102.  
  103. # TCP or UDP server?
  104. ;proto tcp
  105. proto udp
  106.  
  107. # "dev tun" will create a routed IP tunnel,
  108. # "dev tap" will create an ethernet tunnel.
  109. # Use "dev tap0" if you are ethernet bridging
  110. # and have precreated a tap0 virtual interface
  111. # and bridged it with your ethernet interface.
  112. # If you want to control access policies
  113. # over the VPN, you must create firewall
  114. # rules for the the TUN/TAP interface.
  115. # On non-Windows systems, you can give
  116. # an explicit unit number, such as tun0.
  117. # On Windows, use "dev-node" for this.
  118. # On most systems, the VPN will not function
  119. # unless you partially or fully disable
  120. # the firewall for the TUN/TAP interface.
  121. ;dev tap
  122. dev tun
  123.  
  124. # Windows needs the TAP-Win32 adapter name
  125. # from the Network Connections panel if you
  126. # have more than one.  On XP SP2 or higher,
  127. # you may need to selectively disable the
  128. # Windows firewall for the TAP adapter.
  129. # Non-Windows systems usually don't need this.
  130. ;dev-node MyTap
  131.  
  132. # SSL/TLS root certificate (ca), certificate
  133. # (cert), and private key (key).  Each client
  134. # and the server must have their own cert and
  135. # key file.  The server and all clients will
  136. # use the same ca file.
  137. #
  138. # See the "easy-rsa" directory for a series
  139. # of scripts for generating RSA certificates
  140. # and private keys.  Remember to use
  141. # a unique Common Name for the server
  142. # and each of the client certificates.
  143. #
  144. # Any X509 key management system can be used.
  145. # OpenVPN can also use a PKCS #12 formatted key file
  146. # (see "pkcs12" directive in man page).
  147. ca ca.crt
  148. cert server.crt
  149. key server.key  # This file should be kept secret
  150.  
  151. # Diffie hellman parameters.
  152. # Generate your own with:
  153. #   openssl dhparam -out dh2048.pem 2048
  154. dh dh2048.pem
  155.  
  156. # Network topology
  157. # Should be subnet (addressing via IP)
  158. # unless Windows clients v2.0.9 and lower have to
  159. # be supported (then net30, i.e. a /30 per client)
  160. # Defaults to net30 (not recommended)
  161. ;topology subnet
  162.  
  163. # Configure server mode and supply a VPN subnet
  164. # for OpenVPN to draw client addresses from.
  165. # The server will take 10.8.0.1 for itself,
  166. # the rest will be made available to clients.
  167. # Each client will be able to reach the server
  168. # on 10.8.0.1. Comment this line out if you are
  169. # ethernet bridging. See the man page for more info.
  170. server 10.8.0.0 255.255.255.0
  171.  
  172. # Maintain a record of client <-> virtual IP address
  173. # associations in this file.  If OpenVPN goes down or
  174. # is restarted, reconnecting clients can be assigned
  175. # the same virtual IP address from the pool that was
  176. # previously assigned.
  177. ifconfig-pool-persist ipp.txt
  178.  
  179. # Configure server mode for ethernet bridging.
  180. # You must first use your OS's bridging capability
  181. # to bridge the TAP interface with the ethernet
  182. # NIC interface.  Then you must manually set the
  183. # IP/netmask on the bridge interface, here we
  184. # assume 10.8.0.4/255.255.255.0.  Finally we
  185. # must set aside an IP range in this subnet
  186. # (start=10.8.0.50 end=10.8.0.100) to allocate
  187. # to connecting clients.  Leave this line commented
  188. # out unless you are ethernet bridging.
  189. ;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
  190.  
  191. # Configure server mode for ethernet bridging
  192. # using a DHCP-proxy, where clients talk
  193. # to the OpenVPN server-side DHCP server
  194. # to receive their IP address allocation
  195. # and DNS server addresses.  You must first use
  196. # your OS's bridging capability to bridge the TAP
  197. # interface with the ethernet NIC interface.
  198. # Note: this mode only works on clients (such as
  199. # Windows), where the client-side TAP adapter is
  200. # bound to a DHCP client.
  201. ;server-bridge
  202.  
  203. # Push routes to the client to allow it
  204. # to reach other private subnets behind
  205. # the server.  Remember that these
  206. # private subnets will also need
  207. # to know to route the OpenVPN client
  208. # address pool (10.8.0.0/255.255.255.0)
  209. # back to the OpenVPN server.
  210. ;push "route 192.168.10.0 255.255.255.0"
  211. ;push "route 192.168.20.0 255.255.255.0"
  212.  
  213. # To assign specific IP addresses to specific
  214. # clients or if a connecting client has a private
  215. # subnet behind it that should also have VPN access,
  216. # use the subdirectory "ccd" for client-specific
  217. # configuration files (see man page for more info).
  218.  
  219. # EXAMPLE: Suppose the client
  220. # having the certificate common name "Thelonious"
  221. # also has a small subnet behind his connecting
  222. # machine, such as 192.168.40.128/255.255.255.248.
  223. # First, uncomment out these lines:
  224. ;client-config-dir ccd
  225. ;route 192.168.40.128 255.255.255.248
  226. # Then create a file ccd/Thelonious with this line:
  227. #   iroute 192.168.40.128 255.255.255.248
  228. # This will allow Thelonious' private subnet to
  229. # access the VPN.  This example will only work
  230. # if you are routing, not bridging, i.e. you are
  231. # using "dev tun" and "server" directives.
  232.  
  233. # EXAMPLE: Suppose you want to give
  234. # Thelonious a fixed VPN IP address of 10.9.0.1.
  235. # First uncomment out these lines:
  236. ;client-config-dir ccd
  237. ;route 10.9.0.0 255.255.255.252
  238. # Then add this line to ccd/Thelonious:
  239. #   ifconfig-push 10.9.0.1 10.9.0.2
  240.  
  241. # Suppose that you want to enable different
  242. # firewall access policies for different groups
  243. # of clients.  There are two methods:
  244. # (1) Run multiple OpenVPN daemons, one for each
  245. #     group, and firewall the TUN/TAP interface
  246. #     for each group/daemon appropriately.
  247. # (2) (Advanced) Create a script to dynamically
  248. #     modify the firewall in response to access
  249. #     from different clients.  See man
  250. #     page for more info on learn-address script.
  251. ;learn-address ./script
  252.  
  253. # If enabled, this directive will configure
  254. # all clients to redirect their default
  255. # network gateway through the VPN, causing
  256. # all IP traffic such as web browsing and
  257. # and DNS lookups to go through the VPN
  258. # (The OpenVPN server machine may need to NAT
  259. # or bridge the TUN/TAP interface to the internet
  260. # in order for this to work properly).
  261. ;push "redirect-gateway def1 bypass-dhcp"
  262.  
  263. # Certain Windows-specific network settings
  264. # can be pushed to clients, such as DNS
  265. # or WINS server addresses.  CAVEAT:
  266. # http://openvpn.net/faq.html#dhcpcaveats
  267. # The addresses below refer to the public
  268. # DNS servers provided by opendns.com.
  269. ;push "dhcp-option DNS 208.67.222.222"
  270. ;push "dhcp-option DNS 208.67.220.220"
  271.  
  272. # Uncomment this directive to allow different
  273. # clients to be able to "see" each other.
  274. # By default, clients will only see the server.
  275. # To force clients to only see the server, you
  276. # will also need to appropriately firewall the
  277. # server's TUN/TAP interface.
  278. ;client-to-client
  279.  
  280. # Uncomment this directive if multiple clients
  281. # might connect with the same certificate/key
  282. # files or common names.  This is recommended
  283. # only for testing purposes.  For production use,
  284. # each client should have its own certificate/key
  285. # pair.
  286. #
  287. # IF YOU HAVE NOT GENERATED INDIVIDUAL
  288. # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
  289. # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
  290. # UNCOMMENT THIS LINE OUT.
  291. ;duplicate-cn
  292.  
  293. # The keepalive directive causes ping-like
  294. # messages to be sent back and forth over
  295. # the link so that each side knows when
  296. # the other side has gone down.
  297. # Ping every 10 seconds, assume that remote
  298. # peer is down if no ping received during
  299. # a 120 second time period.
  300. keepalive 10 120
  301.  
  302. # For extra security beyond that provided
  303. # by SSL/TLS, create an "HMAC firewall"
  304. # to help block DoS attacks and UDP port flooding.
  305. #
  306. # Generate with:
  307. #   openvpn --genkey --secret ta.key
  308. #
  309. # The server and each client must have
  310. # a copy of this key.
  311. # The second parameter should be '0'
  312. # on the server and '1' on the clients.
  313. tls-auth ta.key 0 # This file is secret
  314. key-direction 0
  315.  
  316. # Select a cryptographic cipher.
  317. # This config item must be copied to
  318. # the client config file as well.
  319. ;cipher BF-CBC        # Blowfish (default)
  320. cipher AES-128-CBC   # AES
  321. auth SHA256
  322. ;cipher DES-EDE3-CBC  # Triple-DES
  323.  
  324. # Enable compression on the VPN link.
  325. # If you enable it here, you must also
  326. # enable it in the client config file.
  327. comp-lzo
  328.  
  329. # The maximum number of concurrently connected
  330. # clients we want to allow.
  331. ;max-clients 100
  332.  
  333. # It's a good idea to reduce the OpenVPN
  334. # daemon's privileges after initialization.
  335. #
  336. # You can uncomment this out on
  337. # non-Windows systems.
  338. user nobody
  339. group nogroup
  340.  
  341. # The persist options will try to avoid
  342. # accessing certain resources on restart
  343. # that may no longer be accessible because
  344. # of the privilege downgrade.
  345. persist-key
  346. persist-tun
  347.  
  348. # Output a short status file showing
  349. # current connections, truncated
  350. # and rewritten every minute.
  351. status openvpn-status.log
  352.  
  353. # By default, log messages will go to the syslog (or
  354. # on Windows, if running as a service, they will go to
  355. # the "\Program Files\OpenVPN\log" directory).
  356. # Use log or log-append to override this default.
  357. # "log" will truncate the log file on OpenVPN startup,
  358. # while "log-append" will append to it.  Use one
  359. # or the other (but not both).
  360. ;log         openvpn.log
  361. ;log-append  openvpn.log
  362.  
  363. # Set the appropriate level of log
  364. # file verbosity.
  365. #
  366. # 0 is silent, except for fatal errors
  367. # 4 is reasonable for general usage
  368. # 5 and 6 can help to debug connection problems
  369. # 9 is extremely verbose
  370. verb 3
  371.  
  372. # Silence repeating messages.  At most 20
  373. # sequential messages of the same message
  374. # category will be output to the log.
  375. ;mute 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement