OpenVPN / openvpn

OpenVPN is an open source VPN daemon
http://openvpn.net
Other
10.64k stars 2.96k forks source link

infinity connection #580

Open bachelor-SGE opened 1 month ago

bachelor-SGE commented 1 month ago

Describe the bug So there is a Windows on which ubuntu 22.04 runs with the help of wsl, on this very ubuntu a server inside the local network should be raised so that then I could connect to the local network from anywhere in the world

installation 1) "sudo apt install mc nano wget curl" 2) "wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh"

Immediately and immediately everything does not work, I open the necessary ports on the router and on the PC, again it does not work, it says that the port is busy, I disable the port in all services, it still does not work in the log and there are no errors when connecting, just an eternal connection

Expected behavior connecting to OpenVPN from a client PC and simulating a local network

Configuration

`server.conf local 172.22.182.196 port 1194 proto tcp4 dev tun ca ca.crt cert server.crt key server.key dh dh.pem auth SHA512 tls-crypt tc.key topology subnet server 10.8.0.0 255.255.255.0 push "redirect-gateway def1 bypass-dhcp" ifconfig-pool-persist ipp.txt push "dhcp-option DNS 172.22.176.1" push "block-outside-dns" keepalive 10 120 user nobody group nogroup persist-key persist-tun verb 3 crl-verify crl.pem verb 5

server.conf`

`aboba.ovpn client dev tun proto tcp remote 77.37.178.172 1194 resolv-retry infinite nobind persist-key persist-tun remote-cert-tls server auth SHA512 ignore-unknown-option block-outside-dns verb 3

vpn.conf`

`root@DESKTOP-DM4V28D:/# systemctl status openvpn@server ● openvpn@server.service - OpenVPN connection to server Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled-runtime; vendor preset: enabled) Active: active (running) since Sun 2024-07-28 04:38:41 MSK; 1min 33s ago Docs: man:openvpn(8) https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage https://community.openvpn.net/openvpn/wiki/HOWTO Main PID: 19293 (openvpn) Status: "Initialization Sequence Completed" Tasks: 1 (limit: 2013) Memory: 1.8M CGroup: /system.slice/system-openvpn.slice/openvpn@server.service └─19293 /usr/sbin/openvpn --daemon ovpn-server --status /run/openvpn/server.status 10 --cd /etc/openvpn --script-security 2 --config /etc/openvpn/server.conf --writepid /run/openvpn/server.pid

Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Listening for incoming TCP connection on [AF_INET]172.22.182.196:1194 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: TCPv4_SERVER link local (bound): [AF_INET]172.22.182.196:1194 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: TCPv4_SERVER link remote: [AF_UNSPEC] Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: GID set to nogroup Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: UID set to nobody Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: MULTI: multi_init called, r=256 v=256 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: IFCONFIG POOL IPv4: base=10.8.0.2 size=253 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: IFCONFIG POOL LIST Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: MULTI: TCP INIT maxclients=1024 maxevents=1028 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Initialization Sequence Completed root@DESKTOP-DM4V28D:/# journalctl -xeu openvpn@server.service Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: ifconfig_ipv6_pool_base = :: Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: ifconfig_ipv6_pool_netbits = 0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: n_bcast_buf = 256 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: tcp_queue_limit = 64 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: real_hash_size = 256 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: virtual_hash_size = 256 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: client_connect_script = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: learn_address_script = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: client_disconnect_script = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: client_config_dir = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: ccd_exclusive = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: tmp_dir = '/tmp' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: push_ifconfig_defined = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: push_ifconfig_local = 0.0.0.0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: push_ifconfig_remote_netmask = 0.0.0.0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: push_ifconfig_ipv6_defined = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: push_ifconfig_ipv6_local = ::/0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: push_ifconfig_ipv6_remote = :: Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: enable_c2c = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: duplicate_cn = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: cf_max = 0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: cf_per = 0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: max_clients = 1024 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: max_routes_per_client = 256 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: auth_user_pass_verify_script = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: auth_user_pass_verify_script_via_file = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: auth_token_generate = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: auth_token_lifetime = 0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: auth_token_secret_file = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: port_share_host = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: port_share_port = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: vlan_tagging = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: vlan_accept = all Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: vlan_pvid = 1 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: client = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: pull = DISABLED Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: auth_user_pass_file = '[UNDEF]' Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: OpenVPN 2.5.9 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jun 27 2024 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: library versions: OpenSSL 3.0.2 15 Mar 2022, LZO 2.10 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: net_route_v4_best_gw query: dst 0.0.0.0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: net_route_v4_best_gw result: via 172.22.176.1 dev eth0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Diffie-Hellman initialized with 2048 bit key Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: CRL: loaded 1 CRLs from file crl.pem Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Outgoing Control Channel Encryption: Cipher 'AES-256-CTR' initialized with 256 bit key Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Outgoing Control Channel Encryption: Using 256 bit message hash 'SHA256' for HMAC authentication Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Incoming Control Channel Encryption: Cipher 'AES-256-CTR' initialized with 256 bit key Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Incoming Control Channel Encryption: Using 256 bit message hash 'SHA256' for HMAC authentication Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: TLS-Auth MTU parms [ L:1623 D:1154 EF:96 EB:0 ET:0 EL:3 ] Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: TUN/TAP device tun0 opened Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: do_ifconfig, ipv4=1, ipv6=0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: net_iface_mtu_set: mtu 1500 for tun0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: net_iface_up: set tun0 up Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: net_addr_v4_add: 10.8.0.1/24 dev tun0 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Data Channel MTU parms [ L:1623 D:1450 EF:123 EB:406 ET:0 EL:3 AF:14/123 ] Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Socket Buffers: R=[131072->131072] S=[16384->16384] Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Listening for incoming TCP connection on [AF_INET]172.22.182.196:1194 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: TCPv4_SERVER link local (bound): [AF_INET]172.22.182.196:1194 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: TCPv4_SERVER link remote: [AF_UNSPEC] Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: GID set to nogroup Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: UID set to nobody Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: MULTI: multi_init called, r=256 v=256 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: IFCONFIG POOL IPv4: base=10.8.0.2 size=253 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: IFCONFIG POOL LIST Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: MULTI: TCP INIT maxclients=1024 maxevents=1028 Jul 28 04:38:41 DESKTOP-DM4V28D ovpn-server[19293]: Initialization Sequence Completed

journalctl & status`

