📡 TCP/UDP port redirector

Overview

rinetd, by Thomas Boutell and Sam Hocevar. Released under the terms of the GNU General Public License, version 2 or later.

This program is used to efficiently redirect connections from one IP address/port combination to another. It is useful when operating virtual servers, firewalls and the like.

To build under Unix, run ./bootstrap to create the configuration files, then ./configure to create the build files, and then type make to build rinetd. To install, type make install as root.

For documentation run make install, then type man rinetd for details. Or, read index.html in your browser.

Issues
  • Does it support ipv6?

    Does it support ipv6?

    I saw the 0.71 version mentioned to support IPv6, but I can't connect my vps with IPv6, the vps has IPv6 & IPv4, maybe it does not support IPv6 & IPv4 machine? Or is my configuration wrong? These are the configurations I have used:

    1. 0.0.0.0 12345/tcp domain.name.com 23456/tcp 0.0.0.0 12345/udp domain.name.com 23456/udp
    2. 0.0.0.0 12345/tcp domain.name.com 23456/tcp 0.0.0.0 12345/udp domain.name.com 23456/udp ::1 12345/tcp domain.name.com 23456/tcp ::1 12345/udp domain.name.com 23456/udp
    3. ::1 12345/tcp domain.name.com 23456/tcp ::1 12345/udp domain.name.com 23456/udp
    opened by notaganin 3
  • Mark a listening socket as bad if we can't accept() from it

    Mark a listening socket as bad if we can't accept() from it

    Hi,

    My logs were full of

    accept(0, 0x7fffb997d7d0, [16])         = -1 ENOTSOCK (Socket operation on non-socket)
    sendto(38, "<27>Feb  3 14:34:15 rinetd[9382]"..., 75, MSG_NOSIGNAL, NULL, 0) = 75
    

    where rinetd was trying to accept on fd 0, which wasn't a listening socket. Other code paths set the fd to INVALID_SOCKET on error, so I've added the same line to handleAccept.

    I can confirm this fixed my issue in production.

    opened by insom 3
  • Does not produce a error if config file is not found

    Does not produce a error if config file is not found

    The program does not produce any output if the config file is absent / not found. Is this supposed to happen?

    UPDATE: hm... I can't see any error for example when a host name in the config file cannot be resolved, it's as if stderr does not exist at all... I wonder what I'm doing wrong...

    opened by andrewsav-bt 2
  • crash on MingW/x64

    crash on MingW/x64

    When I built the software using MinGW (x64), I've got a crash in the function selectPass. After watching the behaviour of select() on windows, I've got this patch to make it work:

    @@ -572,9 +573,15 @@ static ConnectionInfo *findAvailableConnection(void)
     static void selectPass(void) {
    
        int const fdSetCount = maxfd / FD_SETSIZE + 1;
    +#ifndef _WIN32
     #      define FD_ZERO_EXT(ar) for (int i = 0; i < fdSetCount; ++i) { FD_ZERO(&(ar)[i]); }
     #      define FD_SET_EXT(fd, ar) FD_SET((fd) % FD_SETSIZE, &(ar)[(fd) / FD_SETSIZE])
     #      define FD_ISSET_EXT(fd, ar) FD_ISSET((fd) % FD_SETSIZE, &(ar)[(fd) / FD_SETSIZE])
    +#else
    +#      define FD_ZERO_EXT(ar) FD_ZERO(ar);
    +#      define FD_SET_EXT(fd, ar) FD_SET(fd, ar)
    +#      define FD_ISSET_EXT(fd, ar) FD_ISSET(fd, ar)
    +#endif
    
        fd_set readfds[fdSetCount], writefds[fdSetCount];
        FD_ZERO_EXT(readfds);
    
    bug 
    opened by ppanhoto78 2
  • Build under Centos 6.7 i386 Centos 7 x64

    Build under Centos 6.7 i386 Centos 7 x64

    Hello, Build under Ubuntu is fine. But i get a error building under Centos 32 and 64. glibc 2.12 Centos 6.7 and Centos 7 x64 What to do?

    make

    make all-am make[1]: Entering directory /usr/src/rinetd-master' gcc -DHAVE_CONFIG_H -I. -std=c99 -D_XOPEN_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wwrite-strings -I. -g -O2 -MT rinetd-rinetd.o -MD -MP -MF .deps/rinetd-rinetd.Tpo -c -o rinetd-rinetd.otest -f 'rinetd.c' || echo './'`rinetd.c rinetd.c: In function ‘getAddress’: rinetd.c:1152: error: ‘h_errno’ undeclared (first use in this function) rinetd.c:1152: error: (Each undeclared identifier is reported only once rinetd.c:1152: error: for each function it appears in.) rinetd.c:1154: error: ‘HOST_NOT_FOUND’ undeclared (first use in this function) rinetd.c:1157: error: ‘NO_ADDRESS’ undeclared (first use in this function) rinetd.c:1160: error: ‘NO_RECOVERY’ undeclared (first use in this function) rinetd.c:1163: error: ‘TRY_AGAIN’ undeclared (first use in this function) rinetd.c:1172: error: ‘struct hostent’ has no member named ‘h_addr’ make[1]: *** [rinetd-rinetd.o] Error 1

    Thank you,

    bug 
    opened by WuvorWenda 2
  • rinetd 0.71 build issue

    rinetd 0.71 build issue

    👋 trying to build the latest release, but run into some build issue. The error log is as below:

    build failure
    rinetd.c:799:19: error: use of undeclared identifier 'NI_MAXHOST'
            char addressText[NI_MAXHOST];
                             ^
    rinetd.c:924:19: error: use of undeclared identifier 'NI_MAXHOST'
            char addressText[NI_MAXHOST] = { '?' };
                             ^
    2 errors generated.
    make[2]: *** [___rinetd-rinetd.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    mv -f .deps/___rinetd-match.Tpo .deps/___rinetd-match.Po
    mv -f .deps/___rinetd-parse.Tpo .deps/___rinetd-parse.Po
    make[1]: *** [install] Error 2
    make: *** [install-recursive] Error 1
    

    Full build log is in here, https://github.com/Homebrew/homebrew-core/runs/1907745906 relates to https://github.com/Homebrew/homebrew-core/pull/71237

    opened by chenrui333 1
  • realloc size error

    realloc size error

    before: allRules = (Rule *) realloc(allRules, sizeof(Rule *) * (allRulesCount + 1)); Rule * is pointer, size: int

    after: allRules = (Rule *) realloc(allRules, sizeof(Rule) * (allRulesCount + 1));

    bug 
    opened by shiftwinting 1
  • Change _DEFAULT_SOURCE for _GNU_SOURCE to enable building on glibc 2.15

    Change _DEFAULT_SOURCE for _GNU_SOURCE to enable building on glibc 2.15

    Hi,

    As per #2, older glibc versions also require _GNU_SOURCE (which implies _DEFAULT_SOURCE) to build. This allowed me to build on Ubuntu 12.04 (glibc 2.15).

    opened by insom 1
  • required file 'src/Makefile.in' not found

    required file 'src/Makefile.in' not found

    $ ./bootstrap
    + test no = yes
    + aclocal -I .auto -I .
    + autoconf
    + test yes = yes
    + autoheader
    + test yes = yes
    + automake --foreign --add-missing --copy
    configure.ac:7: installing '.auto/install-sh'
    configure.ac:7: installing '.auto/missing'
    configure.ac:37: error: required file 'src/Makefile.in' not found
    
    opened by cdoco 0
  • rinetd ignores FD_SETSIZE limit

    rinetd ignores FD_SETSIZE limit

    A simple way to crash rinetd is through the following configuration file:

    for x in `seq 8000 9024`; do echo 0 $x 0 $(($x + 1)); done > conf-fdset
    rinetd -f -c conf-fdset
    

    Even if the server takes care not to create too many rules, this can be abused by clients.

    security 
    opened by samhocevar 0
  • Change port for one IP with rinetd?-> Cannot assign requested address.

    Change port for one IP with rinetd?-> Cannot assign requested address.

    Hi,

    I'd like to change the port for outgoing traffic to one specific external IP. I use this configurationline:

    12.34.56.78 443 12.34.56.78 12345

    But rinetd tells me:

    rinetd error: couldn't bind to address 12.34.56.78 port 443 (Cannot assign requested address)

    If I use

    127.0.0.1 443 12.34.56.78 12345

    it works perfectly. Does rinetd doesn't work for external IPs?

    Background: I'd like to make my collabora server to speak with my nextcloud server (12.34.56.78) that doesn' listen on 443 but due to security reasons on port 12345. Because my collabora server shall connect to other nextcloud servers on the standard 443, I can't change default outgouing port of collabora server.

    opened by ethpi 0
  • How do I configure rinetd.conf to allow multiple IP?

    How do I configure rinetd.conf to allow multiple IP?

    How do I configure rinetd.conf to allow multiple IP, to have one IP address per line like this?

    allow 14.49.36.1
    allow 14.46.200.1
    0.0.0.0 24057 127.0.0.1 6120
    

    But after testing, I found that this configuration is not working, it is only valid for the last line of allow.

    opened by fivetime 3
  • Never re-resolves hosts

    Never re-resolves hosts

    As reported in Debian bug #173801:

    rinetd should really resolve IP addresses on each connection instead of
    only once during the config read.  It's not a short-lived process and
    having to restart it any time the IP address of a machine changes is
    bad.
    
    enhancement help wanted 
    opened by samhocevar 0
Releases(v0.73)
Owner
Sam Hocevar
Developer or past developer for Debian, VLC, GNOME, libcaca, zzuf, wincompose, also Remember Me, Life Is Strange, Vampyr.
Sam Hocevar
A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols.

evpp Introduction 中文说明 evpp is a modern C++ network library for developing high performance network services using TCP/UDP/HTTP protocols. evpp provid

Qihoo 360 3k Jun 27, 2022
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 8.5k Jun 29, 2022
Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

null 1 Jun 22, 2022
Winpcap-based network packet capture tool, support TLS (part), UDP, ICMP, TCP, ARP, DNS and other protocol analysis, interface reference wireshark.

Winpcap-based network packet capture tool, support TLS (part), UDP, ICMP, TCP, ARP, DNS and other protocol analysis, interface reference wireshark.

null 35 Jun 25, 2022
Provide translation, currency conversion, and voting services. First using telnet you create a connection to a TCP socket, then the server connects to 3 UDP sockets hosted on other servers to do tasks.

to run micro servers g++ translator.cpp -o translator ./translator <port 1> g++ voting.cpp -o voting ./voting <port 2> g++ currency_converter.cpp -o c

Jacob Artuso 1 Oct 29, 2021
A TCP / UDP program supporting multiple test scenarios

sock_test A TCP / UDP program supporting multiple test scenarios The current communication protocol only supports UDP. TCP will be supported later. Ho

null 4 Mar 8, 2022
Wrapper for linux TCP/UDP/unix/USB socket connections

Socket Connection wrapper shared library Shared library that realize sockets connections and could transfer data-packages. Navigation Navigation Insta

Dmitry Golgovsky 7 Dec 21, 2021
Portable, single-file, protocol-agnostic TCP and UDP socket wrapper, primarily for game networking

Documentation This is a header-only library, as such most of its functional documentation is contained within the "header section" of the source code

null 62 Mar 23, 2022
Port-Fin(port finder) is a tool which scans for open and closed port on a website/host.

Port-Fin(port finder) is a tool which scans for open and closed port on a website/host. This tool scans the state of the well known/common ports.

AnonabdulJ 4 Dec 14, 2021
A Tcp/Ip stack implementation on top of Solarflare ef_vi, and a C++ headers only framework for tcp multiplexing client/server.

Efvitcp Efvitcp is a tcp library using Solarflare ef_vi interface on linux, and also a tcp multiplexing framework for both C++ client and server progr

Meng Rao 17 Jun 9, 2022
an easy implementation of a multi-process tcp server and a multi-thread tcp client

一个TCP多进程服务器-多线程客户端的简单实现。 客户端类似Apache ab的测试功能,能够通过向某一个ip端口发送指定并发量和总数量的tcp短连接;服务端处理tcp短连接,每来一条消息就打印一条log。 使用cmake编译,建议在vscode里编译,或者命令行 # 终端进入目录 mkdir bu

adin 1 Nov 28, 2021
TCP Port Redirection Utility

Overview PortBender is a TCP port redirection utility that allows a red team operator to redirect inbound traffic destined for one TCP port (e.g., 445

Praetorian 386 Jun 27, 2022
TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

Robert David Graham 19.3k Jul 5, 2022
TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

MASSCAN-NG: Mass IP port scanner This is an Internet-scale port scanner. It can scan the entire Internet in under 5 minutes, transmitting 10 million p

BI.ZONE 42 Jun 25, 2022
ENet reliable UDP networking library

Please visit the ENet homepage at http://enet.bespin.org for installation and usage instructions. If you obtained this package from github, the quick

Lee Salzman 2.1k Jul 3, 2022
QUIC, a multiplexed stream transport over UDP

QUIC, a multiplexed stream transport over UDP QUIC is an experimental protocol aimed at reducing web latency over that of TCP. On the surface, QUIC is

Devsisters Corp. 1.6k Jun 20, 2022
Reliable & unreliable messages over UDP. Robust message fragmentation & reassembly. P2P networking / NAT traversal. Encryption.

GameNetworkingSockets GameNetworkingSockets is a basic transport layer for games. The features are: Connection-oriented API (like TCP) ... but message

Valve Software 6.1k Jul 2, 2022
Simple local P2P chat on UDP sockets

Local P2P Chat This is a fully decentralized chat. To communicate, simply run it on computers in a single local network (using one port). All messages

Anton Khalitov 15 Apr 13, 2022
(Test assignment) Transfer files over the network using a homegrown UDP protocol

Требования Linux x86_64 gcc >= 4.9 (C++11) Сборка $ make Запуск $ make run -j5 -j5 позволяет серверу и четырём клиентам запуститься одновременно. В

Alexander Batischev 2 Dec 18, 2021