GithubHelp home page GithubHelp logo

node-pptp's Introduction

node-pptp

Simple PPTP VPN server I started working on for a project, but ultimately abandoned. Maybe this will be useful for someone.

Features:

  • No authentication; credentials are not requested.
  • No encryption.
  • IPv4 only.
  • Unreliable handshake. No retransmission is implemented so if there is a single missed packet the handshake will timeout.
  • After established, though, the connection is fairly reliable.
  • Only tested with, and probably only works with, OS X clients.
  • Runs on OS X & Linux

Note that the VPN does not create a network device on the server for incoming clients. Instead the client is simply a NodeJS object that you can send and receive IPv4 frames to directly. If you want to create a network device for your client (say for IP forwarding via iptables MASQ) you can use tun/tap fairly easily. All clients are assigned a hardcoded IP address of 10.0.1.2 and expect a gateway of 10.0.1.1, though these selections are arbitrary.

Also note that connecting to a VPN server on localhost seems to be broken on OS X. If you connect through 127.0.0.1/localhost the handshake will fail completely. If you connect through another IP address the VPN connection is successfully created but the kernel doesn't seem to like routing GRE frames from a loopback device. I tried very hard to work around this and it seems like a problem inherent to the Darwin kernel; this was the main reason I abandoned the project. I guess there's not really many reasons for anyone to connect to a PPTP server on localhost.

Included in the repository is a VPN server which will send ping responses from any host you ping. All other frames are ignored.

Setup

Server

git clone https://github.com/laverdet/node-pptp.git
cd node-pptp
npm install # installs raw-socket & pcap npm modules; required for VPN
sudo node example # root is required

Client

  • OS X PPTP VPN
  • Account Name: anything
    • Encryption: None
    • Authentication Settings...
      • Password: anything
marcel@marcel ~ $ ping 1.2.3.4
PING 1.2.3.4 (1.2.3.4): 56 data bytes
64 bytes from 1.2.3.4: icmp_seq=0 ttl=64 time=71.156 ms
64 bytes from 1.2.3.4: icmp_seq=1 ttl=64 time=72.612 ms
64 bytes from 1.2.3.4: icmp_seq=2 ttl=64 time=72.775 ms

node-pptp's People

Contributors

laverdet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-pptp's Issues

Thanks for your project. This is not issues, I want your help.

Hi Laverdet,

Thank you for your great project.
Your project is very helpfully for my coding.

I am doing a project that is make a virtual PPTP server at local.
The virtual PPTP server will forward all socket to remote PPTP server.

I make two listening as TCP 1723 & the Gre 47.
But it looks can't make pptp connect.

Could you help me?

Peter

----------------------------------- my source ---------------------------
`
import * as Net from 'net'
const raw = require ('raw-socket')
const serverIp = '159.203.11.232'
const netServer = Net.createServer ( socket => {
const client = socket.remoteAddress.split(':')[3]
const netClient = Net.connect ( 1723, serverIp )

socket.on ( 'data', ( data:Buffer) => {

    netClient.write ( data )
    console.log ('socket', data.length )
})

socket.on ( 'close', () => {
    netClient.destroy()
})

netClient.on ( 'data', ( data: Buffer) => {
    socket.write (data)
    console.log ('netClient', data.length )
})
console.log ('connect', client)

const greSocket = raw.createSocket ({
    protocol: 47,
})

greSocket.on ( "message", ( buffer: Buffer, source ) => {
    const tarage = source === serverIp ? client : serverIp
    greSocket.send ( buffer, 0, buffer.length, tarage, ( err, bytes ) => {
        if ( err )
            console.log ('greSocket.sen error', err )
        console.log ('greSocket.send success! bytes = ', bytes, 'source =',source, 'tarage=',tarage)
    })
});

})

netServer.listen ({
port: 1723,
exclusive: true
})`

There is a workaround to connect to localhost on mac

Thanks for your project, which lead me a way to answer :)

I found a workaround to connect to localhost on mac system. We can connect to localhost via LAN ip, but when connecting to the LAN ip, GRE packet is sent via loopback device. A listening on loopback device can capture the PPTP/GRE packet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.