Bug 289964 - [new port] net/rdp2tcp: tunneling tool on top of remote desktop protocol (RDP)
Summary: [new port] net/rdp2tcp: tunneling tool on top of remote desktop protocol (RDP)
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL: https://github.com/V-E-O/rdp2tcp
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-02 16:37 UTC by Ivan Rozhuk
Modified: 2025-11-16 21:58 UTC (History)
2 users (show)

See Also:


Attachments
patch (3.64 KB, patch)
2025-10-02 16:37 UTC, Ivan Rozhuk
no flags Details | Diff
patch (3.68 KB, patch)
2025-10-03 23:53 UTC, Ivan Rozhuk
no flags Details | Diff
patch (3.69 KB, patch)
2025-10-04 01:00 UTC, Ivan Rozhuk
no flags Details | Diff
patch (3.68 KB, patch)
2025-10-04 01:04 UTC, Ivan Rozhuk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2025-10-02 16:37:53 UTC
Created attachment 264243 [details]
patch

rdp2tcp is a tunneling tool on top of remote desktop protocol (RDP).
It uses RDP virtual channel capabilities to multiplex several ports
forwarding over an already established rdesktop or FreeRDP session.

Available features:
 - tcp port forwarding
 - reverse tcp port forwarding
 - process stdin/out forwarding
 - SOCKS5 minimal support

The code is splitted into 2 parts:
 - the client running on the rdesktop or FreeRDP client side
 - the server running on the Terminal Server side