`try to connect on client pc

Sun Jul 28 05:09:50 2024 Note: --cipher is not set. OpenVPN versions before 2.5 defaulted to BF-CBC as fallback when cipher negotiation failed in this case. If you need this fallback please add '--data-ciphers-fallback BF-CBC' to your configuration and/or add BF-CBC to --data-ciphers. Sun Jul 28 05:09:50 2024 OpenVPN 2.6.12 [git:v2.6.12/038a94bae57a446c] Windows [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] [DCO] built on Jul 18 2024 Sun Jul 28 05:09:50 2024 Windows version 10.0 (Windows 10 or greater), amd64 executable Sun Jul 28 05:09:50 2024 library versions: OpenSSL 3.3.1 4 Jun 2024, LZO 2.10 Sun Jul 28 05:09:50 2024 DCO version: 1.2.1 Sun Jul 28 05:09:50 2024 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25352 Sun Jul 28 05:09:50 2024 Need hold release from management interface, waiting... Sun Jul 28 05:09:51 2024 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:62039 Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'state on' Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'log on all' Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'echo on all' Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'bytecount 5' Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'state' Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'hold off' Sun Jul 28 05:09:51 2024 MANAGEMENT: CMD 'hold release' Sun Jul 28 05:09:51 2024 TCP/UDP: Preserving recently used remote address: [AF_INET]77.37.178.172:1194 Sun Jul 28 05:09:51 2024 Socket Buffers: R=[65536->65536] S=[65536->65536] Sun Jul 28 05:09:51 2024 Attempting to establish TCP connection with [AF_INET]77.37.178.172:1194 Sun Jul 28 05:09:51 2024 MANAGEMENT: >STATE:1722132591,TCP_CONNECT,,,,,, Sun Jul 28 05:11:52 2024 TCP: connect to [AF_INET]77.37.178.172:1194 failed: Unknown error Sun Jul 28 05:11:52 2024 SIGUSR1[connection failed(soft),connection-failed] received, process restarting Sun Jul 28 05:11:52 2024 MANAGEMENT: >STATE:1722132712,RECONNECTING,connection-failed,,,,, Sun Jul 28 05:11:52 2024 Restart pause, 1 second(s) Sun Jul 28 05:11:53 2024 TCP/UDP: Preserving recently used remote address: [AF_INET]77.37.178.172:1194 Sun Jul 28 05:11:53 2024 Socket Buffers: R=[65536->65536] S=[65536->65536] Sun Jul 28 05:11:53 2024 Attempting to establish TCP connection with [AF_INET]77.37.178.172:1194 Sun Jul 28 05:11:53 2024 MANAGEMENT: >STATE:1722132713,TCP_CONNECT,,,,,, `

Version information

If you need any other information, please write

cron2 commented 1 month ago

"Ubuntu inside WSL" is not "OS: Ubuntu", it's "OS: Windows with some extras"... so I expect this to just not work. From the logs, the TCP connection from the client does not reach the OpenVPN server process, so this is really "outside of OpenVPN to solve".

Running the OpenVPN server on the Windows side should work fine.

Dibyajyoti-08 commented 3 weeks ago

Hello bachelor-SGE, i will suggest, instead of using Ubuntu inside WSl, just use any cloud server, on top of that you can run your Ubuntu OS, and configure the inbound and outbound rule for the port opening, and then you are good to go.

Regards, DJ