implicit FTPS reverse proxy using caddy-l4 #424
mati1210
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
i've been enjoying using copyparty, however some programs i'd like to use it with (vlc mostly) don't support webdav, so my next best option is FTPS. caddy handles HTTPS encryption for me, and to avoid copying certificates around the file system1 i've figured out a way to use it as a (implicit only2) FTPS reverse proxy, and i figured i might as well share it
assuming you're using the systemd service, installed from a package manager, and have the caddy-l4 extension installed:
Step 1: set up a network namespace for copyparty
copyparty won't be able to bind to the ports required for ftp if caddy has already bound to them, so we'll have to run copyparty in a separate network namespace. as a bonus this will disable internet access to copyparty, if you're particularly paranoid
this script will add a
copyparty-netns.service
that runs beforecopyparty.service
and sets up a new network namespace for copyparty to run inStep 2: caddy configuration
unfortunately caddy-l4 as of writing does not support dynamic ports required for ftp passive, so you'll have to do it in a verbose way
Step 3: copyparty configuration
set copyparty to run on your namespace ip address along to whatever else you're using, and ftp/ftp-pr according to the ports set on the caddy configuration
Step 4: pretending to be a FTPS server
this still won't work, because FTPS requires some commands that the regular FTP handler doesn't recognize, so we'll have to patch it a bit to make it work
this script adds it as a separate file (
copyparty-ftpspatch
), and setscopyparty.service
to run it as defaultFootnotes
also because the ftps handler wasnt working out for me and also because it was fun ↩
i couldn't figure out how to make it match against a packet with empty payload without writing a custom matcher and i have never used go. one day maybe ↩
Beta Was this translation helpful? Give feedback.
All reactions