Code Monkey home page Code Monkey logo

fd-proxy's Introduction

fd-proxy

Name

fd-proxy - glue for making a tcp proxy, using ucspi-tcp tools

Synopsis

fd-proxy

Description

fd-proxy is a very small program, written in C. Its purpose is to connect the I/Os of a tcpserver and tcpclient pair, from the ucspi-tcp suite, in order to implement a TCP proxy. Setting up such a proxy can be done in a singe line:

tcpserver -v 127.0.0.1 8000 tcpclient -v 127.0.0.1 22 ./fd-proxy 2>&1 |tai64n |tai64nlocal

The above proxy will relay all TCP traffic between port 22 and port 8000 on localhost. So, as a simple test, you can run:

ssh -p 8000 localhost

The advantage of using the tcpserver and tcpclient programs is that all the related ucspi-tcp programs can be used in combination with tcpserver and tcpclient. One can for example define access restrictions with tcprules, define what needs to get looked up via DNS, etc.

The fd-proxy, tcpserver and tcpclient combination supply, even a non-privileged user with a simple, fast and light-weight way to selectively forward TCP traffic.

At the moment, logging of the data, flowing between server and client is not possible.

Environment

fd-proxy honors no environment variables.

Return Values

On success, 0 is returned. On error, errno is returned, as set by the POSIX calls: open, read, write or select.

Also see

ucspi-tcp, tcpserver, tcpclient, tcprules

TODO

  • Make it possible to override the read buffer size with an environment variable.
  • Let fd-proxy take a single cdb-style file name as an argument. This file shall exist and either be empty (eg. /dev/null), or contain cdb-style rules. The rules can then be used to set up a proxy filter, eg: - 'ls:regexp' will log all responses that match the regexp, coming from the server-side. - 'lc:regexp' will log all requests that match the regexp, coming from the client-side. - 'is:regexp' ignore data that match the regexp, coming from the server. - 'ts:regexp' terminate the connection to a server that receives data that match the regexp.
  • Use the tcpserver and tcpclient environment variables in the logging, so that it is clear from where data comes, and where data goes to.
  • Build at least a Debian package for this.

Alternatives

The only alternative that I could find for fd-proxy, is redirfd. In order to get redirfd working, follow the instructions in this post. You'll need to install execline as well.

Copyright

Copyright (C) 2014 Pieter du Preez [email protected]

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

fd-proxy's People

Contributors

wingunder avatar

Watchers

 avatar  avatar

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.