Accessing a database on a Windows server via VPN from nodejs running on Linux

I seemed to be lost in my current project. From the linux machine (Ubuntu server), running the code in nodejs, I have to connect to the Windows server via VPN and gain access to the mySQL server running on it.

About the VPN server I only know this Windows, and I can easily connect to it using the VPN connector on another Windows machine, I do not have access to this machine or its parameters.

All I have is the IP of both the VPN and the database server inside that VPN, as well as the username / password for the VPN and the database. I also know that VPN uses ms-chap v2 .

I am trying to use openvpn as follows:

 sudo openvpn --remote vpnIP --dev tun --ifconfig 127.0.0.1 dbIP 

This does not display an error message, but never asks for a VPN username and password

And what should I do with nodejs to access the database after creating the VPN?

Like I said, I really lost it! Any advice would be appreciated!

+5
source share
2 answers

Unless otherwise specified, a Windows-based VPN almost always uses PPTP . You cannot connect to OpenVPN. You must use the PPTP client.

Ubuntu pptp-linux package. There is a detailed explanation of how to configure it here .

In a nutshell (I suppose you don't have a GUI on the server), you can create a tunnel with:

 pptpsetup --create my_tunnel --server <server_address> --username <username> --password '<password>' --encrypt 

Configuration files will be created in /etc/ppp . Then you can connect (in debug mode) with:

 pon my_tunnel debug dump logfd 2 nodetach 

or just (after his work):

 pon my_tunnel 

and stop it:

 poff my_tunnel 

If the server is a gateway, you may need to add a route, for example:

 ip route add 192.168.1.0/24 dev ppp0 
+2
source

You may need Network Manager with the network-manager-pptp plugin, also see this wiki https://help.ubuntu.com/community/VPNClient#PPTP

+1
source

Source: https://habr.com/ru/post/1265641/


All Articles