• Stars
    star
    273
  • Rank 150,780 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Onion addresses for anything.

onionpipe

Onion addresses for anything.

onionpipe forwards ports on the local host to remote Onion addresses as Tor hidden services and vice-versa.

Why would I want to use this?

onionpipe is a decentralized way to create virtually unstoppable global network tunnels.

For example, you might want to securely publish and access a personal service from anywhere in the world, across all sorts of network obstructions -- your ISP doesn't allow ingress traffic to your home lab, your clients might be in heavily firewalled environments (public WiFi, mobile tether), etc.

With onionpipe, that service doesn't need a public IPv4 or IPv6 ingress. You can publish services with a globally-unique persistent onion address, and share access securely and privately to your own allowlist of authorized keys.

You don't need to rely on, and share your personal data with for-profit services (like Tailscale, ZeroTier, etc.) to get to it.

What can I do with it right now?

onionpipe sets up socket forwarding tunnels. It's like socat(1), for onions.

Export services on local networks to onion addresses

Export localhost port 8000 to a temporary, one-time remote onion address.

onionpipe 8000

Export localhost port 8000 to temporary remote onion port 80. ~ is shorthand for the forward between source~destination.

onionpipe 8000~80

Export localhost port 8000 to a persistent remote onion address nicknamed 'my-app'.

onionpipe 8000~80@my-app

Nicknames can be re-used in multiple forwarding expressions to reference the same onion address. Let's set up a little web forum for our Minecraft server.

onionpipe 8000~80@minecraft 25565@minecraft

All the forwards without nicknames use the same temporary address.

onionpipe 192.168.1.100:8000~80,8080,9000 9090

Export a UNIX socket to an onion address.

onionpipe /run/server.sock~80

Export to a non-anonymous remote onion service, trading network privacy for possibly reduced latency.

onionpipe --anonymous=false 8000

Import onion services to local network interfaces.

Import a remote onion's port 80 to localhost port 80.

onionpipe xxx.onion:80

Import remote onion port 80 to local port 80 on all interfaces. This can be used for creating an ingress to the onion on public networks.

onionpipe xxx.onion:80~0.0.0.0:80

Running with Docker is simple and easy, the only caveat is that its the container forwarding, so adjust local addresses accordingly.

Forward port 80 on Docker host.

docker run --rm ghcr.io/cmars/onionpipe:main host.docker.internal:80

If you're using Podman, exposing the local host network is another option.

podman run --network=host --rm ghcr.io/cmars/onionpipe:main 8000 

Because local forwarding addresses are DNS resolved, it's very easy to publish hidden services from within Docker Compose or K8s. Check out this nextcloud example (watch the log for the onion address)!

Client auth

Client auth is great for securing personal services over Tor. How to use it:

Alice creates a new client auth public key pair.

onionpipe client new alice
{
  "alice": {
    "identity": "p2pof7vumwsrqqavtovfwqqaw6cqzvtqqe7cjvxt754k6j7blufa"
  }
}

Alice shares this public key with Bob, who forwards an onion service that only Alice can use.

onionpipe --require-auth p2pof7vumwsrqqavtovfwqqaw6cqzvtqqe7cjvxt754k6j7blufa 8000~80@test
2022/02/13 21:25:46 starting tor...
127.0.0.1:8000 => sd6aq2r6jvuoeisrudq7jbqufjh6nck5buuzjmgalicgwrobgfj4lkqd.onion:80

Alice can use her client private key to connect to this onion and forward to a local port.

onionpipe --auth alice sd6aq2r6jvuoeisrudq7jbqufjh6nck5buuzjmgalicgwrobgfj4lkqd.onion:80~7000
2022/02/13 21:29:17 starting tor...
sd6aq2r6jvuoeisrudq7jbqufjh6nck5buuzjmgalicgwrobgfj4lkqd.onion:80 => 127.0.0.1:7000

How do I install it?

Each commit into main triggers an automated release, which publishes a Homebrew tap and Docker image.

Homebrew

brew tap cmars/onionpipe
brew install onionpipe

Docker

The provided Dockerfile builds a minimal image that can run onionpipe in a container with the latest Tor release from the Tor Project. Build and runtime is Debian-based.

Local build

In a local clone of this project,

make onionpipe

The built binary onionpipe will require a tor daemon executable to be in your $PATH.

Static standalone binary with libtor

Should theoretically work on: Linux, Darwin, Android (gomobile) according to the berty.tech/go-libtor README. There are some quirks; see comments in tor/init_libtor.go for details.

In a local clone of this project,

make onionpipe_libtor

This will take a long time the first time you build, because it compiles CGO wrappers for Tor and its dependencies.

You'll need to have C library dependencies installed for the build to work:

  • tor
  • openssl
  • libevent
  • zlib

If you're on NixOS, you can run nix-shell in this directory to get these dependencies installed into your shell context.

What features are planned?

Declare forwards and operate from a yaml file rather than CLI arguments.

