d3vilh / openvpn-server

Fast Docker container with OpenVPN Server living inside.
MIT License
39 stars 20 forks source link

Tunneled sever #25

Open elyarsa opened 1 week ago

elyarsa commented 1 week ago

Hello I just tunneled my Iran server to germany server (with openvpn) by chisel tunneling ,tunnel protocol is tcp and port is 62789 and the client port is 443. How should I config client setting and server setting?

Thanks for your help

d3vilh commented 4 days ago

Hi @elyarsa

You have to run client with 443 as remote and local port: chisel client <server_ip>:62789 R:443:localhost:443 OpenVPN Server have to be run on tcp/443 port (just example based on standard config):

cat server.conf
management 0.0.0.0 2080

port 443
proto tcp

dev tun

ca pki/ca.crt
cert pki/issued/server.crt
key pki/private/server.key

cipher AES-256-GCM
auth SHA512
dh pki/dh.pem

server 10.0.70.0 255.255.255.0
route 10.0.71.0 255.255.255.0
ifconfig-pool-persist pki/ipp.txt
push "route 10.0.60.0 255.255.255.0"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 1.0.0.1"

keepalive 10 120
max-clients 100

persist-key
persist-tun

log         /var/log/openvpn/openvpn.log
verb 4
topology subnet

client-config-dir /etc/openvpn/staticclients
push "redirect-gateway def1 bypass-dhcp"

data-ciphers AES-256-GCM:AES-192-GCM:AES-128-GCM

user nobody
group nogroup

status /var/log/openvpn/openvpn-status.log
explicit-exit-notify 1
crl-verify pki/crl.pem 

Client side have to connect same way - tcp/443:

cat client.conf
client
dev tun
proto tcp
remote <server_ip> 443 tcp
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-GCM
auth SHA512
auth-nocache
tls-client
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384:TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-GCM-SHA384
verb 3
explicit-exit-notify
key-direction 1

Don't forget to update docker-compolse.xml with the same TCP ports configuration and recreate container:

         # - "1194:1194/udp"   # openvpn UDP port
          - "443:443/tcp"   # openvpn TCP port

This should work.