1

localexpose

This commit is contained in:
Evan Pratten 2020-12-19 11:22:25 -05:00
parent 19f04c1379
commit 059b285ee7
No known key found for this signature in database
GPG Key ID: 93AC7B3D071356D3
2 changed files with 13 additions and 0 deletions

View File

@ -10,12 +10,14 @@
"Optifine",
"Rclone",
"Rosenfeld",
"Socat",
"Soundpack",
"Starlark",
"buildscript",
"clicky",
"keycaps",
"libc",
"manpages",
"microcontrollers",
"modpack",
"ortholinear",

View File

@ -16,3 +16,14 @@ For the past few years, I have been using a self-hosted VPN to bring all my pers
Of course, I could actually grab a RaspberryPI and turn it into a real network gateway for the VPN, allowing me to access anything I want as long as it was attached to that PI's network interface. This setup was not entirely practical though, as I wanted the ability to pull multiple devices from multiple networks into my VPN.
Doing a quick search for solutions around the internet lead me to find a bunch of long and visually complex [`iptables`](https://linux.die.net/man/8/iptables) commands I could run, but I wanted something much simpler. Further searching lead me to find [`socat`](https://linux.die.net/man/1/socat).
> **Socat** is a command line based utility that establishes two bidirectional byte streams and transfers data between them. Because the streams can be constructed from a large set of different types of data sinks and sources (see address types), and because lots of address options may be applied to the streams, socat can be used for many different purposes. [manpages socat(1)]
As stated in the Linux manpages, socat is essentially a port-forwarding utility. Using this, I am able to expose my local printer to my VPN through a RaspberryPI using this short command:
```sh
socat tcp-listen:9100,reuseaddr,fork tcp:<printer_ip>:9100
```
I have also published a small tool called [`localexpose`](https://github.com/Ewpratten/localexpose) that does the same thing with a bit of a nicer argument syntax.