moesocks: A functional firewall killer

[ apache, network, program ] [ Propose Tags ]

A SOCKS5 proxy using the client / server architecture.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6, 0.1.0.7, 0.1.0.8, 0.1.0.9, 0.1.0.10, 0.1.0.11, 0.1.0.12, 0.1.0.13, 0.1.0.14, 0.1.0.15, 0.1.0.16, 0.1.0.17, 0.1.0.18, 0.1.0.19, 0.1.0.20, 0.1.0.21, 0.1.0.22, 0.1.0.23, 0.1.0.24, 0.1.0.25, 0.1.0.26, 0.1.0.27, 0.1.1.0, 0.1.1.10, 0.1.1.20, 0.1.1.30, 0.1.1.31, 0.1.1.32, 0.1.2.0, 0.1.2.10, 0.1.2.20, 0.1.2.30, 1.0.0.0, 1.0.0.1, 1.0.0.10, 1.0.0.20, 1.0.0.30, 1.0.0.40, 1.0.0.41, 1.0.0.42, 1.0.0.43, 1.0.0.44, 1.0.1.0
Change log CHANGELOG.md
Dependencies aeson, async, attoparsec, base (>4 && <=5), binary, bytestring, containers, cryptohash, hslogger, HsOpenSSL, iproute, lens, lens-aeson, mtl, network, optparse-applicative, random, stm, strict, text, time, transformers, unordered-containers [details]
License Apache-2.0
Copyright Copyright (C) 2015 Jinjing Wang
Author Jinjing Wang
Maintainer Jinjing Wang <nfjinjing@gmail.com>
Category Network
Home page https://github.com/nfjinjing/moesocks
Source repo head: git clone git://github.com/nfjinjing/moesocks.git
Uploaded by JinjingWang at 2016-01-26T12:31:13Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables moesocks
Downloads 30853 total (140 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-28 [all 3 reports]

Readme for moesocks-1.0.0.41

[back to package description]

MoeSocks

A SOCKS5 proxy using the client / server architecture.

MoeSocks is compatible with ss at the protocal and most of the configuration level.

Installation

From binary

Install Nix

curl https://nixos.org/nix/install | sh 

Install moesocks

nix-env -i -A nixpkgs.haskellPackages.moesocks

Run

moesocks 

From source

Install GHC and cabal-install

Download moesocks

git clone https://github.com/nfjinjing/moesocks

Sandbox!

cd moesocks
cabal sandbox init

Install

cabal install

Run

.cabal-sandbox/bin/moesocks

Usage

  • Start a remote node outside a firewall:

      moesocks -r remote -k birthday!
    
  • Start a local node inside a firewall:

      moesocks -s $REMOTE_IP -k birthday!
    
  • Now you have a SOCKS5 proxy running inside a firewall on port 1080.

  • See more options:

      moesocks --help
    
  • Not tested in OSX, but it should just work.

System wide proxy for NixOS

  • Add moesocks.nix and moesocks-bento.nix to /etc/nixos

  • Modify the following and add it to configuration.nix:

      imports = [ ./moesocks-bento.nix ];
    
      networking.moesocks-bento =
        {
          enable = true;
          remote = "my-server";
          remotePort = 8388;
          password = "birthday!";
        };
    

Features

  • SOCKS5 proxy service
  • TCP port forwarding
  • UDP port forwarding, for example to tunnel DNS request: -U 5300:8.8.8.8:53
  • SOCKS5 service on local can be turned off
  • Understand ss' configuration file

Know issues

  • UDP over SOCKS5 is not implemented.
  • TCP bind over SOCKS5 is not implemented
  • More then 2 times slower then the original Python implementation (measured at 20M/s vs 43M/s on an Intel P8800, using the AES-256-CFB method, in software AES).
  • Currently only works on Unix.

TCP Fast Open (TFO)

Benefit of using TFO

TFO can bypass the TCP three-way handshake in successive connections, thus reducing latency.

Enable TFO in your OS runtime.

On Linux 3.7+, to check the availability of TFO:

cat /proc/sys/net/ipv4/tcp_fastopen

On Linux 3.7+, to enable TFO (as root):

echo 3 > /proc/sys/net/ipv4/tcp_fastopen

Enable TFO in MoeSocks

TFO can be turned on by adding a "fastOpen":true field in config.json or adding a --fast-open argument in the command line.

Verify

Use tcpdump on the remotePort, check for that SYN should start to carry payload. An example command is:

tcpdump port 8388 -i any -X -v

Credits

  • ss greatly inspired MoeSocks.
  • ss-haskell another implementation of ss in Haskell, also greatly inspired MoeSocks. Much of the understanding of the internal of ss was gained by reading ss-haskell.

License

Copyright 2015 Jinjing Wang

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.