This port only contains client and tools.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-03 12:15:48 UTC
Have you tested it? Does it work?
It doesn't even run with FreeRDP3.
It does run with FreeRDP2, but I couldn't get port forwarding working.
Comment 2 Ivan Rozhuk 2025-10-03 15:08:04 UTC
(In reply to Vladimir Druzenko from comment #1)
Not yet.
I plan to do it in next few days.
Comment 3 Ivan Rozhuk 2025-10-03 18:01:11 UTC
At least current freerdp run it:

97621  -  S          9:18.05 |-- /usr/local/bin/Thunar --gapplication-service (thunar)
83900  -  I          0:01.13 | `-- xfreerdp /bpp:24 -wallpaper +decorations +window-drag +aero +clipboard +aero +async-input +async-update /rdp2tcp:/usr/local/bin/rdp2tcp
84034  -  I          0:00.01 |   `-- /usr/local/bin/rdp2tcp
Comment 4 Ivan Rozhuk 2025-10-03 22:02:58 UTC
(In reply to Vladimir Druzenko from comment #1)

You was right, FreeRDP3 at FBSD is build without rdp2tcp support:

[00:44:56:783] [58860:000bce96] [ERROR][com.winpr.library] - [LoadLibraryA]: failed with Cannot open "/usr/local/lib/freerdp3/librdp2tcp-client.so"
[00:44:56:783] [58860:000bce96] [WARN][com.freerdp.addin] - [freerdp_load_channel_addin_entry]: Failed to load channel rdp2tcp [(null)]
[00:44:56:783] [58860:000bce96] [ERROR][com.winpr.library] - [LoadLibraryA]: failed with Cannot open "/usr/local/lib/freerdp3/librdp2tcp-client.so"
[00:44:56:783] [58860:000bce96] [WARN][com.freerdp.addin] - [freerdp_load_channel_addin_entry]: Failed to load channel rdp2tcp [(null)]
[00:44:56:783] [58860:000bce96] [ERROR][com.freerdp.client.common] - [freerdp_client_load_channels]: Failed to load addins [00000000]


To fix it:
CMAKE_ON+=	CHANNEL_RDP2TCP
and rebuild + reinstall freerdp3.

 9411 40  Is         0:00.43 | |     |-- csh
84354 40  I+         0:00.15 | |     | `-- xfreerdp3 /bpp:24 +window-drag +clipboard /size:1280x960 /sec:rdp /cert-ignore /rdp2tcp:/usr/local/bin/rdp2tcp
84489 40  S+         0:00.02 | |     |   `-- /usr/local/bin/rdp2tcp

Probably some other channels also disabled by default in FreeRDP CMake files.

Console on win server and on FBSD shows that both sides connected via RDP channel.
Comment 5 Ivan Rozhuk 2025-10-03 23:53:28 UTC
Created attachment 264277 [details]
patch

Add shebang fixes.
Comment 6 Ivan Rozhuk 2025-10-03 23:56:32 UTC
(In reply to Vladimir Druzenko from comment #1)

Just finish tests: it work with freerdp3 after change that was in prev messages.
Looks like with freerdp 2 also work.

For tests I do compile windows server rdp2tcp part from same sources.
Also I do patch FreeRDP3 to allow to set custom channel name.
https://github.com/FreeRDP/FreeRDP/pull/11916
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-04 00:18:10 UTC
Suggested Makefile (tabs are broken due to copy&paste from console):
PORTNAME=       rdp2tcp
DISTVERSION=    0.1.0.20250804
CATEGORIES=     net comms

PATCH_SITES=    https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
PATCHFILES+=    1e45654b6e23633a9c648d6b0c8bc5b133a0504b.patch:-p1 # https://github.com/V-E-O/rdp2tcp/pull/14

MAINTAINER=     rozhuk.im@gmail.com
COMMENT=        Open tcp tunnel through remote desktop connection (client)
WWW=            https://github.com/V-E-O/rdp2tcp/

LICENSE=        GPLv3

USES=           shebangfix
USE_GITHUB=     yes
GH_ACCOUNT=     V-E-O
GH_TAGNAME=     0a54991e669e8636b129a60e9ff5baa2fc91d1af
SHEBANG_FILES=  ${TOOLS_PLIST_FILES:S|bin|tools|}

CFLAGS+=        -I${WRKSRC}/common

PLIST_FILES=    bin/rdp2tcp

OPTIONS_DEFINE=         TOOLS
OPTIONS_DEFAULT=        TOOLS
OPTIONS_SUB=            yes

TOOLS_DESC=             Install rdp2tcp.py and rdpupload
TOOLS_USES=             python:run
TOOLS_PLIST_FILES=      bin/rdp2tcp.py \
                        bin/rdpupload

post-patch:
        @${REINPLACE_CMD} \
                -e 's|CC=.*||g' \
                -e 's|CFLAGS=.*||g' \
                -e 's|LDFLAGS=.*||g' \
                ${WRKSRC}/client/Makefile \
                ${WRKSRC}/common/Makefile

do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/client/rdp2tcp ${STAGEDIR}${PREFIX}/bin
        ${INSTALL_SCRIPT} ${WRKSRC}/tools/rdp2tcp.py \
                          ${WRKSRC}/tools/rdpupload ${STAGEDIR}${PREFIX}/bin

.include <bsd.port.mk>
Comment 8 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-04 00:19:13 UTC
(In reply to Ivan Rozhuk from comment #6)
I can add this patch to net/freerdp3 (I'm the maintainer). Ok?
Comment 9 Ivan Rozhuk 2025-10-04 00:52:40 UTC
Thanks, but why 0.1.0?

Feel free to do what you want, since this is opensource :)
Comment 10 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-04 00:53:56 UTC
(In reply to Ivan Rozhuk from comment #9)
It's version 0.1: https://github.com/V-E-O/rdp2tcp/blob/master/ChangeLog
Comment 12 Ivan Rozhuk 2025-10-04 01:04:57 UTC
Created attachment 264279 [details]
patch

fix double uses=shebang
Comment 13 Vladimir Druzenko freebsd_committer freebsd_triage 2025-10-15 14:12:18 UTC
I read this issue: https://github.com/V-E-O/rdp2tcp/issues/15
Is this software broken?
Comment 14 Ivan Rozhuk 2025-10-15 14:24:20 UTC
(In reply to Vladimir Druzenko from comment #13)
It s not totally broken, on active download it may got out of internal sync and disconnect channel.
Probably for upload or small amount of data it works ok.

I use it to proxy https and git.
git pull with small change pack - is ok.
https site - ok for some time.
On error - rdp reconnect required to continue use tunnels.

IMHO it was PoC, and it requires more time make it more stable.
Good thing here is that FreeRDP have no implementation specific code for rdp2tcp app, I mean it use stdin+stdout and any app can be used on client side.
Server side uses MS API - every one can write it own client and server part and use FreeRDP without modification.
Comment 15 commit-hook freebsd_committer freebsd_triage 2025-11-03 02:45:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8c88dbcfe5236b0c43c25b860347084cd7af2994

commit 8c88dbcfe5236b0c43c25b860347084cd7af2994
Author:     Ivan Rozhuk <rozhuk.im@gmail.com>
AuthorDate: 2025-11-03 02:42:56 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-11-03 02:42:56 +0000

    net/rdp2tcp: New port: Tunneling tool on top of RDP

    It uses RDP virtual channel capabilities to multiplex several ports
    forwarding over an already established rdesktop or FreeRDP session.

    Available features:
     - tcp port forwarding
     - reverse tcp port forwarding
     - process stdin/out forwarding
     - SOCKS5 minimal support

    The code is splitted into 2 parts:
     - the client running on the rdesktop or FreeRDP client side
     - the server running on the Terminal Server side

    This port only contains client and tools.

    https://github.com/V-E-O/rdp2tcp

    PR:     289964

 net/Makefile                |  1 +
 net/rdp2tcp/Makefile (new)  | 47 +++++++++++++++++++++++++++++++++++++++++++++
 net/rdp2tcp/distinfo (new)  |  5 +++++
 net/rdp2tcp/pkg-descr (new) | 15 +++++++++++++++
 4 files changed, 68 insertions(+)
Comment 16 Vladimir Druzenko freebsd_committer freebsd_triage 2025-11-03 02:47:08 UTC
(In reply to Ivan Rozhuk from comment #6)
Check please your pull request to FreeRDP.
Comment 17 Vladimir Druzenko freebsd_committer freebsd_triage 2025-11-16 21:58:36 UTC
Friendly ping.