onionpipe --config config.yaml

Considering a fancy TUI.

Considering a control plane for onionpipe SDN orchestration.

Stay tuned.

How can I contribute?

Donate to the Tor project with your dollar, or by hosting honest proxies and exit nodes. If you like and use this project, support the public infrastructure that benefits us all and makes this wonderful magic possible.

More Repositories

1

pystdf

Python module for working with STDF files
Python
145
star
2

ormesh

[UNMAINTAINED: Try https://github.com/cmars/oniongrok instead] onion-routed mesh
Go
63
star
3

ssh-import-id

UNMAINTAINED FORK, you probably want https://launchpad.net/ssh-import-id
Python
58
star
4

statechart

A rust implementation of statecharts: hierarchical, reactive state machines
Rust
47
star
5

represent

Static slide presentation and article pages, generated from text
CSS
44
star
6

replican-sync

Filesystem synchronization for Go
Go
35
star
7

hockeypuck

OpenPGP Key Server (main development is in github.com/hockeypuck/hockeypuck)
Go
29
star
8

conflux

Distributed database synchronization library
Go
28
star
9

juju-ansible

Juju + Ansible = Awesome
Python
20
star
10

sshlurp

Retrieve SSH public keys from remote hosts.
Go
18
star
11

tfclient

tensorflow_serving inception gRPC client
Go
12
star
12

prangster

Prangster tool from the Black Hat USA 2013 presentation "Black-Box Assessment of Pseudorandom Algorithms" by Derek Soeder, Christopher Abad, and Gabriel Acevedo of Cylance.
C#
11
star
13

sks-keyserver

OCaml
9
star
14

affinity

Grouping and role-based access controls for authenticated identities.
Go
8
star
15

basen

Arbitrary base encoding
Go
8
star
16

spoolq

A durable queue backed by filesystem storage
Rust
6
star
17

oostore

An opaque object store featuring decentralized authorization with macaroons.
Go
5
star
18

shadowfax

Shadowfax is a simple, lightweight confidential messaging system.
Go
5
star
19

onionpipe-rs

Onion addresses for anything, Rust edition
Rust
4
star
20

replican-r9p

Remote file synchronization for Go
Go
4
star
21

cascaron

A Go language implementation of the Central Authentication Service (CAS) single-sign on protocol.
Go
3
star
22

tmuxg

Automate tmux project setup
Go
3
star
23

greenroom

Render godocs into Backstage TechDocs documentation.
Go
2
star
24

sleepsort

Golang Sleepsort
Go
2
star
25

juju-charm-mattermost

Mattermost is an open source, self-hosted Slack-alternative.
Python
2
star
26

replican-web

Remote file synchronization over HTTP
Go
2
star
27

lxcify

Go
2
star
28

macaroon

A native Go implementation of macaroons
Go
2
star
29

twik

A tiny language for Go
Go
2
star
30

pyhkp

A really simple python implementation of The OpenPGP HTTP Keyserver Protocol.
Python
2
star
31

glop

Glue Language for OPerations
Rust
1
star
32

nonews

No news is good news.
Go
1
star
33

tor-charm

This charm deploys a Tor proxy and relay.
1
star
34

dotfiles

Shell
1
star
35

logtail

logtail is an HTTP handler that serves log file contents.
Go
1
star
36

alastfm-player

Last.FM player for Android.
Java
1
star
37

timescaledb-charm

TimescaleDB Juju charm
Python
1
star
38

perkeep-helm

Helm chart for Perkeep
Smarty
1
star
39

k8s-ipfs

Shell
1
star
40

jrnl

Go
1
star
41

ieee754-dec

IEEE-754-2008 decimal floating-point numbers for Go
Go
1
star
42

usso-login

Log in to Ubuntu SSO from the command-line
Go
1
star
43

sshlurp-go.crypto

Fork of go.crypto just for scraping SSH host keys
Go
1
star
44

salaam-cairo

Learning and experimenting with Cairo (https://cairo-lang.org/)
Makefile
1
star
45

juju-charm-wallabag

Juju charm for Wallabag
Python
1
star
46

ltt

Automatically download songs posted to /r/listentothis
Go
1
star
47

kafka-schnapp

Kafka snap and charm combined -- a schnapp.
Python
1
star
48

juju-vbox

Virtualbox provider for Juju
Go
1
star
49

arduina

Lighting effects for " ¿Quien es la muchachita?"
Java
1
star
50

layer-juju-agent

Python
1
star
51

tools

Miscellaneous tools that I use.
Go
1
star
52

gonzodb

An in-memory database that speaks the mongodb protocol.
Go
1
star
53

nix-config

Configuration for NixOS machines and more.
Nix
1
star
54

antipaste

Pastebins Get Private: Antipaste wraps several public pastebin services with PGP encryption.
JavaScript
1
star
55

authmerge

Authorization for Automerge
TypeScript
1
star
56

camlistore-charm

Juju charm for camlistore (camlistore.org)
Shell
1
star