So I am a bit new to the VPN stuff and am currently getting a little desperate.
For what I want to do. I have rented a little server somewhere (static IP, Domain and everything). Now I want to run some services on that server via docker. Those services should not just be accessible by everyone, but only with a valid VPN connection to the server. (The firewall currently blocks access to those ports from the outside)
From what I understand I could achieve this with a VPN and Port Forwarding, but It can certainly be that I missunderstood something on a fundamental level.
Anyway, I have a OpenVPN-Server running via docker compose:
version: '2'
services:
openvpn:
cap_add:
- NET_ADMIN
image: kylemanna/openvpn
container_name: openvpn
ports:
- "1194:1194/udp"
restart: always
volumes:
- ./openvpn-data/conf:/etc/openvpn
I followed This Tutorial to configure it. I can connect to the VPN using the client software just fine, but now I don't know how to configure it, so that once I am connected I can call a service on Port 8080 on the Server for example.
I did not really find any answers that helped me set it up so far, so I hope someone here can help me. I tried running the service in the same docker network, and configure the VPN, but that did not work.
Thank you in advance and have a nice day.
Providing specifics after "Blind Spots" question
The OpenVPN.conf
server 192.168.255.0 255.255.255.0
verb 3
key /etc/openvpn/pki/private/www.mysite.com.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/www.mysite.com.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60
persist-key
persist-tun
proto udp
# Rely on Docker to do port mapping, internally always 1194
port 1194
dev tun0
status /tmp/openvpn-status.log
user nobody
group nogroup
### Push Configurations Below
push "dhcp-option DNS 192.168.13.6"
push "dhcp-option DOMAIN mysite.com"
push "route 192.168.192.0 255.255.255.0"
For the troubleshooting results: After I fixed the compression problem I've found, every of the steps mentioned here is satisfied.
For what I achieved and what I want to achieve. The last part of the config file push "route 192.168.192.0 255.255.255.0"
adds a docker network, which I defined and to which the openVPN container as well as some other containers are connected (All of this transpires on the server of course).
When my openVPN client is connected, it gets the IP 192.168.192.6, as expected and I can ping the gateway of 192.168.192.0/20 at 192.168.192.1 as well as all the containers which are connected to said docker network. This works fine now. What I have not been able to achieve is to connect to one of those containers ports.
So for exapmle I have a teamcity container running which is connected to the docker network. I can ping it, but I can not access it through the port I defined for it, let's say port 8080. I want to forward that port for my openVPN client and I don't know how. That's the problem which still persists.